| version 1.6, 2003/12/19 23:16:06 | version 1.13, 2005/02/04 05:32:24 | 
| Line 16  static void cgwindowset(CGROM cr) { | Line 16  static void cgwindowset(CGROM cr) { | 
 | if (grcg.chip >= 2) { | if (grcg.chip >= 2) { | 
 | if (!(cr->code & 0xff00)) { | if (!(cr->code & 0xff00)) { | 
 | high = 0x80000 + (cr->code << 4); | high = 0x80000 + (cr->code << 4); | 
 |  | if (!(gdc.mode1 & 8)) { | 
 |  | high += 0x2000; | 
 |  | } | 
 | } | } | 
 | else { | else { | 
 | code = cr->code & 0x007f; | code = cr->code & 0x007f; | 
| Line 24  static void cgwindowset(CGROM cr) { | Line 27  static void cgwindowset(CGROM cr) { | 
 | cgwindow.writable |= 1; | cgwindow.writable |= 1; | 
 | high += cr->lr; | high += cr->lr; | 
 | } | } | 
 |  | else if ((code >= 0x09) && (code < 0x0c)) {                             // ver0.78 | 
 |  | if (cr->lr) { | 
 |  | high = low; | 
 |  | } | 
 |  | } | 
 | else if (((code >= 0x0c) && (code < 0x10)) || | else if (((code >= 0x0c) && (code < 0x10)) || | 
 | ((code >= 0x58) && (code < 0x60))) { | ((code >= 0x58) && (code < 0x60))) { | 
 | high += cr->lr; | high += cr->lr; | 
 | } | } | 
| else if ((code < 0x08) || (code >= 0x10)) { | else { | 
 | low = high; | low = high; | 
 | high += 0x800; | high += 0x800; | 
 | } | } | 
| Line 37  static void cgwindowset(CGROM cr) { | Line 45  static void cgwindowset(CGROM cr) { | 
 | else { | else { | 
 | high = low; | high = low; | 
 | } | } | 
 |  | #if !defined(CGWND_FONTPTR) | 
 | cgwindow.low = low; | cgwindow.low = low; | 
 | cgwindow.high = high; | cgwindow.high = high; | 
| #if defined(CPUSTRUC_FONTPTR) | #else | 
| FONTPTR_LOW = fontrom + low; | cgwindow.fontlow = fontrom + low; | 
| FONTPTR_HIGH = fontrom + high; | cgwindow.fonthigh = fontrom + high; | 
 | #endif | #endif | 
 | } | } | 
 |  |  | 
| Line 53  static void IOOUTCALL cgrom_oa1(UINT por | Line 62  static void IOOUTCALL cgrom_oa1(UINT por | 
 |  |  | 
 | CGROM   cr; | CGROM   cr; | 
 |  |  | 
 |  | //      TRACEOUT(("%.4x:%.2x [%.4x:%.4x]", port, dat, CPU_CS, CPU_IP)); | 
 | cr = &cgrom; | cr = &cgrom; | 
 | cr->code = (dat << 8) | (cr->code & 0xff); | cr->code = (dat << 8) | (cr->code & 0xff); | 
 | cgwindowset(cr); | cgwindowset(cr); | 
| Line 64  static void IOOUTCALL cgrom_oa3(UINT por | Line 74  static void IOOUTCALL cgrom_oa3(UINT por | 
 |  |  | 
 | CGROM   cr; | CGROM   cr; | 
 |  |  | 
 |  | //      TRACEOUT(("%.4x:%.2x [%.4x:%.4x]", port, dat, CPU_CS, CPU_IP)); | 
 | cr = &cgrom; | cr = &cgrom; | 
 | cr->code = (cr->code & 0xff00) | dat; | cr->code = (cr->code & 0xff00) | dat; | 
 | cgwindowset(cr); | cgwindowset(cr); | 
| Line 76  static void IOOUTCALL cgrom_oa5(UINT por | Line 87  static void IOOUTCALL cgrom_oa5(UINT por | 
 | CGROM   cr; | CGROM   cr; | 
 |  |  | 
 | cr = &cgrom; | cr = &cgrom; | 
| cr->line = dat & 0x0f; | cr->line = dat & 0x1f; | 
 | cr->lr = ((~dat) & 0x20) << 6; | cr->lr = ((~dat) & 0x20) << 6; | 
 | cgwindowset(cr); | cgwindowset(cr); | 
 | (void)port; | (void)port; | 
| Line 90  static void IOOUTCALL cgrom_oa9(UINT por | Line 101  static void IOOUTCALL cgrom_oa9(UINT por | 
 | cr = &cgrom; | cr = &cgrom; | 
 | if ((cr->code & 0x007e) == 0x0056) { | if ((cr->code & 0x007e) == 0x0056) { | 
 | fontrom[((cr->code & 0x7f7f) << 4) + | fontrom[((cr->code & 0x7f7f) << 4) + | 
| cr->lr + cr->line] = (UINT8)dat; | cr->lr + (cr->line & 0x0f)] = (UINT8)dat; | 
 | cgwindow.writable |= 0x80; | cgwindow.writable |= 0x80; | 
 | } | } | 
 | (void)port; | (void)port; | 
| Line 100  static REG8 IOINPCALL cgrom_ia9(UINT por | Line 111  static REG8 IOINPCALL cgrom_ia9(UINT por | 
 |  |  | 
 | CGROM   cr; | CGROM   cr; | 
 | const BYTE      *ptr; | const BYTE      *ptr; | 
 |  | int             type; | 
 |  |  | 
 | cr = &cgrom; | cr = &cgrom; | 
 | ptr = fontrom; | ptr = fontrom; | 
| if (cr->code & 0xff00) { | type = cr->code & 0x00ff; | 
|  | if ((type >= 0x09) && (type < 0x0c)) {                                                  // ver0.78 | 
|  | if (!cr->lr) { | 
|  | ptr += (cr->code & 0x7f7f) << 4; | 
|  | return(ptr[cr->line & 0x0f]); | 
|  | } | 
|  | } | 
|  | else if (cr->code & 0xff00) { | 
 | ptr += (cr->code & 0x7f7f) << 4; | ptr += (cr->code & 0x7f7f) << 4; | 
 | ptr += cr->lr; | ptr += cr->lr; | 
 |  | return(ptr[cr->line & 0x0f]); | 
 | } | } | 
| else { | else if (!(cr->line & 0x10)) {          // Ⱦ³Ñ | 
 | ptr += 0x80000; | ptr += 0x80000; | 
 | ptr += cr->code << 4; | ptr += cr->code << 4; | 
 |  | return(ptr[cr->line]); | 
 | } | } | 
 | (void)port; | (void)port; | 
| return(ptr[cr->line]); | return(0); | 
 | } | } | 
 |  |  | 
 |  |  | 
| Line 132  void cgrom_reset(void) { | Line 153  void cgrom_reset(void) { | 
 |  |  | 
 | cgw = &cgwindow; | cgw = &cgwindow; | 
 | ZeroMemory(cgw, sizeof(cgrom)); | ZeroMemory(cgw, sizeof(cgrom)); | 
 |  | #if !defined(CGWND_FONTPTR) | 
 | cgw->low = 0x7fff0; | cgw->low = 0x7fff0; | 
 | cgw->high = 0x7fff0; | cgw->high = 0x7fff0; | 
| #if defined(CPUSTRUC_FONTPTR) | #else | 
| FONTPTR_LOW = fontrom + 0x7fff0; | cgw->fontlow = fontrom + 0x7fff0; | 
| FONTPTR_HIGH = fontrom + 0x7fff0; | cgw->fonthigh = fontrom + 0x7fff0; | 
 | #endif | #endif | 
 | cgw->writable = 0; | cgw->writable = 0; | 
 | } | } |