--- np2/io/cgrom.c 2003/10/16 17:57:50 1.1 +++ np2/io/cgrom.c 2003/12/19 23:16:06 1.6 @@ -1,48 +1,55 @@ #include "compiler.h" -#include "dosio.h" +#include "cpucore.h" #include "pccore.h" #include "iocore.h" -#include "memory.h" #include "font.h" static void cgwindowset(CGROM cr) { + UINT low; + UINT high; int code; - cgwindow.low = 0x7fff0; cgwindow.writable &= ~1; + low = 0x7fff0; if (grcg.chip >= 2) { if (!(cr->code & 0xff00)) { - cgwindow.high = 0x80000 + (cr->code << 4); + high = 0x80000 + (cr->code << 4); } else { code = cr->code & 0x007f; - cgwindow.high = (cr->code & 0x7f7f) << 4; + high = (cr->code & 0x7f7f) << 4; if ((code >= 0x56) && (code < 0x58)) { cgwindow.writable |= 1; - cgwindow.high += cr->lr; + high += cr->lr; } else if (((code >= 0x0c) && (code < 0x10)) || ((code >= 0x58) && (code < 0x60))) { - cgwindow.high += cr->lr; + high += cr->lr; } else if ((code < 0x08) || (code >= 0x10)) { - cgwindow.low = cgwindow.high; - cgwindow.high += 0x800; + low = high; + high += 0x800; } } } else { - cgwindow.high = cgwindow.low; + high = low; } + cgwindow.low = low; + cgwindow.high = high; +#if defined(CPUSTRUC_FONTPTR) + FONTPTR_LOW = fontrom + low; + FONTPTR_HIGH = fontrom + high; +#endif } // ---- I/O // write charactor code low -static void IOOUTCALL cgrom_oa1(UINT port, BYTE dat) { +static void IOOUTCALL cgrom_oa1(UINT port, REG8 dat) { CGROM cr; @@ -53,7 +60,7 @@ static void IOOUTCALL cgrom_oa1(UINT por } // write charactor code high -static void IOOUTCALL cgrom_oa3(UINT port, BYTE dat) { +static void IOOUTCALL cgrom_oa3(UINT port, REG8 dat) { CGROM cr; @@ -64,7 +71,7 @@ static void IOOUTCALL cgrom_oa3(UINT por } // write charactor line -static void IOOUTCALL cgrom_oa5(UINT port, BYTE dat) { +static void IOOUTCALL cgrom_oa5(UINT port, REG8 dat) { CGROM cr; @@ -76,26 +83,26 @@ static void IOOUTCALL cgrom_oa5(UINT por } // CG write pattern -static void IOOUTCALL cgrom_oa9(UINT port, BYTE dat) { +static void IOOUTCALL cgrom_oa9(UINT port, REG8 dat) { CGROM cr; cr = &cgrom; if ((cr->code & 0x007e) == 0x0056) { - font[((cr->code & 0x7f7f) << 4) + - cr->lr + cr->line] = dat; + fontrom[((cr->code & 0x7f7f) << 4) + + cr->lr + cr->line] = (UINT8)dat; cgwindow.writable |= 0x80; } (void)port; } -static BYTE IOINPCALL cgrom_ia9(UINT port) { +static REG8 IOINPCALL cgrom_ia9(UINT port) { CGROM cr; - BYTE *ptr; +const BYTE *ptr; cr = &cgrom; - ptr = font; + ptr = fontrom; if (cr->code & 0xff00) { ptr += (cr->code & 0x7f7f) << 4; ptr += cr->lr; @@ -127,6 +134,10 @@ void cgrom_reset(void) { ZeroMemory(cgw, sizeof(cgrom)); cgw->low = 0x7fff0; cgw->high = 0x7fff0; +#if defined(CPUSTRUC_FONTPTR) + FONTPTR_LOW = fontrom + 0x7fff0; + FONTPTR_HIGH = fontrom + 0x7fff0; +#endif cgw->writable = 0; }