Power on conditions are chip specific and *not* directly related to construction/destruction.

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2018-01-18 17:50:15 +00:00
parent 19aea5244b
commit 21bd8a06e6
3 changed files with 12 additions and 7 deletions

View File

@ -31,6 +31,7 @@ namespace EightBit {
virtual int execute(uint8_t opcode) final;
virtual int step() final;
virtual void powerOn() override;
uint8_t& X() { return x; }
uint8_t& Y() { return y; }
@ -316,11 +317,11 @@ namespace EightBit {
const uint8_t RSTvector = 0xfc;
const uint8_t NMIvector = 0xfa;
uint8_t x; // index register X
uint8_t y; // index register Y
uint8_t a; // accumulator
uint8_t s; // stack pointer
uint8_t p; // processor status
uint8_t x = 0; // index register X
uint8_t y = 0; // index register Y
uint8_t a = 0; // accumulator
uint8_t s = 0; // stack pointer
uint8_t p = 0; // processor status
PinLevel m_soLine = Low;
};

View File

@ -2,7 +2,9 @@
#include "mos6502.h"
EightBit::MOS6502::MOS6502(Bus& bus)
: Processor(bus) {
: Processor(bus) {}
void EightBit::MOS6502::powerOn() {
X() = Bit7;
Y() = 0;
@ -11,6 +13,8 @@ EightBit::MOS6502::MOS6502(Bus& bus)
S() = Mask8;
raise(SO());
Processor::powerOn();
}
int EightBit::MOS6502::step() {

View File

@ -76,7 +76,7 @@ namespace EightBit {
PinLevel& POWER() { return m_powerLine; } // In
bool powered() { return raised(POWER()); }
void powerOn() { raise(POWER()); raise(HALT()); reset(); }
virtual void powerOn() { raise(POWER()); raise(HALT()); reset(); }
void powerOff() { lower(POWER()); }
int run(int limit);