X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=machine.fasm;h=ddfb9711fe18abd89b514d3ccffd2989a18140c8;hb=1c48f378a2c7786735d05df33dd145c59fb49a12;hp=92f51a1f3433d103ee650eab2c2ef48273f13f32;hpb=9c582d87bca4bce0aa889cad0bd200ee85512f78;p=rrq%2Frrqforth.git diff --git a/machine.fasm b/machine.fasm index 92f51a1..ddfb971 100644 --- a/machine.fasm +++ b/machine.fasm @@ -44,58 +44,4 @@ ;;; ;;; function calling -;;; FORTH model -;;; rsp = data stack pointer -;;; rbp = frame pointer -;;; rdi = frame stack -;;; rsi = instruction pointer -;;; ======================================== -;;; The next macro "moves" execution to the next FORTH instruction, -;;; using rsi as instruction pointer. - - macro next { - lodsq ; mov rax, qword [rsi] - ; add rsi,8 - jmp qword [rax] ; goto code of that FORTH word - } - -;;; ======================================== -;;; The pushr macro pushes x onto the return stack -;;; The popr macro pops x from the return stack - macro pushr x { - sub rbp, 8 - mov qword [rbp], x - } - - macro popr x { - mov x, [rbp] - add rbp, 8 - } - -;;; ======================================== -;;; - - previous_word = 0 - - ;; Macro WORD starts a FORTH word definition in this code - macro WORD label, name, doer, flags { -label#_tfa: - ;; TFA - dq previous_word - ;; PFA -label#_word: - previous_word = label#_word - db flags + 0 - db label - $ - 1 - db name - ;; CFA = pointer to "interpreter" -label: - dq doer - } - - ;; Macro WORD_assembler begins an assembler implementation - macro WORD_assembler label, name, flags { - WORD label, name, label#_code, flags -label#_code: - }