; hence standard lib

.requires "$lib/core.asm"

.macro std_tclr
  ts NULL
.endmacro

.macro std_rclr, lib_std_rclr_arg_0_reg
  ts NULL
  tlr lib_std_rclr_arg_0_reg
.endmacro

.macro std_alu, lib_std_alu_arg_0_op
  ts lib_std_alu_arg_0_op
  alu
.endmacro

.macro std_get, lib_std_get_arg_0_addr
  ts lib_std_get_arg_0_addr
  get
.endmacro

.macro std_set, lib_std_set_arg_0_addr
  ts lib_std_set_arg_0_addr
  set
.endmacro

.macro std_cp, lib_std_cp_arg_0_from, lib_std_cp_arg_1_to
  tsr lib_std_cp_arg_0_from
  tlr lib_std_cp_arg_1_to
.endmacro

.macro std_mv, lib_std_mv_arg_0_from, lib_std_cp_arg_1_to
  tsr lib_std_cp_arg_0_from
  tlr lib_std_cp_arg_1_to
  .std_rclr lib_std_cp_arg_1_to
.endmacro

.macro std_rset, lib_std_init_arg_0_reg, lib_std_init_arg_1_val
  ts lib_std_init_arg_1_val
  tlr lib_std_init_arg_0_reg
.endmacro

.macro std_jump, lib_std_jump_arg_0_label
  .std_rset CORE_REG_PC, lib_std_jump_arg_0_label
.endmacro

.macro std_cond_jump, lib_std_cond_jump_arg_0_label
  ts lib_std_cond_jump_arg_0_label
  tlrc CORE_REG_PC
.endmacro

.macro std_stop
  .std_rset CORE_REG_PC, 0xffff
.endmacro

.macro std_inc, lib_std_inc_arg_0_reg
  .std_rset lib_std_inc_arg_0_reg, 1
  .std_alu CORE_ALU_ADD
.endmacro

.macro std_ld
  tss
  pop
.endmacro
