1
0
mirror of https://github.com/mre/mos6502.git synced 2024-06-12 09:29:30 +00:00

Compare commits

..

10 Commits

Author SHA1 Message Date
omarandlorraine
87dd7c4e85
Merge 0382ce34a8 into 11499b6bc8 2024-04-24 11:29:27 +00:00
Sam M W
0382ce34a8 decode inc a and dec a on CMOS 2024-04-24 12:29:19 +01:00
Sam M W
50b1d6dd37 add/implement BRA instruction for CMOS 2024-04-24 12:16:27 +01:00
Sam M W
df12a5c48b simpler/more obvious way to select for different implementations on derivatives 2024-04-24 12:13:13 +01:00
Sam M W
a93dc11e9c better commenting inside of AddressingMode enum 2024-04-24 06:41:00 +01:00
Sam M W
efa53efa08 rename IndirectWithFix to Indirect 2024-04-23 18:12:38 +01:00
Sam M W
a98809e4c2 fix typo in comment 2024-04-23 18:10:02 +01:00
Sam M W
1f3739cc12 formatting 2024-04-23 17:23:35 +01:00
Sam M W
6632f15c96 split the Indirect addressing mode into BuggyIndirect and IndirectWithFix 2024-04-23 17:23:27 +01:00
Sam M W
1d18d3291b change arr_to_addr to address_from_bytes 2024-04-23 17:23:27 +01:00
2 changed files with 1 additions and 9 deletions

View File

@ -156,7 +156,7 @@ impl<M: Bus, V: Variant> CPU<M, V> {
// (Output: a 16-bit address)
// TODO: If the pointer ends in 0xff, then incrementing it would propagate
// the carry to the high byte of the pointer. This incurs a cost of one
// machine cycle on the real 65C02, which is not implemented here.
// machine on the real 65C02, which is not implemented here.
let slice = read_address(memory, address_from_bytes(slice[0], slice[1]));
OpInput::UseAddress(address_from_bytes(slice[0], slice[1]))
}
@ -580,9 +580,6 @@ impl<M: Bus, V: Variant> CPU<M, V> {
(Instruction::STY, OpInput::UseAddress(addr)) => {
self.memory.set_byte(addr, self.registers.index_y);
}
(Instruction::STZ, OpInput::UseAddress(addr)) => {
self.memory.set_byte(addr, 0);
}
(Instruction::TAX, OpInput::UseImplied) => {
let val = self.registers.accumulator;

View File

@ -100,7 +100,6 @@ pub enum Instruction {
STA, // STore Accumulator............. | .. ..... M = A
STX, // STore X register.............. | .. ..... M = X
STY, // STore Y register.............. | .. ..... M = Y
STZ, // STore Zero.................... | .. ..... M = Y
TAX, // Transfer Accumulator to X..... | N. ...Z. X = A
TAY, // Transfer Accumulator to Y..... | N. ...Z. Y = A
TSX, // Transfer Stack pointer to X... | N. ...Z. X = S
@ -495,10 +494,6 @@ impl crate::Variant for Cmos6502 {
0x3a => Some((Instruction::DEC, AddressingMode::Accumulator)),
0x6c => Some((Instruction::JMP, AddressingMode::Indirect)),
0x80 => Some((Instruction::BRA, AddressingMode::Relative)),
0x64 => Some((Instruction::STZ, AddressingMode::ZeroPage)),
0x74 => Some((Instruction::STZ, AddressingMode::ZeroPageX)),
0x9c => Some((Instruction::STZ, AddressingMode::Absolute)),
0x9e => Some((Instruction::STZ, AddressingMode::AbsoluteX)),
_ => Nmos6502::decode(opcode),
}
}