- Deixe el Abu Simbel ací per a anar fent proves de càrrega
- [NEW] Mòdul zx_tape, encara no carrega correctament les cintes. - [CHG] Gestió completa del só pasada a la ULA, i de la pantalla a zxscreen
This commit is contained in:
@@ -13,9 +13,9 @@ namespace zxscreen
|
||||
SDL_Renderer *ren = nullptr;
|
||||
SDL_Texture *tex = nullptr;
|
||||
|
||||
bool _flash = false;
|
||||
|
||||
void flash() { _flash = not _flash; }
|
||||
uint32_t t_screen = 0;
|
||||
uint8_t t_flash = 0;
|
||||
bool flash = false;
|
||||
|
||||
void show()
|
||||
{
|
||||
@@ -23,11 +23,18 @@ namespace zxscreen
|
||||
win = SDL_CreateWindow("ZX Spectrum Screen", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 352, 288, SDL_WINDOW_RESIZABLE);
|
||||
ren = SDL_CreateRenderer(win, -1, 0);
|
||||
tex = SDL_CreateTexture(ren, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, 352, 288);
|
||||
refresh();
|
||||
refresh(0);
|
||||
}
|
||||
|
||||
void refresh()
|
||||
void refresh(const uint8_t dt, const bool force_refresh)
|
||||
{
|
||||
t_screen += dt;
|
||||
if (t_screen>=69888) {
|
||||
t_flash++;
|
||||
if (t_flash==16) { t_flash=0; flash = !flash; }
|
||||
t_screen=0;
|
||||
} else if (!force_refresh) return;
|
||||
|
||||
const uint8_t* memory = z80::getMem();
|
||||
const uint8_t border_color = zx_ula::get_border_color();
|
||||
//memory+=0x4000;
|
||||
@@ -53,7 +60,7 @@ namespace zxscreen
|
||||
uint16_t address = 0x4000 | (x&0x1f) | ((y&0x7)<<8) | ((y&0x38)<<2) | ((y&0xc0)<<5);
|
||||
uint8_t block = memory[address];
|
||||
uint8_t c1 = color&0x7, c2 = (color>>3)&0x7;
|
||||
if ((color&0x80) && _flash) { c1=c2; c2=color&0x7; }
|
||||
if ((color&0x80) && flash) { c1=c2; c2=color&0x7; }
|
||||
for (int i=0;i<8;++i)
|
||||
{
|
||||
*(pixels++)=(block&0x80) ? palette[c1] : palette[c2];
|
||||
@@ -71,5 +78,7 @@ namespace zxscreen
|
||||
SDL_UnlockTexture(tex);
|
||||
SDL_RenderCopy(ren, tex, NULL, NULL);
|
||||
SDL_RenderPresent(ren);
|
||||
|
||||
if (t_screen==0) z80::interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user