forth: Forth-ify "C!" and "C@"

This commit is contained in:
Virgil Dupras 2020-03-25 17:52:51 -04:00
parent 66412a1c30
commit 6d8edeec63
4 changed files with 18 additions and 30 deletions

Binary file not shown.

View File

@ -1288,23 +1288,10 @@ STORE:
ld (iy+1), h ld (iy+1), h
jp next jp next
; ( n a -- )
.db "C!"
.fill 5
.dw $-STORE
.db 0
CSTORE:
.dw nativeWord
pop hl
pop de
call chkPS
ld (hl), e
jp next
; ( a -- n ) ; ( a -- n )
.db "@" .db "@"
.fill 6 .fill 6
.dw $-CSTORE .dw $-STORE
.db 0 .db 0
FETCH: FETCH:
.dw nativeWord .dw nativeWord
@ -1314,24 +1301,10 @@ FETCH:
push hl push hl
jp next jp next
; ( a -- c )
.db "C@"
.fill 5
.dw $-FETCH
.db 0
CFETCH:
.dw nativeWord
pop hl
call chkPS
ld l, (hl)
ld h, 0
push hl
jp next
; ( a -- ) ; ( a -- )
.db "DROP" .db "DROP"
.fill 3 .fill 3
.dw $-CFETCH .dw $-FETCH
.db 0 .db 0
DROP: DROP:
.dw nativeWord .dw nativeWord

View File

@ -43,7 +43,6 @@
; ;
0x04 OP1r INCr, 0x04 OP1r INCr,
0x46 OP1r LDr(HL), 0x46 OP1r LDr(HL),
0x70 OP1r LD(HL)r,
( r -- ) ( r -- )
: OP1r0 : OP1r0
@ -52,6 +51,7 @@
C@ ( r op ) C@ ( r op )
OR A, OR A,
; ;
0x70 OP1r0 LD(HL)r,
0xa0 OP1r0 ANDr, 0xa0 OP1r0 ANDr,
0xb0 OP1r0 ORr, 0xb0 OP1r0 ORr,
0xa8 OP1r0 XORr, 0xa8 OP1r0 XORr,

View File

@ -110,6 +110,21 @@ CODE XOR
HL PUSHqq, HL PUSHqq,
;CODE ;CODE
CODE C!
HL POPqq,
DE POPqq,
chkPS,
E LD(HL)r,
;CODE
CODE C@
HL POPqq,
chkPS,
L LDr(HL),
H 0 LDrn,
HL PUSHqq,
;CODE
CODE PC! CODE PC!
BC POPqq, BC POPqq,
HL POPqq, HL POPqq,