2017-05-16 21:19:17 -04: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-16 21:28:17 -04:00
|
|
|
AllRAMProcessor::AllRAMProcessor() : ::CPU::AllRAMProcessor(65536) {}
|
2017-05-16 21:19:17 -04:00
|
|
|
|
|
|
|
int AllRAMProcessor::perform_machine_cycle(const MachineCycle *cycle) {
|
2017-05-17 21:45:23 -04:00
|
|
|
switch(cycle->operation) {
|
|
|
|
case BusOperation::ReadOpcode:
|
2017-05-19 22:57:43 -04:00
|
|
|
printf("! ");
|
2017-05-19 21:20:28 -04:00
|
|
|
check_address_for_trap(*cycle->address);
|
2017-05-17 21:45:23 -04:00
|
|
|
case BusOperation::Read:
|
2017-05-20 23:03:52 -04: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-17 21:45:23 -04:00
|
|
|
*cycle->value = memory_[*cycle->address];
|
|
|
|
break;
|
|
|
|
case BusOperation::Write:
|
2017-05-19 19:18:35 -04:00
|
|
|
printf("w %04x\n", *cycle->address);
|
2017-05-17 21:45:23 -04:00
|
|
|
memory_[*cycle->address] = *cycle->value;
|
|
|
|
break;
|
|
|
|
|
2017-05-19 19:18:35 -04:00
|
|
|
case BusOperation::Internal:
|
|
|
|
break;
|
|
|
|
|
2017-05-17 21:45:23 -04:00
|
|
|
default:
|
|
|
|
printf("???\n");
|
|
|
|
break;
|
|
|
|
}
|
2017-05-16 21:19:17 -04:00
|
|
|
return 0;
|
|
|
|
}
|