diff --git a/asm/asm.r8asm b/asm/asm.r8asm index 95ed803..acb9696 100644 --- a/asm/asm.r8asm +++ b/asm/asm.r8asm @@ -1,10 +1,11 @@ -.xor 23 +.xor _UNIT_MAX .anchor arg1 -step 1 -.xor 34 +step 2 +.xor 20 .anchor arg2 -step 1 +back 1 .anchor ans + and arg1 arg2 ans .tp ans out \ No newline at end of file diff --git a/asm/lib.r8asm b/asm/lib.r8asm index a5334f9..af5d4ab 100644 --- a/asm/lib.r8asm +++ b/asm/lib.r8asm @@ -9,29 +9,12 @@ btp %1 %endmacro %macro and 3 - .anchor before_and +.anchor before_and - .tp %1 - stp - .xor _UNIT_MAX - btp +%repeat _UNIT_MAX +out +out +%endrepeat - .loop - .tp %1 - biz - .tp %2 - biz - .tp %3 - flb - biz - flb - rnz - ror - rnz - ror - rnz - ror - .endloop - - .tp before_and -%endmacro +.tp before_and +%endmacro \ No newline at end of file diff --git a/include/r8asm/r8asm_core.hh b/include/r8asm/r8asm_core.hh index 229007c..41f6938 100644 --- a/include/r8asm/r8asm_core.hh +++ b/include/r8asm/r8asm_core.hh @@ -60,8 +60,10 @@ extern mem_size_type dataptr; extern std::map r8asm_insmap; extern unit_size_type UNIT_SIZE; -// #define DEFAULT_UNIT_SIZE (sizeof(unit_size_type) * 8) -#define DEFAULT_UNIT_SIZE 8 // Just for test. #define UNIT_MAX (((uint64_t)1 << UNIT_SIZE) - 1) +// #define DEFAULT_UNIT_SIZE (sizeof(unit_size_type) * 8) +#define DEFAULT_UNIT_SIZE 8 // Just for test. +#define DEFAULT_UNIT_MAX (((uint64_t)1 << DEFAULT_UNIT_SIZE) - 1) + #endif \ No newline at end of file diff --git a/src/r8asm_core.cc b/src/r8asm_core.cc index cb28e1c..c974e82 100644 --- a/src/r8asm_core.cc +++ b/src/r8asm_core.cc @@ -4,7 +4,8 @@ mem_size_type dataptr = 0; std::map labels = {{std::string("main"), 0}}; std::map datas = { - {std::string("_UNIT_MAX"), UNIT_MAX}}; + {std::string("_UNIT_MAX"), DEFAULT_UNIT_MAX}, + {std::string{"_UNIT_SIZE"}, DEFAULT_UNIT_SIZE}}; std::map r8asm_insmap = { {"stp", rot8_bytecode::STP}, {"btp", rot8_bytecode::BTP},