2017-05-17 01:19:17 +00:00
|
|
|
//
|
|
|
|
// Z80AllRAM.cpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 16/05/2017.
|
|
|
|
// Copyright © 2017 Thomas Harte. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "Z80AllRAM.hpp"
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
using namespace CPU::Z80;
|
|
|
|
|
2017-05-17 01:28:17 +00:00
|
|
|
AllRAMProcessor::AllRAMProcessor() : ::CPU::AllRAMProcessor(65536) {}
|
2017-05-17 01:19:17 +00:00
|
|
|
|
|
|
|
int AllRAMProcessor::perform_machine_cycle(const MachineCycle *cycle) {
|
2017-05-18 01:45:23 +00:00
|
|
|
switch(cycle->operation) {
|
|
|
|
case BusOperation::ReadOpcode:
|
2017-05-22 00:43:36 +00:00
|
|
|
// printf("! %02x\n", memory_[*cycle->address]);
|
2017-05-20 01:20:28 +00:00
|
|
|
check_address_for_trap(*cycle->address);
|
2017-05-18 01:45:23 +00:00
|
|
|
case BusOperation::Read:
|
2017-05-21 13:47:53 +00:00
|
|
|
// printf("r %04x [%02x] AF:%04x BC:%04x DE:%04x HL:%04x SP:%04x\n", *cycle->address, memory_[*cycle->address], get_value_of_register(CPU::Z80::Register::AF), get_value_of_register(CPU::Z80::Register::BC), get_value_of_register(CPU::Z80::Register::DE), get_value_of_register(CPU::Z80::Register::HL), get_value_of_register(CPU::Z80::Register::StackPointer));
|
2017-05-18 01:45:23 +00:00
|
|
|
*cycle->value = memory_[*cycle->address];
|
|
|
|
break;
|
|
|
|
case BusOperation::Write:
|
2017-05-21 13:47:53 +00:00
|
|
|
// printf("w %04x\n", *cycle->address);
|
2017-05-18 01:45:23 +00:00
|
|
|
memory_[*cycle->address] = *cycle->value;
|
|
|
|
break;
|
|
|
|
|
2017-05-19 23:18:35 +00:00
|
|
|
case BusOperation::Internal:
|
|
|
|
break;
|
|
|
|
|
2017-05-18 01:45:23 +00:00
|
|
|
default:
|
|
|
|
printf("???\n");
|
|
|
|
break;
|
|
|
|
}
|
2017-05-17 01:19:17 +00:00
|
|
|
return 0;
|
|
|
|
}
|