X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=main.asm;h=e95d9fd5635aafc9d60d82957eef492193d6b7fe;hb=32d0ec28e8ffda578fe8de8eef75426d8ef98f9c;hp=537796de252a2c12db2f3597825afb3a1614f4ea;hpb=1da54a4e8c55400181194a2db2cce4b96e479d61;p=rrq%2Fjonasforth.git diff --git a/main.asm b/main.asm index 537796d..e95d9fd 100644 --- a/main.asm +++ b/main.asm @@ -12,9 +12,29 @@ macro next { 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: + ;; Initialize return stack + mov rbp, return_stack_top + jmp $ segment readable + +segment readable writable + +;; Return stack +rq $2000 +return_stack_top: