This variant doesn't work because carry does not get set properly.  The only values of A that will be tested are 2, 3, 4 and 8.  It should be that carry is set for 2, 3 and 4 but not 8.  Doing the compare after subtracting 3 doesn't work because you don't get carry set for 2 because 2 - 3 is $FF which doesn't give carry when 5 is subtracted.

But I think it is easily fixed.  Instead of "JR NC,_25E5" use "JR Z,_25E5".

                            -- George

On 12/21/2024 6:41 AM, Stephen Adolph wrote:
but this patch does not:
LD A,($40AF) SUB 3 CP 8-3 JR NC,_25E5 OR A SCF RET _25E5: OR A RET

Reply via email to