mirror of
https://github.com/mre/mos6502.git
synced 2025-02-19 16:32:10 +00:00
Add CMP to execute_instruction().
This commit is contained in:
parent
8b962fd542
commit
a05a5dfde7
@ -188,6 +188,14 @@ impl Machine {
|
||||
self.registers.status.and(!PS_OVERFLOW);
|
||||
}
|
||||
|
||||
(instruction::CMP, instruction::UseImmediate(val)) => {
|
||||
self.compare(val);
|
||||
}
|
||||
(instruction::CMP, instruction::UseAddress(addr)) => {
|
||||
let val = self.memory.get_byte(addr);
|
||||
self.compare(val);
|
||||
}
|
||||
|
||||
(instruction::DEC, instruction::UseAddress(addr)) => {
|
||||
self.decrement_memory(addr)
|
||||
}
|
||||
@ -619,7 +627,6 @@ impl Machine {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// From http://www.6502.org/tutorials/compare_beyond.html:
|
||||
// If the Z flag is 0, then A <> NUM and BNE will branch
|
||||
// If the Z flag is 1, then A = NUM and BEQ will branch
|
||||
|
Loading…
x
Reference in New Issue
Block a user