Browse Source

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

pull/95/head
Virgil Dupras 4 years ago
parent
commit
6d8edeec63
4 changed files with 18 additions and 30 deletions
  1. BIN
      emul/forth/z80c.bin
  2. +2
    -29
      forth/forth.asm
  3. +1
    -1
      forth/z80a.fs
  4. +15
    -0
      forth/z80c.fs

BIN
emul/forth/z80c.bin View File


+ 2
- 29
forth/forth.asm View File

@@ -1288,23 +1288,10 @@ STORE:
ld (iy+1), h
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 )
.db "@"
.fill 6
.dw $-CSTORE
.dw $-STORE
.db 0
FETCH:
.dw nativeWord
@@ -1314,24 +1301,10 @@ FETCH:
push hl
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 -- )
.db "DROP"
.fill 3
.dw $-CFETCH
.dw $-FETCH
.db 0
DROP:
.dw nativeWord


+ 1
- 1
forth/z80a.fs View File

@@ -43,7 +43,6 @@
;
0x04 OP1r INCr,
0x46 OP1r LDr(HL),
0x70 OP1r LD(HL)r,

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


+ 15
- 0
forth/z80c.fs View File

@@ -110,6 +110,21 @@ CODE XOR
HL PUSHqq,
;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!
BC POPqq,
HL POPqq,


Loading…
Cancel
Save