Skip to content

Commit 14e99ad

Browse files
cursoragentomiq
andcommitted
Charset lower: ASCII map only A–Z/a–z; CHR$ uses PETSCII path
gfx_ascii_to_screencode_lowcharset for all 32–126 broke CHR (!) and shifted CHR; non-letters must use petscii_to_screencode. Co-authored-by: Chris Garrett <chris@chrisg.com>
1 parent 31a8628 commit 14e99ad

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
- **Browser canvas**: `#OPTION charset lower` (and charset from CLI before run) now applies when video state attaches — fixes PETSCII space (screen code 32) drawing as wrong glyph (e.g. `!`) because the uppercase char ROM was still active.
66
- **INPUT (canvas / GFX)**: When **Stop** / watchdog sets `wasmStopRequested` while waiting in `gfx_read_line`, report **"Stopped"** instead of **"Unexpected end of input"** (misleading; not EOF).
77

8-
- **PETSCII + lowercase charset**: With lowercase video charset (`#OPTION charset lower` / `-charset lower`), `PRINT` / `CHR$` map **ASCII** bytes via `gfx_ascii_to_screencode_lowcharset()` whenever `petscii_to_screencode()` would be wrong — including when the host **omits `-petscii`** (previously used upper-ROM ASCII mapping with the lower char ROM). `wasm_browser_canvas_test` covers charset lower with and without the PETSCII checkbox.
8+
- **PETSCII + lowercase charset**: With lowercase video charset, **ASCII letters** in string literals use `gfx_ascii_to_screencode_lowcharset()`; **all other bytes** (including **`CHR$(n)`** and punctuation) use **`petscii_to_screencode()`** so `CHR$(32)` is space and `CHR$(65)` matches PETSCII semantics (was wrongly treated as ASCII, shifting output). Works with or without **`-petscii`** on the host. `wasm_browser_canvas_test` covers charset lower with and without the PETSCII checkbox.
99

1010
- **Project**: Renamed to **RGC-BASIC** (Retro Game Coders BASIC). GitHub: **`omiq/rgc-basic`**. Tagline: modern cross-platform BASIC interpreter with classic syntax compatibility, written in C. WASM CI artifact: **`rgc-basic-wasm.tar.gz`**. Tutorial CSS classes: `rgc-tutorial-*` (`cbm-tutorial-*` removed). JS: prefer **`RgcBasicTutorialEmbed`** / **`RgcVfsHelpers`** (deprecated **`Cbm*`** aliases retained briefly).
1111

basic.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1602,8 +1602,13 @@ static void gfx_put_byte(unsigned char b)
16021602
} else if (gfx_raw_screen_codes) {
16031603
sc = petscii_to_screencode(b);
16041604
} else if (gfx_vs && gfx_vs->charset_lowercase && b >= 32 && b <= 126) {
1605-
/* Lowercase char ROM: map ASCII literals for any -petscii setting (IDE may omit -petscii). */
1606-
sc = gfx_ascii_to_screencode_lowcharset(b);
1605+
/* Lowercase char ROM + ASCII string literals: only A–Z / a–z are ASCII letters.
1606+
* CHR$(n) and punctuation use PETSCII semantics (see FN_CHR raw byte in gfx). */
1607+
if ((b >= 'A' && b <= 'Z') || (b >= 'a' && b <= 'z')) {
1608+
sc = gfx_ascii_to_screencode_lowcharset(b);
1609+
} else {
1610+
sc = petscii_to_screencode(b);
1611+
}
16071612
} else if (petscii_mode) {
16081613
sc = petscii_to_screencode(b);
16091614
} else if (b >= 32 && b <= 126) {

0 commit comments

Comments
 (0)