mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2026-10-24 20:02:21 +00:00
Introduce an IntelProcessor base class to allow known good implementation to be shared.
Signed-off-by: Adrian.Conlon <adrian.conlon@gmail.com>
This commit is contained in:
1 parent
b1aa523dcc
commit
627e41bf35
12 files changed
+133
-117
No files matched your search
@@ -0,0 +1,36 @@
|
||||
#include "stdafx.h"
|
||||
#include "IntelProcessor.h"
|
||||
|
||||
EightBit::IntelProcessor::IntelProcessor(Memory& memory)
|
||||
: Processor(memory) {
|
||||
MEMPTR().word = 0;
|
||||
}
|
||||
|
||||
EightBit::IntelProcessor::~IntelProcessor() {
|
||||
}
|
||||
|
||||
void EightBit::IntelProcessor::initialise() {
|
||||
Processor::initialise();
|
||||
MEMPTR().word = 0;
|
||||
}
|
||||
|
||||
|
||||
void EightBit::IntelProcessor::push(uint8_t value) {
|
||||
m_memory.ADDRESS().word = --sp.word;
|
||||
m_memory.reference() = value;
|
||||
}
|
||||
|
||||
void EightBit::IntelProcessor::pushWord(register16_t value) {
|
||||
push(value.high);
|
||||
push(value.low);
|
||||
}
|
||||
|
||||
uint8_t EightBit::IntelProcessor::pop() {
|
||||
m_memory.ADDRESS().word = sp.word++;
|
||||
return m_memory.reference();
|
||||
}
|
||||
|
||||
void EightBit::IntelProcessor::popWord(register16_t& output) {
|
||||
output.low = pop();
|
||||
output.high = pop();
|
||||
}
|
||||
Reference in new issue
Block a user