From f420db135de52ab45974c8bd076e2569e00518e4 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Thu, 19 Mar 2020 16:36:54 -0400 Subject: [PATCH] forth: a little house cleaning --- forth/dict.asm | 14 +++++++------- forth/util.asm | 52 +++++++++----------------------------------------- 2 files changed, 16 insertions(+), 50 deletions(-) diff --git a/forth/dict.asm b/forth/dict.asm index eb67298..b83fd71 100644 --- a/forth/dict.asm +++ b/forth/dict.asm @@ -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 diff --git a/forth/util.asm b/forth/util.asm index 82c553b..b8aa11e 100644 --- a/forth/util.asm +++ b/forth/util.asm @@ -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: