mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-27 17:18:05 +11:00
forth: a little housekeeping
This commit is contained in:
parent
abb84b01db
commit
61abafbc1a
@ -131,7 +131,6 @@ forthRdLineNoOk:
|
|||||||
push hl
|
push hl
|
||||||
jp EXECUTE+2
|
jp EXECUTE+2
|
||||||
|
|
||||||
.db 0b10 ; UNWORD
|
|
||||||
INTERPRET:
|
INTERPRET:
|
||||||
.dw compiledWord
|
.dw compiledWord
|
||||||
.dw FIND_
|
.dw FIND_
|
||||||
@ -148,7 +147,6 @@ INTERPRET:
|
|||||||
.dw DROP
|
.dw DROP
|
||||||
.dw EXIT
|
.dw EXIT
|
||||||
|
|
||||||
.db 0b10 ; UNWORD
|
|
||||||
MAINLOOP:
|
MAINLOOP:
|
||||||
.dw compiledWord
|
.dw compiledWord
|
||||||
.dw INTERPRET
|
.dw INTERPRET
|
||||||
@ -296,12 +294,6 @@ addHL:
|
|||||||
pop de
|
pop de
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; make Z the opposite of what it is now
|
|
||||||
toggleZ:
|
|
||||||
jp z, unsetZ
|
|
||||||
cp a
|
|
||||||
ret
|
|
||||||
|
|
||||||
; Copy string from (HL) in (DE), that is, copy bytes until a null char is
|
; Copy string from (HL) in (DE), that is, copy bytes until a null char is
|
||||||
; encountered. The null char is also copied.
|
; encountered. The null char is also copied.
|
||||||
; HL and DE point to the char right after the null char.
|
; HL and DE point to the char right after the null char.
|
||||||
@ -569,7 +561,7 @@ entryhead:
|
|||||||
ld a, NAMELEN
|
ld a, NAMELEN
|
||||||
call addHL
|
call addHL
|
||||||
call DEinHL
|
call DEinHL
|
||||||
; Set word flags: not IMMED, not UNWORD, so it's 0
|
; Set word flags: not IMMED, so it's 0
|
||||||
xor a
|
xor a
|
||||||
ld (hl), a
|
ld (hl), a
|
||||||
inc hl
|
inc hl
|
||||||
@ -577,14 +569,6 @@ entryhead:
|
|||||||
ld (HERE), hl
|
ld (HERE), hl
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; Sets Z if wordref at HL is of the IMMEDIATE type
|
|
||||||
HLisIMMED:
|
|
||||||
dec hl
|
|
||||||
bit FLAG_IMMED, (hl)
|
|
||||||
inc hl
|
|
||||||
; We need an invert flag. We want to Z to be set when flag is non-zero.
|
|
||||||
jp toggleZ
|
|
||||||
|
|
||||||
; Checks flags Z and S and sets BC to 0 if Z, 1 if C and -1 otherwise
|
; Checks flags Z and S and sets BC to 0 if Z, 1 if C and -1 otherwise
|
||||||
flagsToBC:
|
flagsToBC:
|
||||||
ld bc, 0
|
ld bc, 0
|
||||||
@ -666,7 +650,7 @@ chkPS:
|
|||||||
; A dictionary entry has this structure:
|
; A dictionary entry has this structure:
|
||||||
; - 7b name (zero-padded)
|
; - 7b name (zero-padded)
|
||||||
; - 2b prev pointer
|
; - 2b prev pointer
|
||||||
; - 1b flags (bit 0: IMMEDIATE. bit 1: UNWORD)
|
; - 1b flags (bit 0: IMMEDIATE)
|
||||||
; - 2b code pointer
|
; - 2b code pointer
|
||||||
; - Parameter field (PF)
|
; - Parameter field (PF)
|
||||||
;
|
;
|
||||||
@ -832,7 +816,6 @@ ABORTI:
|
|||||||
.dw .private
|
.dw .private
|
||||||
.dw EXIT
|
.dw EXIT
|
||||||
|
|
||||||
.db 0b10 ; UNWORD
|
|
||||||
.private:
|
.private:
|
||||||
.dw nativeWord
|
.dw nativeWord
|
||||||
ld hl, (HERE)
|
ld hl, (HERE)
|
||||||
@ -987,7 +970,6 @@ COMPILE:
|
|||||||
.dw EXECUTE
|
.dw EXECUTE
|
||||||
.dw EXIT
|
.dw EXIT
|
||||||
|
|
||||||
.db 0b10 ; UNWORD
|
|
||||||
.word:
|
.word:
|
||||||
.dw compiledWord
|
.dw compiledWord
|
||||||
.dw WR
|
.dw WR
|
||||||
@ -995,7 +977,6 @@ COMPILE:
|
|||||||
.dw DROP
|
.dw DROP
|
||||||
.dw EXIT
|
.dw EXIT
|
||||||
|
|
||||||
.db 0b10 ; UNWORD
|
|
||||||
.maybeNum:
|
.maybeNum:
|
||||||
.dw compiledWord
|
.dw compiledWord
|
||||||
.dw PARSEI
|
.dw PARSEI
|
||||||
@ -1199,7 +1180,6 @@ FINDI:
|
|||||||
.dw LITN
|
.dw LITN
|
||||||
.dw EXIT
|
.dw EXIT
|
||||||
|
|
||||||
.db 0b10 ; UNWORD
|
|
||||||
FINDERR:
|
FINDERR:
|
||||||
.dw compiledWord
|
.dw compiledWord
|
||||||
.dw DROP ; Drop str addr, we don't use it
|
.dw DROP ; Drop str addr, we don't use it
|
||||||
@ -1285,7 +1265,6 @@ PARSE:
|
|||||||
; success, stack is already good, we can exit
|
; success, stack is already good, we can exit
|
||||||
.dw EXIT
|
.dw EXIT
|
||||||
|
|
||||||
.db 0b10 ; UNWORD
|
|
||||||
.error:
|
.error:
|
||||||
.dw compiledWord
|
.dw compiledWord
|
||||||
.dw LIT
|
.dw LIT
|
||||||
@ -1295,7 +1274,6 @@ PARSE:
|
|||||||
|
|
||||||
|
|
||||||
; Indirect parse caller. Reads PARSEPTR and calls
|
; Indirect parse caller. Reads PARSEPTR and calls
|
||||||
.db 0b10 ; UNWORD
|
|
||||||
PARSEI:
|
PARSEI:
|
||||||
.dw compiledWord
|
.dw compiledWord
|
||||||
.dw PARSEPTR_
|
.dw PARSEPTR_
|
||||||
|
Loading…
Reference in New Issue
Block a user