@@ 23,6 23,12 @@ macro defcode name {
name:
}
+macro defword wordname {
+ align ADDR_SIZE
+wordname:
+ jmp docol
+}
+
;; push/pop data stack
macro pushd r {
lea rsp, [rsp + ADDR_SIZE]
@@ 47,10 53,20 @@ var_STATE: db IMMEDIATE
section '.text' ; readable executable
+docol:
+ push rsi
+ add rax, 5 ; size of shortjmp
+ mov rsi, rax
+ next
+
defcode drop
popd rax
next
+ defcode exitword
+ pop rsi
+ next
+
defcode swap
popd rax
popd rbx
@@ 123,13 139,17 @@ section '.text' ; readable executable
add esi, [esi]
next
+ defword starloop
+ dq lit, '*'
+ dq emit
+ dq branch, -32
+ dq exitword
+
start:
cld
mov rsi, instrs
next
instrs:
- dq lit, '*'
- dq emit
- dq branch, -32
+ dq starloop
dq exit