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