37 lines
1.8 KiB
Markdown
37 lines
1.8 KiB
Markdown
# Test3d
|
|
Low-tech computing for Minetest
|
|
## Memory access
|
|
Memory access in this mod occurs over digilines, with the channel as the prefix plus the memory address, and the message as either the new value or 'get' to get it returned, so for example:
|
|
|
|
|Prefix |Address | Value | Channel | Message |
|
|
|-------|---------------|-------|---------------|---------------|
|
|
|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.
|
|
### 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.
|
|
|
|
| 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 |
|
|
|
|
## 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.
|
|
|
|
## T416
|
|
The T416 is a 16-word memory. It stores 16 ints and is accessed as described in the Memory access section.
|