Diff for /xmil/vram/makescrn.c between versions 1.9 and 1.15

version 1.9, 2004/08/12 20:09:42 version 1.15, 2004/08/18 09:17:56
Line 1 Line 1
 #include        "compiler.h"  #include        "compiler.h"
 #include        "scrnmng.h"  #include        "scrnmng.h"
   #include        "sysmng.h"
 #include        "pccore.h"  #include        "pccore.h"
 #include        "iocore.h"  #include        "iocore.h"
 #include        "vram.h"  #include        "vram.h"
Line 9 Line 10
 #include        "makesub.h"  #include        "makesub.h"
   
   
                 MAKESCRN        makescrn;          MAKESCRN        makescrn;
   
                 BYTE    scrnallflash;          UINT8   scrnallflash;
 static  BYTE    lastdisp = 0;          UINT    drawtime = 0;
 static  BYTE    blinktime = 1;  
                 UINT    drawtime = 0;  
   
   
 static void fillupdatetmp(void) {  static void fillupdatetmp(void) {
Line 101  static BRESULT updateblink(void) { Line 100  static BRESULT updateblink(void) {
         REG8    update;          REG8    update;
         UINT    r;          UINT    r;
   
         if (blinktime) {          if (makescrn.blinktime) {
                 blinktime--;                  makescrn.blinktime--;
                 return(FALSE);                  return(FALSE);
         }          }
         else {          else {
                 blinktime = 30 - 1;                  makescrn.blinktime = 30 - 1;
                 pos = makescrn.vramtop;                  pos = makescrn.vramtop;
                 makescrn.blinktest ^= 0x10;                  makescrn.blinktest ^= 0x10;
                 update = 0;                  update = 0;
Line 132  static BRESULT updateblink(void) { Line 131  static BRESULT updateblink(void) {
   
 // ----  // ----
   
   typedef void (*MAKEFN)(void);
   
   static void width_dummy(void) { }
   
   static const UINT8 screendraw[] = {
                                   MAKESCRN_320x200S,      MAKESCRN_320x400,
                                   MAKESCRN_320x200S,      MAKESCRN_320x400,
                                   MAKESCRN_320x200S,      MAKESCRN_320x400,
                                   MAKESCRN_320x200S,      MAKESCRN_320x200H,
   
                                   MAKESCRN_320x200S,      MAKESCRN_320x400,
                                   MAKESCRN_320x200S,      MAKESCRN_320x400,
                                   MAKESCRN_320x200S,      MAKESCRN_320x200H,
                                   MAKESCRN_320x200S,      MAKESCRN_320x200H,
   
   #if defined(SUPPORT_TURBOZ)
                                   MAKESCRN_320x200H,      MAKESCRN_320x200H,
                                   MAKESCRN_320x200H,      MAKESCRN_320x200H,
                                   MAKESCRN_320x200H,      MAKESCRN_320x200H,
                                   MAKESCRN_320x200H,      MAKESCRN_320x200H,
   
                                   MAKESCRN_320x200H,      MAKESCRN_320x200H,
                                   MAKESCRN_320x200H,      MAKESCRN_320x200H,
                                   MAKESCRN_320x200H,      MAKESCRN_320x200H,
                                   MAKESCRN_320x200H,      MAKESCRN_320x200H,
   #endif
   };
   
   static const MAKEFN screenmake[] = {
                                   width80x25_200l,        width80x25_400h,
                                   width80x25_200l,        width80x25_200h,
                                   width80x12_200l,        width80x12_400h,
                                   width80x12_200l,        width80x12_200h,
   
                                   width80x20l,            width80x20h,
                                   width80x20l,            width80x20h,
                                   width80x10l,            width80x10h,
                                   width80x10l,            width80x10h,
   
   #if defined(SUPPORT_TURBOZ)
                                   width_dummy,            width_dummy,
                                   width_dummy,            width_dummy,
                                   width_dummy,            width_dummy,
                                   width_dummy,            width_dummy,
   
                                   width_dummy,            width_dummy,
                                   width_dummy,            width_dummy,
                                   width_dummy,            width_dummy,
                                   width_dummy,            width_dummy,
   #endif
   };
   
   
 static void changemodes(void) {  static void changemodes(void) {
   
         lastdisp = crtc.e.dispmode;          REG8    dispmode;
         if (!(lastdisp & SCRN_BANK1)) {  
           dispmode = crtc.e.dispmode;
           makescrn.dispmode = dispmode;
           makescrn.drawmode = screendraw[dispmode & DISPMODE_MASKMODE];
           if (dispmode & DISPMODE_WIDTH80) {
                   makescrn.drawmode |= 1;
           }
           sysmng_scrnwidth((dispmode & DISPMODE_WIDTH80) == 0);
   
           if (!(dispmode & DISPMODE_BANK1)) {
                 makescrn.disp1 = gram + GRAM_BANK0;                  makescrn.disp1 = gram + GRAM_BANK0;
                 makescrn.disp2 = gram + GRAM_BANK1;                  makescrn.disp2 = gram + GRAM_BANK1;
                 makescrn.dispflag = UPDATE_TRAM | UPDATE_VRAM0;                  makescrn.dispflag = UPDATE_TRAM + UPDATE_VRAM0;
         }          }
         else {          else {
                 makescrn.disp1 = gram + GRAM_BANK1;                  makescrn.disp1 = gram + GRAM_BANK1;
                 makescrn.disp2 = gram + GRAM_BANK0;                  makescrn.disp2 = gram + GRAM_BANK0;
                 makescrn.dispflag = UPDATE_TRAM | UPDATE_VRAM1;                  makescrn.dispflag = UPDATE_TRAM + UPDATE_VRAM1;
         }          }
         scrnallflash = 1;          scrnallflash = 1;
         makescrn.palandply = 1;          makescrn.palandply = 1;
Line 155  static void changecrtc(void) { Line 216  static void changecrtc(void) {
         UINT    scrnymax;          UINT    scrnymax;
         UINT    textxl;          UINT    textxl;
         UINT    surfcx;          UINT    surfcx;
         REG8    widthmode;  
         UINT    fontcy;          UINT    fontcy;
         UINT    underlines;          UINT    underlines;
         REG8    y2;          REG8    y2;
         UINT    charcy;          UINT    charcy;
         UINT    surfcy;          UINT    surfcy;
           UINT    surfsy;
         UINT    x;          UINT    x;
         UINT    y;          UINT    y;
         UINT8   *p;          UINT8   *p;
   
         makescrn.vramtop = crtc.e.pos;          makescrn.vramtop = crtc.e.pos;
   
         scrnxmax = (crtc.s.reg[CRTCREG_HDISP] <= 40)?40:80;          scrnxmax = (makescrn.dispmode & DISPMODE_WIDTH80)?80:40;
         scrnymax = 200;          scrnymax = 200;
         if (crtc.s.reg[CRTCREG_HDISP] <= 40) {  
                 if (lastdisp & SCRN_DRAW4096) {  
                         widthmode = SCRNWIDTHMODE_4096;  
                 }  
                 else {  
                         widthmode = SCRNWIDTHMODE_WIDTH40;  
                 }  
         }  
         else {  
                 widthmode = SCRNWIDTHMODE_WIDTH80;  
         }  
         scrndraw_changewidth(widthmode);  
   
         textxl = crtc.s.reg[CRTCREG_HDISP];          textxl = crtc.s.reg[CRTCREG_HDISP];
         surfcx = min(scrnxmax, textxl);          surfcx = min(scrnxmax, textxl);
   
         fontcy = crtc.e.fonty;          fontcy = crtc.e.fonty;
         underlines = (crtc.s.SCRN_BITS & SCRN_UNDERLINE)?2:0;          underlines = (makescrn.dispmode & DISPMODE_UNDERLINE)?2:0;
         if (fontcy > underlines) {          if (fontcy > underlines) {
                 fontcy -= underlines;                  fontcy -= underlines;
         }          }
         else {          else {
                 fontcy = 0;                  fontcy = 0;
         }          }
         y2 = (crtc.s.SCRN_BITS & SCRN_TEXTYx2)?1:0;          y2 = (makescrn.dispmode & DISPMODE_TEXTYx2)?1:0;
         fontcy >>= y2;          fontcy >>= y2;
 #if 0  #if 0
         if (((dispmode & SCRN64_MASK) != SCRN64_INVALID) && (fontcy > 8)) {          if (((dispmode & SCRN64_MASK) != SCRN64_INVALID) && (fontcy > 8)) {
Line 215  static void changecrtc(void) { Line 264  static void changecrtc(void) {
                 surfcy = crtc.e.yl;                  surfcy = crtc.e.yl;
         }          }
   
           surfsy = charcy * surfcy * 2;
           // ハイドライド3で画面が消えないのでロジックを修正すべし
         x = min(scrnxmax, makescrn.surfcx);          x = min(scrnxmax, makescrn.surfcx);
         if (surfcx < x) {                                                               // 小さくなった          if (surfcx < x) {                                                               // 小さくなった
                 x = (x - surfcx) * 8;                  x = (x - surfcx) * 8;
                 p = screenmap + (surfcx * 8);                  p = screenmap + (surfcx * 8);
                 y = surfcy * 2;                  y = surfsy;
                 while(y) {                  while(y) {
                         y--;                          y--;
                         ZeroMemory(p, x);                          ZeroMemory(p, x);
                         p += SURFACE_WIDTH;                          p += SURFACE_WIDTH;
                 }                  }
         }          }
         if (surfcy < makescrn.surfcy) {          if (surfsy < makescrn.surfsy) {
                 ZeroMemory(screenmap + (SURFACE_WIDTH * surfcy * charcy * 2),                  ZeroMemory(screenmap + (SURFACE_WIDTH * surfsy),
                                         SURFACE_WIDTH * (makescrn.surfcy - surfcy) * charcy * 2);                                                                  SURFACE_WIDTH * (makescrn.surfsy - surfsy));
         }          }
         makescrn.surfcx = surfcx;          makescrn.surfcx = surfcx;
         makescrn.surfrx = textxl - surfcx;          makescrn.surfrx = textxl - surfcx;
         makescrn.surfcy = surfcy;          makescrn.surfcy = surfcy;
           makescrn.surfsy = surfsy;
         makescrn.surfstep = (SURFACE_WIDTH * charcy * 2) - (surfcx * 8);          makescrn.surfstep = (SURFACE_WIDTH * charcy * 2) - (surfcx * 8);
         makescrn.vramsize = min(0x800, surfcy * textxl);          makescrn.vramsize = min(0x800, surfcy * textxl);
 //      scrnmng_setheight(0, charcy * surfcy * 2);  //      scrnmng_setheight(0, charcy * surfcy * 2);
 }  }
   
   
 // -------------------------------------------------------------------------  
   
 typedef void (*DRAWFN)(void);  
   
 static const DRAWFN screendraw[8] = {  
                                 width80x25_200l,        width80x25_400h,  
                                 width80x25_200l,        width80x25_200h,  
                                 width80x12_200l,        width80x12_400h,  
                                 width80x12_200l,        width80x12_200h};  
   
 static const DRAWFN screendraw2[8] = {  
                                 width80x20l,            width80x20h,  
                                 width80x20l,            width80x20h,  
                                 width80x10l,            width80x10h,  
                                 width80x10l,            width80x10h};  
   
   
 void scrnupdate(void) {  void scrnupdate(void) {
   
         BRESULT ddrawflash;          BRESULT ddrawflash;
Line 266  void scrnupdate(void) { Line 300  void scrnupdate(void) {
         }          }
         corestat.drawframe = 0;          corestat.drawframe = 0;
   
         ddrawflash = FALSE;          ddrawflash = makescrn.nextdraw;
         allflash = FALSE;          allflash = FALSE;
         if (lastdisp != crtc.e.dispmode) {          if (makescrn.dispmode != crtc.e.dispmode) {
                   TRACEOUT(("change mode!"));
                 changemodes();                  changemodes();
         }          }
         if (scrnallflash) {          if (scrnallflash) {
                 scrnallflash = 0;                  scrnallflash = 0;
                 fillupdatetmp();  
                 changecrtc();                  changecrtc();
                   TRACEOUT(("flash! %dx%d", makescrn.surfcx, makescrn.surfcy));
                   fillupdatetmp();
                 ddrawflash = TRUE;                  ddrawflash = TRUE;
                 allflash = TRUE;                  allflash = TRUE;
                 makescrn.scrnflash = 1;                  makescrn.scrnflash = 1;
Line 296  void scrnupdate(void) { Line 332  void scrnupdate(void) {
                 makescrn.scrnflash = 0;                  makescrn.scrnflash = 0;
                 if (makescrn.vramsize) {                  if (makescrn.vramsize) {
                         makescrn.fontycnt = 0;                          makescrn.fontycnt = 0;
                           screenmake[makescrn.dispmode & DISPMODE_MASKMODE]();
   #if 0
                         switch(lastdisp & SCRN64_MASK) {                          switch(lastdisp & SCRN64_MASK) {
                                 case SCRN64_320x200:                                  case SCRN64_320x200:
 //                                      width40x25_64s();  //                                      width40x25_64s();
Line 340  void scrnupdate(void) { Line 378  void scrnupdate(void) {
 //                              case SCRN64_INVALID:  //                              case SCRN64_INVALID:
                                 default:                                  default:
                                         if (!(crtc.s.SCRN_BITS & SCRN_UNDERLINE)) {                                          if (!(crtc.s.SCRN_BITS & SCRN_UNDERLINE)) {
                                                 screendraw[crtc.s.SCRN_BITS & 7]();                                                  screenmake[(crtc.s.SCRN_BITS & 7) + 0]();
                                         }                                          }
                                         else {                                          else {
                                                 screendraw2[crtc.s.SCRN_BITS & 7]();                                                  screenmake[(crtc.s.SCRN_BITS & 7) + 8]();
                                         }                                          }
                                         break;                                          break;
                         }                          }
                         ddrawflash = 1;  #endif
                           ddrawflash = TRUE;
                 }                  }
         }          }
   
         if (ddrawflash) {          if (ddrawflash) {
                 ddrawflash = 0;                  makescrn.nextdraw = scrndraw_draw(allflash);
                 scrndraw_draw(allflash);  
                 drawtime++;                  drawtime++;
         }          }
 }  }

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


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