- [NEW] F8 para execució - [NEW] F5 continua execució - [NEW] ULA synch interrupt - [NEW] Break on read/write - [FIX] INC8 and DEC8 did wrong flags calculations - [FIX] INCMEM8 and DECMEM8 did no flags calculation at all - [NEW] Flags visualization - [DEL] run command replaced by cont command - [NEW] reset command - [NEW] Breakpoint delete command
91 lines
2.5 KiB
C++
91 lines
2.5 KiB
C++
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include "z80.h"
|
|
#include "z80dis.h"
|
|
#include "z80debug.h"
|
|
#include "zxscreen.h"
|
|
#include <SDL2/SDL.h>
|
|
#include <string.h>
|
|
|
|
uint8_t memory[65536];
|
|
uint32_t t = 0;
|
|
|
|
int ula_in()
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
void ula_out(int val)
|
|
{
|
|
|
|
}
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
FILE* f = fopen("48.rom", "rb");
|
|
fread(memory, 1024, 16, f);
|
|
fclose(f);
|
|
|
|
z80::reset(memory);
|
|
z80::connect_port(0xfe, ula_in, ula_out);
|
|
|
|
SDL_Init(SDL_INIT_EVERYTHING);
|
|
z80debug::show();
|
|
zxscreen::show();
|
|
|
|
bool should_exit = false;
|
|
SDL_Event e;
|
|
|
|
while (!should_exit)
|
|
{
|
|
while (SDL_PollEvent(&e))
|
|
{
|
|
if (e.type == SDL_QUIT) { should_exit=true; break; }
|
|
if (z80debug::debugging()) {
|
|
if (e.type == SDL_KEYDOWN) {
|
|
if (e.key.keysym.scancode==SDL_SCANCODE_ESCAPE) {
|
|
should_exit=true; break;
|
|
} else if (e.key.keysym.scancode==SDL_SCANCODE_F10) {
|
|
t += z80::step();
|
|
if (t>=69888) { t=0; z80::interrupt(); }
|
|
z80debug::refresh();
|
|
zxscreen::refresh();
|
|
} else if (e.key.keysym.scancode==SDL_SCANCODE_F5) {
|
|
z80::step();
|
|
z80debug::cont();
|
|
zxscreen::refresh();
|
|
} else if (e.key.keysym.scancode==SDL_SCANCODE_RETURN) {
|
|
z80debug::executeConsole();
|
|
} else if (e.key.keysym.scancode==SDL_SCANCODE_BACKSPACE) {
|
|
z80debug::DeleteCharConsole();
|
|
}
|
|
}
|
|
if (e.type == SDL_TEXTINPUT) {
|
|
z80debug::sendToConsole(e.text.text);
|
|
}
|
|
} else {
|
|
if (e.type == SDL_KEYDOWN) {
|
|
if (e.key.keysym.scancode==SDL_SCANCODE_F8) {
|
|
z80debug::stop();
|
|
zxscreen::refresh();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (!z80debug::debugging()) {
|
|
if (z80debug::isbreak(z80::getPC())) {
|
|
z80debug::stop();
|
|
zxscreen::refresh();
|
|
} else {
|
|
t += z80::step();
|
|
if (t>=69888) {
|
|
t=0;
|
|
zxscreen::refresh();
|
|
z80::interrupt();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
} |