124 lines
1.4 KiB
Plaintext
124 lines
1.4 KiB
Plaintext
%include asm/lib.r8asm
|
|
|
|
; Macro clb_bit_xor
|
|
; %1: CellBit arg1
|
|
; %2: CellBit arg2
|
|
; %3: CellBit ans
|
|
%macro clb_bit_xor 3
|
|
.anchor before_clb_bit_xor
|
|
.tp %3
|
|
set_0
|
|
.tp %1
|
|
biz
|
|
.tp %3
|
|
flb
|
|
.tp %1
|
|
set_0
|
|
rnz
|
|
.tp %2
|
|
biz
|
|
.tp %3
|
|
flb
|
|
.tp %2
|
|
set_0
|
|
rnz
|
|
|
|
.tp before_clb_bit_xor
|
|
%endmacro
|
|
|
|
|
|
|
|
; Macro clb_xor
|
|
; %1: Cell arg1
|
|
; %2: Cell arg2
|
|
; %3: Cell ans
|
|
%macro clb_xor 3
|
|
.anchor before_clb_xor
|
|
|
|
%rep _CELL_SIZE
|
|
clb_bit_xor %1 %2 %3
|
|
.tp %1
|
|
ror
|
|
.tp %2
|
|
ror
|
|
.tp %3
|
|
ror
|
|
%endrep
|
|
.tp before_clb_xor
|
|
%endmacro
|
|
|
|
|
|
|
|
; Macro bit_xor
|
|
; %1: UnitBit arg1
|
|
; %2: UnitBit arg2
|
|
; %3: CellBit ans
|
|
%macro bit_xor 3
|
|
.anchor before_xor
|
|
|
|
.tp %1
|
|
stp
|
|
.anchor bit_xor_buf_1
|
|
.tp %2
|
|
stp
|
|
.anchor bit_xor_buf_2
|
|
|
|
.tp %3
|
|
set_0
|
|
.tp bit_xor_buf_1
|
|
set_0
|
|
.tp bit_xor_buf_2
|
|
set_0
|
|
.tp %1
|
|
biz
|
|
.tp %2
|
|
flb
|
|
.tp bit_xor_buf_1
|
|
flb
|
|
.tp %1
|
|
flb
|
|
rnz
|
|
.tp %2
|
|
biz
|
|
.tp %1
|
|
flb
|
|
.tp %3
|
|
flb
|
|
.tp bit_xor_buf_1
|
|
flb
|
|
.tp %2
|
|
flb
|
|
rnz
|
|
.tp bit_xor_buf_1
|
|
biz
|
|
.tp %1
|
|
flb
|
|
.tp %2
|
|
flb
|
|
.tp bit_xor_buf_1
|
|
flb
|
|
rnz
|
|
|
|
.tp before_xor
|
|
%endmacro
|
|
|
|
|
|
|
|
; Macro xor
|
|
; %1: Unit arg1
|
|
; %2: Unit arg2
|
|
; %3: Cell ans
|
|
%macro xor 3
|
|
.anchor before_xor
|
|
|
|
%rep _CELL_SIZE
|
|
bit_xor %1 %2 %3
|
|
.tp %1
|
|
ror
|
|
.tp %2
|
|
ror
|
|
.tp %3
|
|
ror
|
|
%endrep
|
|
.tp before_xor
|
|
%endmacro |