mirror of
https://github.com/mre/mos6502.git
synced 2024-09-28 10:55:33 +00:00
simpler/more obvious way to select for different implementations on derivatives
This commit is contained in:
parent
4847744518
commit
309ad50374
@ -455,24 +455,15 @@ pub struct Ricoh2a03;
|
|||||||
|
|
||||||
impl crate::Variant for Ricoh2a03 {
|
impl crate::Variant for Ricoh2a03 {
|
||||||
fn decode(opcode: u8) -> Option<(Instruction, AddressingMode)> {
|
fn decode(opcode: u8) -> Option<(Instruction, AddressingMode)> {
|
||||||
match opcode {
|
// It's the same as on NMOS, but doesn't support decimal mode.
|
||||||
0x61 => Some((Instruction::ADCnd, AddressingMode::IndexedIndirectX)),
|
match Nmos6502::decode(opcode) {
|
||||||
0x65 => Some((Instruction::ADCnd, AddressingMode::ZeroPage)),
|
Some((Instruction::ADC, addressing_mode)) => {
|
||||||
0x69 => Some((Instruction::ADCnd, AddressingMode::Immediate)),
|
Some((Instruction::ADCnd, addressing_mode))
|
||||||
0x6d => Some((Instruction::ADCnd, AddressingMode::Absolute)),
|
}
|
||||||
0x71 => Some((Instruction::ADCnd, AddressingMode::IndirectIndexedY)),
|
Some((Instruction::SBC, addressing_mode)) => {
|
||||||
0x75 => Some((Instruction::ADCnd, AddressingMode::ZeroPageX)),
|
Some((Instruction::SBCnd, addressing_mode))
|
||||||
0x79 => Some((Instruction::ADCnd, AddressingMode::AbsoluteY)),
|
}
|
||||||
0x7d => Some((Instruction::ADCnd, AddressingMode::AbsoluteX)),
|
something_else => something_else,
|
||||||
0xe1 => Some((Instruction::SBCnd, AddressingMode::IndexedIndirectX)),
|
|
||||||
0xe5 => Some((Instruction::SBCnd, AddressingMode::ZeroPage)),
|
|
||||||
0xe9 => Some((Instruction::SBCnd, AddressingMode::Immediate)),
|
|
||||||
0xed => Some((Instruction::SBCnd, AddressingMode::Absolute)),
|
|
||||||
0xf1 => Some((Instruction::SBCnd, AddressingMode::IndirectIndexedY)),
|
|
||||||
0xf5 => Some((Instruction::SBCnd, AddressingMode::ZeroPageX)),
|
|
||||||
0xf9 => Some((Instruction::SBCnd, AddressingMode::AbsoluteY)),
|
|
||||||
0xfd => Some((Instruction::SBCnd, AddressingMode::AbsoluteX)),
|
|
||||||
_ => Nmos6502::decode(opcode),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -483,13 +474,10 @@ pub struct RevisionA;
|
|||||||
|
|
||||||
impl crate::Variant for RevisionA {
|
impl crate::Variant for RevisionA {
|
||||||
fn decode(opcode: u8) -> Option<(Instruction, AddressingMode)> {
|
fn decode(opcode: u8) -> Option<(Instruction, AddressingMode)> {
|
||||||
match opcode {
|
// It's the same as on NMOS, but has no ROR instruction.
|
||||||
0x66 => None,
|
match Nmos6502::decode(opcode) {
|
||||||
0x6a => None,
|
Some((Instruction::ROR, _)) => None,
|
||||||
0x6e => None,
|
something_else => something_else,
|
||||||
0x76 => None,
|
|
||||||
0x7e => None,
|
|
||||||
_ => Nmos6502::decode(opcode),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user