4 ms·
Hey, SBC: result = byte1 - byte2 - carry carry = result < 0 return result & 0xff ADC: result = byte1 + byte2 + carry carry = result >
by t0mek 3y ago
Hey,
SBC:
result = byte1 - byte2 - carry
carry = result < 0
return result & 0xff
ADC:
result = byte1 + byte2 + carry
carry = result > 0xff
return result & 0xff
Source - my implementation, passes tests. Look for SBC & ADC in
https://github.com/trekawek/coffee-gb/blob/master/src/main/java/eu/rekawek/coffeegb/cpu/AluFunctions.java https://github.com/trekawek/coffee-gb/blob/master/src/main/j...
- grishka 3y agoHuh, I'm pretty sure I did exactly this initially, but it didn't work. Maybe it didn't work because some other instruction that the test itself relies on didn't. I'll check again, thanks.