mirror of
https://github.com/mre/mos6502.git
synced 2024-12-22 12:29:31 +00:00
Merge pull request #17 from typelist/master
Implement store instructions STA, STX, STY
This commit is contained in:
commit
4f3e6eaba5
@ -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");
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user