49 lines
782 B
Text
49 lines
782 B
Text
|
---------------
|
||
|
-- Opcodes --
|
||
|
---------------
|
||
|
|
||
|
Argless
|
||
|
NOP
|
||
|
HLT
|
||
|
RST
|
||
|
|
||
|
Idfk
|
||
|
DBG
|
||
|
|
||
|
Memory ops
|
||
|
MOV
|
||
|
PUSH
|
||
|
POP
|
||
|
|
||
|
Branches
|
||
|
JMPA
|
||
|
JMP
|
||
|
JZ
|
||
|
|
||
|
ALU stuff
|
||
|
CMP
|
||
|
INC
|
||
|
DEC
|
||
|
|
||
|
|
||
|
------------------------
|
||
|
-- Addressing Modes --
|
||
|
------------------------
|
||
|
reg - Register
|
||
|
imm - Immediate
|
||
|
abs - Absolute
|
||
|
ida - Indirect absolute
|
||
|
idr - Indirect register
|
||
|
|
||
|
---- Examples ----
|
||
|
|
||
|
Assembly -- Mode -- Function
|
||
|
---------------------------------------------------------
|
||
|
mov A, 5 -- reg imm -- A <- 5
|
||
|
mov [$23], 5 -- ida imm -- mem[mem[23]] <- 5
|
||
|
mov $69, A -- abs imm -- mem[69] <- A
|
||
|
mov 420, [A] -- imm idr -- mem[ip + 1] <- mem[A]
|
||
|
add $13, $32 -- ida ida -- mem[13] <- mem[13] + mem[32]
|
||
|
inc A, 14 -- reg imm -- A <- A + 1 | Z <- (A == 14) # Cursed zero flag
|
||
|
|