1
0
mirror of https://github.com/mre/mos6502.git synced 2024-11-25 02:33:26 +00:00

Implement store instructions STA, STX, STY

This commit is contained in:
Johannes Muenzel 2014-10-25 18:30:05 -04:00
parent 36843cce70
commit 20abdc9ff6

View File

@ -90,6 +90,13 @@ impl Machine {
self.add_with_carry(val);
},
(instruction::BMI, instruction::UseRelative(rel)) => {
let addr = self.registers.program_counter
+ AddressDiff(rel as i32);
log!(log::DEBUG, "branch if minus relative. address: {}", addr);
self.branch_if_minus(addr);
},
(instruction::DEC, instruction::UseAddress(addr)) => {
self.decrement_memory(addr)
}
@ -102,13 +109,6 @@ impl Machine {
self.jump(addr)
},
(instruction::BMI, instruction::UseRelative(rel)) => {
let addr = self.registers.program_counter
+ AddressDiff(rel as i32);
log!(log::DEBUG, "branch if minus relative. address: {}", addr);
self.branch_if_minus(addr);
},
(instruction::LDA, instruction::UseImmediate(val)) => {
log!(log::DEBUG, "load A immediate: {}", val);
self.load_accumulator(val as i8);
@ -139,6 +139,16 @@ impl Machine {
self.load_y_register(val as i8);
},
(instruction::STA, instruction::UseAddress(addr)) => {
self.memory.set_byte(addr, self.registers.accumulator as u8);
},
(instruction::STX, instruction::UseAddress(addr)) => {
self.memory.set_byte(addr, self.registers.index_x as u8);
},
(instruction::STY, instruction::UseAddress(addr)) => {
self.memory.set_byte(addr, self.registers.index_y as u8);
},
(instruction::NOP, _) => {
log!(log::DEBUG, "nop instr");
},