OpC_40 4F - Nakazoto/CenturionComputer GitHub Wiki

46 Instructions

These instructions are big number operations. The instruction form is 46 llllkkkk ssssmmnn where l is the size of operand 1, k is the size of operand 2, s is the operation selection (so far 0 is +, 1 is -), m and n are CPU6 extended instruction addressing modes. The first operand is the source, the second is the destination.

Selector Opcode Description
0 ADDBIG Adds two big numbers. Dest = Src + Dest
1 SUBBIG Subtracts two big numbers. Dest = Src - Dest
2 CMPBIG Set flags based on subtraction
3 XFRBIG Assigns a big number
4 NEGBIG Negates a big number
5 MULBIG Multiplies two big numbers (signed). Zero results where one operand is negative are unreliable
6 DIVBIG Divides two big numbers (signed). Remainder is not stored
7 DIVBIGR Divides two big numbers (signed). Remainder is written to address pointed to by AW. Link flag is set for zero remainder
8 IBASECONV Base string to Big number. Base can be from 2 to 17. (TODO - describe how base is provided - similar to OBASECONV)
9 OBASECONV Big number to Base string. Base can be from 2 to 17. Operand 1 is destination, Operand 2 is source. Base is length field of Operand 1 (field holds Base - 2). Operand 1 length is provided in AL. BL provides padding byte. AW holds address of result following operation. Result is formatted, @ in destination will be replaced by result. # in destination is padding marker, result will be zero filled until marker, from marker on result will be filled with padding byte. Other bytes in destination are left as is.

47 and 67 Instructions

These instructions appear to operate on strings or memory blocks. The general form is 47 ssssmmnn followed by the operands. m and n are the CPU6 addressing modes. 47 4x and 47 8x have an additional literal byte length argument (length of block - 1). 47 2x has two additional arguments,

67 instructions are identical to 47 instructions, except when relevant, they take their length argument in register AL (WIP, it is unknown if 67 instructions are limited to 8bit lengths)

Selector Opcode 1st Operand 2nd Operand 3rd Operand 4th Operand Description
0 binload BaseAddress record Implements most of the Centurion binary record format in Microcode.
1 strcmp?
2 condcpy? MaxCount - 1 (implicit) byte to match Src Dest Copies from Source to Dest until matching byte is found (can be used as strcpy). Sets Fault if no match found. Sets Y to match in Src. Sets Z to match in Dest
4 memcpy Count - 1 Count Length any mode count length memory copy block of memory from first argument to second argument
8 memcmp Count - 1 Count Length any mode count length memory compare two blocks of memory
9 memset Count - 1 Single Byte count length memory copies first arg repeated to second arg