This repository has been archived on 2026-09-29. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
R8ASM/asm/lib.r8asm
T
2026-06-14 21:14:37 +08:00

94 lines
1008 B
Plaintext

;lib.r8asm
%macro step 1
stp %1
stp %1
%endmacro
%macro back 1
btp %1
btp %1
%endmacro
%macro set_0 0
biz
flb
rnz
%endmacro
%macro set_1 0
set_0
flb
%endmacro
%macro erase 0
%repeat _CELL_SIZE
set_0
ror
%endrepeat
%endmacro
%macro bit_move_to 1
.anchor before_bit_move_to
.tp %1
set_0
.tp before_bit_move_to
biz
.tp %1
flb
.tp before_bit_move_to
flb
rnz
.tp before_bit_move_to
%endmacro
; Macro bit_copy_to_buffer.
; %1: tmp
%macro bit_copy_to_buffer 1
.anchor before_bit_copy_to_buffer
stp
set_0
.tp %1
set_0
.tp before_bit_copy_to_buffer
biz
flb
stp
flb
.tp %1
flb
.tp before_bit_copy_to_buffer
rnz
.tp %1
biz
flb
.tp before_bit_copy_to_buffer
flb
.tp %1
rnz
.tp before_bit_copy_to_buffer
%endmacro
; Macro copy_to_buffer.
; %1: tmp
%macro copy_to_buffer 1
.anchor before_copy_to_buffer
%repeat _CELL_SIZE
bit_copy_to_buffer %1
ror
stp
ror
.tp %1
ror
.tp before_copy_to_buffer
%endrepeat
%endmacro