--- xmil/io/ppi.c 2004/08/13 02:16:33 1.14 +++ xmil/io/ppi.c 2004/08/18 08:08:13 1.17 @@ -21,6 +21,9 @@ static REG8 getportb(void) { if (clock < crtc.e.dispclock) { ret |= 0x80; // 1:DISP } + + // 実機の動きを見ると どうも 読み込んだらリセットされるようだ? + // 有効範囲が絞れるならそうすべき(VSYNCを取りこぼすソフトがある clock -= crtc.e.vsyncstart; if ((clock >= 0) && (clock < crtc.e.vpulseclock)) { ret |= 0x04; // 1:V-SYNC @@ -41,28 +44,25 @@ static REG8 getportb(void) { static void setportc(REG8 dat) { - REG8 oldc; - UINT8 xl; + REG8 modify; - oldc = ppi.portc; - if (crtc.s.reg[CRTCREG_HDISP] == 40) { - oldc |= 0x40; - } - else { - oldc &= ~0x40; - } + modify = ppi.portc ^ dat; ppi.portc = dat; - // cmt_write((REG8)(dat & 1)); - if ((oldc & 0x20) && (!(dat & 0x20))) { + if ((modify & 0x20) && (!(dat & 0x20))) { iocore.s.mode = 1; } + if (modify & 0x40) { + crtc_setwidth((REG8)(dat & 0x40)); + } +#if 0 xl = ((dat & 0x40)?40:80); if (crtc.s.reg[CRTCREG_HDISP] != xl) { crtc.s.reg[CRTCREG_HDISP] = (UINT8)xl; crtc_bankupdate(); scrnallflash = 1; } +#endif } @@ -119,14 +119,7 @@ REG8 IOINPCALL ppi_i(UINT port) { return(getportb()); case 2: -#if 1 - if (crtc.s.reg[CRTCREG_HDISP] == 40) { - ppi.portc |= 0x40; - } - else { - ppi.portc &= ~0x40; - } -#endif + // mode? return(ppi.portc); case 3: