forth: add words "C@" and "C!"

This commit is contained in:
Virgil Dupras 2020-03-11 22:11:54 -04:00
parent 80f63cd185
commit f89e7bd503
2 changed files with 27 additions and 2 deletions

View File

@ -389,10 +389,21 @@ STORE:
ld (iy+1), h
jp exit
; ( n a -- )
.db "C!"
.fill 6
.dw STORE
CSTORE:
.dw nativeWord
pop hl
pop de
ld (hl), e
jp exit
; ( a -- n )
.db "@"
.fill 7
.dw STORE
.dw CSTORE
FETCH:
.dw nativeWord
pop hl
@ -400,10 +411,22 @@ FETCH:
push hl
jp exit
; ( a -- c )
.db "C@"
.fill 6
.dw FETCH
CFETCH:
.dw nativeWord
pop hl
ld l, (hl)
ld h, 0
push hl
jp exit
; ( -- a )
.db "LIT@"
.fill 4
.dw FETCH
.dw CFETCH
LITFETCH:
.dw nativeWord
call readLITTOS

View File

@ -60,6 +60,8 @@ SWAP a b -- b a
! n a -- Store n in address a
? a -- Print value of addr a
+! n a -- Increase value of addr a by n
C@ a -- c Set c to byte at address a
C! c a -- Store byte c in address a
CURRENT -- n Set n to wordref of last added entry.
HERE -- a Push HERE's address