- [NEW] [Z80Analize] backspace esborra tots els tags - [NEW] [zx-128bankviewer] Es mostra quina pàgina de memòria està asignada a cada bank - [FIX] [zx_128mem] es filtra el port al que escolta la memòria - [NEW] [zx_screen] Es mostra en quina pantalla estem (normal o shadow) - [FIX] [zx_screen] tots els tipos per al calcul de adreces passats a uint32_t - [NEW] [zx_ula] afegides combinacions de cursors per a major comoditat
79 lines
2.3 KiB
C++
79 lines
2.3 KiB
C++
#include "zx_128bankviewer.h"
|
|
#include "z80.h"
|
|
#include "z80mem.h"
|
|
#include "zx_128mem.h"
|
|
#include "ui.h"
|
|
//#include "ui_window.h"
|
|
|
|
void zx_128bankviewer::show()
|
|
{
|
|
if (!win)
|
|
{
|
|
win = SDL_CreateWindow("Z80 Bank Viewer", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 128, 512, SDL_WINDOW_SHOWN);
|
|
ren = SDL_CreateRenderer(win, -1, 0);
|
|
tex = SDL_CreateTexture(ren, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, 128, 512);
|
|
uitex = ui::createtexture(ren);
|
|
|
|
//ui::window::registerWindow(SDL_GetWindowID(win), handleEvent);
|
|
}
|
|
refresh();
|
|
}
|
|
|
|
|
|
void zx_128bankviewer::refresh()
|
|
{
|
|
if (!win) return;
|
|
|
|
ui::setrenderer(ren, uitex);
|
|
|
|
Uint32 *pixels;
|
|
int pitch;
|
|
SDL_LockTexture(tex, NULL, (void**)&pixels, &pitch);
|
|
for (int i=0; i<65536; ++i)
|
|
{
|
|
//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 = z80mem::get()->getTag(i);
|
|
pixels[i] = !(tag & MEMTAG_TOUCHED) ? none_color : (tag & MEMTAG_TINST) ? 0x00FF00 : (tag & MEMTAG_TREPEAT) ? 0xFF0000 : 0x0000FF;
|
|
}
|
|
pixels[z80::getPC()] = 0xFFFFFF;
|
|
|
|
SDL_UnlockTexture(tex);
|
|
SDL_RenderCopy(ren, tex, NULL, NULL);
|
|
|
|
char temp[256];
|
|
zx_128mem* mem = ((zx_128mem*)z80mem::get());
|
|
sprintf(temp, "%u", mem->getPage(0));
|
|
ui::placetxt(1,1,temp, COLOR_WHITE);
|
|
sprintf(temp, "%u", mem->getPage(1));
|
|
ui::placetxt(1,129,temp, COLOR_WHITE);
|
|
sprintf(temp, "%u", mem->getPage(2));
|
|
ui::placetxt(1,257,temp, COLOR_WHITE);
|
|
sprintf(temp, "%u", mem->getPage(3));
|
|
ui::placetxt(1,385,temp, COLOR_WHITE);
|
|
|
|
SDL_RenderPresent(ren);
|
|
}
|
|
|
|
void zx_128bankviewer::hide()
|
|
{
|
|
//ui::window::unregisterWindow(SDL_GetWindowID(win));
|
|
SDL_DestroyTexture(tex); tex = nullptr;
|
|
SDL_DestroyRenderer(ren); ren = nullptr;
|
|
SDL_DestroyWindow(win); win = nullptr;
|
|
}
|
|
|
|
void zx_128bankviewer::focus()
|
|
{
|
|
if (win) {
|
|
SDL_RaiseWindow(win);
|
|
refresh();
|
|
}
|
|
}
|
|
|
|
bool zx_128bankviewer::handleEvent(SDL_Event *e)
|
|
{
|
|
return true;
|
|
}
|