- [NEW] ui::placetext() i ui::placechar, pa ficar text en qualsevol pixel
- [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
This commit is contained in:
16
ui.cpp
16
ui.cpp
@@ -88,6 +88,22 @@ namespace ui
|
|||||||
for (int i=0; i<strlen(text);++i) if (text[i]!=32) printchar(x+i, y, text[i]);
|
for (int i=0; i<strlen(text);++i) if (text[i]!=32) printchar(x+i, y, text[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void placechar(int x, int y, char chr, uint8_t color)
|
||||||
|
{
|
||||||
|
if (color != 255) SDL_SetRenderDrawColor(ren, colors[color][0], colors[color][1], colors[color][2], 255);
|
||||||
|
if (chr==32) return;
|
||||||
|
if (chr<32 || chr>127) chr = '.';
|
||||||
|
SDL_Rect src {((chr-32)&0xf)*CHR_W, ((chr-32)>>4)*CHR_H, CHR_W, CHR_H};
|
||||||
|
SDL_Rect dst {x, y, CHR_W*2, CHR_H*2};
|
||||||
|
SDL_RenderCopy(ren, tex, &src, &dst);
|
||||||
|
}
|
||||||
|
|
||||||
|
void placetxt(int x, int y, const char *text, uint8_t color)
|
||||||
|
{
|
||||||
|
SDL_SetTextureColorMod(tex, colors[color][0], colors[color][1], colors[color][2]);
|
||||||
|
for (int i=0; i<strlen(text);++i) if (text[i]!=32) placechar(x+i*CHR_W*2, y, text[i]);
|
||||||
|
}
|
||||||
|
|
||||||
void setClicked(const bool value)
|
void setClicked(const bool value)
|
||||||
{
|
{
|
||||||
clicked = value;
|
clicked = value;
|
||||||
|
|||||||
3
ui.h
3
ui.h
@@ -33,6 +33,9 @@ namespace ui
|
|||||||
void printchar(int x, int y, char chr, uint8_t color=255);
|
void printchar(int x, int y, char chr, uint8_t color=255);
|
||||||
void printtxt(int x, int y, const char *text, uint8_t color);
|
void printtxt(int x, int y, const char *text, uint8_t color);
|
||||||
|
|
||||||
|
void placechar(int x, int y, char chr, uint8_t color=255);
|
||||||
|
void placetxt(int x, int y, const char *text, uint8_t color);
|
||||||
|
|
||||||
void setClicked(const bool value);
|
void setClicked(const bool value);
|
||||||
const bool getClicked();
|
const bool getClicked();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,8 @@ namespace z80analyze
|
|||||||
*/
|
*/
|
||||||
} else if (e->key.keysym.scancode == SDL_SCANCODE_BACKSPACE) {
|
} else if (e->key.keysym.scancode == SDL_SCANCODE_BACKSPACE) {
|
||||||
const uint32_t size = z80mem::get()->getSize();
|
const uint32_t size = z80mem::get()->getSize();
|
||||||
for (int i=0; i<size; ++i) z80mem::get()->setTag(i, z80mem::get()->getTag(i) & ~MEMTAG_TOUCHED);
|
//for (int i=0; i<size; ++i) z80mem::get()->setTag(i, z80mem::get()->getTag(i) & ~MEMTAG_TOUCHED);
|
||||||
|
for (int i=0; i<size; ++i) z80mem::get()->setTag(i, MEMTAG_NONE);
|
||||||
refresh();
|
refresh();
|
||||||
z80debug::refresh();
|
z80debug::refresh();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,18 @@
|
|||||||
#include "zx_128bankviewer.h"
|
#include "zx_128bankviewer.h"
|
||||||
#include "z80.h"
|
#include "z80.h"
|
||||||
#include "z80mem.h"
|
#include "z80mem.h"
|
||||||
|
#include "zx_128mem.h"
|
||||||
|
#include "ui.h"
|
||||||
|
//#include "ui_window.h"
|
||||||
|
|
||||||
void zx_128bankviewer::show()
|
void zx_128bankviewer::show()
|
||||||
{
|
{
|
||||||
if (!win)
|
if (!win)
|
||||||
{
|
{
|
||||||
win = SDL_CreateWindow("Z80 Analyzer", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 128, 512, SDL_WINDOW_SHOWN);
|
win = SDL_CreateWindow("Z80 Bank Viewer", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 128, 512, SDL_WINDOW_SHOWN);
|
||||||
ren = SDL_CreateRenderer(win, -1, 0);
|
ren = SDL_CreateRenderer(win, -1, 0);
|
||||||
tex = SDL_CreateTexture(ren, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, 128, 512);
|
tex = SDL_CreateTexture(ren, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, 128, 512);
|
||||||
|
uitex = ui::createtexture(ren);
|
||||||
|
|
||||||
//ui::window::registerWindow(SDL_GetWindowID(win), handleEvent);
|
//ui::window::registerWindow(SDL_GetWindowID(win), handleEvent);
|
||||||
}
|
}
|
||||||
@@ -20,6 +24,8 @@ void zx_128bankviewer::refresh()
|
|||||||
{
|
{
|
||||||
if (!win) return;
|
if (!win) return;
|
||||||
|
|
||||||
|
ui::setrenderer(ren, uitex);
|
||||||
|
|
||||||
Uint32 *pixels;
|
Uint32 *pixels;
|
||||||
int pitch;
|
int pitch;
|
||||||
SDL_LockTexture(tex, NULL, (void**)&pixels, &pitch);
|
SDL_LockTexture(tex, NULL, (void**)&pixels, &pitch);
|
||||||
@@ -35,6 +41,18 @@ void zx_128bankviewer::refresh()
|
|||||||
|
|
||||||
SDL_UnlockTexture(tex);
|
SDL_UnlockTexture(tex);
|
||||||
SDL_RenderCopy(ren, tex, NULL, NULL);
|
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);
|
SDL_RenderPresent(ren);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ zx_128mem::zx_128mem()
|
|||||||
|
|
||||||
void zx_128mem::port_out(int port, int val)
|
void zx_128mem::port_out(int port, int val)
|
||||||
{
|
{
|
||||||
|
if (port != 0x7ffd) return;
|
||||||
if (config & ZX_128MEM_DISPAG) return;
|
if (config & ZX_128MEM_DISPAG) return;
|
||||||
const bool shadow = config & ZX_128MEM_SCREEN;
|
const bool shadow = config & ZX_128MEM_SCREEN;
|
||||||
config = val;
|
config = val;
|
||||||
@@ -163,3 +164,26 @@ uint8_t *zx_128mem::rawTagPtr(uint32_t address)
|
|||||||
{
|
{
|
||||||
return &tags[address];
|
return &tags[address];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t zx_128mem::getPage(uint8_t bank)
|
||||||
|
{
|
||||||
|
switch(bank) {
|
||||||
|
case 0:
|
||||||
|
return (config & ZX_128MEM_ROM) ? 1 : 0;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
return 5;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
return 2;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
return config & ZX_128MEM_PAGE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool zx_128mem::getShadowScreen()
|
||||||
|
{
|
||||||
|
return config & ZX_128MEM_SCREEN;
|
||||||
|
}
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ class zx_128mem : public z80mem
|
|||||||
uint8_t *rawPtr(uint32_t address);
|
uint8_t *rawPtr(uint32_t address);
|
||||||
uint8_t *rawTagPtr(uint32_t address);
|
uint8_t *rawTagPtr(uint32_t address);
|
||||||
|
|
||||||
|
uint8_t getPage(uint8_t bank);
|
||||||
|
bool getShadowScreen();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
uint8_t config;
|
uint8_t config;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "ui_window.h"
|
#include "ui_window.h"
|
||||||
#include "z80debug.h"
|
#include "z80debug.h"
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
|
#include "zx_128mem.h"
|
||||||
|
|
||||||
namespace zxscreen
|
namespace zxscreen
|
||||||
{
|
{
|
||||||
@@ -39,11 +40,11 @@ namespace zxscreen
|
|||||||
|
|
||||||
int pixels_draw = 0;
|
int pixels_draw = 0;
|
||||||
|
|
||||||
uint16_t pixel_base_addr = 0x4000;
|
uint32_t pixel_base_addr = 0x4000;
|
||||||
uint16_t color_base_addr = 0x5800;
|
uint32_t color_base_addr = 0x5800;
|
||||||
|
|
||||||
uint16_t *pixel_addr = nullptr; //[69888];
|
uint32_t *pixel_addr = nullptr; //[69888];
|
||||||
uint16_t *color_addr = nullptr; //[69888];
|
uint32_t *color_addr = nullptr; //[69888];
|
||||||
uint8_t zx_pixels[352*296];
|
uint8_t zx_pixels[352*296];
|
||||||
uint8_t *ptr_pixel = zx_pixels;
|
uint8_t *ptr_pixel = zx_pixels;
|
||||||
|
|
||||||
@@ -56,11 +57,11 @@ namespace zxscreen
|
|||||||
|
|
||||||
if (pixel_addr) free(pixel_addr);
|
if (pixel_addr) free(pixel_addr);
|
||||||
if (color_addr) free(color_addr);
|
if (color_addr) free(color_addr);
|
||||||
pixel_addr = (uint16_t*)malloc(t_states_total*sizeof(uint16_t));
|
pixel_addr = (uint32_t*)malloc(t_states_total*sizeof(uint32_t));
|
||||||
color_addr = (uint16_t*)malloc(t_states_total*sizeof(uint16_t));
|
color_addr = (uint32_t*)malloc(t_states_total*sizeof(uint32_t));
|
||||||
|
|
||||||
uint16_t *ptr_pixel = pixel_addr;
|
uint32_t *ptr_pixel = pixel_addr;
|
||||||
uint16_t *ptr_color = color_addr;
|
uint32_t *ptr_color = color_addr;
|
||||||
|
|
||||||
// vsync
|
// vsync
|
||||||
for (int i=0; i<t_states_per_scanline*vsync_lines;++i) { *(ptr_pixel++) = 0; *(ptr_color++) = SCREEN_SYNC; } // En el 128K 16 passa a ser 15 i 224 passa a ser 228
|
for (int i=0; i<t_states_per_scanline*vsync_lines;++i) { *(ptr_pixel++) = 0; *(ptr_color++) = SCREEN_SYNC; } // En el 128K 16 passa a ser 15 i 224 passa a ser 228
|
||||||
@@ -300,6 +301,9 @@ namespace zxscreen
|
|||||||
// Pintem la textura a pantalla
|
// Pintem la textura a pantalla
|
||||||
SDL_RenderCopy(ren, tex, NULL, &dest_rect);
|
SDL_RenderCopy(ren, tex, NULL, &dest_rect);
|
||||||
|
|
||||||
|
zx_128mem* mem = ((zx_128mem*)z80mem::get());
|
||||||
|
ui::printtxt(0,0,mem->getShadowScreen()?"SHADOW":"NORMAL", COLOR_WHITE);
|
||||||
|
|
||||||
if (present)
|
if (present)
|
||||||
SDL_RenderPresent(ren);
|
SDL_RenderPresent(ren);
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -131,6 +131,12 @@ namespace zx_ula
|
|||||||
// Keys in a normal keyboard that ara combinations in the zx one
|
// Keys in a normal keyboard that ara combinations in the zx one
|
||||||
if (keys[SDL_SCANCODE_BACKSPACE]) zx_keyboard[KEY_SHIFT] = zx_keyboard[KEY_0] = 1;
|
if (keys[SDL_SCANCODE_BACKSPACE]) zx_keyboard[KEY_SHIFT] = zx_keyboard[KEY_0] = 1;
|
||||||
if (keys[SDL_SCANCODE_PERIOD]) zx_keyboard[KEY_SYMBOL] = zx_keyboard[KEY_M] = 1;
|
if (keys[SDL_SCANCODE_PERIOD]) zx_keyboard[KEY_SYMBOL] = zx_keyboard[KEY_M] = 1;
|
||||||
|
|
||||||
|
if (keys[SDL_SCANCODE_UP]) zx_keyboard[KEY_SHIFT] = zx_keyboard[KEY_7] = 1;
|
||||||
|
if (keys[SDL_SCANCODE_DOWN]) zx_keyboard[KEY_SHIFT] = zx_keyboard[KEY_6] = 1;
|
||||||
|
if (keys[SDL_SCANCODE_LEFT]) zx_keyboard[KEY_SHIFT] = zx_keyboard[KEY_5] = 1;
|
||||||
|
if (keys[SDL_SCANCODE_RIGHT]) zx_keyboard[KEY_SHIFT] = zx_keyboard[KEY_8] = 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int port_in(int port)
|
int port_in(int port)
|
||||||
|
|||||||
Reference in New Issue
Block a user