Go to file
2024-12-17 10:09:20 +00:00
asm minor tweaks 2024-12-17 10:09:20 +00:00
emu more changes 2024-12-10 11:03:41 +00:00
lib lots of work 2024-04-19 09:05:05 +00:00
.gitignore added cmake config 2024-12-10 10:52:14 +00:00
.gitmodules lots of work 2024-04-19 09:05:05 +00:00
build.sh even more fixes, and some work on assembly 2024-04-25 09:47:01 +00:00
CMakeLists.txt minor tweaks 2024-12-17 10:09:20 +00:00
LICENSE Initial commit 2024-04-17 11:05:55 +01:00
README Update and rename README.md to README 2024-04-26 13:39:58 +01:00

r16

+--------+-------------+------------+------------+----------------------+---------------------------------------------------+
| number | instruction | argument 1 | argument 2 | fullname             | explanation                                       |
+--------+-------------+------------+------------+----------------------+---------------------------------------------------+
|   0x00 |     HLT     |            |            | Halt                 | halts the CPU                                     |
+--------+-------------+------------+------------+----------------------+---------------------------------------------------+
|   0x01 |     ADD     | value 1    | value 2    | Add                  | ACU = value 1 + value 2                           |
+--------+-------------+------------+------------+----------------------+---------------------------------------------------+
|   0x02 |     SUB     | value 1    | value 2    | Subtract             | ACU = value 1 - value 2                           |
+--------+-------------+------------+------------+----------------------+---------------------------------------------------+
|   0x03 |     MUL     | value 1    | value 2    | Multiply             | ACU = value 1 * value 2                           |
+--------+-------------+------------+------------+----------------------+---------------------------------------------------+
|   0x04 |     DIV     | value 1    | value 2    | Divide               | ACU = value 1 / value 2                           |
+--------+-------------+------------+------------+----------------------+---------------------------------------------------+
|   0x05 |     LBS     | value      | amount     | Left Bit-Shift       | ACU = value << amount                             |
+--------+-------------+------------+------------+----------------------+---------------------------------------------------+
|   0x06 |     RBS     | value      | amount     | Right Bit-Shift      | ACU = value << amount                             |
+--------+-------------+------------+------------+----------------------+---------------------------------------------------+
|   0x07 |     BAN     | value 1    | value 2    | Bitwise And          | ACU = value 1 & value 2                           |
+--------+-------------+------------+------------+----------------------+---------------------------------------------------+
|   0x08 |     BOR     | value 1    | value 2    | Bitwise Or           | ACU = value 1 \                                   |
+--------+-------------+------------+------------+----------------------+---------------------------------------------------+
|   0x09 |     BXO     | value 1    | value 2    | Bitwise Exclusive Or | ACU = value 1 ^ value 2                           |
+--------+-------------+------------+------------+----------------------+---------------------------------------------------+
|   0x0A |     BNO     | value      |            | Bitwise Not          | ACU = ~ value                                     |
+--------+-------------+------------+------------+----------------------+---------------------------------------------------+
|   0x0B |     PUS     | value      |            | Push                 | pushes value onto the stack                       |
+--------+-------------+------------+------------+----------------------+---------------------------------------------------+
|   0x0C |     POP     |            |            | Pop                  | pops a value from the stack and stores it in ACU  |
+--------+-------------+------------+------------+----------------------+---------------------------------------------------+
|   0x0D |     JMP     | address    |            | Jump                 | jumps to address                                  |
+--------+-------------+------------+------------+----------------------+---------------------------------------------------+
|   0x0E |     JEQ     | address    | value      | Jump If Equal        | jumps to address, if value is equal to ACU        |
+--------+-------------+------------+------------+----------------------+---------------------------------------------------+
|   0x0F |     JNZ     | address    | value      | Jump If Not Zero     | jumps to address, if value is not zero            |
+--------+-------------+------------+------------+----------------------+---------------------------------------------------+
|   0x10 |     CAL     | address    |            | Call                 | pushes PC + 1 to the stack, then jumps to address |
+--------+-------------+------------+------------+----------------------+---------------------------------------------------+
|   0x11 |     RET     |            |            | Return               | pops value from stack and jumps to it             |
+--------+-------------+------------+------------+----------------------+---------------------------------------------------+
|   0x12 |     REG     | int type   | address    | Register Interrupt   | registers int type to address                     |
+--------+-------------+------------+------------+----------------------+---------------------------------------------------+
|   0x13 |     INT     | int type   |            | Interrupt            | interrupts as int type                            |
+--------+-------------+------------+------------+----------------------+---------------------------------------------------+
|   0x14 |     INP     |            |            | Input                | inputs a character into ACU                       |
+--------+-------------+------------+------------+----------------------+---------------------------------------------------+
|   0x15 |     OUT     | value      |            | Output               | outputs value                                     |
+--------+-------------+------------+------------+----------------------+---------------------------------------------------+
|   0x16 |     DIN     | location   |            | Disk In              | reads value from disk at location to ACU          |
+--------+-------------+------------+------------+----------------------+---------------------------------------------------+
|   0x17 |     DOT     | location   | value      | Disk Out             | writes value to disk at location                  |
+--------+-------------+------------+------------+----------------------+---------------------------------------------------+
|   0x18 |     MOV     | value 1    | value 2    | Move                 | move value 2 to value 1                           |
+--------+-------------+------------+------------+----------------------+---------------------------------------------------+

+--------+----------+-----------------+
| Number | Register | Usage           |
+--------+----------+-----------------+
|    0x0 |    R0    | general usage   |
+--------+----------+-----------------+
|    0x1 |    R1    | general usage   |
+--------+----------+-----------------+
|    0x2 |    R2    | general usage   |
+--------+----------+-----------------+
|    0x3 |    R3    | general usage   |
+--------+----------+-----------------+
|    0x4 |    ACU   | Accumulator     |
+--------+----------+-----------------+
|    0x5 |    PC    | Program Counter |
+--------+----------+-----------------+
|    0x6 |    SP    | Stack Pointer   |
+--------+----------+-----------------+

+---------------+----------+----------+-------------------+
|  Area of RAM  | reserved | Writable | usage             |
+---------------+----------+----------+-------------------+
| 00000 - 00064 |    YES   |    NO    | system header     |
+---------------+----------+----------+-------------------+
| 00064 - 65023 |    NO    |    YES   | executable        |
+---------------+----------+----------+-------------------+
| 65023 - 65279 |    YES   |    YES   | interupt pointers |
+---------------+----------+----------+-------------------+
| 65279 - 65535 |    YES   |    YES   | stack             |
+---------------+----------+----------+-------------------+

+-------------------------------------------+------------+------------+
|                   BYTE 1                  |   BYTE 2   |   BYTE 2   |
+--------+--------+------------+------------+------------+------------+
| OPCODE | UNUSED | ARG 1 INFO | ARG 2 INFO | ARGUMENT 1 | ARGUMENT 2 |
+--------+--------+------------+------------+------------+------------+
| 8 bits | 4 bits |   2 bits   |   2 bits   |   16 bits  |   16 bits  |
+--------+--------+------------+------------+------------+------------+

+-------+---------------------------------------------+
| State | Argument Interpretation                     |
+-------+---------------------------------------------+
|   0x0 | Value in argument                           |
+-------+---------------------------------------------+
|   0x1 | Value in register                           |
+-------+---------------------------------------------+
|   0x2 | Value in RAM                                |
+-------+---------------------------------------------+
|   0x3 | Value in RAM, at address stored in register |
+-------+---------------------------------------------+