-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathz80test.cpp
More file actions
59 lines (53 loc) · 1.01 KB
/
z80test.cpp
File metadata and controls
59 lines (53 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
* z80test.cpp
*
* Created on: 29 mar 2016
* Author: wpk
*/
#include "z80test.h"
#include "z80.h"
#include <iostream>
#include <memory>
using namespace std;
z80test::z80test() {
string testname;
cin >> testname;
z80* cpu = new z80(*this);
uint64_t ticks = cpu->readstate(cin);
while (true) {
int addr;
cin >> hex >> addr;
if (addr == -1) break;
while (true) {
int m;
cin >> hex >> m;
if (m == -1) {
break;
}
memory[addr++] = m;
}
}
uint64_t t = 0;
std::cerr << cpu->get_trace();
while (t < ticks) {
t = cpu->tick();
std::cerr << cpu->get_trace();
};
cpu->writestate(cout);
}
uint32_t z80test::readmem(uint16_t address) {
return * ((uint32_t*) (memory + address));
}
void z80test::writemem(uint16_t address, uint8_t value) {
memory[address] = value;
}
uint8_t z80test::readio(uint16_t address) {
return address >> 8;
}
void z80test::writeio(uint16_t address, uint8_t value) {}
z80test::~z80test() {
// TODO Auto-generated destructor stub
}
int main() {
z80test x;
}