Skip to content

Commit

Permalink
More work on handling input stack effects (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbirddog authored Jul 11, 2024
1 parent 0c16ba5 commit 8540540
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
3 changes: 3 additions & 0 deletions dictionary.inc
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,9 @@ seX_parse_end:
or al, DE_SE_KNOWN
stosb

mov rax, [_dictionary.latest]
call push_flow_in

ret

se_reg_eax:
Expand Down
39 changes: 38 additions & 1 deletion flow.inc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ flow_in:
cmp eax, _IMMEDIATE
jne .flow_reg

.flow_lit:
mov al, 0xb8
add al, bl
call b_comma
Expand All @@ -29,11 +30,47 @@ flow_in:
jmp .loop

.flow_reg:
die ERR_NO_IMPL
and ebx, 7
shl ebx, 3
and rax, REG_MASK
shr rax, REG_OFFSET
and eax, 7

or ebx, eax
or ebx, 0xc0

mov al, 0x89
call b_comma

mov al, bl
call b_comma
jmp .loop
.done:
ret

;
; expects
; - word in rax
;
push_flow_in:
call word_input_stack_effects

.loop:
dec ecx
js .done

lea rax, [rsi + (rcx * 8)]
mov rax, [rax]

call data_stack_push
jmp .loop
.done:
ret
;
; expects
; - word in rax
Expand Down
13 changes: 13 additions & 0 deletions kernel_test.inc
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ kernel_test:
tc1 user_empty_words
tc1 seX_empty
tc1 ise_1
tc1 ise_2
tc2 bogus

Expand Down Expand Up @@ -220,6 +221,18 @@ ise_1:
db 0xc3
.expected_length = $ - .expected

ise_2:
.blue:
db ': myd, (( num eax -- )) d, ; immediate '
db ': _ 7 myd, ; entry '
.blue_length = $ - .blue

.expected:
db 0xc3
dd 0x07
db 0xc3
.expected_length = $ - .expected

entry_0:
.blue:
db ': 1b 1 b, ; entry '
Expand Down

0 comments on commit 8540540

Please sign in to comment.