forth: a little house cleaning

This commit is contained in:
Virgil Dupras 2020-03-19 16:36:54 -04:00
parent af5a97243a
commit f420db135d
2 changed files with 16 additions and 50 deletions

View File

@ -402,13 +402,13 @@ DOES:
; 2. Leave 2 bytes for regular cell variable.
; 3. Write down IP+2 to entry.
; 3. exit. we're done here.
ld iy, (CURRENT)
ld hl, doesWord
call wrCompHL
inc iy \ inc iy ; cell variable space
ld hl, (IP)
call wrCompHL
ld (HERE), iy
ld hl, (CURRENT)
ld de, doesWord
call DEinHL
inc hl \ inc hl ; cell variable space
ld de, (IP)
call DEinHL
ld (HERE), hl
jp EXIT+2

View File

@ -251,12 +251,6 @@ parseDecimal:
ret
; *** Forth-specific part ***
; Return address of scratchpad in HL
pad:
ld hl, (HERE)
ld a, PADDING
jp addHL
; Advance (INPUTPOS) until a non-whitespace is met. If needed,
; call fetchline.
; Set HL to newly set (INPUTPOS)
@ -315,41 +309,21 @@ HLPointsDE:
cp d ; Z has our answer
ret
HLPointsNUMBER:
push de
ld de, NUMBER
call HLPointsDE
pop de
ret
HLPointsLIT:
push de
ld de, LIT
call HLPointsDE
pop de
ret
HLPointsBR:
push de
ld de, FBR
call HLPointsDE
jr z, .end
ld de, BBR
call HLPointsDE
.end:
pop de
ret
; Skip the compword where HL is currently pointing. If it's a regular word,
; it's easy: we inc by 2. If it's a NUMBER, we inc by 4. If it's a LIT, we skip
; to after null-termination.
compSkip:
call HLPointsNUMBER
ld de, NUMBER
call HLPointsDE
jr z, .isNum
call HLPointsBR
ld de, FBR
call HLPointsDE
jr z, .isBranch
call HLPointsLIT
ld de, BBR
call HLPointsDE
jr z, .isBranch
ld de, LIT
call HLPointsDE
jr nz, .isWord
; We have a literal
inc hl \ inc hl
@ -409,14 +383,6 @@ find:
; Z will be set if DE is zero
ret
; Write compiled data from HL into IY, advancing IY at the same time.
wrCompHL:
ld (iy), l
inc iy
ld (iy), h
inc iy
ret
; Spit name + prev in (HERE) and adjust (HERE) and (CURRENT)
; HL points to new (HERE)
entryhead: