Update
This commit is contained in:
parent
00bab636db
commit
3da2567890
3 changed files with 75 additions and 67 deletions
|
@ -11,21 +11,36 @@
|
||||||
.org prev
|
.org prev
|
||||||
.delete prev, diff
|
.delete prev, diff
|
||||||
|
|
||||||
.define_eval prev, OFFSET
|
; .define_eval prev, OFFSET
|
||||||
.bytes NULL
|
;
|
||||||
.bytes NULL
|
; .bytes CORE_U16_MAX, CORE_U16_MAX
|
||||||
|
;
|
||||||
|
; .define_eval JUMP_TABLE_CONDITIONS_SIZE, (OFFSET - prev)
|
||||||
|
; .org prev
|
||||||
|
; .delete prev
|
||||||
|
|
||||||
.define_eval INDEX_CONDITIONS_SIZE, (OFFSET - prev)
|
; .define_eval JUMP_TABLE_WORDS_SIZE, (0 * 2)
|
||||||
.org prev
|
|
||||||
.delete prev
|
|
||||||
|
|
||||||
.debug INDEX_CONDITIONS_SIZE
|
; .define_eval MEM_JUMP_TABLE_LEN, (JUMP_TABLE_CONDITIONS_SIZE + JUMP_TABLE_WORDS_SIZE / 2)
|
||||||
|
; .define_eval MEM_JUMP_TABLE_PTR, CORE_MEM_MEM
|
||||||
|
; .define_eval MEM_JUMP_TABLE_END, (MEM_JUMP_TABLE_PTR + MEM_JUMP_TABLE_LEN)
|
||||||
|
|
||||||
; index
|
; .debug MEM_JUMP_TABLE_LEN, MEM_JUMP_TABLE_PTR, MEM_JUMP_TABLE_END
|
||||||
index_conditions_if_0:
|
|
||||||
|
|
||||||
|
; ; jump table
|
||||||
|
; ; conditions
|
||||||
|
;
|
||||||
|
; jump_table_conditions_if_0: .bytes 444
|
||||||
|
;
|
||||||
|
; jump_table_conditions_else_0: .bytes 5498
|
||||||
|
;
|
||||||
|
;
|
||||||
|
|
||||||
.define_eval MEM_LOOP_DEPTH, CORE_MEM_MEM
|
.define_eval MEM_JUMP_TABLE_LEN, 9
|
||||||
|
.define_eval MEM_JUMP_TABLE_PTR, CORE_MEM_MEM
|
||||||
|
.define_eval MEM_JUMP_TABLE_END, (MEM_JUMP_TABLE_PTR + MEM_JUMP_TABLE_LEN)
|
||||||
|
|
||||||
|
.define_eval MEM_LOOP_DEPTH, (MEM_JUMP_TABLE_END + 1)
|
||||||
.define_eval MEM_LOOP_I, (MEM_LOOP_DEPTH + 1)
|
.define_eval MEM_LOOP_I, (MEM_LOOP_DEPTH + 1)
|
||||||
.define_eval MEM_LOOP_J, (MEM_LOOP_I + 1)
|
.define_eval MEM_LOOP_J, (MEM_LOOP_I + 1)
|
||||||
|
|
||||||
|
@ -42,9 +57,14 @@
|
||||||
tlr CORE_REG_A
|
tlr CORE_REG_A
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
|
; setup jump table
|
||||||
|
|
||||||
|
|
||||||
|
; reference MEM_CALL_STACK_PTR to itself
|
||||||
.std_rset CORE_REG_A, MEM_CALL_STACK_PTR
|
.std_rset CORE_REG_A, MEM_CALL_STACK_PTR
|
||||||
.std_set MEM_CALL_STACK_PTR
|
.std_set MEM_CALL_STACK_PTR
|
||||||
|
|
||||||
|
; reference MEM_ALLOC_PTR to itself
|
||||||
.std_rset CORE_REG_A, MEM_ALLOC_PTR
|
.std_rset CORE_REG_A, MEM_ALLOC_PTR
|
||||||
.std_set MEM_ALLOC_PTR
|
.std_set MEM_ALLOC_PTR
|
||||||
|
|
||||||
|
@ -176,11 +196,6 @@ return_call_stack_jump:
|
||||||
.std_set CORE_MEM_OUT
|
.std_set CORE_MEM_OUT
|
||||||
.std_rset CORE_REG_A, '\n'
|
.std_rset CORE_REG_A, '\n'
|
||||||
.std_set CORE_MEM_CHR
|
.std_set CORE_MEM_CHR
|
||||||
.call_stack_jump words_0
|
|
||||||
.call_stack_jump words_1
|
|
||||||
.call_stack_jump words_2
|
|
||||||
.call_stack_jump words_3
|
|
||||||
.call_stack_jump words_4
|
|
||||||
dbg
|
dbg
|
||||||
.return_call_stack_jump
|
.return_call_stack_jump
|
||||||
|
|
||||||
|
@ -195,38 +210,6 @@ return_call_stack_jump:
|
||||||
|
|
||||||
|
|
||||||
; words
|
; words
|
||||||
words_0:
|
|
||||||
; name : "test"
|
|
||||||
push 40
|
|
||||||
push 2
|
|
||||||
.stack_transfer_alu
|
|
||||||
.std_alu CORE_ALU_ADD
|
|
||||||
tls
|
|
||||||
.return_call_stack_jump
|
|
||||||
|
|
||||||
words_1:
|
|
||||||
; name : "meep"
|
|
||||||
push 32
|
|
||||||
.return_call_stack_jump
|
|
||||||
|
|
||||||
words_2:
|
|
||||||
; name : "morp"
|
|
||||||
push 4875
|
|
||||||
push 8748
|
|
||||||
dbg
|
|
||||||
.return_call_stack_jump
|
|
||||||
|
|
||||||
words_3:
|
|
||||||
; name : "zeep"
|
|
||||||
push 8777
|
|
||||||
dbg
|
|
||||||
.return_call_stack_jump
|
|
||||||
|
|
||||||
words_4:
|
|
||||||
; name : "borg"
|
|
||||||
dbg
|
|
||||||
.return_call_stack_jump
|
|
||||||
|
|
||||||
|
|
||||||
; main
|
; main
|
||||||
main:
|
main:
|
||||||
|
@ -237,11 +220,18 @@ main:
|
||||||
.org main
|
.org main
|
||||||
push 0
|
push 0
|
||||||
.call_stack_jump_cond_if_else conditions_if_0, conditions_else_0
|
.call_stack_jump_cond_if_else conditions_if_0, conditions_else_0
|
||||||
.call_stack_jump words_0
|
push 40
|
||||||
|
push 2
|
||||||
|
.stack_transfer_alu
|
||||||
|
.std_alu CORE_ALU_ADD
|
||||||
|
tls
|
||||||
|
dbg
|
||||||
|
push 32
|
||||||
|
push 4875
|
||||||
|
push 8748
|
||||||
|
dbg
|
||||||
|
push 8777
|
||||||
|
dbg
|
||||||
dbg
|
dbg
|
||||||
.call_stack_jump words_1
|
|
||||||
.call_stack_jump words_2
|
|
||||||
.call_stack_jump words_3
|
|
||||||
.call_stack_jump words_4
|
|
||||||
dbg
|
dbg
|
||||||
.std_stop
|
.std_stop
|
||||||
|
|
|
@ -6,5 +6,5 @@
|
||||||
|
|
||||||
\ 42 42 = debug if 69 . else 420 . then cr
|
\ 42 42 = debug if 69 . else 420 . then cr
|
||||||
|
|
||||||
0 if 42 . cr test meep morp zeep borg debug else 69 . cr then
|
0 if 42 . cr debug else 69 . cr then
|
||||||
test debug meep morp zeep borg debug
|
test debug meep morp zeep borg debug
|
||||||
|
|
|
@ -15,23 +15,36 @@
|
||||||
.org prev
|
.org prev
|
||||||
.delete prev, diff
|
.delete prev, diff
|
||||||
|
|
||||||
.define_eval prev, OFFSET
|
; .define_eval prev, OFFSET
|
||||||
{%- for c in conditions %}
|
; {%- for c in conditions %}
|
||||||
.bytes NULL
|
; .bytes CORE_U16_MAX{% if !c.data.1.is_empty() %}, CORE_U16_MAX{% endif %}
|
||||||
{% if !c.data.1.is_empty() %}.bytes NULL{% endif %}
|
; {%- endfor %}
|
||||||
{% endfor %}
|
; .define_eval JUMP_TABLE_CONDITIONS_SIZE, (OFFSET - prev)
|
||||||
.define_eval INDEX_CONDITIONS_SIZE, (OFFSET - prev)
|
; .org prev
|
||||||
.org prev
|
; .delete prev
|
||||||
.delete prev
|
|
||||||
|
|
||||||
.debug INDEX_CONDITIONS_SIZE
|
; .define_eval JUMP_TABLE_WORDS_SIZE, ({{ words.len() }} * 2)
|
||||||
|
|
||||||
; index
|
; .define_eval MEM_JUMP_TABLE_LEN, (JUMP_TABLE_CONDITIONS_SIZE + JUMP_TABLE_WORDS_SIZE / 2)
|
||||||
{%- for c in conditions %}
|
; .define_eval MEM_JUMP_TABLE_PTR, CORE_MEM_MEM
|
||||||
index_conditions_if_{{ c.id }}:
|
; .define_eval MEM_JUMP_TABLE_END, (MEM_JUMP_TABLE_PTR + MEM_JUMP_TABLE_LEN)
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
.define_eval MEM_LOOP_DEPTH, CORE_MEM_MEM
|
; .debug MEM_JUMP_TABLE_LEN, MEM_JUMP_TABLE_PTR, MEM_JUMP_TABLE_END
|
||||||
|
|
||||||
|
; ; jump table
|
||||||
|
; ; conditions
|
||||||
|
; {%- for c in conditions %}
|
||||||
|
; jump_table_conditions_if_{{ c.id }}: .bytes 444
|
||||||
|
; {%- if !c.data.1.is_empty() %}
|
||||||
|
; jump_table_conditions_else_{{ c.id }}: .bytes 5498
|
||||||
|
; {%- endif %}
|
||||||
|
; {%- endfor %}
|
||||||
|
|
||||||
|
.define_eval MEM_JUMP_TABLE_LEN, 9
|
||||||
|
.define_eval MEM_JUMP_TABLE_PTR, CORE_MEM_MEM
|
||||||
|
.define_eval MEM_JUMP_TABLE_END, (MEM_JUMP_TABLE_PTR + MEM_JUMP_TABLE_LEN)
|
||||||
|
|
||||||
|
.define_eval MEM_LOOP_DEPTH, (MEM_JUMP_TABLE_END + 1)
|
||||||
.define_eval MEM_LOOP_I, (MEM_LOOP_DEPTH + 1)
|
.define_eval MEM_LOOP_I, (MEM_LOOP_DEPTH + 1)
|
||||||
.define_eval MEM_LOOP_J, (MEM_LOOP_I + 1)
|
.define_eval MEM_LOOP_J, (MEM_LOOP_I + 1)
|
||||||
|
|
||||||
|
@ -48,9 +61,14 @@
|
||||||
tlr CORE_REG_A
|
tlr CORE_REG_A
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
|
; setup jump table
|
||||||
|
|
||||||
|
|
||||||
|
; reference MEM_CALL_STACK_PTR to itself
|
||||||
.std_rset CORE_REG_A, MEM_CALL_STACK_PTR
|
.std_rset CORE_REG_A, MEM_CALL_STACK_PTR
|
||||||
.std_set MEM_CALL_STACK_PTR
|
.std_set MEM_CALL_STACK_PTR
|
||||||
|
|
||||||
|
; reference MEM_ALLOC_PTR to itself
|
||||||
.std_rset CORE_REG_A, MEM_ALLOC_PTR
|
.std_rset CORE_REG_A, MEM_ALLOC_PTR
|
||||||
.std_set MEM_ALLOC_PTR
|
.std_set MEM_ALLOC_PTR
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue