[err]202609131217

This commit is contained in:
starcells committed 2026-09-13 12:17:41 +08:00
1 parent ed4ce6d3d4
commit ebe98fdfa8
7 files changed
+219 -189

No files matched your search

+10
View File
@@ -140,4 +140,14 @@ stp
.anchor copy_to_buffer_buf_1
btp
copy copy_to_buffer_buf_1 %1
%endmacro
; Macro output
; %1: operand
%macro output 1
.anchor before_output
.tp %1
out
.tp before_output
%endmacro
-1
View File
@@ -103,7 +103,6 @@ rnz
%macro raw_add 6
.anchor before_raw_add
erase %6
.tp %3
bit_copy %6 %5
.tp %6
+52 -50
View File
@@ -48,74 +48,76 @@ rnz
; Macro bit_and
; %1: UnitBit arg1
; %2: UnitBit arg2
; %1: CellBit arg1
; %2: CellBit arg2
; %3: CellBit ans
%macro bit_and 3
.anchor before_and
.tp %1 + 1
.anchor bit_and_buf_1
.tp %2 + 1
.anchor bit_and_buf_2
; %4: CellBit tmp
%macro bit_and 4
.anchor before_bit_and
.tp %3
set_0
.tp bit_and_buf_1
set_0
.tp bit_and_buf_2
set_0
biz
flb
rnz
.tp %4
biz
flb
rnz
.tp %1
biz
.tp %3
set_1
.tp bit_and_buf_1
set_1
.tp %1
flb
.tp %3
set_1
.tp %4
set_1
.tp %1
flb
rnz
.tp %2
biz
.tp %1
set_1
.tp %3
set_1
.tp %2
flb
rnz
.tp %1
biz
.tp %2
flb
.tp %3
flb
.tp %1
flb
rnz
.tp bit_and_buf_1
biz
.tp %1
flb
.tp %3
flb
.tp bit_and_buf_1
flb
.tp %1
set_1
.tp %3
set_1
.tp %2
flb
rnz
.tp before_and
.tp %1
biz
.tp %2
flb
.tp %3
flb
.tp %1
flb
rnz
.tp %4
biz
.tp %1
flb
.tp %3
flb
.tp %4
flb
rnz
.tp before_bit_and
%endmacro
; Macro and
; %1: Unit arg1
; %2: Unit arg2
; %1: Cell arg1
; %2: Cell arg2
; %3: Cell ans
%macro and 3
; %4: CellBit tmp
%macro raw_and 4
.anchor before_and
%rep _CELL_SIZE
bit_and %1 %2 %3
bit_and %1 %2 %3 %4
.tp %1
ror
.tp %2
+13 -20
View File
@@ -1,10 +1,7 @@
; TODO
%include asm/lib.r8asm
; Macro inc
%include "asm/lib.r8asm"
; Macro bit_raw_inc
; %1: CellBit A
; %2: CellBit B
; %2: CellBit Ci
; %3: CellBit S
; %4: CellBit Co
; %5: CellBit tmp
@@ -63,38 +60,34 @@ rnz
; Macro raw_inc
; %1: Cell A
; %2: Cell B
; %2: CellBit Ci
; %3: Cell S
; %4: Cell Co
; %4: CellBit Co
; %5: Cell tmp
%macro raw_inc 5
.anchor before_raw_inc
.tp %5
erase
.tp %2
bit_copy %5 %4
.tp %5
ror
%rep _CELL_SIZE
bit_raw_add %1 %2 %3 %4 %5
.tp %5
clb_bit_mov %3
bit_raw_inc %1 %2 %3 %4 %5
.tp %4
clb_bit_mov %2
.tp %1
ror
.tp %2
ror
.tp %4
.tp %3
ror
%endrep
.tp %3
clb_bit_mov %5
.tp %2
clb_bit_mov %4
.tp %5
rol
clb_bit_mov %3
clb_bit_mov %2
.tp before_raw_add
.tp before_raw_inc
%endmacro
+60 -56
View File
@@ -49,75 +49,79 @@ rnz
; Macro bit_or
; %1: UnitBit arg1
; %2: UnitBit arg2
; Macro bit_raw_or
; %1: CellBit arg1
; %2: CellBit arg2
; %3: CellBit ans
%macro bit_or 3
.anchor before_or
.tp %1 + 1
.anchor bit_or_buf_1
.tp %2 + 1
.anchor bit_or_buf_2
; %4: CellBit tmp
%macro bit_raw_or 3
.anchor before_bit_raw_or
.tp %3
set_0
.tp bit_or_buf_1
set_0
.tp bit_or_buf_2
set_0
biz
flb
rnz
.tp %4
biz
flb
rnz
.tp %1
biz
.tp %3
set_1
.tp %1
flb
rnz
.tp %3
biz
.tp %1
flb
.tp %2
flb
.tp bit_or_buf_1
flb
.tp %3
flb
rnz
.tp %2
biz
.tp %3
flb
.tp bit_or_buf_1
flb
.tp %2
flb
rnz
.tp bit_or_buf_1
biz
.tp %2
set_1
.tp %3
set_1
.tp bit_or_buf_1
flb
.tp %3
set_1
.tp %1
flb
rnz
.tp before_or
.tp %3
biz
.tp %1
flb
.tp %2
flb
.tp %4
flb
.tp %3
flb
rnz
.tp %2
biz
.tp %3
flb
.tp %4
flb
.tp %2
flb
rnz
.tp %4
biz
.tp %2
set_1
.tp %3
set_1
.tp %4
flb
rnz
.tp before_bit_raw_or
%endmacro
; Macro or
; %1: Unit arg1
; %2: Unit arg2
; Macro raw_or
; %1: Cell arg1
; %2: Cell arg2
; %3: Cell ans
%macro or 3
.anchor before_or
; %4: CellBit tmp
%macro raw_or 4
.anchor before_raw_or
%rep _CELL_SIZE
bit_or %1 %2 %3
bit_raw_or %1 %2 %3 %4
.tp %1
ror
.tp %2
@@ -125,5 +129,5 @@ rnz
.tp %3
ror
%endrep
.tp before_or
.tp before_raw_or
%endmacro
+50 -42
View File
@@ -50,53 +50,61 @@ rnz
; Macro bit_xor
; %1: UnitBit arg1
; %2: UnitBit arg2
; %1: CellBit arg1
; %2: CellBit 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
; %4: CellBit tmp
%macro bit_raw_xor 4
.anchor before_bit_raw_xor
.tp %3
set_0
.tp bit_xor_buf_1
set_0
.tp bit_xor_buf_2
set_0
biz
flb
rnz
.tp %4
biz
flb
rnz
.tp %1
biz
.tp %2
flb
.tp bit_xor_buf_1
flb
.tp %1
flb
.tp %3
set_1
.tp %1
flb
rnz
.tp %3
biz
.tp %1
flb
.tp %2
flb
.tp %4
flb
.tp %3
flb
rnz
.tp %2
biz
.tp %1
flb
.tp %3
flb
.tp bit_xor_buf_1
flb
.tp %2
flb
.tp %3
flb
.tp %4
flb
.tp %2
flb
rnz
.tp bit_xor_buf_1
.tp %4
biz
.tp %1
flb
.tp %2
flb
.tp bit_xor_buf_1
flb
.tp %2
set_1
.tp %3
set_1
.tp %4
flb
rnz
.tp before_xor
@@ -104,15 +112,15 @@ rnz
; Macro xor
; Macro raw_xor
; %1: Unit arg1
; %2: Unit arg2
; %3: Cell ans
%macro xor 3
.anchor before_xor
%macro raw_xor 4
.anchor before_raw_xor
%rep _CELL_SIZE
bit_xor %1 %2 %3
bit_raw_xor %1 %2 %3 %4
.tp %1
ror
.tp %2
@@ -120,5 +128,5 @@ rnz
.tp %3
ror
%endrep
.tp before_xor
.tp before_raw_xor
%endmacro
+34 -20
View File
@@ -1,11 +1,16 @@
%include "asm/add.r8asm"
%include "asm/and.r8asm"
%include "asm/raw_add.r8asm"
%include "asm/raw_and.r8asm"
%include "asm/raw_or.r8asm"
%include "asm/raw_xor.r8asm"
%include "asm/raw_inc.r8asm"
.var A 0
.var B 2
.var Ci 4
.var S 6
.var Co 8
.var tmp 1
.tp A
.xor 126
@@ -14,23 +19,32 @@
.tp Ci
.xor 1
raw_add A B Ci S Co 1
raw_add A B Ci S Co tmp
.tp A
out
.tp B
out
.tp Ci
out
.tp S
out
.tp Co
out
output A
output B
output Ci
output S
output Co
and A B S
.tp A
out
.tp B
out
.tp S
out
raw_and A B S tmp
output A
output B
output S
raw_or A B S tmp
output A
output B
output S
raw_xor A B S tmp
output A
output B
output S
raw_inc A Ci S Co tmp
output A
output Ci
output S
output Co