--- np2/lio/gput1.c 2004/02/21 00:25:33 1.7 +++ np2/lio/gput1.c 2004/02/21 20:48:52 1.10 @@ -321,7 +321,7 @@ const BYTE *src; // ---- -static REG8 putsub(LIOWORK lio, const LIOPUT *lput) { +static REG8 putsub(GLIO lio, const LIOPUT *lput) { UINT addr; PUTCNTX pt; @@ -334,8 +334,8 @@ static REG8 putsub(LIOWORK lio, const LI if ((lput->x < lio->draw.x1) || (lput->y < lio->draw.y1) || - ((lput->x + lput->width) > lio->draw.x2) || - ((lput->y + lput->height) > lio->draw.y2)) { + ((lput->x + lput->width - 1) > lio->draw.x2) || + ((lput->y + lput->height - 1) > lio->draw.y2)) { return(LIO_ILLEGALFUNC); } if ((lput->width <= 0) || (lput->height <= 0)) { @@ -343,11 +343,12 @@ static REG8 putsub(LIOWORK lio, const LI } addr = (lput->x >> 3) + (lput->y * 80); - if (lio->scrn.top) { + if (lio->draw.flag & LIODRAW_UPPER) { addr += 16000; } setdirty(addr, (lput->x & 7) + lput->width, lput->height, lio->draw.sbit); + pt.addr = addr; pt.sft = lput->x & 7; pt.width = lput->width; pt.maskl = (UINT8)(0xff >> pt.sft); @@ -357,29 +358,32 @@ static REG8 putsub(LIOWORK lio, const LI datacnt = (lput->width + 7) >> 3; off = lput->off; - flag = (lio->gcolor1.palmode == 2)?0x0f:0x07; + flag = (lio->draw.flag & LIODRAW_4BPP)?0x0f:0x07; flag |= (lput->fg & 15) << 4; flag |= (lput->bg & 15) << 8; // さて表示。 writecnt = 0; - for (pl=0; pl<4; pl++) { - if (flag & 1) { - pt.baseptr = mem + lio->draw.base + lioplaneadrs[pl]; - pt.addr = addr; - height = lput->height; - do { + height = lput->height; + do { + flag <<= 4; + for (pl=0; pl<4; pl++) { + flag >>= 1; + if (flag & 8) { + pt.baseptr = mem + lio->draw.base + lioplaneadrs[pl]; i286_memstr_read(lput->seg, off, pt.pat, datacnt); - off += datacnt; + if (lput->sw) { + off += datacnt; + } switch(lput->mode) { case 0: // PSET - if (flag & (1 << 4)) { + if (flag & (8 << 4)) { putor(&pt); } else { putandn(&pt); } - if (flag & (1 << 8)) { + if (flag & (8 << 8)) { putorn(&pt); } else { @@ -389,13 +393,13 @@ static REG8 putsub(LIOWORK lio, const LI break; case 1: // NOT - if (!(flag & (1 << 4))) { + if (!(flag & (8 << 4))) { putor(&pt); } else { putandn(&pt); } - if (!(flag & (1 << 8))) { + if (!(flag & (8 << 8))) { putorn(&pt); } else { @@ -405,46 +409,45 @@ static REG8 putsub(LIOWORK lio, const LI break; case 2: // OR - if (flag & (1 << 4)) { + if (flag & (8 << 4)) { putor(&pt); writecnt++; } - if (flag & (1 << 8)) { + if (flag & (8 << 8)) { putorn(&pt); writecnt++; } break; case 3: // AND - if (!(flag & (1 << 4))) { + if (!(flag & (8 << 4))) { putandn(&pt); writecnt++; } - if (!(flag & (1 << 8))) { + if (!(flag & (8 << 8))) { putand(&pt); writecnt++; } break; case 4: // XOR - if (flag & (1 << 4)) { + if (flag & (8 << 4)) { putxor(&pt); writecnt++; } - if (flag & (1 << 8)) { + if (flag & (8 << 8)) { putxorn(&pt); writecnt++; } break; } - pt.addr += 80; - } while(--height); - if (!lput->sw) { - off = lput->off; } } - flag >>= 1; - } + pt.addr += 80; + if (!lput->sw) { + off += datacnt; + } + } while(--height); lio->wait += writecnt * datacnt * (10 + 10 + 10); return(LIO_SUCCESS); } @@ -452,7 +455,7 @@ static REG8 putsub(LIOWORK lio, const LI // ---- GGET -REG8 lio_gget(LIOWORK lio) { +REG8 lio_gget(GLIO lio) { GGET dat; SINT32 x; @@ -465,11 +468,9 @@ REG8 lio_gget(LIOWORK lio) { UINT32 size; UINT datacnt; UINT mask; - UINT addr; GETCNTX gt; BYTE pat[84]; UINT pl; - UINT height; lio_updatedraw(lio); i286_memstr_read(CPU_DS, CPU_BX, &dat, sizeof(dat)); @@ -492,8 +493,8 @@ REG8 lio_gget(LIOWORK lio) { datacnt = (x2 + 7) >> 3; size = datacnt * y2; leng = LOADINTELWORD(dat.leng); - if (lio->scrn.plane & 0x80) { - if (lio->gcolor1.palmode == 2) { + if (!(lio->draw.flag & LIODRAW_MONO)) { + if (lio->draw.flag & LIODRAW_4BPP) { size *= 4; mask = 0x0f; } @@ -503,7 +504,7 @@ REG8 lio_gget(LIOWORK lio) { } } else { - mask = 1 << (lio->scrn.plane & 3); + mask = 1 << (lio->draw.flag & LIODRAW_PMASK); } if (leng < (size + 4)) { return(LIO_ILLEGALFUNC); @@ -511,27 +512,26 @@ REG8 lio_gget(LIOWORK lio) { i286_memword_write(seg, off, (REG16)x2); i286_memword_write(seg, off+2, (REG16)y2); off += 4; - addr = (x >> 3) + (y * 80); - if (lio->scrn.top) { - addr += 16000; + gt.addr = (x >> 3) + (y * 80); + if (lio->draw.flag & LIODRAW_UPPER) { + gt.addr += 16000; } gt.sft = x & 7; gt.width = x2; gt.mask = (UINT8)((~0x7f) >> ((x2 - 1) & 7)); - for (pl=0; pl<4; pl++) { - if (mask & 1) { - gt.baseptr = mem + lio->draw.base + lioplaneadrs[pl]; - gt.addr = addr; - height = y2; - do { + do { + mask <<= 4; + for (pl=0; pl<4; pl++) { + mask >>= 1; + if (mask & 8) { + gt.baseptr = mem + lio->draw.base + lioplaneadrs[pl]; getvram(>, pat); - gt.addr += 80; i286_memstr_write(seg, off, pat, datacnt); off += datacnt; - } while(--height); + } } - mask >>= 1; - } + gt.addr += 80; + } while(--y2); lio->wait = size * 12; return(LIO_SUCCESS); } @@ -539,7 +539,7 @@ REG8 lio_gget(LIOWORK lio) { // ---- GPUT1 -REG8 lio_gput1(LIOWORK lio) { +REG8 lio_gput1(GLIO lio) { GPUT1 dat; LIOPUT lput; @@ -567,8 +567,8 @@ REG8 lio_gput1(LIOWORK lio) { lput.bg = dat.bg; } else { - lput.fg = lio->gcolor1.fgcolor; - lput.bg = lio->gcolor1.bgcolor; + lput.fg = lio->work.fgcolor; + lput.bg = lio->work.bgcolor; } } else { @@ -583,14 +583,13 @@ REG8 lio_gput1(LIOWORK lio) { lput.bg = 0; } } - TRACEOUT(("put1 - %d,%d / %d / %d %d %d", lput.width, lput.height, lput.mode, lput.sw, lput.fg, lput.bg)); return(putsub(lio, &lput)); } // ---- GPUT2 -REG8 lio_gput2(LIOWORK lio) { +REG8 lio_gput2(GLIO lio) { GPUT2 dat; LIOPUT lput; @@ -622,8 +621,8 @@ REG8 lio_gput2(LIOWORK lio) { lput.bg = dat.bg; } else { - lput.fg = lio->gcolor1.fgcolor; - lput.bg = lio->gcolor1.bgcolor; + lput.fg = lio->work.fgcolor; + lput.bg = lio->work.bgcolor; } return(putsub(lio, &lput)); }