diff --git a/emul/forth/z80c.bin b/emul/forth/z80c.bin index 022ce5e..5b6f9f0 100644 Binary files a/emul/forth/z80c.bin and b/emul/forth/z80c.bin differ diff --git a/forth/forth.asm b/forth/forth.asm index 1c2d973..e328f07 100644 --- a/forth/forth.asm +++ b/forth/forth.asm @@ -1063,50 +1063,13 @@ PARSED: jp next -.fill 51 - -; Spit name (in (HL)) + prev in (HERE) and adjust (HERE) and (CURRENT) -; HL points to new (HERE) - .db "(entry)" - .dw $-PARSED - .db 7 -ENTRYHEAD: - .dw compiledWord - .dw WORD - .dw .private - .dw EXIT - -.private: - .dw nativeWord - pop hl - ld de, (HERE) - call strcpy - ; DE point to char after null, rewind. - dec de - ; B counts the null, adjust - dec b - ld a, b - ex de, hl ; HL points to new HERE - ld de, (CURRENT) - push hl ; --> lvl 1 - or a ; clear carry - sbc hl, de - ex de, hl - pop hl ; <-- lvl 1 - call DEinHL - ; Save size - ld (hl), b - inc hl - ld (CURRENT), hl - ld (HERE), hl - jp next - +.fill 107 ; STABLE ABI (every sysvars) ; Offset: 05ca .out $ .db "HERE" - .dw $-ENTRYHEAD + .dw $-PARSED .db 4 HERE_: ; Caution: conflicts with actual variable name .dw sysvarWord diff --git a/forth/icore.fs b/forth/icore.fs index efceffc..d5d36a1 100644 --- a/forth/icore.fs +++ b/forth/icore.fs @@ -81,12 +81,27 @@ AGAIN ; +: (entry) + HERE @ ( h ) + WORD ( h s ) + SCPY ( h ) + ( Adjust HERE -1 because SCPY copies the null ) + HERE @ 1 _c - ( h h' ) + DUP HERE ! ( h h' ) + SWAP _c - ( sz ) + ( write prev value ) + HERE @ CURRENT @ _c - , + ( write size ) + C, + HERE @ CURRENT ! +; + ( : and ; have to be defined last because it can't be executed now also, they can't have their real name right away ) : X - (entry) + _c (entry) ( JUMPTBL+0 == compiledWord ) [ ROUTINE J LITN ] , BEGIN