diff --git a/asm/add.r8asm b/asm/add.r8asm index d6cc41b..91a4041 100644 --- a/asm/add.r8asm +++ b/asm/add.r8asm @@ -25,7 +25,6 @@ biz flb rnz -; sac=Ci: FLIP {A,B,buf} .tp %3 biz .tp %1 @@ -38,7 +37,6 @@ biz flb rnz -; sac=A: FLIP {Ci,S,buf} .tp %1 biz .tp %3 @@ -51,7 +49,6 @@ biz flb rnz -; sac=B: FLIP {A,Ci,Co,buf} .tp %2 biz .tp %1 @@ -66,7 +63,6 @@ biz flb rnz -; sac=S: SET1 {B,Co} .tp %4 biz .tp %2 @@ -77,7 +73,6 @@ biz flb rnz -; sac=buf: FLIP {A,B,Ci,S,Co} .tp %6 biz .tp %1 @@ -108,8 +103,7 @@ rnz %macro raw_add 6 .anchor before_raw_add -.tp %6 -erase +erase %6 .tp %3 bit_copy %6 %5 .tp %6 diff --git a/asm/and.r8asm b/asm/and.r8asm index c48c88d..8cf00f1 100644 --- a/asm/and.r8asm +++ b/asm/and.r8asm @@ -54,11 +54,9 @@ rnz %macro bit_and 3 .anchor before_and -.tp %1 -stp +.tp %1 + 1 .anchor bit_and_buf_1 -.tp %2 -stp +.tp %2 + 1 .anchor bit_and_buf_2 .tp %3 diff --git a/asm/inc.r8asm b/asm/inc.r8asm index 3e2a619..ac3df13 100644 --- a/asm/inc.r8asm +++ b/asm/inc.r8asm @@ -3,34 +3,98 @@ %include asm/lib.r8asm ; Macro inc +; %1: CellBit A +; %2: CellBit B +; %3: CellBit S +; %4: CellBit Co +; %5: CellBit tmp -%macro inc 0 +%macro bit_raw_inc 5 -stp -flb -btp +.anchor before_bit_raw_inc + +.tp %2 +biz + .tp %1 + flb + .tp %4 + flb + .tp %2 + flb +rnz + +.tp %1 +biz + .tp %3 + set_1 + .tp %5 + set_1 + .tp %1 + flb +rnz + +.tp %4 +biz + .tp %1 + set_1 + .tp %2 + set_1 + .tp %3 + set_1 + .tp %4 + flb +rnz + +.tp %5 +biz + .tp %1 + flb + .tp %3 + flb + .tp %4 + flb + .tp %5 + flb +rnz + +.tp before_bit_raw_inc + +%endmacro + +; Macro raw_inc +; %1: Cell A +; %2: Cell B +; %3: Cell S +; %4: Cell 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 - - stp - - - biz - flb - btp - flb - stp - rol - flb + bit_raw_add %1 %2 %3 %4 %5 + .tp %5 + clb_bit_mov %3 + .tp %1 + ror + .tp %2 + ror + .tp %4 ror - rnz - - - out - ror - btp - out - ror %endrep +.tp %3 +clb_bit_mov %5 +.tp %5 +rol +clb_bit_mov %3 + +.tp before_raw_add %endmacro \ No newline at end of file diff --git a/asm/lib.r8asm b/asm/lib.r8asm index 6a4f6a1..5d1f500 100644 --- a/asm/lib.r8asm +++ b/asm/lib.r8asm @@ -32,12 +32,15 @@ flb %endmacro ; Macro erase -; %this: Cell operand -%macro erase 0 +; %1: Cell operand +%macro erase 1 +.anchor before_erase +.tp %1 %rep _CELL_SIZE set_0 ror %endrep +.tp before_erase %endmacro ; Macro rol diff --git a/asm/or.r8asm b/asm/or.r8asm index 740ebc1..6d24172 100644 --- a/asm/or.r8asm +++ b/asm/or.r8asm @@ -56,11 +56,9 @@ rnz %macro bit_or 3 .anchor before_or -.tp %1 -stp +.tp %1 + 1 .anchor bit_or_buf_1 -.tp %2 -stp +.tp %2 + 1 .anchor bit_or_buf_2 .tp %3 diff --git a/asm/test.r8asm b/asm/test.r8asm index 110820d..4803bcd 100644 --- a/asm/test.r8asm +++ b/asm/test.r8asm @@ -1,4 +1,5 @@ %include "asm/add.r8asm" +%include "asm/and.r8asm" .var A 0 .var B 2 @@ -7,7 +8,7 @@ .var Co 8 .tp A -.xor 127 +.xor 126 .tp B .xor 11 .tp Ci @@ -24,4 +25,12 @@ out .tp S out .tp Co +out + +and A B S +.tp A +out +.tp B +out +.tp S out \ No newline at end of file