version 1.3, 2010/04/25 18:27:09
|
version 1.5, 2010/05/02 18:15:14
|
Line 28 end-code
|
Line 28 end-code
|
|
|
: my-constant ( w "name" -- ) |
: my-constant ( w "name" -- ) |
create , |
create , |
;abi-code ( -- w ) |
;abi-code ( -- w ) |
\ sp in di, address of fp in si, body address in dx |
\ sp in di, address of fp in si, body address in dx |
-8 di d) ax lea \ compute new sp in result reg |
-8 di d) ax lea \ compute new sp in result reg |
dx ) cx mov \ load w |
dx ) cx mov \ load w |
Line 42 end-code
|
Line 42 end-code
|
|
|
foo 5 <> throw |
foo 5 <> throw |
foo-compiled 5 <> throw |
foo-compiled 5 <> throw |
|
|
|
: my-constant2 ( w "name" -- ) |
|
create , |
|
;code ( -- w ) |
|
\ sp=r15, tos=r14, ip=bx |
|
8 # bx add |
|
r14 r15 ) mov |
|
$10 r9 d) r14 mov |
|
8 # r15 sub |
|
-8 bx d) jmp |
|
end-code |
|
|
|
7 my-constant2 bar |
|
: bar-compiled bar ; |
|
|
|
bar 7 <> throw |
|
bar-compiled 7 <> throw |
|
|
|
code my-1+ ( n1 -- n2 ) |
|
8 # bx add |
|
r14 inc |
|
-8 bx d) jmp |
|
end-code |
|
|
|
: compiled-my-1+ |
|
my-1+ ; |
|
|
|
7 my-1+ 8 <> throw |
|
8 compiled-my-1+ 9 <> throw |
|
|
|
: funny-compiler-test |
|
drop my-1+ 1 ; |
|
|
|
\ 6 9 funny-compiler-test 1 <> throw 7 <> throw |