neilsf / xc-basic3

A BASIC cross compiler for MOS 6502-based machines
MIT License
44 stars 5 forks source link

PRINT "" and ASC() clog up the string stack #236

Closed sine707 closed 1 year ago

sine707 commented 1 year ago

In BASIC v2 tradition, i wanted to force a new line by placing a single print. This doesn't seem to work in XC-BASIC3, so I resorted to print ""

for i as byte = 0 to 255
print "test";:print ""
next

This results in garbled strings (or just output?) eventually when the string stack overflows. A {cr} or {return} works fine though.

asc() seems to do the same thing, that's how I got aware of this in the first place.

dim x as byte

for i as byte = 0 to 255
x = asc("a")
next
sine707 commented 1 year ago

Thanks for the quick fix, I applied the changes you've made and tested them. It appears that val() is also affected.

dim value$ as string * 7

for i as byte = 0 to 255
    print "test:";:input value$
    x = val(value$)
next
neilsf commented 1 year ago

Fixed in Version 3.1.7