updated README

This commit is contained in:
Izaya 2017-03-13 17:34:51 +11:00
parent bc92154936
commit 856bcf40f5

View File

@ -8,29 +8,43 @@ Memory access in this mod occurs over digilines, with the channel as the prefix
|A | 1 | 4 | A1 | 4 |
|Default| 15 | get | DefaultF | get |
## T400
The T400 is a 12-bit stack machine operating at 1Hz (due to ABMs only running once per second). It has a 16-word stack, 0 registers and a very simple instruction set.
## T408
The T400 is an 8-bit stack machine operating at 1Hz (due to ABMs only running once per second). It has a 16-word stack, 0 registers and a very simple instruction set.
### Instructions
There are 8 instructions for the T400. Any values encountered by the processor that are not instructions are treated as data and pushed to the stack. While this does make both the code for the emulator and the code for the emulated computer simple, it has the downside that if you really do want the value 4095 you have to add two things together.
Any words encountered that aren't instructions are pushed to the stack. This makes very compact simple program code.
| ins | function | mnemonic |
|--------|----------------------------------------------|---------------|
|4095 | push program counter | ppc |
|4094 | swap TOS | swp |
|4093 | read memory from TOS | read |
|4092 | write to memory from TOS | write |
|4091 | add TOS | add |
|4090 | suptract TOS | sub |
|4089 | jump to TOS | jmp |
|4088 | skip if TOS = zero | sez |
|4087 | jump if TOS = zero | jez |
|4086 | jump to subroutine, push pc to retstack | jsr |
|4085 | return from subroutine, PC = top of retstack | ret |
|4084 | duplicate TOS | dup |
|4083 | drop TOS | drop |
| 255 | push program counter | ppc |
| 254 | swap TOS | swp |
| 253 | read memory from TOS | read |
| 252 | write to memory from TOS | write |
| 251 | add TOS | add |
| 250 | suptract TOS | sub |
| 249 | jump to TOS | jmp |
| 248 | skip if TOS = zero | sez |
| 247 | jump if TOS = zero | jez |
| 246 | jump to subroutine, push pc to retstack | jsr |
| 245 | return from subroutine, PC = top of retstack | ret |
| 244 | duplicate TOS | dup |
| 243 | drop TOS | drop |
| 242 | halt processor | hlt |
| 241 | pre-read address at TOS | prd |
## T410
The T410, is, in essence, the write instruction in a block. You put in an address and a value and it tries to write the value to that address.
### I/O
The T408 uses memory-mapped I/O. This may seem like a stupid idea on a machine with 8-bit addressing but port-based I/O isn't hugely sane.
Address 224 to 239 (16 words) are used for access to external devices. In Minetest you need to execute the **prd** instruction first, though in an emulator that is treated as a no-op.
### Examples
Counts upwards from zero, writing the result to address 224 (<prefix>0)
```
1 -- push 1
251 -- add
244 -- dup
224 -- push 224
252 -- write result to 224
1 -- push 1
249 -- jump to 1
```
## T416
The T416 is a 16-word memory. It stores 16 ints and is accessed as described in the Memory access section.