|
|
| version 1.7, 2004/02/20 16:20:41 | version 1.8, 2004/02/21 00:25:33 |
|---|---|
| Line 2 | Line 2 |
| #include "cpucore.h" | #include "cpucore.h" |
| #include "pccore.h" | #include "pccore.h" |
| #include "iocore.h" | #include "iocore.h" |
| #include "gdc_sub.h" | |
| #include "bios.h" | #include "bios.h" |
| #include "biosmem.h" | #include "biosmem.h" |
| #include "vram.h" | #include "vram.h" |
| Line 28 void lio_initialize(void) { | Line 29 void lio_initialize(void) { |
| void bios_lio(REG8 cmd) { | void bios_lio(REG8 cmd) { |
| LIOWORK lio; | LIOWORK lio; |
| UINT8 ret; | |
| TRACEOUT(("lio command %.2x", cmd)); | // TRACEOUT(("lio command %.2x", cmd)); |
| lio = &liowork; | lio = &liowork; |
| lio->wait = 500; | lio->wait = 500; |
| switch(cmd) { | switch(cmd) { |
| case 0x00: // a0: GINIT | case 0x00: // a0: GINIT |
| CPU_AH = lio_ginit(lio); | ret = lio_ginit(lio); |
| break; | break; |
| case 0x01: // a1: GSCREEN | case 0x01: // a1: GSCREEN |
| CPU_AH = lio_gscreen(lio); | ret = lio_gscreen(lio); |
| break; | break; |
| case 0x02: // a2: GVIEW | case 0x02: // a2: GVIEW |
| CPU_AH = lio_gview(lio); | ret = lio_gview(lio); |
| break; | break; |
| case 0x03: // a3: GCOLOR1 | case 0x03: // a3: GCOLOR1 |
| CPU_AH = lio_gcolor1(lio); | ret = lio_gcolor1(lio); |
| break; | break; |
| case 0x04: // a4: GCOLOR2 | case 0x04: // a4: GCOLOR2 |
| CPU_AH = lio_gcolor2(lio); | ret = lio_gcolor2(lio); |
| break; | break; |
| case 0x05: // a5: GCLS | case 0x05: // a5: GCLS |
| CPU_AH = lio_gcls(lio); | ret = lio_gcls(lio); |
| break; | break; |
| case 0x06: // a6: GPSET | case 0x06: // a6: GPSET |
| CPU_AH = lio_gpset(lio); | ret = lio_gpset(lio); |
| break; | break; |
| case 0x07: // a7: GLINE | case 0x07: // a7: GLINE |
| CPU_AH = lio_gline(lio); | ret = lio_gline(lio); |
| break; | break; |
| case 0x08: // a8: GCIRCLE | // case 0x08: // a8: GCIRCLE |
| break; | // break; |
| case 0x09: // a9: GPAINT1 | // case 0x09: // a9: GPAINT1 |
| break; | // break; |
| case 0x0a: // aa: GPAINT2 | // case 0x0a: // aa: GPAINT2 |
| break; | // break; |
| case 0x0b: // ab: GGET | case 0x0b: // ab: GGET |
| ret = lio_gget(lio); | |
| break; | break; |
| case 0x0c: // ac: GPUT1 | case 0x0c: // ac: GPUT1 |
| CPU_AH = lio_gput1(lio); | ret = lio_gput1(lio); |
| break; | break; |
| case 0x0d: // ad: GPUT2 | case 0x0d: // ad: GPUT2 |
| CPU_AH = lio_gput2(lio); | ret = lio_gput2(lio); |
| break; | break; |
| case 0x0e: // ae: GROLL | // case 0x0e: // ae: GROLL |
| break; | // break; |
| case 0x0f: // af: GPOINT2 | case 0x0f: // af: GPOINT2 |
| ret = lio_gpoint2(lio); | |
| break; | break; |
| case 0x10: // ce: GCOPY | // case 0x10: // ce: GCOPY |
| // break; | |
| default: | |
| ret = LIO_SUCCESS; | |
| break; | break; |
| } | } |
| CPU_AH = ret; | |
| gdcsub_setslavewait(lio->wait); | gdcsub_setslavewait(lio->wait); |
| TRACEOUT(("lio wait = %d", lio->wait)); | |
| } | } |
| Line 104 void bios_lio(REG8 cmd) { | Line 112 void bios_lio(REG8 cmd) { |
| const UINT32 lioplaneadrs[4] = {VRAM_B, VRAM_R, VRAM_G, VRAM_E}; | const UINT32 lioplaneadrs[4] = {VRAM_B, VRAM_R, VRAM_G, VRAM_E}; |
| void lio_updaterange(LIOWORK lio) { | void lio_updatedraw(LIOWORK lio) { |
| lio->range.x1 = max(lio->gview.x1, 0); | lio->draw.x1 = max(lio->gview.x1, 0); |
| lio->range.y1 = max(lio->gview.y1, 0); | lio->draw.y1 = max(lio->gview.y1, 0); |
| lio->range.x2 = min(lio->gview.x2, 639); | lio->draw.x2 = min(lio->gview.x2, 639); |
| lio->range.y2 = min(lio->gview.x2, (lio->scrn.lines - 1)); | lio->draw.y2 = min(lio->gview.x2, (lio->scrn.lines - 1)); |
| if (!gdcs.access) { | |
| lio->draw.base = 0; | |
| lio->draw.bank = 0; | |
| lio->draw.sbit = 0x01; | |
| } | |
| else { | |
| lio->draw.base = VRAM_STEP; | |
| lio->draw.bank = 1; | |
| lio->draw.sbit = 0x02; | |
| } | |
| } | } |
| Line 139 static void pixed8(const _LIOWORK *lio, | Line 157 static void pixed8(const _LIOWORK *lio, |
| else { | else { |
| mem[vadrs + VRAM_G] &= ~bit; | mem[vadrs + VRAM_G] &= ~bit; |
| } | } |
| if (pal & 8) { | if (lio->gcolor1.palmode == 2) { |
| mem[vadrs + VRAM_E] |= bit; | if (pal & 8) { |
| } | mem[vadrs + VRAM_E] |= bit; |
| else { | } |
| mem[vadrs + VRAM_E] &= ~bit; | else { |
| mem[vadrs + VRAM_E] &= ~bit; | |
| } | |
| } | } |
| } | } |
| else { | else { |
| Line 162 void lio_pset(const _LIOWORK *lio, SINT1 | Line 182 void lio_pset(const _LIOWORK *lio, SINT1 |
| UINT32 adrs; | UINT32 adrs; |
| BYTE bit; | BYTE bit; |
| if ((lio->range.x1 > x) || (lio->range.x2 < x) || | if ((lio->draw.x1 > x) || (lio->draw.x2 < x) || |
| (lio->range.y1 > y) || (lio->range.y2 < y)) { | (lio->draw.y1 > y) || (lio->draw.y2 < y)) { |
| return; | return; |
| } | } |
| adrs = (y * 80) + (x >> 3); | adrs = (y * 80) + (x >> 3); |
| Line 171 void lio_pset(const _LIOWORK *lio, SINT1 | Line 191 void lio_pset(const _LIOWORK *lio, SINT1 |
| if (lio->scrn.top) { | if (lio->scrn.top) { |
| adrs += 16000; | adrs += 16000; |
| } | } |
| if (!lio->scrn.bank) { | vramupdate[adrs] |= lio->draw.sbit; |
| vramupdate[adrs] |= 1; | gdcs.grphdisp |= lio->draw.sbit; |
| gdcs.grphdisp |= 1; | adrs += lio->draw.base; |
| } | |
| else { | |
| vramupdate[adrs] |= 2; | |
| gdcs.grphdisp |= 2; | |
| adrs += VRAM_STEP; | |
| } | |
| pixed8(lio, adrs, bit, pal); | pixed8(lio, adrs, bit, pal); |
| } | } |
| Line 190 void lio_line(const _LIOWORK *lio, SINT1 | Line 204 void lio_line(const _LIOWORK *lio, SINT1 |
| BYTE bit, dbit, sbit; | BYTE bit, dbit, sbit; |
| SINT16 width; | SINT16 width; |
| if ((lio->range.y1 > y) || (lio->range.y2 < y)) { | if ((lio->draw.y1 > y) || (lio->draw.y2 < y)) { |
| return; | return; |
| } | } |
| if (lio->range.x1 > x1) { | if (lio->draw.x1 > x1) { |
| x1 = lio->range.x1; | x1 = lio->draw.x1; |
| } | } |
| if (lio->range.x2 < x2) { | if (lio->draw.x2 < x2) { |
| x2 = lio->range.x2; | x2 = lio->draw.x2; |
| } | } |
| width = x2 - x1 + 1; | width = x2 - x1 + 1; |
| if (width <= 0) { | if (width <= 0) { |
| Line 243 void lio_line(const _LIOWORK *lio, SINT1 | Line 257 void lio_line(const _LIOWORK *lio, SINT1 |
| } | } |
| } | } |
| void lio_look(UINT vect) { | |
| BYTE work[16]; | |
| TRACEOUT(("lio command %.2x [%.4x:%.4x]", vect, CPU_CS, CPU_IP)); | |
| if (vect == 0xa7) { | |
| i286_memstr_read(CPU_DS, CPU_BX, work, 16); | |
| TRACEOUT(("LINE %d %d %d %d - %d %d / %d : %.2x %.2x", | |
| LOADINTELWORD(work), | |
| LOADINTELWORD(work+2), | |
| LOADINTELWORD(work+4), | |
| LOADINTELWORD(work+6), | |
| work[8], work[9], work[10], work[11], work[12])); | |
| } | |
| else if (vect == 0xad) { | |
| i286_memstr_read(CPU_DS, CPU_BX, work, 16); | |
| TRACEOUT(("GPUT2 x=%d / y=%d / chr=%.4x / %d / %d %d %d", | |
| LOADINTELWORD(work), | |
| LOADINTELWORD(work+2), | |
| LOADINTELWORD(work+4), | |
| work[6], work[7], work[8], work[9])); | |
| } | |
| } | |