mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2024-12-21 02:32:15 +00:00
Small simplifications to base Processor class.
Signed-off-by: Adrian.Conlon <adrian.conlon@gmail.com>
This commit is contained in:
parent
49d7a4c169
commit
b1aa523dcc
@ -1,11 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <array>
|
||||
#include <functional>
|
||||
|
||||
#include "Memory.h"
|
||||
#include "Signal.h"
|
||||
|
||||
namespace EightBit {
|
||||
class Processor {
|
||||
@ -81,8 +78,7 @@ namespace EightBit {
|
||||
void popWord(register16_t& output);
|
||||
|
||||
uint8_t fetchByte() {
|
||||
m_memory.ADDRESS() = pc;
|
||||
pc.word++;
|
||||
m_memory.ADDRESS().word = pc.word++;
|
||||
return m_memory.reference();
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,9 @@
|
||||
#include <algorithm>
|
||||
|
||||
EightBit::Memory::Memory(uint16_t addressMask)
|
||||
: m_addressMask(addressMask) {
|
||||
: m_addressMask(addressMask),
|
||||
m_temporary(0) {
|
||||
clear();
|
||||
m_address.word = 0;
|
||||
m_data = &(m_bus[m_address.word]);
|
||||
}
|
||||
|
@ -2,9 +2,9 @@
|
||||
#include "Processor.h"
|
||||
|
||||
EightBit::Processor::Processor(Memory& memory)
|
||||
: m_memory(memory),
|
||||
cycles(0),
|
||||
m_halted(false) {
|
||||
: m_memory(memory),
|
||||
cycles(0),
|
||||
m_halted(false) {
|
||||
sp.word = 0xffff;
|
||||
pc.word = 0;
|
||||
}
|
||||
@ -19,8 +19,7 @@ void EightBit::Processor::initialise() {
|
||||
}
|
||||
|
||||
void EightBit::Processor::push(uint8_t value) {
|
||||
sp.word--;
|
||||
m_memory.ADDRESS() = sp;
|
||||
m_memory.ADDRESS().word = --sp.word;
|
||||
m_memory.reference() = value;
|
||||
}
|
||||
|
||||
@ -30,8 +29,7 @@ void EightBit::Processor::pushWord(register16_t value) {
|
||||
}
|
||||
|
||||
uint8_t EightBit::Processor::pop() {
|
||||
m_memory.ADDRESS() = sp;
|
||||
sp.word++;
|
||||
m_memory.ADDRESS().word = sp.word++;
|
||||
return m_memory.reference();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user