My4th
Технический форум по робототехнике.
esisl писал(а):Круто!
Opcodes
This is a non-exhaustive list of opcodes supported by the TOM-1:
halt
no_op
push_literal — pushes a 16-bit operand to the top of stack
branch0 — if the top of stack is equal to 0, jump to a 16-bit address (operand)
add — pops values A and B from the data stack, pushes the value A + B to the top of stack
nand — pops values A and B from the data stack, pushes the value A nand B to the top of stack
load — pops an address from the stack, pushes the value of that address in RAM to the top of stack
store — pops an address, then a value, from the stack and sets that address in RAM to the value
return_push — pushes the value at the top of the stack onto the return stack
return_pop — pops a value off the return stack and pushes it to the top of stack
dup — duplicates the value a the top of stack
drop — drops the top of the stack
in — read a value from the 8-bit I/O port
out — output a value on the 8-bit I/O port
I/O Port
The I/O port on the TOM-1 is a bidirectional transceiver that can read and write to any address in RAM. This port has the following pins:
Power
GND
8 bits of data (low byte of 2-byte value in RAM)
CLK
Data Valid
Code Name Size Operation
0 noop 4 No operation
1 @ 4 Load word from memory
2 call 4+16 Push P to return stack, fetch a word and jump
3 exit 4 Pop P from return stack
4 (literal) 4+16 Fetch a word and push to stack
7 r> 4 Pop return stack and push to data stack
8 + 4 Add top two items on data stack
9 nand 4 Inverted conjunction of the two top items on data stack
10 >r 4 Pop data stack and push to return stack
11 0branch 4+8 Fetch a byte and add to P if popped data stack is zero
12 ! 4 Store word into memory