Replace all with T408
|3 years ago|
|test3d_t408||3 years ago|
|LICENSE||4 years ago|
|README.md||3 years ago|
|modpack.txt||4 years ago|
Low-tech computing for Minetest
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:
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.
Any words encountered that aren't instructions are pushed to the stack. This makes very compact simple program code.
|255||push program counter||ppc|
|253||read memory from TOS||read|
|252||write to memory from TOS||write|
|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|
|241||pre-read address at TOS||prd|
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.
Counts upwards from zero, writing the result to address 224 (0)
1 -- push 1 251 -- add 244 -- dup 224 -- push 224 252 -- write result to 224 1 -- push 1 249 -- jump to 1