Simplify register access code

jsmoo
Nick Krichevsky 2022-04-14 21:22:05 -04:00
parent f1e72b45de
commit deeacd917a
1 changed files with 3 additions and 9 deletions

View File

@ -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