09-09-2015, 03:56 PM
Bump!
I noticed this still happens in latest ZX BASIC version:
Notice that "and a / jp nz" works exactly like "sub 1 / jp nc" but it's shorter and faster. Unless you really need flag C to indicate expression result?
Also if you keep track if "sub 8" was the last instruction that affected flags, then your optimizer should be able to remove "and a" in most cases afterwards.
I noticed this still happens in latest ZX BASIC version:
britlion Wrote:Input Basic:
IF myCurrentVector = %1000 then
Output assembly:
ld a, (ix+9)
sub 8
sub 1
jp nc, __LABEL56
Notice that "and a / jp nz" works exactly like "sub 1 / jp nc" but it's shorter and faster. Unless you really need flag C to indicate expression result?
Also if you keep track if "sub 8" was the last instruction that affected flags, then your optimizer should be able to remove "and a" in most cases afterwards.