Diff for /np2/io/cgrom.c between versions 1.2 and 1.9

version 1.2, 2003/10/21 11:22:05 version 1.9, 2004/03/28 19:50:25
Line 1 Line 1
 #include        "compiler.h"  #include        "compiler.h"
 #include        "memory.h"  #include        "cpucore.h"
 #include        "pccore.h"  #include        "pccore.h"
 #include        "iocore.h"  #include        "iocore.h"
 #include        "font.h"  #include        "font.h"
Line 7 Line 7
   
 static void cgwindowset(CGROM cr) {  static void cgwindowset(CGROM cr) {
   
           UINT    low;
           UINT    high;
         int             code;          int             code;
   
         cgwindow.low = 0x7fff0;  
         cgwindow.writable &= ~1;          cgwindow.writable &= ~1;
           low = 0x7fff0;
         if (grcg.chip >= 2) {          if (grcg.chip >= 2) {
                 if (!(cr->code & 0xff00)) {                  if (!(cr->code & 0xff00)) {
                         cgwindow.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;
                         cgwindow.high = (cr->code & 0x7f7f) << 4;                          high = (cr->code & 0x7f7f) << 4;
                         if ((code >= 0x56) && (code < 0x58)) {                          if ((code >= 0x56) && (code < 0x58)) {
                                 cgwindow.writable |= 1;                                  cgwindow.writable |= 1;
                                 cgwindow.high += cr->lr;                                  high += cr->lr;
                           }
                           else if ((code >= 0x08) && (code < 0x0c)) {
                                   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))) {
                                 cgwindow.high += cr->lr;                                  high += cr->lr;
                         }                          }
                         else if ((code < 0x08) || (code >= 0x10)) {                          else {
                                 cgwindow.low = cgwindow.high;                                  low = high;
                                 cgwindow.high += 0x800;                                  high += 0x800;
                         }                          }
                 }                  }
         }          }
         else {          else {
                 cgwindow.high = cgwindow.low;                  high = low;
         }          }
   #if !defined(CGWND_FONTPTR)
           cgwindow.low = low;
           cgwindow.high = high;
   #else
           cgwindow.fontlow = fontrom + low;
           cgwindow.fonthigh = fontrom + high;
   #endif
 }  }
   
   
 // ---- I/O  // ---- I/O
   
 // write charactor code low  // write charactor code low
 static void IOOUTCALL cgrom_oa1(UINT port, BYTE dat) {  static void IOOUTCALL cgrom_oa1(UINT port, REG8 dat) {
   
         CGROM   cr;          CGROM   cr;
   
Line 52  static void IOOUTCALL cgrom_oa1(UINT por Line 69  static void IOOUTCALL cgrom_oa1(UINT por
 }  }
   
 // write charactor code high  // write charactor code high
 static void IOOUTCALL cgrom_oa3(UINT port, BYTE dat) {  static void IOOUTCALL cgrom_oa3(UINT port, REG8 dat) {
   
         CGROM   cr;          CGROM   cr;
   
Line 63  static void IOOUTCALL cgrom_oa3(UINT por Line 80  static void IOOUTCALL cgrom_oa3(UINT por
 }  }
   
 // write charactor line  // write charactor line
 static void IOOUTCALL cgrom_oa5(UINT port, BYTE dat) {  static void IOOUTCALL cgrom_oa5(UINT port, REG8 dat) {
   
         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;
 }  }
   
 // CG write pattern  // CG write pattern
 static void IOOUTCALL cgrom_oa9(UINT port, BYTE dat) {  static void IOOUTCALL cgrom_oa9(UINT port, REG8 dat) {
   
         CGROM   cr;          CGROM   cr;
   
         cr = &cgrom;          cr = &cgrom;
         if ((cr->code & 0x007e) == 0x0056) {          if ((cr->code & 0x007e) == 0x0056) {
                 font[((cr->code & 0x7f7f) << 4) +                  fontrom[((cr->code & 0x7f7f) << 4) +
                                                         cr->lr + cr->line] = dat;                                                          cr->lr + (cr->line & 0x0f)] = (UINT8)dat;
                 cgwindow.writable |= 0x80;                  cgwindow.writable |= 0x80;
         }          }
         (void)port;          (void)port;
 }  }
   
 static BYTE IOINPCALL cgrom_ia9(UINT port) {  static REG8 IOINPCALL cgrom_ia9(UINT port) {
   
         CGROM   cr;          CGROM   cr;
         BYTE    *ptr;  const BYTE      *ptr;
   
         cr = &cgrom;          cr = &cgrom;
         ptr = font;          ptr = fontrom;
         if (cr->code & 0xff00) {          TRACEOUT(("read code = %.4x", cr->code));
           if ((cr->code & 0x00fc) == 0x0008) {
                   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 124  void cgrom_reset(void) { Line 150  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;
   #else
           cgw->fontlow = fontrom + 0x7fff0;
           cgw->fonthigh = fontrom + 0x7fff0;
   #endif
         cgw->writable = 0;          cgw->writable = 0;
 }  }
   

Removed from v.1.2  
changed lines
  Added in v.1.9


RetroPC.NET-CVS <cvs@retropc.net>