[fix]202605160036

This commit is contained in:
starcells committed 2026-05-16 00:36:53 +08:00
1 parent 5eb17bf557
commit 6bb88bb90f
3 files changed
+39 -27

No files matched your search

+20 -27
View File
@@ -9,35 +9,28 @@ btp %1
%endmacro
%macro and 3
.anchor before_and
; bitwise AND: result[i] = arg1[i] AND arg2[i]
; each %repeat copy processes one bit (LSB after previous rotations)
.tp %1
%repeat _UNIT_SIZE
biz
.tp %2
biz
.tp %3
flb
biz
flb
rnz
.tp %2
rnz
.tp %1
rnz
ror
.tp %2
ror
.tp %3
ror
.tp %1
%endrepeat
.tp %1 ; → arg1
biz ; if arg1&1 == 0 → skip (result=0)
.tp %2 ; → arg2
biz ; if arg2&1 == 0 → skip (result=0)
.tp %3 ; → ans
flb ; set ans LSB = 1 (both bits were 1)
.tp %2 ; ← back to arg2
flb ; clear arg2 LSB so inner rnz exits
rnz ; arg2 LSB = 0 → exit
.tp %1 ; ← back to arg1
flb ; clear arg1 LSB so outer rnz exits
rnz ; arg1 LSB = 0 → exit
.tp before_and
.tp %1 ; rotate arg1 for next bit
ror
.tp %2 ; rotate arg2 for next bit
ror
.tp %3 ; rotate ans for next bit
ror
%endrepeat
.tp before_and
%endmacro
out
out
+1
View File
@@ -7,6 +7,7 @@
#include <queue>
#include <string>
#include <utility>
#include <queue>
#include <vector>
#define EMPTY_CHARS (" \t\n\r\f\v")
+18
View File
@@ -0,0 +1,18 @@
#include <iostream>
#include "r8asm/r8asm.hh"
#include "r8asm/r8asm_parse.hh"
int main(int argc, char *argv[]) {
auto lib = read_src("/home/admin/Git/R8ASM/asm/lib.r8asm");
/*
for (auto i : lib.raw_src)
for (auto j : i)
std::cout << j << ';';*/
lib.preprocess();
auto src = read_src("asm/asm.r8asm");
auto out_tape = r8asm_tape_out(expand_macros(r8asm_preprocess(src)));
for (auto i : out_tape)
std::cout << ROT8_BC_TO_CHAR(i);
return (0);
}