neilsf / XC-BASIC

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

Crash when running in C64 #144

Closed orlof closed 2 years ago

orlof commented 2 years ago

c64 consistently crashes when executing this code (I tried to isolate the problem into small snippet):

DIM i AS INT

SUB calc_mod(s0 AS INT, s1 AS INT) STATIC
    i = s0 MOD s1
END SUB

CALL calc_mod(0, 255)
orlof commented 2 years ago

I don't know if this is related but MOD operator seems to return 0 if divisor is greater than 255. e.g.

FOR t AS INT = 250 to 260
    print t MOD 256
NEXT

prints all zeros.

orlof commented 2 years ago

Sorry, submitted to wrong project - I just realised there were XC-Basic and xc-basic3

neilsf commented 2 years ago

I can move the issue to xcb3