09-08-2015, 06:33 PM
This is not a bug. Look:
This will loop until n>255. The problem is, your variable n is defined as UBYTE (or perhaps it's undefined so compiler assumed UBYTE by default?), so you will never get n>255, therefore your loop will repeat forever.
Either replace it with FOR n=0 TO 254 or redefine n as UINTEGER.
This code is correct. There's no instruction ld h,(_n) so it's using ld hl,(_n-1) instead, which will affect h in the same way.
Code:
10 FOR n=1 TO 255
20 NEXT n
This will loop until n>255. The problem is, your variable n is defined as UBYTE (or perhaps it's undefined so compiler assumed UBYTE by default?), so you will never get n>255, therefore your loop will repeat forever.
Either replace it with FOR n=0 TO 254 or redefine n as UINTEGER.
Code:
__LABEL0:
ld a, 255
ld hl, (_n - 1) <-- looks a bit dodgy
cp h
jp nc, __LABEL3
This code is correct. There's no instruction ld h,(_n) so it's using ld hl,(_n-1) instead, which will affect h in the same way.