mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-27 17:18:05 +11:00
forth: fix name conflict with "H" in core and z80a
This commit is contained in:
parent
77ecbc4918
commit
3e934a2a3b
@ -1,4 +1,4 @@
|
|||||||
: H HERE @ ;
|
: H@ HERE @ ;
|
||||||
: -^ SWAP - ;
|
: -^ SWAP - ;
|
||||||
: [LITN] LITN ; IMMEDIATE
|
: [LITN] LITN ; IMMEDIATE
|
||||||
: LIT ROUTINE S [LITN] , ;
|
: LIT ROUTINE S [LITN] , ;
|
||||||
@ -9,9 +9,9 @@
|
|||||||
: ['] WORD (find) SKIP? _err LITN ; IMMEDIATE
|
: ['] WORD (find) SKIP? _err LITN ; IMMEDIATE
|
||||||
: COMPILE ' LITN ['] , , ; IMMEDIATE
|
: COMPILE ' LITN ['] , , ; IMMEDIATE
|
||||||
: [COMPILE] ' , ; IMMEDIATE
|
: [COMPILE] ' , ; IMMEDIATE
|
||||||
: BEGIN H ; IMMEDIATE
|
: BEGIN H@ ; IMMEDIATE
|
||||||
: AGAIN COMPILE (bbr) H -^ C, ; IMMEDIATE
|
: AGAIN COMPILE (bbr) H@ -^ C, ; IMMEDIATE
|
||||||
: UNTIL COMPILE SKIP? COMPILE (bbr) H -^ C, ; IMMEDIATE
|
: UNTIL COMPILE SKIP? COMPILE (bbr) H@ -^ C, ; IMMEDIATE
|
||||||
: ( BEGIN LIT< ) WORD SCMP NOT UNTIL ; IMMEDIATE
|
: ( BEGIN LIT< ) WORD SCMP NOT UNTIL ; IMMEDIATE
|
||||||
( Hello, hello, krkrkrkr... do you hear me?
|
( Hello, hello, krkrkrkr... do you hear me?
|
||||||
Ah, voice at last! Some lines above need comments
|
Ah, voice at last! Some lines above need comments
|
||||||
@ -30,21 +30,21 @@
|
|||||||
: IF ( -- a | a: br cell addr )
|
: IF ( -- a | a: br cell addr )
|
||||||
COMPILE SKIP? ( if true, don't branch )
|
COMPILE SKIP? ( if true, don't branch )
|
||||||
COMPILE (fbr)
|
COMPILE (fbr)
|
||||||
H ( push a )
|
H@ ( push a )
|
||||||
1 ALLOT ( br cell allot )
|
1 ALLOT ( br cell allot )
|
||||||
; IMMEDIATE
|
; IMMEDIATE
|
||||||
|
|
||||||
: THEN ( a -- | a: br cell addr )
|
: THEN ( a -- | a: br cell addr )
|
||||||
DUP H -^ SWAP ( a-H a )
|
DUP H@ -^ SWAP ( a-H a )
|
||||||
C!
|
C!
|
||||||
; IMMEDIATE
|
; IMMEDIATE
|
||||||
|
|
||||||
: ELSE ( a1 -- a2 | a1: IF cell a2: ELSE cell )
|
: ELSE ( a1 -- a2 | a1: IF cell a2: ELSE cell )
|
||||||
COMPILE (fbr)
|
COMPILE (fbr)
|
||||||
1 ALLOT
|
1 ALLOT
|
||||||
DUP H -^ SWAP ( a-H a )
|
DUP H@ -^ SWAP ( a-H a )
|
||||||
C!
|
C!
|
||||||
H 1 - ( push a. -1 for allot offset )
|
H@ 1 - ( push a. -1 for allot offset )
|
||||||
; IMMEDIATE
|
; IMMEDIATE
|
||||||
|
|
||||||
: CREATE
|
: CREATE
|
||||||
@ -53,18 +53,18 @@
|
|||||||
, ( write it )
|
, ( write it )
|
||||||
;
|
;
|
||||||
: VARIABLE CREATE 2 ALLOT ;
|
: VARIABLE CREATE 2 ALLOT ;
|
||||||
: CONSTANT CREATE H ! DOES> @ ;
|
: CONSTANT CREATE H@ ! DOES> @ ;
|
||||||
: = CMP NOT ;
|
: = CMP NOT ;
|
||||||
: < CMP 0 1 - = ;
|
: < CMP 0 1 - = ;
|
||||||
: > CMP 1 = ;
|
: > CMP 1 = ;
|
||||||
: / /MOD SWAP DROP ;
|
: / /MOD SWAP DROP ;
|
||||||
: MOD /MOD DROP ;
|
: MOD /MOD DROP ;
|
||||||
|
|
||||||
( In addition to pushing H this compiles 2 >R so that loop
|
( In addition to pushing H@ this compiles 2 >R so that loop
|
||||||
variables are sent to PS at runtime )
|
variables are sent to PS at runtime )
|
||||||
: DO
|
: DO
|
||||||
COMPILE SWAP COMPILE >R COMPILE >R
|
COMPILE SWAP COMPILE >R COMPILE >R
|
||||||
H
|
H@
|
||||||
; IMMEDIATE
|
; IMMEDIATE
|
||||||
|
|
||||||
( One could think that we should have a sub word to avoid all
|
( One could think that we should have a sub word to avoid all
|
||||||
@ -73,7 +73,7 @@
|
|||||||
: LOOP
|
: LOOP
|
||||||
COMPILE R> 1 LITN COMPILE + COMPILE DUP COMPILE >R
|
COMPILE R> 1 LITN COMPILE + COMPILE DUP COMPILE >R
|
||||||
COMPILE I' COMPILE = COMPILE SKIP? COMPILE (bbr)
|
COMPILE I' COMPILE = COMPILE SKIP? COMPILE (bbr)
|
||||||
H -^ C,
|
H@ -^ C,
|
||||||
COMPILE R> COMPILE DROP COMPILE R> COMPILE DROP
|
COMPILE R> COMPILE DROP COMPILE R> COMPILE DROP
|
||||||
; IMMEDIATE
|
; IMMEDIATE
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ C@ a -- c Set c to byte at address a
|
|||||||
C! c a -- Store byte c in address a
|
C! c a -- Store byte c in address a
|
||||||
CURRENT -- a Set a to wordref of last added entry.
|
CURRENT -- a Set a to wordref of last added entry.
|
||||||
HERE -- a Push HERE's address
|
HERE -- a Push HERE's address
|
||||||
H -- a HERE @
|
H@ -- a HERE @
|
||||||
|
|
||||||
*** Arithmetic / Bits ***
|
*** Arithmetic / Bits ***
|
||||||
|
|
||||||
|
@ -7,5 +7,5 @@
|
|||||||
current HERE value. The staging executable needs it to know
|
current HERE value. The staging executable needs it to know
|
||||||
what to dump. )
|
what to dump. )
|
||||||
|
|
||||||
HERE @ 256 / 2 PC!
|
H@ 256 / 2 PC!
|
||||||
HERE @ 2 PC!
|
H@ 2 PC!
|
||||||
|
@ -21,9 +21,9 @@
|
|||||||
|
|
||||||
( Initializes the readln subsystem )
|
( Initializes the readln subsystem )
|
||||||
: (c<$)
|
: (c<$)
|
||||||
HERE @ IN( !
|
H@ IN( !
|
||||||
INBUFSZ ALLOT
|
INBUFSZ ALLOT
|
||||||
HERE @ IN) !
|
H@ IN) !
|
||||||
(infl)
|
(infl)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user