neilsf / XC-BASIC

A compiling BASIC dialect for the Commodore-64
https://xc-basic.net/
MIT License
74 stars 15 forks source link

Support using ZP addresses in POKE and PEEK #89

Closed neilsf closed 4 years ago

neilsf commented 4 years ago

Currently CASTing is the only way you can PEEK/POKE from/to a ZP address, e. g:

print peek(cast(1))

The compiler should allow byte type as address.

oliverhermanni commented 4 years ago

Doesn't PEEK!() work here? I had a similar bug report.

neilsf commented 4 years ago

I think that was about the return type of PEEK(). Yes, PEEK() is overloaded for byte and integer return types. That's OK.

However, the address can only be an integer currently, which means it's not intuitive to read/write ZP addresses. A numeric literal under 256 is a byte. The compiler will complain for this.