diff --git a/README.md b/README.md index 36c6998..644e787 100644 --- a/README.md +++ b/README.md @@ -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的变量 | diff --git a/asm/add.r8asm b/asm/add.r8asm index 826f1c0..4d38883 100644 --- a/asm/add.r8asm +++ b/asm/add.r8asm @@ -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 diff --git a/asm/and.r8asm b/asm/and.r8asm index 629b54d..cf79e42 100644 --- a/asm/and.r8asm +++ b/asm/and.r8asm @@ -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 \ No newline at end of file diff --git a/asm/inc.r8asm b/asm/inc.r8asm index 26215f0..3e2a619 100644 --- a/asm/inc.r8asm +++ b/asm/inc.r8asm @@ -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 \ No newline at end of file diff --git a/asm/lib.r8asm b/asm/lib.r8asm index 65f35a9..e259be6 100644 --- a/asm/lib.r8asm +++ b/asm/lib.r8asm @@ -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 diff --git a/asm/or.r8asm b/asm/or.r8asm index 1b0212f..b807662 100644 --- a/asm/or.r8asm +++ b/asm/or.r8asm @@ -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 \ No newline at end of file diff --git a/asm/xor.r8asm b/asm/xor.r8asm index 1eac728..264fc72 100644 --- a/asm/xor.r8asm +++ b/asm/xor.r8asm @@ -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 \ No newline at end of file diff --git a/include/r8asm/r8asm_core.hh b/include/r8asm/r8asm_core.hh index 96a500a..5211850 100644 --- a/include/r8asm/r8asm_core.hh +++ b/include/r8asm/r8asm_core.hh @@ -39,8 +39,8 @@ enum class r8asm_builtin { enum class r8asm_parse { MACRO, ENDMACRO, - REPEAT, - ENDREPEAT, + REP, + ENDREP, INCLUDE, VAR, }; diff --git a/src/r8asm_parse.cc b/src/r8asm_parse.cc index e9e3e7e..885f5ff 100644 --- a/src/r8asm_parse.cc +++ b/src/r8asm_parse.cc @@ -13,7 +13,7 @@ std::unordered_map 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_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_arg_stoi((*i.first)[1])); count > 0; count--)