202607050048
This commit is contained in:
1 parent
4593d7055f
commit
c0e99f5d9e
5 files changed
+59
-12
No files matched your search
@@ -129,5 +129,6 @@ make -j$(nproc)
|
||||
|
||||
## TODO
|
||||
|
||||
0. 真 理 机
|
||||
1. 像正经汇编一样的sections结构
|
||||
2. 各种边界检查/语法检查
|
||||
@@ -0,0 +1,36 @@
|
||||
; TODO
|
||||
|
||||
|
||||
%include asm/lib.r8asm
|
||||
; Macro inc
|
||||
|
||||
%macro inc 0
|
||||
|
||||
stp
|
||||
flb
|
||||
btp
|
||||
|
||||
%repeat _CELL_SIZE
|
||||
|
||||
stp
|
||||
|
||||
|
||||
biz
|
||||
flb
|
||||
btp
|
||||
flb
|
||||
stp
|
||||
rol
|
||||
flb
|
||||
ror
|
||||
rnz
|
||||
|
||||
|
||||
out
|
||||
ror
|
||||
btp
|
||||
out
|
||||
ror
|
||||
%endrepeat
|
||||
|
||||
%endmacro
|
||||
+18
-11
@@ -24,11 +24,23 @@ flb
|
||||
|
||||
%macro erase 0
|
||||
%repeat _CELL_SIZE
|
||||
set_0
|
||||
ror
|
||||
set_0
|
||||
ror
|
||||
%endrepeat
|
||||
%endmacro
|
||||
|
||||
|
||||
%macro rol 0 ;Surprise.
|
||||
%repeat _ROL_STEP
|
||||
ror
|
||||
%endrepeat
|
||||
%endmacro
|
||||
|
||||
|
||||
|
||||
; Macro bit_move_to
|
||||
; %1: CellBit destination
|
||||
|
||||
%macro bit_move_to 1
|
||||
.anchor before_bit_move_to
|
||||
.tp %1
|
||||
@@ -44,8 +56,8 @@ rnz
|
||||
%endmacro
|
||||
|
||||
|
||||
; Macro bit_copy_to_buffer.
|
||||
; %1: tmp
|
||||
; Macro bit_copy_to_buffer
|
||||
; %1: CellBit buffer
|
||||
|
||||
%macro bit_copy_to_buffer 1
|
||||
.anchor before_bit_copy_to_buffer
|
||||
@@ -64,19 +76,14 @@ biz
|
||||
.tp before_bit_copy_to_buffer
|
||||
rnz
|
||||
.tp %1
|
||||
biz
|
||||
flb
|
||||
.tp before_bit_copy_to_buffer
|
||||
flb
|
||||
.tp %1
|
||||
rnz
|
||||
bit_move_to before_bit_copy_to_buffer
|
||||
|
||||
.tp before_bit_copy_to_buffer
|
||||
%endmacro
|
||||
|
||||
|
||||
|
||||
; Macro copy_to_buffer.
|
||||
; Macro copy_to_buffer
|
||||
; %1: tmp
|
||||
|
||||
%macro copy_to_buffer 1
|
||||
|
||||
@@ -69,8 +69,10 @@ extern std::map<std::string, R8MetaOp> r8asm_insmap;
|
||||
|
||||
extern r8asm_cell_size CELL_SIZE;
|
||||
#define CELL_MAX (((uint64_t)1 << CELL_SIZE) - 1)
|
||||
#define ROL_STEP (CELL_SIZE - 1)
|
||||
|
||||
#define DEFAULT_CELL_SIZE 8 // Just for test.
|
||||
#define DEFAULT_CELL_MAX (((uint64_t)1 << DEFAULT_CELL_SIZE) - 1)
|
||||
#define DEFAULT_ROL_STEP (DEFAULT_CELL_SIZE - 1)
|
||||
|
||||
#endif
|
||||
+2
-1
@@ -5,7 +5,8 @@ r8asm_mem_size rot8_dataptr = 0;
|
||||
std::map<std::string, r8asm_label> r8asm_labelmap = {{std::string("main"), 0}};
|
||||
std::map<std::string, r8asm_data> r8asm_datamap = {
|
||||
{std::string("_CELL_MAX"), DEFAULT_CELL_MAX},
|
||||
{std::string{"_CELL_SIZE"}, DEFAULT_CELL_SIZE}};
|
||||
{std::string{"_CELL_SIZE"}, DEFAULT_CELL_SIZE},
|
||||
{std::string("_ROL_STEP"), DEFAULT_ROL_STEP}};
|
||||
|
||||
std::map<std::string, R8MetaOp> r8asm_insmap = {
|
||||
{"stp", rot8_bytecode::STP}, {"btp", rot8_bytecode::BTP},
|
||||
|
||||
Reference in new issue
Block a user