03-07-2025, 08:01 PM
Hello,
The documentation for CHR function (https://zxbasic.readthedocs.io/en/latest/chr/) says that, although expanded, the function is 100% Sinclair basic compatible.
If it is so, then for the same parameters I'd expect the same output, not only for ascii letters, but also for sinclair basic keywords.
In Sinclair basic, this programme:
gives some Basic keywords in the output (see the attached image zxkeywords_sinclair.png).
zxkeywords_sinclair.png (Size: 10.26 KB / Downloads: 99)
The equivalent programme in ZX Basic:
outputs some silly characters (see the attached image zxkeywords_boriel.png).
zxkeywords_boriel.png (Size: 11.44 KB / Downloads: 78)
Compiled with:
I'd say it is a bug.
The documentation for CHR function (https://zxbasic.readthedocs.io/en/latest/chr/) says that, although expanded, the function is 100% Sinclair basic compatible.
If it is so, then for the same parameters I'd expect the same output, not only for ascii letters, but also for sinclair basic keywords.
In Sinclair basic, this programme:
Code:
10 CLS
20 FOR i = 230 TO 250
30 PRINT CHR$ i
40 NEXT i
gives some Basic keywords in the output (see the attached image zxkeywords_sinclair.png).

The equivalent programme in ZX Basic:
Code:
dim i as ubyte
cls
for i = 230 to 250
print chr(i)
next
outputs some silly characters (see the attached image zxkeywords_boriel.png).

Compiled with:
Quote:..\..\zxbasic\zxbc.exe --optimize 2 --output zxkeywords.tzx --output-format tzx --BASIC --autorun --explicit --strict zxkeywords.bas
I'd say it is a bug.
Swan, my ZX Spectrum emulator https://github.com/zoran-vucenovic/swan