# opcode function table
# 
# format is:
# name args arg_types
# 
# Opcode number is determined at build time
#
# All fields should be whitespace separated
#
# The arg_types are the types to be packed (integer, number, whatever) 
# not the type of the register or anything. So N3 is still an i, since that
# 3 specifying the register should be packed as an integer.

# This must be opcode zero

end	0

# Integer ops

set_i_ic	2	i i
set_i	2	i i
add_i	3	i i i
sub_i	3	i i i
mul_i	3	i i i
div_i	3	i i i
inc_i	1	i
inc_i_ic	2	i i
dec_i	1	i
dec_i_ic	2	i i

# NUM ops

set_n_nc	2	i n
add_n	3	i i i
sub_n	3	i i i
mul_n	3	i i i
div_n	3	i i i
inc_n	1	i
inc_n_nc	2	i n
dec_n	1	i
dec_n_nc	2	i n

# String ops

set_s_sc	2	i i
print_s	1	i
length_s_i	2	i i
chopn_s_ic	2	i i

# Comparators

eq_i_ic	4	i i i i
eq_n_ic	4	i i i i
ne_i_ic	4	i i i i
lt_i_ic	4	i i i i
le_i_ic	4	i i i i
gt_i_ic	4	i i i i
ge_i_ic	4	i i i i

# Flow control

jump_i	1	i
branch_ic	1	i
if_i_ic	3	i i i
if_n_ic	3	i i i

# Convertors

iton_n_i	2	i i
ntoi_i_n	2	i i

# Miscellaneous and debugging ops

time_i	1	i
print_i	1	i
time_n	1	i
print_n	1	i
noop	0

# Register ops
push_i	0
push_s	0
push_n	0
push_p	0
pop_i	0
pop_s	0
pop_n	0
pop_p	0
clear_i	0
clear_s	0
clear_n	0
clear_p	0

