changed repeat to rep

This commit is contained in:
starcells committed 2026-07-28 21:22:56 +08:00
1 parent e627d5728e
commit d89e342252
9 files changed
+29 -29

No files matched your search

+2 -2
View File
@@ -46,8 +46,8 @@ macro和repeat内同理,并且这样宏就不会破坏调用前的上下文.
| --- | --- |
| %macro s1 s2 | 创建具有stoi(s2)个参数的,名为s1的宏. |
| %endmacro | 结束对该宏的声明 |
| %repeat s | 将该段代码重复插入stoi(s)次 |
| %endrepeat | 结束重复的代码段 |
| %rep s | 将该段代码重复插入stoi(s)次 |
| %endrep | 结束重复的代码段 |
| %include s | 将s作为依赖引入 |
| %var s1 s2 | 创建值为stoi(s2)的,名为s1的变量 |
+2 -2
View File
@@ -170,7 +170,7 @@ bit_copy %6 %5
.tp %6
ror
%repeat _CELL_SIZE
%rep _CELL_SIZE
bit_raw_add %1 %2 %3 %4 %5 %6
.tp %5
bit_distructive_move %3
@@ -180,7 +180,7 @@ ror
ror
.tp %4
ror
%endrepeat
%endrep
.tp %3
bit_distructive_move %5
+4 -4
View File
@@ -33,7 +33,7 @@ rnz
%macro distructive_and 3
.anchor before_distructive_and
%repeat _CELL_SIZE
%rep _CELL_SIZE
bit_distructive_and %1 %2 %3
.tp %1
ror
@@ -41,7 +41,7 @@ rnz
ror
.tp %3
ror
%endrepeat
%endrep
.tp before_distructive_and
%endmacro
@@ -116,7 +116,7 @@ rnz
%macro and 3
.anchor before_and
%repeat _CELL_SIZE
%rep _CELL_SIZE
bit_and %1 %2 %3
.tp %1
ror
@@ -124,6 +124,6 @@ rnz
ror
.tp %3
ror
%endrepeat
%endrep
.tp before_and
%endmacro
+2 -2
View File
@@ -10,7 +10,7 @@ stp
flb
btp
%repeat _CELL_SIZE
%rep _CELL_SIZE
stp
@@ -31,6 +31,6 @@ btp
btp
out
ror
%endrepeat
%endrep
%endmacro
+6 -6
View File
@@ -30,18 +30,18 @@ flb
; Macro erase
; %this: Cell operand
%macro erase 0
%repeat _CELL_SIZE
%rep _CELL_SIZE
set_0
ror
%endrepeat
%endrep
%endmacro
; Macro rol
; %this: Cell operand
%macro rol 0
%repeat _ROL_STEP
%rep _ROL_STEP
ror
%endrepeat
%endrep
%endmacro
@@ -101,7 +101,7 @@ bit_distructive_move before_bit_copy
%macro copy 2
.anchor before_copy
%repeat _CELL_SIZE
%rep _CELL_SIZE
bit_copy %1 %2
ror
.tp %1
@@ -109,7 +109,7 @@ bit_distructive_move before_bit_copy
.tp %2
ror
.tp before_copy
%endrepeat
%endrep
%endmacro
+4 -4
View File
@@ -34,7 +34,7 @@ rnz
%macro distructive_or 3
.anchor before_distructive_or
%repeat _CELL_SIZE
%rep _CELL_SIZE
bit_distructive_or %1 %2 %3
.tp %1
ror
@@ -42,7 +42,7 @@ rnz
ror
.tp %3
ror
%endrepeat
%endrep
.tp before_distructive_or
%endmacro
@@ -118,7 +118,7 @@ rnz
%macro or 3
.anchor before_or
%repeat _CELL_SIZE
%rep _CELL_SIZE
bit_or %1 %2 %3
.tp %1
ror
@@ -126,6 +126,6 @@ rnz
ror
.tp %3
ror
%endrepeat
%endrep
.tp before_or
%endmacro
+4 -4
View File
@@ -35,7 +35,7 @@ rnz
%macro distructive_xor 3
.anchor before_distructive_xor
%repeat _CELL_SIZE
%rep _CELL_SIZE
bit_distructive_xor %1 %2 %3
.tp %1
ror
@@ -43,7 +43,7 @@ rnz
ror
.tp %3
ror
%endrepeat
%endrep
.tp before_distructive_xor
%endmacro
@@ -111,7 +111,7 @@ rnz
%macro xor 3
.anchor before_xor
%repeat _CELL_SIZE
%rep _CELL_SIZE
bit_xor %1 %2 %3
.tp %1
ror
@@ -119,6 +119,6 @@ rnz
ror
.tp %3
ror
%endrepeat
%endrep
.tp before_xor
%endmacro
+2 -2
View File
@@ -39,8 +39,8 @@ enum class r8asm_builtin {
enum class r8asm_parse {
MACRO,
ENDMACRO,
REPEAT,
ENDREPEAT,
REP,
ENDREP,
INCLUDE,
VAR,
};
+3 -3
View File
@@ -13,7 +13,7 @@
std::unordered_map<r8asm_parse, std::string> r8asm_parsemap = {
{r8asm_parse::MACRO, "%macro"}, {r8asm_parse::ENDMACRO, "%endmacro"},
{r8asm_parse::REPEAT, "%repeat"}, {r8asm_parse::ENDREPEAT, "%endrepeat"},
{r8asm_parse::REP, "%rep"}, {r8asm_parse::ENDREP, "%endrep"},
{r8asm_parse::INCLUDE, "%include"}, {r8asm_parse::VAR, "%var"},
};
@@ -65,7 +65,7 @@ R8Src r8asm_read_src(std::string filename) {
src.raw_src.push_back({ins_buffer});
if (ins_buffer[0][0] == '%') {
if (ins_buffer[0] == r8asm_parsemap[r8asm_parse::ENDMACRO] ||
ins_buffer[0] == r8asm_parsemap[r8asm_parse::ENDREPEAT]) {
ins_buffer[0] == r8asm_parsemap[r8asm_parse::ENDREP]) {
src.codeblocks.push(
{matcher.top(), std::prev(src.raw_src.end())});
matcher.pop();
@@ -144,7 +144,7 @@ void R8Src::preprocess_blocks() {
(*i.first)[1], R8Macro{(r8asm_argc)std::get<r8asm_data>(
r8asm_arg_stoi((*i.first)[2])),
tmp_codeblock});
} else if ((*i.first)[0] == r8asm_parsemap[r8asm_parse::REPEAT]) {
} else if ((*i.first)[0] == r8asm_parsemap[r8asm_parse::REP]) {
for (auto count =
std::get<r8asm_data>(r8asm_arg_stoi((*i.first)[1]));
count > 0; count--)