top | item 36012908

(no title)

t0mek | 2 years 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/j...

discuss

order

grishka|2 years ago

Huh, 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.