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