mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-23 19:38:05 +11:00
forth: Forth-ify "@"
This commit is contained in:
parent
f9c3a0444c
commit
8ef9e7d0da
Binary file not shown.
@ -857,22 +857,10 @@ STORE:
|
||||
ld (iy+1), h
|
||||
jp next
|
||||
|
||||
; ( a -- n )
|
||||
.db "@"
|
||||
.dw $-STORE
|
||||
.db 1
|
||||
FETCH:
|
||||
.dw nativeWord
|
||||
pop hl
|
||||
call chkPS
|
||||
call intoHL
|
||||
push hl
|
||||
jp next
|
||||
|
||||
.fill 13
|
||||
.fill 30
|
||||
|
||||
.db "_bend"
|
||||
.dw $-FETCH
|
||||
.dw $-STORE
|
||||
.db 5
|
||||
; Offset: 0647
|
||||
.out $
|
||||
|
@ -86,12 +86,12 @@
|
||||
|
||||
: C<
|
||||
( JTBL+40 == CINPTR )
|
||||
[ JTBL 40 + @ LITN ] @ EXECUTE
|
||||
[ JTBL 40 + @ LITN ] _c @ EXECUTE
|
||||
;
|
||||
|
||||
: C,
|
||||
HERE @ _c C!
|
||||
HERE @ 1 _c + HERE !
|
||||
HERE _c @ _c C!
|
||||
HERE _c @ 1 _c + HERE !
|
||||
;
|
||||
|
||||
( The NOT is to normalize the negative/positive numbers to 1
|
||||
@ -126,18 +126,18 @@
|
||||
;
|
||||
|
||||
: (entry)
|
||||
HERE @ ( h )
|
||||
HERE _c @ ( h )
|
||||
_c WORD ( h s )
|
||||
SCPY ( h )
|
||||
( Adjust HERE -1 because SCPY copies the null )
|
||||
HERE @ 1 _c - ( h h' )
|
||||
HERE _c @ 1 _c - ( h h' )
|
||||
_c DUP HERE ! ( h h' )
|
||||
_c SWAP _c - ( sz )
|
||||
( write prev value )
|
||||
HERE @ CURRENT @ _c - ,
|
||||
HERE _c @ CURRENT _c @ _c - ,
|
||||
( write size )
|
||||
_c C,
|
||||
HERE @ CURRENT !
|
||||
HERE _c @ CURRENT !
|
||||
;
|
||||
|
||||
: INTERPRET
|
||||
@ -149,7 +149,7 @@
|
||||
EXECUTE
|
||||
0 FLAGS !
|
||||
ELSE
|
||||
(parse*) @ EXECUTE
|
||||
(parse*) _c @ EXECUTE
|
||||
THEN
|
||||
AGAIN
|
||||
;
|
||||
@ -185,7 +185,7 @@
|
||||
( is word )
|
||||
IF _c DUP _c IMMED? IF EXECUTE ELSE , THEN
|
||||
( maybe number )
|
||||
ELSE (parse*) @ EXECUTE _c LITN THEN
|
||||
ELSE (parse*) _c @ EXECUTE _c LITN THEN
|
||||
AGAIN
|
||||
; IMMEDIATE
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
( -- )
|
||||
: OP1 CREATE C, DOES> C@ A, ;
|
||||
0xeb OP1 EXDEHL,
|
||||
0x76 OP1 HALT,
|
||||
0xc9 OP1 RET,
|
||||
0x17 OP1 RLA,
|
||||
|
@ -213,6 +213,16 @@ CODE /MOD
|
||||
BC PUSHqq,
|
||||
;CODE
|
||||
|
||||
CODE @
|
||||
HL POPqq,
|
||||
chkPS,
|
||||
E (HL) LDrr,
|
||||
HL INCss,
|
||||
D (HL) LDrr,
|
||||
EXDEHL,
|
||||
HL PUSHqq,
|
||||
;CODE
|
||||
|
||||
CODE C!
|
||||
HL POPqq,
|
||||
DE POPqq,
|
||||
|
Loading…
Reference in New Issue
Block a user