From 46833f381923e2b61390ab6d58325b34502dd3b8 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sun, 22 Mar 2020 11:56:40 -0400 Subject: [PATCH] forth: Forth-ify "LIT", "LITS", "LIT<" --- forth/core.fs | 5 ++++- forth/forth.asm | 34 +--------------------------------- 2 files changed, 5 insertions(+), 34 deletions(-) diff --git a/forth/core.fs b/forth/core.fs index afd3853..ed48a4b 100644 --- a/forth/core.fs +++ b/forth/core.fs @@ -1,5 +1,9 @@ : H HERE @ ; : -^ SWAP - ; +: [LITN] LITN ; IMMEDIATE +: LIT ROUTINE S [LITN] , ; +: LITS LIT SCPY ; +: LIT< WORD LITS ; IMMEDIATE : COMPILE ' LITN ['] , , ; IMMEDIATE : [COMPILE] ' , ; IMMEDIATE : BEGIN H ; IMMEDIATE @@ -37,7 +41,6 @@ H 1 - ( push a. -1 for allot offset ) ; IMMEDIATE -: [LITN] LITN ; IMMEDIATE : CREATE WORD (entry) ( empty header with name ) ROUTINE C [LITN] ( push cellWord addr ) diff --git a/forth/forth.asm b/forth/forth.asm index 6a02cc8..fb43b99 100644 --- a/forth/forth.asm +++ b/forth/forth.asm @@ -988,41 +988,9 @@ SCPY: jp next - .db "LIT" - .fill 4 - .dw SCPY - .db 0 -LIT_: - .dw compiledWord - .dw NUMBER - .dw LIT - .dw WR - .dw EXIT - - .db "LITS" - .fill 3 - .dw LIT_ - .db 0 -LITS: - .dw compiledWord - .dw LIT_ - .dw SCPY - .dw EXIT - - - .db "LIT<" - .fill 3 - .dw LITS - .db 1 ; IMMEDIATE -LITRD: - .dw compiledWord - .dw WORD - .dw LITS - .dw EXIT - .db "(find)" .fill 1 - .dw LITRD + .dw SCPY .db 0 FIND_: .dw nativeWord