Diff for /np2/bios/bios18.c between versions 1.27 and 1.45

version 1.27, 2004/02/29 03:10:02 version 1.45, 2007/11/11 13:54:14
Line 8 Line 8
 #include        "font.h"  #include        "font.h"
   
   
 static  int             sti_waiting = 0;  
   
 typedef struct {  typedef struct {
         BYTE    GBON_PTN;          UINT8   GBON_PTN;
         BYTE    GBBCC;          UINT8   GBBCC;
         BYTE    GBDOTU;          UINT8   GBDOTU;
         BYTE    GBDSP;          UINT8   GBDSP;
         BYTE    GBCPC[4];          UINT8   GBCPC[4];
         BYTE    GBSX1[2];          UINT8   GBSX1[2];
         BYTE    GBSY1[2];          UINT8   GBSY1[2];
         BYTE    GBLNG1[2];          UINT8   GBLNG1[2];
         BYTE    GBWDPA[2];          UINT8   GBWDPA[2];
         BYTE    GBRBUF[2][3];          UINT8   GBRBUF[2][3];
         BYTE    GBSX2[2];          UINT8   GBSX2[2];
         BYTE    GBSY2[2];          UINT8   GBSY2[2];
         BYTE    GBMDOT[2];          UINT8   GBMDOT[2];
         BYTE    GBCIR[2];          UINT8   GBCIR[2];
         BYTE    GBLNG2[2];          UINT8   GBLNG2[2];
         BYTE    GBMDOTI[8];          UINT8   GBMDOTI[8];
         BYTE    GBDTYP;          UINT8   GBDTYP;
         BYTE    GBFILL;          UINT8   GBFILL;
 } UCWTBL;  } UCWTBL;
   
 typedef struct {  typedef struct {
Line 41  typedef struct { Line 39  typedef struct {
 static const UINT8 modenum[4] = {3, 1, 0, 2};  static const UINT8 modenum[4] = {3, 1, 0, 2};
   
 static const CRTDATA crtdata[7] = {  static const CRTDATA crtdata[7] = {
                                                 {0x07,  0x00, 0x07, 0x08},              // 200-20                                                  {0x09,  0x1f, 0x08, 0x08},              // 200-20
                                                 {0x09,  0x1f, 0x08, 0x08},              // 200-25                                                  {0x07,  0x00, 0x07, 0x08},              // 200-25
                                                 {0x0f,  0x00, 0x0f, 0x10},              // 400-20                                                  {0x13,  0x1e, 0x11, 0x10},              // 400-20
                                                 {0x13,  0x1e, 0x11, 0x10},              // 400-25                                                  {0x0f,  0x00, 0x0f, 0x10},              // 400-25
                                                 {0x17,  0x1c, 0x13, 0x10},              // 480-20                                                  {0x17,  0x1c, 0x13, 0x10},              // 480-20
                                                 {0x12,  0x1f, 0x11, 0x10},              // 480-25                                                  {0x12,  0x1f, 0x11, 0x10},              // 480-25
                                                 {0x0f,  0x00, 0x0f, 0x10}};             // 480-30                                                  {0x0f,  0x00, 0x0f, 0x10}};             // 480-30
Line 109  const CRTDATA *crt; Line 107  const CRTDATA *crt;
         gdc.mode1 &= ~(0x2d);          gdc.mode1 &= ~(0x2d);
         mem[MEMB_CRT_STS_FLAG] = mode;          mem[MEMB_CRT_STS_FLAG] = mode;
         crt = crtdata;          crt = crtdata;
         if (!(np2cfg.dipsw[0] & 1)) {          if (!(pccore.dipsw[0] & 1)) {
                 mem[MEMB_CRT_STS_FLAG] |= 0x80;                  mem[MEMB_CRT_STS_FLAG] |= 0x80;
                 gdc.mode1 |= 0x08;                  gdc.mode1 |= 0x08;
                 crt += 2;                  crt += 2;
         }          }
         if (mode & 0x01) {          if (!(mode & 0x01)) {
                 crt += 1;                                               // 20行                  crt += 1;                                               // 25行
         }          }
         if (mode & 0x02) {          if (mode & 0x02) {
                 gdc.mode1 |= 0x04;                              // 40桁                  gdc.mode1 |= 0x04;                              // 40桁
Line 135  const CRTDATA *crt; Line 133  const CRTDATA *crt;
         bios0x18_10(0);          bios0x18_10(0);
 }  }
   
   void bios0x18_0c(void) {
   
           if (!(gdcs.textdisp & GDCSCRN_ENABLE)) {
                   gdcs.textdisp |= GDCSCRN_ENABLE;
                   pcstat.screenupdate |= 2;
           }
   }
   
 static void bios0x18_0f(UINT seg, UINT off, REG8 num, REG8 cnt) {  static void bios0x18_0f(UINT seg, UINT off, REG8 num, REG8 cnt) {
   
         BYTE    *p;          UINT8   *p;
         UINT    raster;          UINT    raster;
         UINT    t;          UINT    t;
   
Line 167  static void bios0x18_0f(UINT seg, UINT o Line 173  static void bios0x18_0f(UINT seg, UINT o
 #endif  #endif
   
         while((cnt--) && (p < (gdc.m.para + GDC_SCROLL + 0x10))) {          while((cnt--) && (p < (gdc.m.para + GDC_SCROLL + 0x10))) {
                 t = i286_memword_read(seg, off);                  t = MEMR_READ16(seg, off);
                 t >>= 1;                  t >>= 1;
                 STOREINTELWORD(p, t);                  STOREINTELWORD(p, t);
                 t = i286_memword_read(seg, off + 2);                  t = MEMR_READ16(seg, off + 2);
                 t *= raster;                  t *= raster;
                 STOREINTELWORD(p + 2, t);                  STOREINTELWORD(p + 2, t);
                 off += 4;                  off += 4;
                 p += 4;                  p += 4;
         }          }
         gdcs.textdisp |= GDCSCRN_ALLDRAW2;          gdcs.textdisp |= GDCSCRN_ALLDRAW2;
         screenupdate |= 2;          pcstat.screenupdate |= 2;
 }  }
   
 void bios0x18_10(REG8 curdel) {  void bios0x18_10(REG8 curdel) {
Line 201  void bios0x18_10(REG8 curdel) { Line 207  void bios0x18_10(REG8 curdel) {
 REG16 bios0x18_14(REG16 seg, REG16 off, REG16 code) {  REG16 bios0x18_14(REG16 seg, REG16 off, REG16 code) {
   
         UINT16  size;          UINT16  size;
 const BYTE      *p;  const UINT8     *p;
         BYTE    buf[32];          UINT8   buf[32];
         UINT    i;          UINT    i;
   
         switch(code >> 8) {          switch(code >> 8) {
                 case 0x00:                      // 8x8                  case 0x00:                      // 8x8
                         size = 0x0101;                          size = 0x0101;
                         i286_memword_write(seg, off, 0x0101);                          MEMR_WRITE16(seg, off, 0x0101);
                         p = fontrom + 0x82000 + ((code & 0xff) << 4);                          p = fontrom + 0x82000 + ((code & 0xff) << 4);
                         i286_memstr_write(seg, off + 2, p, 8);                          MEMR_WRITES(seg, off + 2, p, 8);
                         break;                          break;
   
                 case 0x28:                      // 8x16 KANJI  //              case 0x28:
                 case 0x29:                  case 0x29:                      // 8x16 KANJI
                 case 0x2a:                  case 0x2a:
                 case 0x2b:                  case 0x2b:
                         size = 0x0102;                          size = 0x0102;
                         i286_memword_write(seg, off, 0x0102);                          MEMR_WRITE16(seg, off, 0x0102);
                         p = fontrom;                          p = fontrom;
                         p += (code & 0x7f) << 12;                          p += (code & 0x7f) << 12;
                         p += (((code >> 8) - 0x20) & 0x7f) << 4;                          p += (((code >> 8) - 0x20) & 0x7f) << 4;
                         i286_memstr_write(seg, off + 2, p, 16);                          MEMR_WRITES(seg, off + 2, p, 16);
                         break;                          break;
   
                 case 0x80:                      // 8x16 ANK                  case 0x80:                      // 8x16 ANK
                         size = 0x0102;                          size = 0x0102;
                         p = fontrom + 0x80000 + ((code & 0xff) << 4);                          p = fontrom + 0x80000 + ((code & 0xff) << 4);
                         i286_memstr_write(seg, off + 2, p, 16);                          MEMR_WRITES(seg, off + 2, p, 16);
                         break;                          break;
   
                 default:                  default:
Line 240  const BYTE *p; Line 246  const BYTE *p;
                                 buf[i*2+0] = *p;                                  buf[i*2+0] = *p;
                                 buf[i*2+1] = *(p+0x800);                                  buf[i*2+1] = *(p+0x800);
                         }                          }
                         i286_memstr_write(seg, off + 2, buf, 32);                          MEMR_WRITES(seg, off + 2, buf, 32);
                         break;                          break;
         }          }
         i286_memword_write(seg, off, size);          MEMR_WRITE16(seg, off, size);
         return(size);          return(size);
 }  }
   
 static void bios0x18_1a(REG16 seg, REG16 off, REG16 code) {  static void bios0x18_1a(REG16 seg, REG16 off, REG16 code) {
   
         BYTE    *p;          UINT8   *p;
         BYTE    buf[32];          UINT8   buf[32];
         UINT    i;          UINT    i;
   
         if (((code >> 8) & 0x7e) == 0x76) {          if (((code >> 8) & 0x7e) == 0x76) {
                 i286_memstr_read(seg, off + 2, buf, 32);                  MEMR_READS(seg, off + 2, buf, 32);
                 p = fontrom;                  p = fontrom;
                 p += (code & 0x7f) << 12;                  p += (code & 0x7f) << 12;
                 p += (((code >> 8) - 0x20) & 0x7f) << 4;                  p += (((code >> 8) - 0x20) & 0x7f) << 4;
Line 284  void bios0x18_16(REG8 chr, REG8 atr) { Line 290  void bios0x18_16(REG8 chr, REG8 atr) {
 // ---- 31khz  // ---- 31khz
   
 #if defined(SUPPORT_CRT31KHZ)  #if defined(SUPPORT_CRT31KHZ)
 static REG8 bios0x18_30(REG8 mode, REG8 scrn) {  static REG8 bios0x18_30(REG8 rate, REG8 scrn) {
   
         int                     crt;          int                     crt;
         int                     master;          int                     master;
         int                     slave;          int                     slave;
 const CRTDATA   *p;  const CRTDATA   *p;
   
         if (((mode & 0xf8) != 0x08) || (scrn & (~0x33)) || ((scrn & 3) == 3)) {          if (((rate & 0xf8) != 0x08) || (scrn & (~0x33)) || ((scrn & 3) == 3)) {
                 return(1);                  return(0);
         }          }
         if ((scrn & 0x30) == 0x30) {                            // 640x480          if ((scrn & 0x30) == 0x30) {                            // 640x480
 #if defined(SUPPORT_PC9821)  #if defined(SUPPORT_PC9821)
                 if (mode & 4) {                  if (rate & 4) {
                         gdc_analogext(TRUE);                          gdc_analogext(TRUE);
                         mem[MEMB_PRXDUPD] |= 0x80;                          mem[MEMB_PRXDUPD] |= 0x80;
                         crt = 4;                          crt = 4;
                         master = 3;                          master = 3 + (scrn & 3);
                         slave = 1;                          slave = 1;
                         gdc.display |= 0x10;                          gdc.analog |= (1 << GDCANALOG_256E);
                 }                  }
                 else                  else
 #endif  #endif
                 return(1);                  return(0);
         }          }
         else {          else {
                 if ((scrn & 3) >= 2) {                  if ((scrn & 3) >= 2) {
                         return(1);                          return(0);
                 }                  }
                 if (mode & 4) {                                                 // 31khz                  if (rate & 4) {                                                 // 31khz
                         crt = 2;                          crt = 2;
                         master = 2;                          master = 2;
                         slave = 4;                          slave = 4;
Line 335  const CRTDATA *p; Line 341  const CRTDATA *p;
                         gdc_analogext(FALSE);                          gdc_analogext(FALSE);
                         mem[MEMB_PRXDUPD] &= ~0x80;                          mem[MEMB_PRXDUPD] &= ~0x80;
                 }                  }
                   gdc.analog &= ~(1 << (GDCANALOG_256E));
 #endif  #endif
         }          }
         crt += (scrn & 3);          crt += (scrn & 3);
         master += (scrn & 3);  
   
         if (mode & 4) {          if (rate & 4) {
                 gdc.display |= (1 << GDCDISP_31);                  gdc.display |= (1 << GDCDISP_31);
         }          }
         else {          else {
Line 348  const CRTDATA *p; Line 354  const CRTDATA *p;
         }          }
   
         CopyMemory(gdc.m.para + GDC_SYNC, gdcmastersync[master], 8);          CopyMemory(gdc.m.para + GDC_SYNC, gdcmastersync[master], 8);
         ZeroMemory(gdc.m.para + GDC_SCROLL, 8);          ZeroMemory(gdc.m.para + GDC_SCROLL, 4);
         gdc.m.para[GDC_PITCH] = 80;          gdc.m.para[GDC_PITCH] = 80;
   
         p = crtdata + crt;          p = crtdata + crt;
Line 363  const CRTDATA *p; Line 369  const CRTDATA *p;
         crtc.reg.sdr = 0;          crtc.reg.sdr = 0;
   
         CopyMemory(gdc.s.para + GDC_SYNC, gdcslavesync[slave], 8);          CopyMemory(gdc.s.para + GDC_SYNC, gdcslavesync[slave], 8);
         ZeroMemory(gdc.s.para + GDC_SCROLL, 8);          ZeroMemory(gdc.s.para + GDC_SCROLL, 4);
         if (slave & 1) {          if (slave & 1) {
                 gdc.s.para[GDC_PITCH] = 80;                  gdc.s.para[GDC_PITCH] = 80;
                 gdc.clock |= 3;                  gdc.clock |= 3;
                 mem[MEMB_PRXDUPD] |= 0x04;                  mem[MEMB_PRXDUPD] |= 0x04;
                   gdc.s.para[GDC_SCROLL+3] = 0x40;
         }          }
         else {          else {
                 gdc.s.para[GDC_PITCH] = 40;                  gdc.s.para[GDC_PITCH] = 40;
Line 389  const CRTDATA *p; Line 396  const CRTDATA *p;
   
         gdcs.textdisp &= ~GDCSCRN_ENABLE;          gdcs.textdisp &= ~GDCSCRN_ENABLE;
         gdcs.textdisp |= GDCSCRN_EXT | GDCSCRN_ALLDRAW2;          gdcs.textdisp |= GDCSCRN_EXT | GDCSCRN_ALLDRAW2;
         gdcs.grphdisp &= ~GDCSCRN_ENABLE;  
         gdcs.grphdisp |= GDCSCRN_EXT | GDCSCRN_ALLDRAW2;          gdcs.grphdisp |= GDCSCRN_EXT | GDCSCRN_ALLDRAW2;
         screenupdate |= 2;          pcstat.screenupdate |= 2;
   
         mem[0x597] &= ~3;          mem[0x597] &= ~3;
         mem[0x597] |= (scrn >> 4) & 3;          mem[0x597] |= (scrn >> 4) & 3;
Line 402  const CRTDATA *p; Line 408  const CRTDATA *p;
         if (scrn & 2) {          if (scrn & 2) {
                 mem[MEMB_CRT_STS_FLAG] |= 0x10;                  mem[MEMB_CRT_STS_FLAG] |= 0x10;
         }          }
         return(0);          return(5);                      // 最後にGDCへ送ったデータ…
 }  }
   
 static REG8 bios0x18_31al(void) {  static REG8 bios0x18_31al(void) {
   
         UINT8   mode;          UINT8   rate;
   
         mode = 0x08 + ((gdc.display >> (GDCDISP_31 - 5)) & 4);          rate = 0x08 + ((gdc.display >> (GDCDISP_31 - 5)) & 4);
         return(mode);          return(rate);
 }  }
   
 static REG8 bios0x18_31bh(void) {  static REG8 bios0x18_31bh(void) {
Line 436  void bios0x18_40(void) { Line 442  void bios0x18_40(void) {
         gdc_forceready(GDCWORK_SLAVE);          gdc_forceready(GDCWORK_SLAVE);
         if (!(gdcs.grphdisp & GDCSCRN_ENABLE)) {          if (!(gdcs.grphdisp & GDCSCRN_ENABLE)) {
                 gdcs.grphdisp |= GDCSCRN_ENABLE;                  gdcs.grphdisp |= GDCSCRN_ENABLE;
                 screenupdate |= 2;                  pcstat.screenupdate |= 2;
         }          }
         mem[MEMB_PRXCRT] |= 0x80;          mem[MEMB_PRXCRT] |= 0x80;
 }  }
Line 446  void bios0x18_41(void) { Line 452  void bios0x18_41(void) {
         gdc_forceready(GDCWORK_SLAVE);          gdc_forceready(GDCWORK_SLAVE);
         if (gdcs.grphdisp & GDCSCRN_ENABLE) {          if (gdcs.grphdisp & GDCSCRN_ENABLE) {
                 gdcs.grphdisp &= ~(GDCSCRN_ENABLE);                  gdcs.grphdisp &= ~(GDCSCRN_ENABLE);
                 screenupdate |= 2;                  pcstat.screenupdate |= 2;
         }          }
         mem[MEMB_PRXCRT] &= 0x7f;          mem[MEMB_PRXCRT] &= 0x7f;
 }  }
Line 454  void bios0x18_41(void) { Line 460  void bios0x18_41(void) {
 void bios0x18_42(REG8 mode) {  void bios0x18_42(REG8 mode) {
   
         UINT8   crtmode;          UINT8   crtmode;
   #if defined(SUPPORT_CRT31KHZ)
           UINT8   rate;
           UINT8   scrn;
   #endif
           int             slave;
   
         gdc_forceready(GDCWORK_MASTER);          gdc_forceready(GDCWORK_MASTER);
         gdc_forceready(GDCWORK_SLAVE);          gdc_forceready(GDCWORK_SLAVE);
   
         crtmode = modenum[mode >> 6];          crtmode = modenum[mode >> 6];
 #if defined(SUPPORT_CRT31KHZ)  #if defined(SUPPORT_CRT31KHZ)
         if (mem[MEMB_CRT_BIOS] & 0x80) {          rate = bios0x18_31al();
                 bios0x18_30(bios0x18_31al(), (crtmode << 4) + (bios0x18_31bh() & 3));          scrn = bios0x18_31bh();
           if ((mem[MEMB_CRT_BIOS] & 0x80) &&
                   (((scrn & 0x30) == 0x30) || (crtmode == 3))) {
                   bios0x18_30(rate, (REG8)((crtmode << 4) + 1));
         }          }
         else {          else {
                 mem[MEMB_CRT_BIOS] &= ~3;  
                 mem[MEMB_CRT_BIOS] |= crtmode;  
 #endif  #endif
                 ZeroMemory(gdc.s.para + GDC_SCROLL, 8);                  ZeroMemory(gdc.s.para + GDC_SCROLL, 4);
                 if (crtmode == 2) {                                                     // ALL                  if (crtmode == 2) {                                                     // ALL
                         crtmode = 2;                          crtmode = 2;
                         if ((mem[MEMB_PRXDUPD] & 0x24) == 0x20) {                          if ((mem[MEMB_PRXDUPD] & 0x24) == 0x20) {
                                 mem[MEMB_PRXDUPD] ^= 4;                                  mem[MEMB_PRXDUPD] ^= 4;
                                 gdc.clock |= 3;                                  gdc.clock |= 3;
                                 CopyMemory(gdc.s.para + GDC_SYNC, sync400m, 8);                                  CopyMemory(gdc.s.para + GDC_SYNC, gdcslavesync[3], 8);
                                 gdc.s.para[GDC_PITCH] = 80;                                  gdc.s.para[GDC_PITCH] = 80;
                                 gdcs.grphdisp |= GDCSCRN_EXT;                                  gdcs.grphdisp |= GDCSCRN_EXT;
                                 mem[MEMB_PRXDUPD] |= 0x08;                                  mem[MEMB_PRXDUPD] |= 0x08;
                         }                          }
                 }                  }
                 else {                  else {
                         crtmode &= 1;  
                         if ((mem[MEMB_PRXDUPD] & 0x24) == 0x24) {                          if ((mem[MEMB_PRXDUPD] & 0x24) == 0x24) {
                                 mem[MEMB_PRXDUPD] ^= 4;                                  mem[MEMB_PRXDUPD] ^= 4;
                                 gdc.clock &= ~3;                                  gdc.clock &= ~3;
                                 CopyMemory(gdc.s.para + GDC_SYNC,  #if defined(SUPPORT_CRT31KHZ)
                                                         (mem[MEMB_PRXCRT] & 0x40)?sync200m:sync200l, 8);                                  if (rate & 4) slave = 4;
                                   else
   #endif
                                   slave = (mem[MEMB_PRXCRT] & 0x40)?2:0;
                                   CopyMemory(gdc.s.para + GDC_SYNC, gdcslavesync[slave], 8);
                                 gdc.s.para[GDC_PITCH] = 40;                                  gdc.s.para[GDC_PITCH] = 40;
                                 gdcs.grphdisp |= GDCSCRN_EXT;                                  gdcs.grphdisp |= GDCSCRN_EXT;
                                 mem[MEMB_PRXDUPD] |= 0x08;                                  mem[MEMB_PRXDUPD] |= 0x08;
                         }                          }
                         if (crtmode == 1) {                             // UPPER                          if (crtmode & 1) {                              // UPPER
                                 gdc.s.para[GDC_SCROLL+0] = (200*40) & 0xff;                                  gdc.s.para[GDC_SCROLL+0] = (200*40) & 0xff;
                                 gdc.s.para[GDC_SCROLL+1] = (200*40) >> 8;                                  gdc.s.para[GDC_SCROLL+1] = (200*40) >> 8;
                         }                          }
                 }                  }
                   if (mem[MEMB_PRXDUPD] & 4) {
                           gdc.s.para[GDC_SCROLL+3] = 0x40;
                   }
                 if ((crtmode == 2) || (!(mem[MEMB_PRXCRT] & 0x40))) {                  if ((crtmode == 2) || (!(mem[MEMB_PRXCRT] & 0x40))) {
                         gdc.mode1 &= ~(0x10);                          gdc.mode1 &= ~(0x10);
                         gdc.s.para[GDC_CSRFORM] = 0;                          gdc.s.para[GDC_CSRFORM] = 0;
Line 504  void bios0x18_42(REG8 mode) { Line 522  void bios0x18_42(REG8 mode) {
                         gdc.s.para[GDC_CSRFORM] = 1;                          gdc.s.para[GDC_CSRFORM] = 1;
                 }                  }
 #if defined(SUPPORT_CRT31KHZ)  #if defined(SUPPORT_CRT31KHZ)
                   mem[MEMB_CRT_BIOS] &= ~3;
                   mem[MEMB_CRT_BIOS] |= crtmode;
         }          }
 #endif  #endif
         if (crtmode != 3) {          if (crtmode != 3) {
                 gdcs.disp = (mode >> 4) & 1;                  gdcs.disp = (mode >> 4) & 1;
         }          }
         if (!(mode & 0x20)) {          if (!(mode & 0x20)) {
                 gdc.mode1 &= ~0x04;                  gdc.mode2 &= ~0x04;
         }          }
         else {          else {
                 gdc.mode2 |= 0x04;                  gdc.mode2 |= 0x04;
         }          }
           gdcs.mode2 = gdc.mode2;
         gdcs.grphdisp |= GDCSCRN_ALLDRAW2;          gdcs.grphdisp |= GDCSCRN_ALLDRAW2;
         screenupdate |= 2;          pcstat.screenupdate |= 2;
 }  }
   
 static void setbiosgdc(UINT32 csrw, const GDCVECT *vect, UINT8 ope) {  static void setbiosgdc(UINT32 csrw, const GDCVECT *vect, UINT8 ope) {
   
         gdc.s.para[GDC_CSRW + 0] = (BYTE)csrw;          gdc.s.para[GDC_CSRW + 0] = (UINT8)csrw;
         gdc.s.para[GDC_CSRW + 1] = (BYTE)(csrw >> 8);          gdc.s.para[GDC_CSRW + 1] = (UINT8)(csrw >> 8);
         gdc.s.para[GDC_CSRW + 2] = (BYTE)(csrw >> 16);          gdc.s.para[GDC_CSRW + 2] = (UINT8)(csrw >> 16);
   
         gdc.s.para[GDC_VECTW] = vect->ope;          gdc.s.para[GDC_VECTW] = vect->ope;
         gdc_vectreset(&gdc.s);          gdc_vectreset(&gdc.s);
Line 551  static void bios0x18_47(void) { Line 572  static void bios0x18_47(void) {
         SINT16          dy;          SINT16          dy;
   
         gdc_forceready(GDCWORK_SLAVE);          gdc_forceready(GDCWORK_SLAVE);
         i286_memstr_read(CPU_DS, CPU_BX, &ucw, sizeof(ucw));          MEMR_READS(CPU_DS, CPU_BX, &ucw, sizeof(ucw));
         GBSX1 = LOADINTELWORD(ucw.GBSX1);          GBSX1 = LOADINTELWORD(ucw.GBSX1);
         GBSY1 = LOADINTELWORD(ucw.GBSY1);          GBSY1 = LOADINTELWORD(ucw.GBSY1);
         GBSX2 = LOADINTELWORD(ucw.GBSX2);          GBSX2 = LOADINTELWORD(ucw.GBSX2);
Line 610  static void bios0x18_47(void) { Line 631  static void bios0x18_47(void) {
                 vect.ope = 0x20 + (ucw.GBDSP & 7);                  vect.ope = 0x20 + (ucw.GBDSP & 7);
                 vect.DC[0] = ucw.GBLNG1[0];                  vect.DC[0] = ucw.GBLNG1[0];
                 vect.DC[1] = ucw.GBLNG1[1];                  vect.DC[1] = ucw.GBLNG1[1];
                 data = LOADINTELWORD(ucw.GBLNG2) - 1;  //              data = LOADINTELWORD(ucw.GBLNG2) - 1;
                   data = LOADINTELWORD(ucw.GBCIR) - 1;
                 STOREINTELWORD(vect.D, data);                  STOREINTELWORD(vect.D, data);
                 data >>= 1;                  data >>= 1;
                 STOREINTELWORD(vect.D2, data);                  STOREINTELWORD(vect.D2, data);
Line 652  static void bios0x18_49(void) { Line 674  static void bios0x18_49(void) {
   
         UCWTBL          ucw;          UCWTBL          ucw;
         UINT            i;          UINT            i;
         BYTE            pat[8];          UINT8           pat[8];
         UINT16          tmp;          UINT16          tmp;
         GDCVECT         vect;          GDCVECT         vect;
         UINT16          GBSX1;          UINT16          GBSX1;
Line 662  static void bios0x18_49(void) { Line 684  static void bios0x18_49(void) {
   
         gdc_forceready(GDCWORK_SLAVE);          gdc_forceready(GDCWORK_SLAVE);
   
         i286_memstr_read(CPU_DS, CPU_BX, &ucw, sizeof(ucw));          MEMR_READS(CPU_DS, CPU_BX, &ucw, sizeof(ucw));
         for (i=0; i<8; i++) {          for (i=0; i<8; i++) {
                 mem[MEMW_PRXGLS + i] = ucw.GBMDOTI[i];                  mem[MEMW_PRXGLS + i] = ucw.GBMDOTI[i];
                 pat[i] = GDCPATREVERSE(ucw.GBMDOTI[i]);                  pat[i] = GDCPATREVERSE(ucw.GBMDOTI[i]);
Line 737  void bios0x18(void) { Line 759  void bios0x18(void) {
   
         union {          union {
                 BOOL    b;                  BOOL    b;
                   REG8    r8;
                 UINT16  w;                  UINT16  w;
                 UINT32  d;                  UINT32  d;
                 UINT8   col[4];                  UINT8   col[4];
Line 745  void bios0x18(void) { Line 768  void bios0x18(void) {
   
 #if 0  #if 0
         TRACEOUT(("int18 AX=%.4x %.4x:%.4x", CPU_AX,          TRACEOUT(("int18 AX=%.4x %.4x:%.4x", CPU_AX,
                                                         i286_memword_read(CPU_SS, CPU_SP+2),                                                          MEMR_READ16(CPU_SS, CPU_SP+2),
                                                         i286_memword_read(CPU_SS, CPU_SP)));                                                          MEMR_READ16(CPU_SS, CPU_SP)));
 #endif  #endif
   
         sti_waiting ^= 1;  
         if (sti_waiting) {                                      // 割込み許可の遊び  
                 CPU_STI;  
                 if (PICEXISTINTR) {  
                         CPU_IP--;  
                         nevent_forceexit();  
                         return;  
                 }  
         }  
         sti_waiting = 0;  
   
         switch(CPU_AH) {          switch(CPU_AH) {
                 case 0x00:                                              // キー・データの読みだし                  case 0x00:                                              // キー・データの読みだし
                         if (mem[MEMB_KB_COUNT]) {                          if (mem[MEMB_KB_COUNT]) {
Line 792  void bios0x18(void) { Line 804  void bios0x18(void) {
                         break;                          break;
   
                 case 0x04:                                              // キー入力状態のセンス                  case 0x04:                                              // キー入力状態のセンス
                         CPU_AH = mem[0x00052a + (CPU_AL & 0x0f)];                          CPU_AH = mem[MEMX_KB_KY_STS + (CPU_AL & 0x0f)];
                         break;                          break;
   
                 case 0x05:                                              // キー入力センス                  case 0x05:                                              // キー入力センス
Line 814  void bios0x18(void) { Line 826  void bios0x18(void) {
                         break;                          break;
   
                 case 0x0c:                                              // テキスト画面の表示開始                  case 0x0c:                                              // テキスト画面の表示開始
                         if (!(gdcs.textdisp & GDCSCRN_ENABLE)) {                          bios0x18_0c();
                                 gdcs.textdisp |= GDCSCRN_ENABLE;  
                                 screenupdate |= 2;  
                         }  
                         break;                          break;
   
                 case 0x0d:                                              // テキスト画面の表示終了                  case 0x0d:                                              // テキスト画面の表示終了
                         if (gdcs.textdisp & GDCSCRN_ENABLE) {                          if (gdcs.textdisp & GDCSCRN_ENABLE) {
                                 gdcs.textdisp &= ~(GDCSCRN_ENABLE);                                  gdcs.textdisp &= ~(GDCSCRN_ENABLE);
                                 screenupdate |= 2;                                  pcstat.screenupdate |= 2;
                         }                          }
                         break;                          break;
   
Line 840  void bios0x18(void) { Line 849  void bios0x18(void) {
                         SETBIOSMEM16(MEMW_CRT_W_RASTER, tmp.w);                          SETBIOSMEM16(MEMW_CRT_W_RASTER, tmp.w);
                         STOREINTELWORD(gdc.m.para + GDC_SCROLL + 2, tmp.w);                          STOREINTELWORD(gdc.m.para + GDC_SCROLL + 2, tmp.w);
                         gdcs.textdisp |= GDCSCRN_ALLDRAW2;                          gdcs.textdisp |= GDCSCRN_ALLDRAW2;
 //                      screenupdate |= 2;  //                      pcstat.screenupdate |= 2;
                         break;                          break;
   
                 case 0x0f:                                              // 複数の表示領域の設定                  case 0x0f:                                              // 複数の表示領域の設定
Line 924  void bios0x18(void) { Line 933  void bios0x18(void) {
                         if (mem[MEMB_CRT_BIOS] & 0x80) {                          if (mem[MEMB_CRT_BIOS] & 0x80) {
                                 gdc_forceready(GDCWORK_MASTER);                                  gdc_forceready(GDCWORK_MASTER);
                                 gdc_forceready(GDCWORK_SLAVE);                                  gdc_forceready(GDCWORK_SLAVE);
                                 CPU_AL = bios0x18_30(CPU_AL, CPU_BH);                                  tmp.r8 = bios0x18_30(CPU_AL, CPU_BH);
                                   CPU_AH = tmp.r8;
                                   if (tmp.r8 == 0x05) {
                                           CPU_AL = 0;
                                           CPU_BH = 0;
                                   }
                                   else {
                                           CPU_AL = 1;
                                           CPU_BH = 1;
                                   }
                         }                          }
                         break;                          break;
   
Line 948  void bios0x18(void) { Line 966  void bios0x18(void) {
                         break;                          break;
   
                 case 0x43:                                              // パレットの設定                  case 0x43:                                              // パレットの設定
                         i286_memstr_read(CPU_DS, CPU_BX + offsetof(UCWTBL, GBCPC),                          MEMR_READS(CPU_DS, CPU_BX + offsetof(UCWTBL, GBCPC), tmp.col, 4);
                                                                                                                                 tmp.col, 4);  
                         for (i=0; i<4; i++) {                          for (i=0; i<4; i++) {
                                 gdc_setdegitalpal(6 - (i*2), (REG8)(tmp.col[i] >> 4));                                  gdc_setdegitalpal(6 - (i*2), (REG8)(tmp.col[i] >> 4));
                                 gdc_setdegitalpal(7 - (i*2), (REG8)(tmp.col[i] & 15));                                  gdc_setdegitalpal(7 - (i*2), (REG8)(tmp.col[i] & 15));
Line 958  void bios0x18(void) { Line 975  void bios0x18(void) {
   
                 case 0x44:                                              // ボーダカラーの設定                  case 0x44:                                              // ボーダカラーの設定
 //                      if (!(mem[MEMB_PRXCRT] & 0x40)) {  //                      if (!(mem[MEMB_PRXCRT] & 0x40)) {
 //                              color = i286_membyte_read(CPU_DS, CPU_BX + 1);  //                              color = MEMR_READ8(CPU_DS, CPU_BX + 1);
 //                      }  //                      }
                         break;                          break;
   

Removed from v.1.27  
changed lines
  Added in v.1.45


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