Compare commits

...

2 Commits

Author SHA1 Message Date
bdec53eb97 - [FIX] Els opcodes DD amb paràmetre de 16 bits mostraven mal l'adreça
- [FIX] Al carregar un estat el contador de programa no mantenia l'adreça correcta
- [NEW] Afegit al analitzador la visualització de escritura de dades
- [NEW] Deshabilite les interrupcions al entrar a una interrupció. No se si fa falta.
- [NEW] Afegit el Batman de Jon Ritman pa provar
2024-12-17 17:40:42 +01:00
dfcc0a26fe - [FIX] El cursor es mostra sempre damunt de les finestres zx_screen i z80debug
- [FIX] el dibuixat del crosshair en la finestra z80analyze causaba potencialment una escritura fora de rang
- [NEW] Refresc de la finestra z80analyze millorat
2024-12-17 12:03:04 +01:00
11 changed files with 77 additions and 60 deletions

BIN
batman.sav Normal file

Binary file not shown.

BIN
batmanritman.tap Normal file

Binary file not shown.

View File

@@ -236,6 +236,7 @@ int main(int argc, char *argv[])
time = SDL_GetTicks();
z80analyze::refresh();
}
z80analyze::refresh(true);
} else if (!z80debug::debugging() && z80debug::paused()) {

13
symbols-glaurung.txt Normal file
View File

@@ -0,0 +1,13 @@
0x5e38 STACK
0x9a01 DRW_ROOM
0x9f00 DRW_SCO_HERO
0x9f0f VAR_VIDES
0x9f8d DRW_SCO_INV
0xa00a DRW_SCO_LIVS
0xa01a DRW_SCO_NBAG
0xa022 DRW_SCO_NARW
0xa02a DRW_SCO_PNTS
0xc661 CLEAR_SCR
0xed5e MAINLOOP
0xf2b1 DRW_HERO
0xfed5 COUNT500

View File

@@ -1,13 +1 @@
0x5e38 STACK
0x9a01 DRW_ROOM
0x9f00 DRW_SCO_HERO
0x9f0f VAR_VIDES
0x9f8d DRW_SCO_INV
0xa00a DRW_SCO_LIVS
0xa01a DRW_SCO_NBAG
0xa022 DRW_SCO_NARW
0xa02a DRW_SCO_PNTS
0xc661 CLEAR_SCR
0xed5e MAINLOOP
0xf2b1 DRW_HERO
0xfed5 COUNT500
0x6580 START

50
z80.cpp
View File

@@ -217,6 +217,7 @@ namespace z80
memtag[addr] = MEMTAG_MIXED;
} else {
memtag[addr] = MEMTAG_DATA;
memtouched[addr] = MEMTAG_DATA;
}
}
@@ -717,30 +718,6 @@ namespace z80
RETN();
}
void interrupt()
{
if (!iff1) return;
exit_from_halt = true;
PUSH(rPC);
uint16_t address;
if (im==1) {
rPC = 0x38;
} else if (im==2) {
address = (rI<<8) | 0xFE;
rPC = READ_MEM_16(address);
} else if (im==0) {
printf("Interrupt mode 0!\n");
z80debug::stop();
return;
}
if (options[Z80_OPTION_BREAK_ON_INTERRUPT]) {
printf("Break on interrupt! 0x%2x, PC: 0x%2x\n", address, rPC);
z80debug::setcursor(rPC);
z80debug::history::store();
z80debug::stop();
}
}
void RST(uint8_t vec)
{
PUSH(rPC);
@@ -785,6 +762,31 @@ namespace z80
}
}
void interrupt()
{
if (!iff1) return;
DI();
exit_from_halt = true;
PUSH(rPC);
uint16_t address;
if (im==1) {
rPC = 0x38;
} else if (im==2) {
address = (rI<<8) | 0xFE;
rPC = READ_MEM_16(address);
} else if (im==0) {
printf("Interrupt mode 0!\n");
z80debug::stop();
return;
}
if (options[Z80_OPTION_BREAK_ON_INTERRUPT]) {
printf("Break on interrupt! 0x%2x, PC: 0x%2x\n", address, rPC);
z80debug::setcursor(rPC);
z80debug::history::store();
z80debug::stop();
}
}
static inline const uint8_t RLC(const uint8_t v)
{
const uint8_t res = (v>>7) | (v<<1);

View File

@@ -12,6 +12,8 @@ namespace z80analyze
SDL_Texture *tex = nullptr;
SDL_Texture *uitex = nullptr;
uint16_t address = 0;
int mx, my;
bool needs_refresh = true;
void refreshTitle();
@@ -34,8 +36,11 @@ namespace z80analyze
{
if (e->motion.windowID == SDL_GetWindowID(win)) {
SDL_ShowCursor(SDL_DISABLE);
mx = e->motion.x/2;
my = e->motion.y/2;
refreshTitle();
refresh();
needs_refresh=true;
focus();
}
}
@@ -70,15 +75,17 @@ namespace z80analyze
char tmp[10];
void refreshTitle()
{
int mx, my;
SDL_GetMouseState(&mx, &my);
mx/=2; my/=2;
address = mx+my*256;
SDL_SetWindowTitle(win, SDL_itoa(address, tmp, 16));
if (mx>=0 && my>=0 && mx<256 && my<256) {
address = mx+my*256;
SDL_SetWindowTitle(win, SDL_itoa(address, tmp, 16));
}
}
void refresh()
void refresh(const bool conditional)
{
if (!win) return;
if (conditional && !needs_refresh) return;
needs_refresh = false;
ui::setrenderer(ren, uitex);
Uint32 *pixels;
@@ -88,23 +95,22 @@ namespace z80analyze
{
//uint8_t tag = z80::getMemTag(i);
//pixels[i] = tag==MEMTAG_NONE ? 0x808080 : tag==MEMTAG_DATA ? 0x0000FF : tag==MEMTAG_MIXED ? 0xFF00FF : 0x00FF00;
uint32_t none_color = i<0x4000 ? 0x101010 : i<0x5800 ? 0x202020 : i<0x5b00 ? 0x404040 : 0x808080;
uint8_t tag = z80::getMemTouched(i);
pixels[i] = tag==MEMTAG_NONE ? 0x808080 : tag==MEMTAG_DATA ? 0x0000FF : tag==MEMTAG_REPEAT ? 0xFF0000 : 0x00FF00;
pixels[i] = tag==MEMTAG_NONE ? none_color : tag==MEMTAG_DATA ? 0x0000FF : tag==MEMTAG_REPEAT ? 0xFF0000 : 0x00FF00;
}
pixels[z80::getPC()] = 0xFFFFFF;
int mx, my;
SDL_GetMouseState(&mx, &my);
mx/=2; my/=2;
pixels[(mx-2)+(my)*256] = 0x000000;
pixels[(mx-1)+(my)*256] = 0x000000;
pixels[(mx+1)+(my)*256] = 0x000000;
pixels[(mx+2)+(my)*256] = 0x000000;
pixels[(mx)+(my-1)*256] = 0x000000;
pixels[(mx)+(my-2)*256] = 0x000000;
pixels[(mx)+(my+1)*256] = 0x000000;
pixels[(mx)+(my+2)*256] = 0x000000;
if (mx>=0 && my>=0 && mx<256 && my<256) {
if (mx>2) pixels[(mx-2)+(my)*256] = 0x000000;
if (mx>1) pixels[(mx-1)+(my)*256] = 0x000000;
if (mx<255) pixels[(mx+1)+(my)*256] = 0x000000;
if (mx<254) pixels[(mx+2)+(my)*256] = 0x000000;
if (my>1) pixels[(mx)+(my-1)*256] = 0x000000;
if (my>2) pixels[(mx)+(my-2)*256] = 0x000000;
if (my<255) pixels[(mx)+(my+1)*256] = 0x000000;
if (my<254) pixels[(mx)+(my+2)*256] = 0x000000;
}
SDL_UnlockTexture(tex);
SDL_RenderCopy(ren, tex, NULL, NULL);

View File

@@ -3,7 +3,7 @@
namespace z80analyze
{
void show();
void refresh();
void refresh(const bool conditional=false);
void hide();
void focus();
}

View File

@@ -93,6 +93,9 @@ namespace z80debug
bool eventHandler(SDL_Event *e)
{
if (e->type == SDL_MOUSEMOTION) {
SDL_ShowCursor(SDL_ENABLE);
}
if (z80debug::debugging()) {
if (e->type==SDL_WINDOWEVENT) {
if ((e->window.event==SDL_WINDOWEVENT_SHOWN) || (e->window.event==SDL_WINDOWEVENT_EXPOSED)) {
@@ -164,7 +167,6 @@ namespace z80debug
}
}
if (e->type == SDL_MOUSEMOTION) {
SDL_ShowCursor(SDL_ENABLE);
if (!resizing) {
if ( (e->motion.y > (mem_y*CHR_H)-8) && (e->motion.y < (mem_y*CHR_H)+8) && ( e->motion.x < midx*CHR_W ) ) {
if (resizing_type != RESIZING_MEMORY) SDL_SetCursor(cur_ns);
@@ -1026,6 +1028,8 @@ namespace z80debug
fread(regs, 31, 1, f);
fread(&memory[0x4000], 0xc000, 1, f);
fclose(f);
history::store();
history::gototop();
}
void setcursor(const uint16_t address)

View File

@@ -123,7 +123,7 @@ namespace z80dis
if (strstr(buffer, "4x"))
{
opcode_size+=2;
const uint16_t word = *(uint16_t*)(memory+((*memory==0xFD) || (*memory==0xDD)?2:1));
const uint16_t word = *(uint16_t*)(memory+((*memory==0xFD) || (*memory==0xDD) || (*memory==0xED)?2:1));
if (symbols[word][0]!=0) {
char *p = strstr(buffer, "$");
(*p)='%'; p++;

View File

@@ -128,6 +128,9 @@ namespace zxscreen
}
}
}
if (e->type == SDL_MOUSEMOTION) {
SDL_ShowCursor(true);
}
return true;
}