Casio_asm/data/opcode.list

124 lines
4.2 KiB
Plaintext

# obligatory nop in instruction set
# if an empty ROM segment gets executed, it won't do anything
0 nop does nothing
E 0 nop extended nop
# extend instruction
# allows for more than 2^6 instructions
63 extend allows for wide instructions
# arithmetic on integral values
add_i adds arg0 and arg1
sub_i subtracts arg1 to arg0
mul_i multiplies arg0 and arg1
div_i divides arg0 by arg1
mod_i returns the remainder of the integral division of arg0 by arg1
neg_i negates arg0
# bitwise operations
shlt shifts arg0 to the left by arg1 bits
shrt shifts arg0 to the right by arg1 bits
and returns a value containing the bits present in arg0 and arg1
or returns a value containing the bits present in arg0 or arg1
xor returns a value containing the bits present in arg0 or arg1, but not both
not returns a value with all the bits absent in arg0
# logic operations
and_l returns 1 if arg0 and arg1 are nonzero, 0 otherwise
or_l returns 1 if arg0 or arg1 are nonzero, 0 otherwise
xor_l returns 1 if exactly one of arg0 and arg1 is nonzero, 0 otherwise
not_l returns 1 if arg0 is zero, 0 otherwise
is_l returns 1 if arg0 is nonzero, 0 otherwise
# comparison operators
lt_i returns 1 if arg0 is less than arg1, 0 otherwise
le_i returns 1 if arg0 is less than or equal to arg1, 0 otherwise
gt_i returns 1 if arg0 is greater than arg1, 0 otherwise
ge_i returns 1 if arg0 is greater than or equal to arg1, 0 otherwise
eq_i returns 1 if arg0 is equal to arg1, 0 otherwise
neq_i return 1 if arg0 is not equal to arg1, 0 otherwise
# stack control
push pushes arg0 to the stack
dup pushes arg0 to the stack twice
pop does nothing with arg0
swap pushes arg0 and arg1 to the stack, effectively swapping them
high pushes arg0 to the stack, shifted 16 bits to the left
top returns stack size
# flow control
jmp jumps unconditionally to address arg0
jif jumps to address arg0 if arg1 is nonzero
jnt jumps to address arg0 if arg1 is zero
jind jumps to address arg0+arg1
call pushes PC to the stack and jumps to address arg0
cif call arg0 if arg1 is nonzero
cnt call arg0 if arg1 is zero
# register control
store stores arg1 in register #arg0
stind stores arg1 in register arg0
puind pushes value contained in register arg0
swreg swaps registers #arg0 and #arg1
swregi swaps register arg0 and #arg1
# processor control
halt halts execution
reset resets the processor, clearing RAM and registers
int sends interrupt arg0
inth sets interrupt handler to address arg0
sub subscribes to hardware interrupt arg0
unsub unsubscribes to hardware interrupt arg0
stat_g reads status bit arg0
stat_s writes arg1 in status bit arg0
stat reads status
ext calls external function arg0 which arguments are popped from the stack
# memory manipulation
mem_wr reads a word from RAM or ROM at address arg0
mem_ww writes word arg1 at RAM address arg0
mem_hr reads half a word from RAM or ROM at address arg0
mem_hw writes half word arg1 at RAM address arg0
mem_br reads a byte from RAM or ROM at address arg0
mem_bw writes byte arg1 at RAM address arg0
lastad returns the last accessed memory address
# decimal arithmetic
E add_d adds arg0 and arg1
E sub_d subtracts arg1 from arg0
E mul_d multiplies arg0 and arg1
E div_d divides arg0 by arg1
E pow_d returns arg0 to the power of arg1
E neg_d negates arg0
# usual functions
E sqrt returns the square root of arg0
E cbrt returns the cubic root of arg0
E hypot returns sqrt(arg0^2+arg1^2)
E exp returns e^arg0
E ln returns ln(arg0)
E floor returns floor(arg0)
E ceil returns ceil(arg0)
E round returns round(arg0)
# trigonometry on decimal values
E cos returns cos(arg0)
E sin returns sin(arg0)
E tan returns tan(arg0)
E atan returns atan(arg0)
E atan2 returns atan2(arg0, arg1)
# comparison of decimal values
E lt_d returns 1 if arg0 is less than arg1, 0 otherwise
E le_d returns 1 if arg0 is less than or equal to arg1, 0 otherwise
E gt_d returns 1 if arg0 is greater than arg1, 0 otherwise
E ge_d returns 1 if arg0 is greater than or equal to arg1, 0 otherwise
E eq_d returns 1 if arg0 is equal to arg1, 0 otherwise
E neq_d returns 1 if arg0 is not equal to arg1, 0 otherwise
# values operations
E i2d converts arg0 to a decimal value
E d2i converts arg0 to an integral value
E cst_pi pushes pi to the stack
E cst_e pushes e to the stack