sdcc -v
9916 MINGW64
signed char enemygravity[]={0,0,0,0}; void doenemyverticalmovement(unsigned char a) { if(enemygravity[a]<16)enemygravity[a]+=1; }
sdcc -mz80 -S test.c
Resulting code:
_doenemyverticalmovement:: ;zzz.c:5: if(enemygravity[a]<16)enemygravity[a]+=1; ld a, #<(_enemygravity) ld hl, #2 add hl, sp add a, (hl) ld c, a ld a, #>(_enemygravity) adc a, #0x00 ld b, a ld a, (bc) cp a, #0x10 ret NC inc a ld (bc), a ret
The comparison against 16 is made with the single "cp a,#0x10" instruction which is an unsigned comparison. enemygravity[] is an array of signed char so this should be a signed comparison.
Fixed in revision [r9917].
Philipp
This one is now fixed too. Philip have you had a chance to run the tests yet on the current sdcc for the z80? I've moved on to testing more compiles and it seems there are more errors there.
SDCC regression testing is done automatically each night on varioushost systems.
At
https://sourceforge.net/p/sdcc/bugs/2617/
click the green (not tests failed) or red (something failed) dot to see details.
Philipp