--- xmil/io/vramio.c 2004/08/04 15:18:26 1.1 +++ xmil/io/vramio.c 2004/08/12 13:32:52 1.6 @@ -1,15 +1,8 @@ #include "compiler.h" #include "pccore.h" #include "iocore.h" -#include "x1_io.h" -#include "x1_crtc.h" #include "vram.h" -#include "draw.h" - - - BYTE *curvram; - BYTE curupdt; - DWORD updatemsk = 0x7ff; +#include "makescrn.h" // ---- text @@ -23,11 +16,11 @@ void IOOUTCALL tram_o(UINT port, REG8 va if (tram[TRAM_ATR + addr] == value) { return; } - if ((tram[TRAM_ATR + addr] ^ value) & (X1ATR_Yx2 | X1ATR_Xx2)) { - doubleatrchange = 1; + if ((tram[TRAM_ATR + addr] ^ value) & (TRAMATR_Yx2 | TRAMATR_Xx2)) { + makescrn.remakeattr = 1; } - if (value & X1ATR_BLINK) { - blinkflag = 1; + if (value & TRAMATR_BLINK) { + makescrn.existblink = 1; } tram[TRAM_ATR + addr] = value; } @@ -43,9 +36,9 @@ void IOOUTCALL tram_o(UINT port, REG8 va } tram[TRAM_ANK + addr] = value; } - scrnflash = 1; - if (tram[TRAM_ATR + addr] & X1ATR_Xx2) { - updatetmp[addr + 1] |= UPDATE_TVRAM; + makescrn.scrnflash = 1; + if (tram[TRAM_ATR + addr] & TRAMATR_Xx2) { + updatetmp[LOW11(addr + 1)] |= UPDATE_TVRAM; } updatetmp[addr] |= UPDATE_TVRAM; } @@ -69,52 +62,51 @@ REG8 IOINPCALL tram_i(UINT port) { void IOOUTCALL gram_o(UINT port, REG8 value) { - UINT addr; + UINT8 *p; - addr = (LOW11(port) << 5) + (port >> 11); - if (curvram[addr] == value) { + p = crtc.e.gram + (LOW11(port) << 5) + (port >> 11); + if (*p == value) { return; } - curvram[addr] = value; - updatetmp[port & updatemsk] |= curupdt; - scrnflash = 1; + *p = value; + updatetmp[port & crtc.e.updatemask] |= crtc.e.updatebit; + makescrn.scrnflash = 1; } REG8 IOINPCALL gram_i(UINT port) { - return(curvram[(LOW11(port) << 5) + (port >> 11)]); + return(crtc.e.gram[(LOW11(port) << 5) + (port >> 11)]); } void IOOUTCALL gram2_o(UINT port, REG8 value) { UINT8 *p; - p = curvram + (((port << 5) | (port >> 11)) & 0xffe7); - switch(port & 0xc000) { - case 0x0000: - p[PLANE_B] = value; - p[PLANE_R] = value; - p[PLANE_G] = value; + p = crtc.e.gram + (((port << 5) + (port >> 11)) & 0xffe7); + switch((port >> 14) & 3) { + case 0: + p[GRAM_B] = value; + p[GRAM_R] = value; + p[GRAM_G] = value; break; - case 0x4000: - p[PLANE_R] = value; - p[PLANE_G] = value; + case 1: + p[GRAM_R] = value; + p[GRAM_G] = value; break; - case 0x8000: - p[PLANE_B] = value; - p[PLANE_G] = value; + case 2: + p[GRAM_B] = value; + p[GRAM_G] = value; break; - case 0xc000: - p[PLANE_B] = value; - p[PLANE_R] = value; + case 3: + p[GRAM_B] = value; + p[GRAM_R] = value; break; } - - updatetmp[port & updatemsk] |= curupdt; - scrnflash = 1; + updatetmp[port & crtc.e.updatemask] |= crtc.e.updatebit; + makescrn.scrnflash = 1; } @@ -122,12 +114,10 @@ void IOOUTCALL gram2_o(UINT port, REG8 v void vramio_reset(void) { - ZeroMemory(GRP_RAM, 0x20000); - ZeroMemory(tram, 0x01800); - memset(tram + TRAM_ATR, 0x07, 0x800); - memset(tram + TRAM_ANK, 0x20, 0x800); + ZeroMemory(gram, sizeof(gram)); + FillMemory(tram + TRAM_ATR, 0x800, 0x07); + FillMemory(tram + TRAM_ANK, 0x800, 0x20); + ZeroMemory(tram + TRAM_KNJ, 0x800); ZeroMemory(updatetmp, sizeof(updatetmp)); - curvram = &GRP_RAM[GRAM_BANK0]; - curupdt = UPDATE_VRAM0; }