Low-tech computing for Minetest
Go to file
2017-03-13 17:41:09 +11:00
test3d_t408 working T408 2017-03-13 13:36:49 +11:00
LICENSE Initial commit 2016-09-12 22:34:23 +10:00
modpack.txt Turned the whole thing into a modpack. 2016-10-05 15:59:44 +11:00
README.md README formatting 2017-03-13 17:36:11 +11:00

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

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

Any words encountered that aren't instructions are pushed to the stack. This makes very compact simple program code.

ins function mnemonic
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

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 (0)

1 -- push 1
251 -- add
244 -- dup
224 -- push 224
252 -- write result to 224
1 -- push 1
249 -- jump to 1