From b56482607e7049bfb0299f0114b24b7c0b021676 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 5 Jun 2016 11:44:29 -0400 Subject: [PATCH] Added just enough that the 6502 should now be operating correctly. --- Machines/Vic-20/Vic20.cpp | 30 +++++++++++++++++++++++++++++- Machines/Vic-20/Vic20.hpp | 2 +- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/Machines/Vic-20/Vic20.cpp b/Machines/Vic-20/Vic20.cpp index 12566bc36..74d0fa12c 100644 --- a/Machines/Vic-20/Vic20.cpp +++ b/Machines/Vic-20/Vic20.cpp @@ -13,10 +13,38 @@ using namespace Vic20; Machine::Machine() -{} +{ + set_reset_line(true); +} unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uint16_t address, uint8_t *value) { + set_reset_line(false); + + if(isReadOperation(operation)) + { + uint8_t returnValue = 0xff; + + if(address < sizeof(_ram)) + returnValue &= _ram[address]; + + if(address >= 0x8000 && address < 0x9000) + returnValue &= _characterROM[address&0x0fff]; + + if(address >= 0xc000 && address < 0xe000) + returnValue &= _basicROM[address&0x1fff]; + + if(address >= 0xe000) + returnValue &= _kernelROM[address&0x1fff]; + + *value = returnValue; + } + else + { + if(address < sizeof(_ram)) + _ram[address] = *value; + } + return 1; } diff --git a/Machines/Vic-20/Vic20.hpp b/Machines/Vic-20/Vic20.hpp index f9eba88ba..4c6f81416 100644 --- a/Machines/Vic-20/Vic20.hpp +++ b/Machines/Vic-20/Vic20.hpp @@ -43,7 +43,7 @@ class Machine: public CPU6502::Processor, public CRTMachine::Machine { uint8_t _characterROM[0x1000]; uint8_t _basicROM[0x2000]; uint8_t _kernelROM[0x2000]; - uint8_t _ram[0x1000]; + uint8_t _ram[0x2000]; std::unique_ptr _mos6560; };