diff --git a/README.md b/README.md index 5776565..62c0779 100644 --- a/README.md +++ b/README.md @@ -1 +1,50 @@ -# r16 \ No newline at end of file +# r16 + +| number | instruction | argument 1 | argument 2 | explanation | +|-------:|:-----------:|:----------:|:----------:|---------------------------------------------------| +| 0x00 | HLT | | | halts the CPU | +| 0x01 | ADD | value 1 | value 2 | ACU = value 1 + value 2 | +| 0x02 | SUB | value 1 | value 2 | ACU = value 1 - value 2 | +| 0x03 | MUL | value 1 | value 2 | ACU = value 1 * value 2 | +| 0x04 | DIV | value 1 | value 2 | ACU = value 1 / value 2 | +| 0x05 | LBS | value | amount | ACU = value << amount | +| 0x06 | RBS | value | amount | ACU = value << amount | +| 0x07 | BAN | value 1 | value 2 | ACU = value 1 & value 2 | +| 0x08 | BOR | value 1 | value 2 | ACU = value 1 \| value 2 | +| 0x09 | BXO | value 1 | value 2 | ACU = value 1 ^ value 2 | +| 0x0A | BNO | value | | ACU = ~ value | +| 0x0B | PUS | value | | pushes value onto the stack | +| 0x0C | POP | | | pops a value from the stack and stores it in ACU | +| 0x0D | JMP | address | | jumps to address | +| 0x0E | JEQ | address | value | jumps to address, if value is equal to ACU | +| 0x0F | JNZ | address | value | jumps to address, if value is not zero | +| 0x10 | CAL | address | | pushes PC + 1 to the stack, then jumps to address | +| 0x11 | RET | | | pops value from stack and jumps to it | +| 0x12 | REG | int type | address | registers int type to address | +| 0x13 | INT | int type | | interrupts as int type | +| 0x14 | INP | | | inputs a character into ACU | +| 0x15 | OUT | value | | outputs value | +| 0x16 | DIN | location | | reads value from disk at location to ACU | +| 0x17 | DOT | location | value | writes value to disk at location | + +| Register | Usage | +|---------:|-----------------| +| R0 | general usage | +| R1 | general usage | +| R2 | general usage | +| R3 | general usage | +| ACU | Accumulator | +| PC | Program Counter | +| SP | Stack Pointer | + +| Area of RAM | reserved | usage | +|:-------------:|:--------:|-------------------| +| 00000 - 00064 | NO | system header | +| 00064 - 65263 | NO | executable | +| 65263 - 65519 | YES | interupt pointers | +| 65519 - 65535 | YES | stack | + +| BYTE 1 | | | BYTE 2 | BYTE 2 | +|------------|-------------|-------------|------------|------------| +| OPCODE | arg 1 info | arg 2 info | ARGUMENT 1 | ARGUMENT 2 | +| bit 0 - 12 | bit 12 - 14 | bit 14 - 16 | bit 0 - 16 | bit 0 - 16 |