MCPcopy
hub / github.com/fogleman/nes / adc

Method adc

nes/cpu.go:513–529  ·  view source on GitHub ↗

ADC - Add with Carry

(info *stepInfo)

Source from the content-addressed store, hash-verified

511
512// ADC - Add with Carry
513func (cpu *CPU) adc(info *stepInfo) {
514 a := cpu.A
515 b := cpu.Read(info.address)
516 c := cpu.C
517 cpu.A = a + b + c
518 cpu.setZN(cpu.A)
519 if int(a)+int(b)+int(c) > 0xFF {
520 cpu.C = 1
521 } else {
522 cpu.C = 0
523 }
524 if (a^b)&0x80 == 0 && (a^cpu.A)&0x80 != 0 {
525 cpu.V = 1
526 } else {
527 cpu.V = 0
528 }
529}
530
531// AND - Logical AND
532func (cpu *CPU) and(info *stepInfo) {

Callers

nothing calls this directly

Calls 2

setZNMethod · 0.95
ReadMethod · 0.65

Tested by

no test coverage detected