neilsf / XC-BASIC

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

Problem with - raster extension #127

Closed EmanueleBonin closed 3 years ago

EmanueleBonin commented 4 years ago

I'm trying to use raster extension to make a smooth vertical - scroll of the screen. So in my first attempt i simply move down the screen using $D011 register. If i write a program with a normal loop poking into $d011 offset-screen value is all ok, but if i will try to poking $d011 inside my raster routine the program crash.

VScroll.zip

neilsf commented 4 years ago

Hi. I'm not sure why it crashes but the bug is in this line:

poke \RI_VIC_CTR, peek(\RI_VIC_CTR) & %11110000 | \Offset!

If you add an exclamation mark after peek: peek!(\RI_VIC_CTR) then it will work. The ! means that we force peek to return a byte instead of an integer. Because peek(n) is an integer then all the rest of the expression is promoted to integers.

I still don't know why the crash happens though so I'll investigate a little more.

EmanueleBonin commented 4 years ago

Thank you very much! Was my fault!

neilsf commented 3 years ago

Fixed in v2.3.08