X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=machine.asm;h=4628077226d1c0487e15c708a584a942a48313f1;hb=1e20129cc5801258ef162be39d764693511ff6fb;hp=90310145359539274faf91e6aece21e0fffb4e00;hpb=74e26fb7ed992b0c8a53988eb4e717ec3e04248a;p=rrq%2Frrqforth.git diff --git a/machine.asm b/machine.asm index 9031014..4628077 100644 --- a/machine.asm +++ b/machine.asm @@ -97,16 +97,15 @@ macro ENDFORTH { ;;; ======================================== ;;; The DOFORTH lays out a single FORTH call -macro DOFORTH label { +macro DOFORTH [label] { +common FORTH +forward dq label +common ENDFORTH } - previous_word = 0 ; Used for chaining the words - - IMMEDIATE = 1 ; optional flag (symbol) - ;;; ======================================== ;;; Macro WORD starts a FORTH word definition in this code. ;;; The layout of a word is as follows: @@ -122,6 +121,8 @@ macro DOFORTH label { ;;; CFA: [8 bytes] pointer to the word's "doer" code ;;; DFA: [? bytes] the word's data field +IMMEDIATE = 1 ; optional flag (symbol) + macro WORD label, name, doer, flags, previous, offset { local pname ;; align 8 @@ -196,11 +197,12 @@ macro dfa2tfa reg { sub reg,24 mov reg,qword [reg] } -macro pushpname rg { ; ( reg -- chars* length ) - add rg,8 - push rg - sub rg,8 - push qword [rg] +;;; Code snippet to push a pname string with address and 64-bit length field. +;;; The register is advanced to point at the text part. +macro pushpname reg { + add reg,8 + push reg + push qword [reg-8] } ;;; ======================================== ;;; The BLOCK macro lays out the length for a subsequent block to the @@ -231,7 +233,19 @@ macro BRANCH zero,label { if zero in <0> dq p_zero_branch else - dq p_zero_branch + dq p_branch end if dq label - $ - 8 } + +;;; ======================================== +;;; The STREAM macro starts an in-core FORTH STREAM area. See WORD +;;; STREAM for details. + macro STREAM endlabel { + local datastart + dq $+32 + dq -1 + dq endlabel - datastart + dq 0 +datastart: + }