Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Spectrum keywords codes
#1
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:

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).

.png   zxkeywords_sinclair.png (Size: 10.26 KB / Downloads: 99)

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).

.png   zxkeywords_boriel.png (Size: 11.44 KB / Downloads: 78)

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
Reply
#2
This is because PRINT is not using the ROM.
PRINT is totally implemented from scratch, so BASIC tokens are not output.
Only graphic chars and UDG, along with the normal charset supported.
---
Boriel
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)