From d21b3c94d5ba514d86fae981d9b05c7e1b64c8a5 Mon Sep 17 00:00:00 2001 From: Johan Kotlinski Date: Tue, 2 Aug 2022 21:29:58 +0200 Subject: [PATCH 1/3] print warning when replacing a word --- CHANGELOG.md | 4 ++++ compiler.asm | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 702ae88c1..f0d9eb83b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] + +### Added + - Warning when redefining a word. ### Fixed - POSTPONE error handling. - Documented DEFCODE. ## [4.0.0] - 2022-07-20 + ### Changed - OPEN/CHKIN/CHKOUT no longer return a file number. - IOABORT no longer accepts a file number. diff --git a/compiler.asm b/compiler.asm index cb283a256..9c5665f4c 100644 --- a/compiler.asm +++ b/compiler.asm @@ -156,6 +156,9 @@ COLON jmp RBRAC ; enter compile mode +replaced_str + !byte 9 + !text "replaced " ; --- HEADER ( name -- ) +BACKLINK "header", 6 @@ -170,6 +173,25 @@ HEADER jsr REFILL jmp - + + + ; prints replaced warning + jsr TWODUP + jsr FIND_NAME + inx + lda MSB-1, x + beq + + dex + lda #replaced_str + sta MSB,x + jsr COUNT + jsr TYPE + jsr TWODUP + jsr TYPE + jsr CR ++ + ; update dictionary pointer lda LSB, x sta .putlen+1 From 9589c3c7ec94ad1f953e922bee6317807b540376 Mon Sep 17 00:00:00 2001 From: Johan Kotlinski Date: Tue, 2 Aug 2022 21:48:04 +0200 Subject: [PATCH 2/3] replaced => redefined --- compiler.asm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/compiler.asm b/compiler.asm index 9c5665f4c..65c76e583 100644 --- a/compiler.asm +++ b/compiler.asm @@ -156,9 +156,9 @@ COLON jmp RBRAC ; enter compile mode -replaced_str - !byte 9 - !text "replaced " +redefined_str + !byte 10 + !text "redefined " ; --- HEADER ( name -- ) +BACKLINK "header", 6 @@ -174,16 +174,16 @@ HEADER jmp - + - ; prints replaced warning + ; prints warning when redefining a word jsr TWODUP jsr FIND_NAME inx lda MSB-1, x beq + dex - lda #replaced_str + lda #>redefined_str sta MSB,x jsr COUNT jsr TYPE From 7fbb9baac52e6ca4598875a2955569148c70cda3 Mon Sep 17 00:00:00 2001 From: Johan Kotlinski Date: Tue, 2 Aug 2022 22:40:49 +0200 Subject: [PATCH 3/3] end warning message with space --- compiler.asm | 2 +- core.asm | 5 +++++ forth_src/base.fs | 1 - 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/compiler.asm b/compiler.asm index 65c76e583..29192fad7 100644 --- a/compiler.asm +++ b/compiler.asm @@ -189,7 +189,7 @@ HEADER jsr TYPE jsr TWODUP jsr TYPE - jsr CR + jsr SPACE + ; update dictionary pointer diff --git a/core.asm b/core.asm index 477e8f153..2afc46689 100644 --- a/core.asm +++ b/core.asm @@ -311,6 +311,11 @@ R_FETCH BL +VALUE K_SPACE + +BACKLINK "space", 5 +SPACE + jsr BL + jmp EMIT + +BACKLINK "pick", 4 txa sta + + 1 diff --git a/forth_src/base.fs b/forth_src/base.fs index 41a3fc32c..d1d7f0b1d 100644 --- a/forth_src/base.fs +++ b/forth_src/base.fs @@ -77,7 +77,6 @@ dup code lda,# 100/ ldy,# ( to free up space, pad could be e.g. HERE+34 instead ) $35b constant pad -: space bl emit ; : spaces ( n -- ) begin ?dup while space 1- repeat ;