1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2 ;; UrForth level
1: self
-hosting
32-bit Forth compiler
3 ;; Copyright
(C
) 2020 Ketmar Dark
// Invisible Vector
5 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7 ;; aligned PFA forces aligned CFA
(metacompiler does this
)
9 code: (URFORTH-DOXXX-CODEBLOCKS)
56 ;; pfa is on the stack
85 $
if URFORTH_TLS_TYPE
= URFORTH_TLS_TYPE_FS
86 ld TOS
,[TOS
] ;; offset
87 add TOS
,ts
:[0] ;; add user area base address
91 ;; use this
subroutine to call a forth word from a machine code
92 ;; EAX should point
to the cfa
93 ;; TOS and other things should be set accordingly
94 ;; direction flag should be cleared
95 ;; no registers are preserved
98 ;; move mc
return address
to rstack
101 ;; push current EIP
to rstack
106 ;; turn off debugger temporarily
, because the debugger is using this
108 ld edx
,[urfdebug_active_flag
]
110 ;; special flag
, means
"no breakpoint checks"
111 ld dword
[urfdebug_active_flag
],-1
114 ;; and execute the word
119 ;; restore debugger state
122 ld dword
[urfdebug_active_flag
],edx
127 ;; restore
return address
135 $constant
"(URFORTH-DOFORTH-ADDR)" ur_doforth
136 $constant
"(URFORTH-DOCONST-ADDR)" ur_doconst
137 $constant
"(URFORTH-DOVAR-ADDR)" ur_dovar
138 $constant
"(URFORTH-DOVALUE-ADDR)" ur_dovalue
139 $constant
"(URFORTH-DODEFER-ADDR)" ur_dodefer
140 $constant
"(URFORTH-DODOES-ADDR)" ur_dodoes
141 $constant
"(URFORTH-DOOVERRIDE-ADDR)" ur_dooverride
142 $constant
"(URFORTH-DOUSERVAR-ADDR)" ur_douservar
143 $constant
"(URFORTH-FCALL-ADDR)" ur_mc_fcall