Simplify register access code
parent
f1e72b45de
commit
deeacd917a
12
src/run.rs
12
src/run.rs
|
@ -172,9 +172,7 @@ impl Processor {
|
|||
SixteenBitLoadInstruction::LDEffectiveAddress { dst, offset } => {
|
||||
let current_sp = self
|
||||
.registers
|
||||
.get_16bit_register(register::SixteenBit::Single(
|
||||
register::SingleSixteenBit::StackPointer,
|
||||
));
|
||||
.get_single_16bit_register(register::SingleSixteenBit::StackPointer);
|
||||
|
||||
// TODO: This is gross. I'll clean this up when I do more ALU instructions
|
||||
// because there's bound to be reuse
|
||||
|
@ -220,9 +218,7 @@ impl Processor {
|
|||
SixteenBitLoadInstruction::Push { src } => {
|
||||
let current_sp = self
|
||||
.registers
|
||||
.get_16bit_register(register::SixteenBit::Single(
|
||||
register::SingleSixteenBit::StackPointer,
|
||||
));
|
||||
.get_single_16bit_register(register::SingleSixteenBit::StackPointer);
|
||||
|
||||
// we want to pop the LSB first (i.e. we write the MSB first)
|
||||
// https://rgbds.gbdev.io/docs/v0.5.2/gbz80.7#PUSH_r16
|
||||
|
@ -242,9 +238,7 @@ impl Processor {
|
|||
SixteenBitLoadInstruction::Pop { dst } => {
|
||||
let current_sp = self
|
||||
.registers
|
||||
.get_16bit_register(register::SixteenBit::Single(
|
||||
register::SingleSixteenBit::StackPointer,
|
||||
));
|
||||
.get_single_16bit_register(register::SingleSixteenBit::StackPointer);
|
||||
|
||||
let popped_bytes = [
|
||||
self.memory
|
||||
|
|
Loading…
Reference in New Issue