projects
/
rrq
/
jonasforth.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1da54a4
)
Implement basic return stack
author
Jonas Hvid
<mail@johv.dk>
Thu, 14 Nov 2019 17:47:05 +0000
(18:47 +0100)
committer
Jonas Hvid
<mail@johv.dk>
Thu, 14 Nov 2019 17:47:05 +0000
(18:47 +0100)
main.asm
patch
|
blob
|
history
diff --git
a/main.asm
b/main.asm
index 537796de252a2c12db2f3597825afb3a1614f4ea..e95d9fd5635aafc9d60d82957eef492193d6b7fe 100644
(file)
--- a/
main.asm
+++ b/
main.asm
@@
-12,9
+12,29
@@
macro next {
jmp qword [rax] ; Jump to the codeword of the current word
}
jmp qword [rax] ; Jump to the codeword of the current word
}
+;; pushr and popr work on the return stack, whose location is stored in the
+;; register RBP.
+macro pushr x {
+ sub rbp, 8
+ mov [rbp], x
+}
+macro popr x {
+ mov x, [rbp]
+ add rbp, 8
+}
+
segment readable executable
start:
segment readable executable
start:
+ ;; Initialize return stack
+ mov rbp, return_stack_top
+
jmp $
segment readable
jmp $
segment readable
+
+segment readable writable
+
+;; Return stack
+rq $2000
+return_stack_top: