diff --git a/src/386.c b/src/386.c index 2029c1afd..256a1ce88 100644 --- a/src/386.c +++ b/src/386.c @@ -1,3 +1,7 @@ +#include +#ifndef INFINITY +# define INFINITY (__builtin_inff()) +#endif #include #include #include @@ -8,6 +12,7 @@ #include "cpu.h" #include "disc.h" #include "fdc.h" +#include "pic.h" #include "timer.h" #include "386_common.h" @@ -56,7 +61,7 @@ uint32_t *eal_r, *eal_w; uint16_t *mod1add[2][8]; uint32_t *mod1seg[8]; -static inline void fetch_ea_32_long(uint32_t rmdat) +static __inline void fetch_ea_32_long(uint32_t rmdat) { eal_r = eal_w = NULL; easeg = cpu_state.ea_seg->base; @@ -74,7 +79,7 @@ static inline void fetch_ea_32_long(uint32_t rmdat) case 1: cpu_state.pc++; cpu_state.eaaddr = ((uint32_t)(int8_t)getbyte()) + cpu_state.regs[sib & 7].l; -// pc++; + /* pc++; */ break; case 2: cpu_state.eaaddr = (fastreadl(cs + cpu_state.pc + 1)) + cpu_state.regs[sib & 7].l; @@ -129,7 +134,7 @@ static inline void fetch_ea_32_long(uint32_t rmdat) } } -static inline void fetch_ea_16_long(uint32_t rmdat) +static __inline void fetch_ea_16_long(uint32_t rmdat) { eal_r = eal_w = NULL; easeg = cpu_state.ea_seg->base; @@ -215,22 +220,23 @@ void exec386(int cycs) int tempi; int cycdiff; int oldcyc; + int cycle_period = cycs / 2000; /*Use a 5us timing granularity*/ cycles+=cycs; -// output=3; + /* output=3; */ while (cycles>0) { cycdiff=0; oldcyc=cycles; timer_start_period(cycles << TIMER_SHIFT); -// pclog("%i %02X\n", ins, ram[8]); - while (cycdiff<100) + /* pclog("%i %02X\n", ins, ram[8]); */ + while (cycdiff < cycle_period) { /* testr[0]=EAX; testr[1]=EBX; testr[2]=ECX; testr[3]=EDX; testr[4]=ESI; testr[5]=EDI; testr[6]=EBP; testr[7]=ESP;*/ /* testr[8]=flags;*/ -// oldcs2=oldcs; -// oldpc2=oldpc; + /* oldcs2=oldcs; */ + /* oldpc2=oldpc; */ oldcs=CS; cpu_state.oldpc = cpu_state.pc; oldcpl=CPL; @@ -262,8 +268,8 @@ dontprint=0; if (cpu_state.abrt) { flags_rebuild(); -// pclog("Abort\n"); -// if (CS == 0x228) pclog("Abort at %04X:%04X - %i %i %i\n",CS,pc,notpresent,nullseg,cpu_state.abrt); + /* pclog("Abort\n"); */ + /* if (CS == 0x228) pclog("Abort at %04X:%04X - %i %i %i\n",CS,pc,notpresent,nullseg,cpu_state.abrt); */ /* if (testr[0]!=EAX) pclog("EAX corrupted %08X\n",pc); if (testr[1]!=EBX) pclog("EBX corrupted %08X\n",pc); if (testr[2]!=ECX) pclog("ECX corrupted %08X\n",pc); @@ -297,8 +303,8 @@ dontprint=0; if (trap) { flags_rebuild(); -// oldpc=pc; -// oldcs=CS; + /* oldpc=pc; */ + /* oldcs=CS; */ if (msw&1) { pmodeint(1,0); @@ -320,19 +326,24 @@ dontprint=0; { cpu_state.oldpc = cpu_state.pc; oldcs = CS; -// pclog("NMI\n"); + /* pclog("NMI\n"); */ x86_int(2); nmi_enable = 0; + if (nmi_auto_clear) + { + nmi_auto_clear = 0; + nmi = 0; + } } else if ((flags&I_FLAG) && pic_intpending) { temp=picinterrupt(); if (temp!=0xFF) { -// if (temp == 0x54) pclog("Take int 54\n"); -// if (output) output=3; -// if (temp == 0xd) pclog("Hardware int %02X %i %04X(%08X):%08X\n",temp,ins, CS,cs,pc); -// if (temp==0x54) output=3; + /* if (temp == 0x54) pclog("Take int 54\n"); */ + /* if (output) output=3; */ + /* if (temp == 0xd) pclog("Hardware int %02X %i %04X(%08X):%08X\n",temp,ins, CS,cs,pc); */ + /* if (temp==0x54) output=3; */ flags_rebuild(); if (msw&1) { @@ -350,9 +361,9 @@ dontprint=0; oxpc=cpu_state.pc; cpu_state.pc=readmemw(0,addr); loadcs(readmemw(0,addr+2)); -// if (temp==0x76) pclog("INT to %04X:%04X\n",CS,pc); + /* if (temp==0x76) pclog("INT to %04X:%04X\n",CS,pc); */ } -// pclog("Now at %04X(%08X):%08X\n", CS, cs, pc); + /* pclog("Now at %04X(%08X):%08X\n", CS, cs, pc); */ } } diff --git a/src/386_common.h b/src/386_common.h index d1350f55d..a091a817d 100644 --- a/src/386_common.h +++ b/src/386_common.h @@ -64,7 +64,7 @@ extern uint16_t ea_rseg; } #define CHECK_READ(chseg, low, high) \ - if ((low < (chseg)->limit_low) || (high > (chseg)->limit_high)) \ + if ((low < (chseg)->limit_low) || (high > (chseg)->limit_high) || ((msw & 1) && !(eflags & VM_FLAG) && (((chseg)->access & 10) == 8))) \ { \ x86gpf("Limit check", 0); \ return 1; \ @@ -79,7 +79,7 @@ extern uint16_t ea_rseg; } #define CHECK_WRITE(chseg, low, high) \ - if ((low < (chseg)->limit_low) || (high > (chseg)->limit_high) || !((chseg)->access & 2)) \ + if ((low < (chseg)->limit_low) || (high > (chseg)->limit_high) || !((chseg)->access & 2) || ((msw & 1) && !(eflags & VM_FLAG) && ((chseg)->access & 8))) \ { \ x86gpf("Limit check", 0); \ return 1; \ @@ -118,7 +118,7 @@ extern uint16_t ea_rseg; -static inline uint8_t fastreadb(uint32_t a) +static __inline uint8_t fastreadb(uint32_t a) { uint8_t *t; @@ -126,13 +126,13 @@ static inline uint8_t fastreadb(uint32_t a) return *((uint8_t *)&pccache2[a]); t = getpccache(a); if (cpu_state.abrt) - return; + return 0xFF; pccache = a >> 12; pccache2 = t; return *((uint8_t *)&pccache2[a]); } -static inline uint16_t fastreadw(uint32_t a) +static __inline uint16_t fastreadw(uint32_t a) { uint8_t *t; uint16_t val; @@ -145,14 +145,14 @@ static inline uint16_t fastreadw(uint32_t a) if ((a>>12)==pccache) return *((uint16_t *)&pccache2[a]); t = getpccache(a); if (cpu_state.abrt) - return; + return 0xff; pccache = a >> 12; pccache2 = t; return *((uint16_t *)&pccache2[a]); } -static inline uint32_t fastreadl(uint32_t a) +static __inline uint32_t fastreadl(uint32_t a) { uint8_t *t; uint32_t val; @@ -165,7 +165,7 @@ static inline uint32_t fastreadl(uint32_t a) return 0; pccache2 = t; pccache=a>>12; - //return *((uint32_t *)&pccache2[a]); + /* return *((uint32_t *)&pccache2[a]); */ } return *((uint32_t *)&pccache2[a]); } @@ -176,25 +176,25 @@ static inline uint32_t fastreadl(uint32_t a) return val; } -static inline uint8_t getbyte() +static __inline uint8_t getbyte() { cpu_state.pc++; return fastreadb(cs + (cpu_state.pc - 1)); } -static inline uint16_t getword() +static __inline uint16_t getword() { cpu_state.pc+=2; return fastreadw(cs+(cpu_state.pc-2)); } -static inline uint32_t getlong() +static __inline uint32_t getlong() { cpu_state.pc+=4; return fastreadl(cs+(cpu_state.pc-4)); } -static inline uint64_t getquad() +static __inline uint64_t getquad() { cpu_state.pc+=8; return fastreadl(cs+(cpu_state.pc-8)) | ((uint64_t)fastreadl(cs+(cpu_state.pc-4)) << 32); @@ -202,7 +202,7 @@ static inline uint64_t getquad() -static inline uint8_t geteab() +static __inline uint8_t geteab() { if (cpu_mod == 3) return (cpu_rm & 4) ? cpu_state.regs[cpu_rm & 3].b.h : cpu_state.regs[cpu_rm&3].b.l; @@ -211,48 +211,48 @@ static inline uint8_t geteab() return readmemb(easeg, cpu_state.eaaddr); } -static inline uint16_t geteaw() +static __inline uint16_t geteaw() { if (cpu_mod == 3) return cpu_state.regs[cpu_rm].w; -// cycles-=3; + /* cycles-=3; */ if (eal_r) return *(uint16_t *)eal_r; return readmemw(easeg, cpu_state.eaaddr); } -static inline uint32_t geteal() +static __inline uint32_t geteal() { if (cpu_mod == 3) return cpu_state.regs[cpu_rm].l; -// cycles-=3; + /* cycles-=3; */ if (eal_r) return *eal_r; return readmeml(easeg, cpu_state.eaaddr); } -static inline uint64_t geteaq() +static __inline uint64_t geteaq() { return readmemq(easeg, cpu_state.eaaddr); } -static inline uint8_t geteab_mem() +static __inline uint8_t geteab_mem() { if (eal_r) return *(uint8_t *)eal_r; return readmemb(easeg,cpu_state.eaaddr); } -static inline uint16_t geteaw_mem() +static __inline uint16_t geteaw_mem() { if (eal_r) return *(uint16_t *)eal_r; return readmemw(easeg,cpu_state.eaaddr); } -static inline uint32_t geteal_mem() +static __inline uint32_t geteal_mem() { if (eal_r) return *eal_r; return readmeml(easeg,cpu_state.eaaddr); } -static inline void seteaq(uint64_t v) +static __inline void seteaq(uint64_t v) { writememql(easeg, cpu_state.eaaddr, v); } diff --git a/src/386_dynarec.c b/src/386_dynarec.c index 4fd3555f9..69a3df8a8 100644 --- a/src/386_dynarec.c +++ b/src/386_dynarec.c @@ -1,3 +1,7 @@ +#include +#ifndef INFINITY +# define INFINITY (__builtin_inff()) +#endif #include #include #include @@ -10,6 +14,7 @@ #include "cpu.h" #include "disc.h" #include "fdc.h" +#include "pic.h" #include "timer.h" #include "386_common.h" @@ -62,7 +67,7 @@ uint32_t *eal_r, *eal_w; uint16_t *mod1add[2][8]; uint32_t *mod1seg[8]; -static inline void fetch_ea_32_long(uint32_t rmdat) +static __inline void fetch_ea_32_long(uint32_t rmdat) { eal_r = eal_w = NULL; easeg = cpu_state.ea_seg->base; @@ -80,7 +85,6 @@ static inline void fetch_ea_32_long(uint32_t rmdat) case 1: cpu_state.pc++; cpu_state.eaaddr = ((uint32_t)(int8_t)getbyte()) + cpu_state.regs[sib & 7].l; -// cpu_state.pc++; break; case 2: cpu_state.eaaddr = (fastreadl(cs + cpu_state.pc + 1)) + cpu_state.regs[sib & 7].l; @@ -136,7 +140,7 @@ static inline void fetch_ea_32_long(uint32_t rmdat) cpu_state.last_ea = cpu_state.eaaddr; } -static inline void fetch_ea_16_long(uint32_t rmdat) +static __inline void fetch_ea_16_long(uint32_t rmdat) { eal_r = eal_w = NULL; easeg = cpu_state.ea_seg->base; @@ -187,7 +191,6 @@ static inline void fetch_ea_16_long(uint32_t rmdat) void x86_int(int num) { uint32_t addr; -// pclog("x86_int %02x %04x:%04x\n", num, CS,pc); flags_rebuild(); cpu_state.pc=cpu_state.oldpc; if (msw&1) @@ -225,8 +228,6 @@ void x86_int(int num) void x86_int_sw(int num) { uint32_t addr; -// pclog("x86_int_sw %02x %04x:%04x\n", num, CS,pc); -// pclog("x86_int\n"); flags_rebuild(); cycles -= timing_int; if (msw&1) @@ -264,14 +265,6 @@ void x86_int_sw(int num) void x86illegal() { - uint16_t addr; -// pclog("x86 illegal %04X %08X %04X:%08X %02X\n",msw,cr0,CS,pc,opcode); - -// if (output) -// { -// dumpregs(); -// exit(-1); -// } x86_int(6); } @@ -359,14 +352,28 @@ static void prefetch_flush() #define PREFETCH_FLUSH() prefetch_flush() +int checkio(int port) +{ + uint16_t t; + uint8_t d; + cpl_override = 1; + t = readmemw(tr.base, 0x66); + cpl_override = 0; + if (cpu_state.abrt) return 0; + if ((t+(port>>3))>tr.limit) return 1; + cpl_override = 1; + d = readmemb386l(0, tr.base + t + (port >> 3)); + cpl_override = 0; + return d&(1<<(port&7)); +} + int rep386(int fv) { uint8_t temp; - uint32_t c;//=CX; + uint32_t c; uint8_t temp2; uint16_t tempw,tempw2,of; - uint32_t ipc = cpu_state.oldpc;//pc-1; - uint32_t oldds; + uint32_t ipc = cpu_state.oldpc; uint32_t rep32 = cpu_state.op32; uint32_t templ,templ2; int tempz; @@ -384,16 +391,9 @@ int rep386(int fv) flags_rebuild(); of = flags; -// if (inrecomp) pclog("REP32 %04X %04X ",use32,rep32); startrep: temp=opcode2=readmemb(cs,cpu_state.pc); cpu_state.pc++; -// if (firstrepcycle && temp==0xA5) pclog("REP MOVSW %06X:%04X %06X:%04X\n",ds,SI,es,DI); -// if (inrecomp) pclog("REP %02X %04X\n",temp,ipc); c=(rep32&0x200)?ECX:CX; -/* if (rep32 && (msw&1)) - { - if (temp!=0x67 && temp!=0x66 && (rep32|temp)!=0x1AB && (rep32|temp)!=0x3AB) pclog("32-bit REP %03X %08X %04X:%06X\n",temp|rep32,c,CS,pc); - }*/ switch (temp|rep32) { case 0xC3: case 0x1C3: case 0x2C3: case 0x3C3: @@ -436,7 +436,6 @@ int rep386(int fv) PREFETCH_PREFIX(); goto startrep; case 0x6C: case 0x16C: /*REP INSB*/ -// cpu_notreps++; if (c>0) { checkio_perm(DX); @@ -453,7 +452,6 @@ int rep386(int fv) else firstrepcycle=1; break; case 0x26C: case 0x36C: /*REP INSB*/ -// cpu_notreps++; if (c>0) { checkio_perm(DX); @@ -470,10 +468,8 @@ int rep386(int fv) else firstrepcycle=1; break; case 0x6D: /*REP INSW*/ -// cpu_notreps++; if (c>0) { -// pclog("REP INSW %04x %04x:%04x %04x\n", DX, ES, DI, CX); tempw=inw(DX); writememw(es,DI,tempw); if (cpu_state.abrt) break; @@ -487,7 +483,6 @@ int rep386(int fv) else firstrepcycle=1; break; case 0x16D: /*REP INSL*/ -// cpu_notreps++; if (c>0) { templ=inl(DX); @@ -503,7 +498,6 @@ int rep386(int fv) else firstrepcycle=1; break; case 0x26D: /*REP INSW*/ -// cpu_notreps++; if (c>0) { tempw=inw(DX); @@ -519,7 +513,6 @@ int rep386(int fv) else firstrepcycle=1; break; case 0x36D: /*REP INSL*/ -// cpu_notreps++; if (c>0) { templ=inl(DX); @@ -535,7 +528,6 @@ int rep386(int fv) else firstrepcycle=1; break; case 0x6E: case 0x16E: /*REP OUTSB*/ -// cpu_notreps++; if (c>0) { temp2 = readmemb(cpu_state.ea_seg->base, SI); @@ -552,7 +544,6 @@ int rep386(int fv) else firstrepcycle=1; break; case 0x26E: case 0x36E: /*REP OUTSB*/ -// cpu_notreps++; if (c>0) { temp2 = readmemb(cpu_state.ea_seg->base, ESI); @@ -569,12 +560,10 @@ int rep386(int fv) else firstrepcycle=1; break; case 0x6F: /*REP OUTSW*/ -// cpu_notreps++; if (c>0) { tempw = readmemw(cpu_state.ea_seg->base, SI); if (cpu_state.abrt) break; -// pclog("OUTSW %04X -> %04X\n",SI,tempw); outw(DX,tempw); if (flags&D_FLAG) SI-=2; else SI+=2; @@ -586,7 +575,6 @@ int rep386(int fv) else firstrepcycle=1; break; case 0x16F: /*REP OUTSL*/ -// cpu_notreps++; if (c > 0) { templ = readmeml(cpu_state.ea_seg->base, SI); @@ -602,7 +590,6 @@ int rep386(int fv) else firstrepcycle = 1; break; case 0x26F: /*REP OUTSW*/ -// cpu_notreps++; if (c>0) { tempw = readmemw(cpu_state.ea_seg->base, ESI); @@ -618,7 +605,6 @@ int rep386(int fv) else firstrepcycle=1; break; case 0x36F: /*REP OUTSL*/ -// cpu_notreps++; if (c > 0) { templ = readmeml(cpu_state.ea_seg->base, ESI); @@ -635,7 +621,6 @@ int rep386(int fv) break; case 0x90: case 0x190: /*REP NOP*/ case 0x290: case 0x390: -// cpu_notreps++; break; case 0xA4: case 0x1A4: /*REP MOVSB*/ while (c > 0) @@ -643,7 +628,6 @@ int rep386(int fv) CHECK_WRITE_REP(&_es, DI, DI); temp2 = readmemb(cpu_state.ea_seg->base, SI); if (cpu_state.abrt) break; writememb(es,DI,temp2); if (cpu_state.abrt) break; -// if (output==3) pclog("MOVSB %08X:%04X -> %08X:%04X %02X\n",ds,SI,es,DI,temp2); if (flags&D_FLAG) { DI--; SI--; } else { DI++; SI++; } c--; @@ -700,7 +684,6 @@ int rep386(int fv) { CHECK_WRITE_REP(&_es, DI, DI+3); templ = readmeml(cpu_state.ea_seg->base, SI); if (cpu_state.abrt) break; -// pclog("MOVSD %08X from %08X to %08X (%04X:%08X)\n", templ, ds+SI, es+DI, CS, pc); writememl(es,DI,templ); if (cpu_state.abrt) break; if (flags&D_FLAG) { DI-=4; SI-=4; } else { DI+=4; SI+=4; } @@ -721,7 +704,6 @@ int rep386(int fv) CHECK_WRITE_REP(&_es, EDI, EDI+1); tempw = readmemw(cpu_state.ea_seg->base, ESI); if (cpu_state.abrt) break; writememw(es,EDI,tempw); if (cpu_state.abrt) break; -// if (output) pclog("Written %04X from %08X to %08X %i %08X %04X %08X %04X\n",tempw,ds+ESI,es+EDI,c,ds,ES,es,ES); if (flags&D_FLAG) { EDI-=2; ESI-=2; } else { EDI+=2; ESI+=2; } c--; @@ -740,9 +722,7 @@ int rep386(int fv) { CHECK_WRITE_REP(&_es, EDI, EDI+3); templ = readmeml(cpu_state.ea_seg->base, ESI); if (cpu_state.abrt) break; -// if ((EDI&0xFFFF0000)==0xA0000) cycles-=12; writememl(es,EDI,templ); if (cpu_state.abrt) break; -// if (output) pclog("Load %08X from %08X to %08X %04X %08X %04X %08X\n",templ,ESI,EDI,DS,ds,ES,es); if (flags&D_FLAG) { EDI-=4; ESI-=4; } else { EDI+=4; ESI+=4; } c--; @@ -757,7 +737,6 @@ int rep386(int fv) else firstrepcycle=1; break; case 0xA6: case 0x1A6: /*REP CMPSB*/ -// cpu_notreps++; tempz = (fv) ? 1 : 0; if ((c>0) && (fv==tempz)) { @@ -776,7 +755,6 @@ int rep386(int fv) else firstrepcycle=1; break; case 0x2A6: case 0x3A6: /*REP CMPSB*/ -// cpu_notreps++; tempz = (fv) ? 1 : 0; if ((c>0) && (fv==tempz)) { @@ -795,14 +773,11 @@ int rep386(int fv) else firstrepcycle=1; break; case 0xA7: /*REP CMPSW*/ -// cpu_notreps++; tempz = (fv) ? 1 : 0; if ((c>0) && (fv==tempz)) { -// pclog("CMPSW (%04x:%04x)%05X (%04x:%04x)%05X ", DS,SI, ds+SI, ES,DI, es+DI); tempw = readmemw(cpu_state.ea_seg->base, SI); tempw2=readmemw(es,DI); -// pclog("%04X %04X %c%c %c%c\n", tempw, tempw2, tempw & 0xff, tempw >> 8, tempw2 & 0xff, tempw2 >> 8); if (cpu_state.abrt) { flags=of; break; } if (flags&D_FLAG) { DI-=2; SI-=2; } @@ -817,7 +792,6 @@ int rep386(int fv) else firstrepcycle=1; break; case 0x1A7: /*REP CMPSL*/ -// cpu_notreps++; tempz = (fv) ? 1 : 0; if ((c>0) && (fv==tempz)) { @@ -836,7 +810,6 @@ int rep386(int fv) else firstrepcycle=1; break; case 0x2A7: /*REP CMPSW*/ -// cpu_notreps++; tempz = (fv) ? 1 : 0; if ((c>0) && (fv==tempz)) { @@ -855,7 +828,6 @@ int rep386(int fv) else firstrepcycle=1; break; case 0x3A7: /*REP CMPSL*/ -// cpu_notreps++; tempz = (fv) ? 1 : 0; if ((c>0) && (fv==tempz)) { @@ -989,8 +961,6 @@ int rep386(int fv) else firstrepcycle=1; break; case 0xAC: case 0x1AC: /*REP LODSB*/ -// cpu_notreps++; -// if (ds==0xFFFFFFFF) pclog("Null selector REP LODSB %04X(%06X):%06X\n",CS,cs,pc); if (c>0) { AL = readmemb(cpu_state.ea_seg->base, SI); @@ -1005,8 +975,6 @@ int rep386(int fv) else firstrepcycle=1; break; case 0x2AC: case 0x3AC: /*REP LODSB*/ -// cpu_notreps++; -// if (ds==0xFFFFFFFF) pclog("Null selector REP LODSB %04X(%06X):%06X\n",CS,cs,pc); if (c>0) { AL = readmemb(cpu_state.ea_seg->base, ESI); @@ -1021,8 +989,6 @@ int rep386(int fv) else firstrepcycle=1; break; case 0xAD: /*REP LODSW*/ -// cpu_notreps++; -// if (ds==0xFFFFFFFF) pclog("Null selector REP LODSW %04X(%06X):%06X\n",CS,cs,pc); if (c>0) { AX = readmemw(cpu_state.ea_seg->base, SI); @@ -1037,8 +1003,6 @@ int rep386(int fv) else firstrepcycle=1; break; case 0x1AD: /*REP LODSL*/ -// cpu_notreps++; -// if (ds==0xFFFFFFFF) pclog("Null selector REP LODSL %04X(%06X):%06X\n",CS,cs,pc); if (c>0) { EAX = readmeml(cpu_state.ea_seg->base, SI); @@ -1053,8 +1017,6 @@ int rep386(int fv) else firstrepcycle=1; break; case 0x2AD: /*REP LODSW*/ -// cpu_notreps++; -// if (ds==0xFFFFFFFF) pclog("Null selector REP LODSW %04X(%06X):%06X\n",CS,cs,pc); if (c>0) { AX = readmemw(cpu_state.ea_seg->base, ESI); @@ -1069,8 +1031,6 @@ int rep386(int fv) else firstrepcycle=1; break; case 0x3AD: /*REP LODSL*/ -// cpu_notreps++; -// if (ds==0xFFFFFFFF) pclog("Null selector REP LODSL %04X(%06X):%06X\n",CS,cs,pc); if (c>0) { EAX = readmeml(cpu_state.ea_seg->base, ESI); @@ -1086,8 +1046,6 @@ int rep386(int fv) break; case 0xAE: case 0x1AE: /*REP SCASB*/ cpu_notreps++; -// if (es==0xFFFFFFFF) pclog("Null selector REP SCASB %04X(%06X):%06X\n",CS,cs,pc); -// tempz=(fv)?1:0; tempz = (fv) ? 1 : 0; while ((c > 0) && (fv == tempz)) { @@ -1110,14 +1068,11 @@ int rep386(int fv) break; case 0x2AE: case 0x3AE: /*REP SCASB*/ cpu_notreps++; -// if (es==0xFFFFFFFF) pclog("Null selector REP SCASB %04X(%06X):%06X\n",CS,cs,pc); -// tempz=(fv)?1:0; tempz = (fv) ? 1 : 0; while ((c > 0) && (fv == tempz)) { temp2=readmemb(es,EDI); if (cpu_state.abrt) { flags=of; break; } -// if (output) pclog("Compare %02X,%02X\n",temp2,AL); setsub8(AL,temp2); tempz = (ZF_SET()) ? 1 : 0; if (flags&D_FLAG) EDI--; @@ -1135,7 +1090,6 @@ int rep386(int fv) break; case 0xAF: /*REP SCASW*/ cpu_notreps++; -// if (es==0xFFFFFFFF) pclog("Null selector REP SCASW %04X(%06X):%06X\n",CS,cs,pc); tempz = (fv) ? 1 : 0; while ((c > 0) && (fv == tempz)) { @@ -1158,7 +1112,6 @@ int rep386(int fv) break; case 0x1AF: /*REP SCASL*/ cpu_notreps++; -// if (es==0xFFFFFFFF) pclog("Null selector REP SCASL %04X(%06X):%06X\n",CS,cs,pc); tempz = (fv) ? 1 : 0; while ((c > 0) && (fv == tempz)) { @@ -1181,7 +1134,6 @@ int rep386(int fv) break; case 0x2AF: /*REP SCASW*/ cpu_notreps++; -// if (es==0xFFFFFFFF) pclog("Null selector REP SCASW %04X(%06X):%06X\n",CS,cs,pc); tempz = (fv) ? 1 : 0; while ((c > 0) && (fv == tempz)) { @@ -1204,7 +1156,6 @@ int rep386(int fv) break; case 0x3AF: /*REP SCASL*/ cpu_notreps++; -// if (es==0xFFFFFFFF) pclog("Null selector REP SCASL %04X(%06X):%06X\n",CS,cs,pc); tempz = (fv) ? 1 : 0; while ((c > 0) && (fv == tempz)) { @@ -1229,7 +1180,6 @@ int rep386(int fv) default: cpu_state.pc = ipc+1; - //pclog("Bad REP %02X %i\n", temp, rep32 >> 8); break; } if (rep32&0x200) ECX=c; @@ -1237,27 +1187,6 @@ int rep386(int fv) CPU_BLOCK_END(); PREFETCH_RUN(total_cycles, 1, -1, reads, reads_l, writes, writes_l, 0); return cpu_state.abrt; -//pclog("rep cpu_block_end=%d %p\n", cpu_block_end, (void *)&cpu_block_end); -// if (output) pclog("%03X %03X\n",rep32,use32); -} - -int checkio(int port) -{ - uint16_t t; - uint8_t d; - cpl_override = 1; - t = readmemw(tr.base, 0x66); - cpl_override = 0; -// pclog("CheckIO 1 %08X %04x %02x\n",tr.base, eflags, _cs.access); - if (cpu_state.abrt) return 0; -// pclog("CheckIO %04X %01X %01X %02X %04X %04X %08X ",CS,CPL,IOPL,port,t,t+(port>>3),tr.base+t+(port>>3)); - if ((t+(port>>3))>tr.limit) return 1; - cpl_override = 1; - d = readmemb386l(0, tr.base + t + (port >> 3)); -// d=readmemb(tr.base,t+(port>>3)); - cpl_override = 0; -// pclog("%02X %02X\n",d,d&(1<<(port&7))); - return d&(1<<(port&7)); } int xout=0; @@ -1276,15 +1205,20 @@ int xout=0; int divl(uint32_t val) { + uint64_t num, quo; + uint32_t rem, quo32; + if (val==0) { divexcp(); return 1; } - uint64_t num=(((uint64_t)EDX)<<32)|EAX; - uint64_t quo=num/val; - uint32_t rem=num%val; - uint32_t quo32=(uint32_t)(quo&0xFFFFFFFF); + + num=(((uint64_t)EDX)<<32)|EAX; + quo=num/val; + rem=num%val; + quo32=(uint32_t)(quo&0xFFFFFFFF); + if (quo!=(uint64_t)quo32) { divexcp(); @@ -1296,15 +1230,20 @@ int divl(uint32_t val) } int idivl(int32_t val) { + int64_t num, quo; + int32_t rem, quo32; + if (val==0) { divexcp(); return 1; } - int64_t num=(((uint64_t)EDX)<<32)|EAX; - int64_t quo=num/val; - int32_t rem=num%val; - int32_t quo32=(int32_t)(quo&0xFFFFFFFF); + + num=(((uint64_t)EDX)<<32)|EAX; + quo=num/val; + rem=num%val; + quo32=(int32_t)(quo&0xFFFFFFFF); + if (quo!=(int64_t)quo32) { divexcp(); @@ -1338,7 +1277,6 @@ int dontprint=0; #define CACHE_ON() (!(cr0 & (1 << 30)) /*&& (cr0 & 1)*/ && !(flags & T_FLAG)) -//#define CACHE_ON() 0 static int cycles_main = 0; void exec386_dynarec(int cycs) @@ -1348,8 +1286,8 @@ void exec386_dynarec(int cycs) int tempi; int cycdiff; int oldcyc; + uint32_t start_pc = 0; -//output = 3; cycles_main += cycs; while (cycles_main > 0) { @@ -1359,7 +1297,6 @@ void exec386_dynarec(int cycs) cycles_start = cycles; timer_start_period(cycles << TIMER_SHIFT); -// output=3; while (cycles>0) { oldcs = CS; @@ -1370,11 +1307,9 @@ void exec386_dynarec(int cycs) cycdiff=0; oldcyc=cycles; -// if (output && CACHE_ON()) pclog("Block %04x:%04x %04x:%08x\n", CS, pc, SS,ESP); if (!CACHE_ON()) /*Interpret block*/ { cpu_block_end = 0; -// if (output) pclog("Interpret block at %04x:%04x %04x %04x %04x %04x %04x %04x %04x\n", CS, pc, AX, BX, CX, DX, SI, DI, SP); while (!cpu_block_end) { oldcs=CS; @@ -1385,19 +1320,13 @@ void exec386_dynarec(int cycs) cpu_state.ea_seg = &_ds; cpu_state.ssegs = 0; - opcodestart: fetchdat = fastreadl(cs + cpu_state.pc); -// if (!fetchdat) -// fatal("Dead with cache off\n"); if (!cpu_state.abrt) { trap = flags & T_FLAG; opcode = fetchdat & 0xFF; fetchdat >>= 8; -// if (output == 3) -// pclog("int %04X(%06X):%04X : %08X %08X %08X %08X %04X %04X %04X(%08X) %04X %04X %04X(%08X) %08X %08X %08X SP=%04X:%08X %02X %04X %i %08X %08X %i %i %02X %02X %02X %02X %02X %f %02X%02X %02X%02X\n",CS,cs,pc,EAX,EBX,ECX,EDX,CS,DS,ES,es,FS,GS,SS,ss,EDI,ESI,EBP,SS,ESP,opcode,flags,ins,0, ldt.base, CPL, stack32, pic.pend, pic.mask, pic.mask2, pic2.pend, pic2.mask, pit.c[0], ram[0x8f13f], ram[0x8f13e], ram[0x8f141], ram[0x8f140]); - cpu_state.pc++; x86_opcodes[(opcode | cpu_state.op32) & 0x3ff](fetchdat); } @@ -1504,13 +1433,11 @@ void exec386_dynarec(int cycs) void (*code)() = (void *)&block->data[BLOCK_START]; codeblock_hash[hash] = block; -// if (output) pclog("Run block at %04x:%04x %04x %04x %04x %04x %04x %04x ESP=%08x %04x %08x %08x %016llx %08x\n", CS, pc, AX, BX, CX, DX, SI, DI, ESP, BP, get_phys(cs+pc), block->phys, block->page_mask, block->endpc); inrecomp=1; code(); inrecomp=0; if (!use32) cpu_state.pc &= 0xffff; -// cpu_recomp_ins += block->ins; cpu_recomp_blocks++; /* ins += codeblock_ins[index]; insc += codeblock_ins[index];*/ @@ -1518,10 +1445,8 @@ inrecomp=0; } else if (valid_block && !cpu_state.abrt) { - uint32_t start_page = cpu_state.pc >> 12; - uint32_t start_pc = cpu_state.pc; + start_pc = cpu_state.pc; -// pclog("Hash %08x %i\n", codeblock_hash_pc[HASH(cs + pc)], codeblock_page_dirty[(cs + pc) >> 12]); cpu_block_end = 0; x86_was_reset = 0; @@ -1530,7 +1455,6 @@ inrecomp=0; codegen_block_start_recompile(block); codegen_in_recompile = 1; -// if (output) pclog("Recompile block at %04x:%04x %04x %04x %04x %04x %04x %04x ESP=%04x %04x %02x%02x:%02x%02x %02x%02x:%02x%02x %02x%02x:%02x%02x\n", CS, pc, AX, BX, CX, DX, SI, DI, ESP, BP, ram[0x116330+0x6df4+0xa+3], ram[0x116330+0x6df4+0xa+2], ram[0x116330+0x6df4+0xa+1], ram[0x116330+0x6df4+0xa+0], ram[0x11d136+3],ram[0x11d136+2],ram[0x11d136+1],ram[0x11d136+0], ram[(0x119abe)+0x3],ram[(0x119abe)+0x2],ram[(0x119abe)+0x1],ram[(0x119abe)+0x0]); while (!cpu_block_end) { oldcs=CS; @@ -1541,21 +1465,13 @@ inrecomp=0; cpu_state.ea_seg = &_ds; cpu_state.ssegs = 0; - opcodestart_compile: fetchdat = fastreadl(cs + cpu_state.pc); -// if (fetchdat == 0xffffffff) -// fatal("Dead ffffffff\n"); -// if (!fetchdat) -// fatal("Dead\n"); if (!cpu_state.abrt) { trap = flags & T_FLAG; opcode = fetchdat & 0xFF; fetchdat >>= 8; -// if (output == 3) -// pclog("%04X(%06X):%04X : %08X %08X %08X %08X %04X %04X %04X(%08X) %04X %04X %04X(%08X) %08X %08X %08X SP=%04X:%08X %02X %04X %i %08X %08X %i %i %02X %02X %02X %02X %02X %08x %08x\n",CS,cs,pc,EAX,EBX,ECX,EDX,CS,DS,ES,es,FS,GS,SS,ss,EDI,ESI,EBP,SS,ESP,opcode,flags,ins,0, ldt.base, CPL, stack32, pic.pend, pic.mask, pic.mask2, pic2.pend, pic2.mask, cs+pc, pccache); - cpu_state.pc++; codegen_generate_call(opcode, x86_opcodes[(opcode | cpu_state.op32) & 0x3ff], fetchdat, cpu_state.pc, cpu_state.pc-1); @@ -1596,23 +1512,17 @@ inrecomp=0; codegen_reset(); codegen_in_recompile = 0; -// output &= ~2; } else if (!cpu_state.abrt) { /*Mark block but do not recompile*/ - uint32_t start_page = cpu_state.pc >> 12; - uint32_t start_pc = cpu_state.pc; + start_pc = cpu_state.pc; -// pclog("Hash %08x %i\n", codeblock_hash_pc[HASH(cs + pc)], codeblock_page_dirty[(cs + pc) >> 12]); cpu_block_end = 0; x86_was_reset = 0; -// cpu_new_blocks++; - codegen_block_init(phys_addr); -// if (output) pclog("Recompile block at %04x:%04x %04x %04x %04x %04x %04x %04x ESP=%04x %04x %02x%02x:%02x%02x %02x%02x:%02x%02x %02x%02x:%02x%02x\n", CS, pc, AX, BX, CX, DX, SI, DI, ESP, BP, ram[0x116330+0x6df4+0xa+3], ram[0x116330+0x6df4+0xa+2], ram[0x116330+0x6df4+0xa+1], ram[0x116330+0x6df4+0xa+0], ram[0x11d136+3],ram[0x11d136+2],ram[0x11d136+1],ram[0x11d136+0], ram[(0x119abe)+0x3],ram[(0x119abe)+0x2],ram[(0x119abe)+0x1],ram[(0x119abe)+0x0]); while (!cpu_block_end) { oldcs=CS; @@ -1632,9 +1542,6 @@ inrecomp=0; opcode = fetchdat & 0xFF; fetchdat >>= 8; -// if (output == 3) -// pclog("%04X(%06X):%04X : %08X %08X %08X %08X %04X %04X %04X(%08X) %04X %04X %04X(%08X) %08X %08X %08X SP=%04X:%08X %02X %04X %i %08X %08X %i %i %02X %02X %02X %02X %02X %08x %08x\n",CS,cs,pc,EAX,EBX,ECX,EDX,CS,DS,ES,es,FS,GS,SS,ss,EDI,ESI,EBP,SS,ESP,opcode,flags,ins,0, ldt.base, CPL, stack32, pic.pend, pic.mask, pic.mask2, pic2.pend, pic2.mask, cs+pc, pccache); - cpu_state.pc++; x86_opcodes[(opcode | cpu_state.op32) & 0x3ff](fetchdat); @@ -1671,18 +1578,12 @@ inrecomp=0; if (x86_was_reset) codegen_reset(); - -// output &= ~2; } -// if (output && (SP & 1)) -// fatal("odd SP\n"); } cycdiff=oldcyc-cycles; tsc += cycdiff; -// timer_end_period(cycles); - if (cpu_state.abrt) { flags_rebuild(); @@ -1710,8 +1611,6 @@ inrecomp=0; { flags_rebuild(); -// oldpc=pc; -// oldcs=CS; if (msw&1) { pmodeint(1,0); @@ -1734,7 +1633,6 @@ inrecomp=0; temp=picinterrupt(); if (temp!=0xFF) { -// pclog("IRQ %02X %04X:%04X %04X:%04X\n", temp, SS, SP, CS, pc); CPU_BLOCK_END(); flags_rebuild(); if (msw&1) diff --git a/src/386_dynarec_ops.c b/src/386_dynarec_ops.c index bf2fe7ad4..7b5a5c7f5 100644 --- a/src/386_dynarec_ops.c +++ b/src/386_dynarec_ops.c @@ -1,3 +1,7 @@ +#include +#ifndef INFINITY +# define INFINITY (__builtin_inff()) +#endif #include "ibm.h" #include "cpu.h" #include "x86.h" @@ -6,6 +10,7 @@ #include "x86_flags.h" #include "mem.h" #include "codegen.h" +#include "pic.h" #define CPU_BLOCK_END() cpu_block_end = 1 @@ -15,7 +20,7 @@ extern uint16_t *mod1add[2][8]; extern uint32_t *mod1seg[8]; -static inline void fetch_ea_32_long(uint32_t rmdat) +static __inline void fetch_ea_32_long(uint32_t rmdat) { eal_r = eal_w = NULL; easeg = cpu_state.ea_seg->base; @@ -31,7 +36,7 @@ static inline void fetch_ea_32_long(uint32_t rmdat) cpu_state.last_ea = cpu_state.eaaddr; } -static inline void fetch_ea_16_long(uint32_t rmdat) +static __inline void fetch_ea_16_long(uint32_t rmdat) { eal_r = eal_w = NULL; easeg = cpu_state.ea_seg->base; diff --git a/src/386_ops.h b/src/386_ops.h index 15ce9349a..4e5d78125 100644 --- a/src/386_ops.h +++ b/src/386_ops.h @@ -15,7 +15,7 @@ } \ } while (0) -static inline void PUSH_W(uint16_t val) +static __inline void PUSH_W(uint16_t val) { if (stack32) { @@ -31,7 +31,7 @@ static inline void PUSH_W(uint16_t val) } } -static inline void PUSH_L(uint32_t val) +static __inline void PUSH_L(uint32_t val) { if (stack32) { @@ -47,7 +47,7 @@ static inline void PUSH_L(uint32_t val) } } -static inline uint16_t POP_W() +static __inline uint16_t POP_W() { uint16_t ret; if (stack32) @@ -65,7 +65,7 @@ static inline uint16_t POP_W() return ret; } -static inline uint32_t POP_L() +static __inline uint32_t POP_L() { uint32_t ret; if (stack32) @@ -83,7 +83,7 @@ static inline uint32_t POP_L() return ret; } -static inline uint16_t POP_W_seg(uint32_t seg) +static __inline uint16_t POP_W_seg(uint32_t seg) { uint16_t ret; if (stack32) @@ -101,7 +101,7 @@ static inline uint16_t POP_W_seg(uint32_t seg) return ret; } -static inline uint32_t POP_L_seg(uint32_t seg) +static __inline uint32_t POP_L_seg(uint32_t seg) { uint32_t ret; if (stack32) @@ -119,6 +119,17 @@ static inline uint32_t POP_L_seg(uint32_t seg) return ret; } +static int fopcode; + +static int ILLEGAL(uint32_t fetchdat) +{ + cpu_state.pc = cpu_state.oldpc; + + pclog("Illegal instruction %08X (%02X)\n", fetchdat, fopcode); + x86illegal(); + return 0; +} + #include "x86seg.h" #include "x86_ops_arith.h" #include "x86_ops_atomic.h" @@ -133,6 +144,8 @@ static inline uint32_t POP_L_seg(uint32_t seg) #include "x86_ops_io.h" #include "x86_ops_jump.h" #include "x86_ops_misc.h" +#include "x87_ops.h" +#include "x86_ops_i686.h" #include "x86_ops_mmx.h" #include "x86_ops_mmx_arith.h" #include "x86_ops_mmx_cmp.h" @@ -156,25 +169,12 @@ static inline uint32_t POP_L_seg(uint32_t seg) #include "x86_ops_string.h" #include "x86_ops_xchg.h" -static int fopcode; - -static int ILLEGAL(uint32_t fetchdat) -{ - cpu_state.pc = cpu_state.oldpc; - -// fatal("Illegal instruction %08X\n", fetchdat); - pclog("Illegal instruction %08X (%02X)\n", fetchdat, fopcode); - x86illegal(); - return 0; -} - static int op0F_w_a16(uint32_t fetchdat) { int opcode = fetchdat & 0xff; fopcode = opcode; cpu_state.pc++; - // pclog("A16W: 0F %02X\n", opcode); PREFETCH_PREFIX(); return x86_opcodes_0f[opcode](fetchdat >> 8); @@ -185,7 +185,6 @@ static int op0F_l_a16(uint32_t fetchdat) fopcode = opcode; cpu_state.pc++; - // pclog("A16L: 0F %02X\n", opcode); PREFETCH_PREFIX(); return x86_opcodes_0f[opcode | 0x100](fetchdat >> 8); @@ -196,7 +195,6 @@ static int op0F_w_a32(uint32_t fetchdat) fopcode = opcode; cpu_state.pc++; - // pclog("A32W: 0F %02X\n", opcode); PREFETCH_PREFIX(); return x86_opcodes_0f[opcode | 0x200](fetchdat >> 8); @@ -207,15 +205,11 @@ static int op0F_l_a32(uint32_t fetchdat) fopcode = opcode; cpu_state.pc++; - // pclog("A32L: 0F %02X\n", opcode); PREFETCH_PREFIX(); return x86_opcodes_0f[opcode | 0x300](fetchdat >> 8); } -#include "x87_ops.h" -#include "x86_ops_i686.h" - OpFn OP_TABLE(286_0f)[1024] = { /*16-bit data, 16-bit addr*/ @@ -1241,7 +1235,7 @@ OpFn OP_TABLE(286)[1024] = /*c0*/ opC0_a16, opC1_w_a16, opRET_w_imm, opRET_w, opLES_w_a16, opLDS_w_a16, opMOV_b_imm_a16,opMOV_w_imm_a16,opENTER_w, opLEAVE_w, opRETF_a16_imm, opRETF_a16, opINT3, opINT, opINTO, opIRET_286, /*d0*/ opD0_a16, opD1_w_a16, opD2_a16, opD3_w_a16, opAAM, opAAD, opSETALC, opXLAT_a16, opESCAPE_d8_a16,opESCAPE_d9_a16,opESCAPE_da_a16,opESCAPE_db_a16,opESCAPE_dc_a16,opESCAPE_dd_a16,opESCAPE_de_a16,opESCAPE_df_a16, /*e0*/ opLOOPNE_w, opLOOPE_w, opLOOP_w, opJCXZ, opIN_AL_imm, opIN_AX_imm, opOUT_AL_imm, opOUT_AX_imm, opCALL_r16, opJMP_r16, opJMP_far_a16, opJMP_r8, opIN_AL_DX, opIN_AX_DX, opOUT_AL_DX, opOUT_AX_DX, -/*f0*/ opLOCK, ILLEGAL, opREPNE, opREPE, opHLT, opCMC, opF6_a16, opF7_w_a16, opCLC, opSTC, opCLI, opSTI, opCLD, opSTD, opINCDEC_b_a16, opFF_w_a16, +/*f0*/ opLOCK, opLOCK, opREPNE, opREPE, opHLT, opCMC, opF6_a16, opF7_w_a16, opCLC, opSTC, opCLI, opSTI, opCLD, opSTD, opINCDEC_b_a16, opFF_w_a16, /*32-bit data, 16-bit addr*/ /* 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f*/ @@ -1263,7 +1257,7 @@ OpFn OP_TABLE(286)[1024] = /*c0*/ opC0_a16, opC1_w_a16, opRET_w_imm, opRET_w, opLES_w_a16, opLDS_w_a16, opMOV_b_imm_a16,opMOV_w_imm_a16,opENTER_w, opLEAVE_w, opRETF_a16_imm, opRETF_a16, opINT3, opINT, opINTO, opIRET_286, /*d0*/ opD0_a16, opD1_w_a16, opD2_a16, opD3_w_a16, opAAM, opAAD, opSETALC, opXLAT_a16, opESCAPE_d8_a16,opESCAPE_d9_a16,opESCAPE_da_a16,opESCAPE_db_a16,opESCAPE_dc_a16,opESCAPE_dd_a16,opESCAPE_de_a16,opESCAPE_df_a16, /*e0*/ opLOOPNE_w, opLOOPE_w, opLOOP_w, opJCXZ, opIN_AL_imm, opIN_AX_imm, opOUT_AL_imm, opOUT_AX_imm, opCALL_r16, opJMP_r16, opJMP_far_a16, opJMP_r8, opIN_AL_DX, opIN_AX_DX, opOUT_AL_DX, opOUT_AX_DX, -/*f0*/ opLOCK, ILLEGAL, opREPNE, opREPE, opHLT, opCMC, opF6_a16, opF7_w_a16, opCLC, opSTC, opCLI, opSTI, opCLD, opSTD, opINCDEC_b_a16, opFF_w_a16, +/*f0*/ opLOCK, opLOCK, opREPNE, opREPE, opHLT, opCMC, opF6_a16, opF7_w_a16, opCLC, opSTC, opCLI, opSTI, opCLD, opSTD, opINCDEC_b_a16, opFF_w_a16, /*16-bit data, 32-bit addr*/ /* 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f*/ @@ -1285,7 +1279,7 @@ OpFn OP_TABLE(286)[1024] = /*c0*/ opC0_a16, opC1_w_a16, opRET_w_imm, opRET_w, opLES_w_a16, opLDS_w_a16, opMOV_b_imm_a16,opMOV_w_imm_a16,opENTER_w, opLEAVE_w, opRETF_a16_imm, opRETF_a16, opINT3, opINT, opINTO, opIRET_286, /*d0*/ opD0_a16, opD1_w_a16, opD2_a16, opD3_w_a16, opAAM, opAAD, opSETALC, opXLAT_a16, opESCAPE_d8_a16,opESCAPE_d9_a16,opESCAPE_da_a16,opESCAPE_db_a16,opESCAPE_dc_a16,opESCAPE_dd_a16,opESCAPE_de_a16,opESCAPE_df_a16, /*e0*/ opLOOPNE_w, opLOOPE_w, opLOOP_w, opJCXZ, opIN_AL_imm, opIN_AX_imm, opOUT_AL_imm, opOUT_AX_imm, opCALL_r16, opJMP_r16, opJMP_far_a16, opJMP_r8, opIN_AL_DX, opIN_AX_DX, opOUT_AL_DX, opOUT_AX_DX, -/*f0*/ opLOCK, ILLEGAL, opREPNE, opREPE, opHLT, opCMC, opF6_a16, opF7_w_a16, opCLC, opSTC, opCLI, opSTI, opCLD, opSTD, opINCDEC_b_a16, opFF_w_a16, +/*f0*/ opLOCK, opLOCK, opREPNE, opREPE, opHLT, opCMC, opF6_a16, opF7_w_a16, opCLC, opSTC, opCLI, opSTI, opCLD, opSTD, opINCDEC_b_a16, opFF_w_a16, /*32-bit data, 32-bit addr*/ /* 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f*/ @@ -1307,7 +1301,7 @@ OpFn OP_TABLE(286)[1024] = /*c0*/ opC0_a16, opC1_w_a16, opRET_w_imm, opRET_w, opLES_w_a16, opLDS_w_a16, opMOV_b_imm_a16,opMOV_w_imm_a16,opENTER_w, opLEAVE_w, opRETF_a16_imm, opRETF_a16, opINT3, opINT, opINTO, opIRET_286, /*d0*/ opD0_a16, opD1_w_a16, opD2_a16, opD3_w_a16, opAAM, opAAD, opSETALC, opXLAT_a16, opESCAPE_d8_a16,opESCAPE_d9_a16,opESCAPE_da_a16,opESCAPE_db_a16,opESCAPE_dc_a16,opESCAPE_dd_a16,opESCAPE_de_a16,opESCAPE_df_a16, /*e0*/ opLOOPNE_w, opLOOPE_w, opLOOP_w, opJCXZ, opIN_AL_imm, opIN_AX_imm, opOUT_AL_imm, opOUT_AX_imm, opCALL_r16, opJMP_r16, opJMP_far_a16, opJMP_r8, opIN_AL_DX, opIN_AX_DX, opOUT_AL_DX, opOUT_AX_DX, -/*f0*/ opLOCK, ILLEGAL, opREPNE, opREPE, opHLT, opCMC, opF6_a16, opF7_w_a16, opCLC, opSTC, opCLI, opSTI, opCLD, opSTD, opINCDEC_b_a16, opFF_w_a16, +/*f0*/ opLOCK, opLOCK, opREPNE, opREPE, opHLT, opCMC, opF6_a16, opF7_w_a16, opCLC, opSTC, opCLI, opSTI, opCLD, opSTD, opINCDEC_b_a16, opFF_w_a16, }; OpFn OP_TABLE(386)[1024] = @@ -1332,7 +1326,7 @@ OpFn OP_TABLE(386)[1024] = /*c0*/ opC0_a16, opC1_w_a16, opRET_w_imm, opRET_w, opLES_w_a16, opLDS_w_a16, opMOV_b_imm_a16,opMOV_w_imm_a16,opENTER_w, opLEAVE_w, opRETF_a16_imm, opRETF_a16, opINT3, opINT, opINTO, opIRET, /*d0*/ opD0_a16, opD1_w_a16, opD2_a16, opD3_w_a16, opAAM, opAAD, opSETALC, opXLAT_a16, opESCAPE_d8_a16,opESCAPE_d9_a16,opESCAPE_da_a16,opESCAPE_db_a16,opESCAPE_dc_a16,opESCAPE_dd_a16,opESCAPE_de_a16,opESCAPE_df_a16, /*e0*/ opLOOPNE_w, opLOOPE_w, opLOOP_w, opJCXZ, opIN_AL_imm, opIN_AX_imm, opOUT_AL_imm, opOUT_AX_imm, opCALL_r16, opJMP_r16, opJMP_far_a16, opJMP_r8, opIN_AL_DX, opIN_AX_DX, opOUT_AL_DX, opOUT_AX_DX, -/*f0*/ opLOCK, ILLEGAL, opREPNE, opREPE, opHLT, opCMC, opF6_a16, opF7_w_a16, opCLC, opSTC, opCLI, opSTI, opCLD, opSTD, opINCDEC_b_a16, opFF_w_a16, +/*f0*/ opLOCK, opINT1, opREPNE, opREPE, opHLT, opCMC, opF6_a16, opF7_w_a16, opCLC, opSTC, opCLI, opSTI, opCLD, opSTD, opINCDEC_b_a16, opFF_w_a16, /*32-bit data, 16-bit addr*/ /* 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f*/ @@ -1354,7 +1348,7 @@ OpFn OP_TABLE(386)[1024] = /*c0*/ opC0_a16, opC1_l_a16, opRET_l_imm, opRET_l, opLES_l_a16, opLDS_l_a16, opMOV_b_imm_a16,opMOV_l_imm_a16,opENTER_l, opLEAVE_l, opRETF_a32_imm, opRETF_a32, opINT3, opINT, opINTO, opIRETD, /*d0*/ opD0_a16, opD1_l_a16, opD2_a16, opD3_l_a16, opAAM, opAAD, opSETALC, opXLAT_a16, opESCAPE_d8_a16,opESCAPE_d9_a16,opESCAPE_da_a16,opESCAPE_db_a16,opESCAPE_dc_a16,opESCAPE_dd_a16,opESCAPE_de_a16,opESCAPE_df_a16, /*e0*/ opLOOPNE_w, opLOOPE_w, opLOOP_w, opJCXZ, opIN_AL_imm, opIN_EAX_imm, opOUT_AL_imm, opOUT_EAX_imm, opCALL_r32, opJMP_r32, opJMP_far_a32, opJMP_r8, opIN_AL_DX, opIN_EAX_DX, opOUT_AL_DX, opOUT_EAX_DX, -/*f0*/ opLOCK, ILLEGAL, opREPNE, opREPE, opHLT, opCMC, opF6_a16, opF7_l_a16, opCLC, opSTC, opCLI, opSTI, opCLD, opSTD, opINCDEC_b_a16, opFF_l_a16, +/*f0*/ opLOCK, opINT1, opREPNE, opREPE, opHLT, opCMC, opF6_a16, opF7_l_a16, opCLC, opSTC, opCLI, opSTI, opCLD, opSTD, opINCDEC_b_a16, opFF_l_a16, /*16-bit data, 32-bit addr*/ /* 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f*/ @@ -1376,7 +1370,7 @@ OpFn OP_TABLE(386)[1024] = /*c0*/ opC0_a32, opC1_w_a32, opRET_w_imm, opRET_w, opLES_w_a32, opLDS_w_a32, opMOV_b_imm_a32,opMOV_w_imm_a32,opENTER_w, opLEAVE_w, opRETF_a16_imm, opRETF_a16, opINT3, opINT, opINTO, opIRET, /*d0*/ opD0_a32, opD1_w_a32, opD2_a32, opD3_w_a32, opAAM, opAAD, opSETALC, opXLAT_a32, opESCAPE_d8_a32,opESCAPE_d9_a32,opESCAPE_da_a32,opESCAPE_db_a32,opESCAPE_dc_a32,opESCAPE_dd_a32,opESCAPE_de_a32,opESCAPE_df_a32, /*e0*/ opLOOPNE_l, opLOOPE_l, opLOOP_l, opJECXZ, opIN_AL_imm, opIN_AX_imm, opOUT_AL_imm, opOUT_AX_imm, opCALL_r16, opJMP_r16, opJMP_far_a16, opJMP_r8, opIN_AL_DX, opIN_AX_DX, opOUT_AL_DX, opOUT_AX_DX, -/*f0*/ opLOCK, ILLEGAL, opREPNE, opREPE, opHLT, opCMC, opF6_a32, opF7_w_a32, opCLC, opSTC, opCLI, opSTI, opCLD, opSTD, opINCDEC_b_a32, opFF_w_a32, +/*f0*/ opLOCK, opINT1, opREPNE, opREPE, opHLT, opCMC, opF6_a32, opF7_w_a32, opCLC, opSTC, opCLI, opSTI, opCLD, opSTD, opINCDEC_b_a32, opFF_w_a32, /*32-bit data, 32-bit addr*/ /* 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f*/ @@ -1398,5 +1392,5 @@ OpFn OP_TABLE(386)[1024] = /*c0*/ opC0_a32, opC1_l_a32, opRET_l_imm, opRET_l, opLES_l_a32, opLDS_l_a32, opMOV_b_imm_a32,opMOV_l_imm_a32,opENTER_l, opLEAVE_l, opRETF_a32_imm, opRETF_a32, opINT3, opINT, opINTO, opIRETD, /*d0*/ opD0_a32, opD1_l_a32, opD2_a32, opD3_l_a32, opAAM, opAAD, opSETALC, opXLAT_a32, opESCAPE_d8_a32,opESCAPE_d9_a32,opESCAPE_da_a32,opESCAPE_db_a32,opESCAPE_dc_a32,opESCAPE_dd_a32,opESCAPE_de_a32,opESCAPE_df_a32, /*e0*/ opLOOPNE_l, opLOOPE_l, opLOOP_l, opJECXZ, opIN_AL_imm, opIN_EAX_imm, opOUT_AL_imm, opOUT_EAX_imm, opCALL_r32, opJMP_r32, opJMP_far_a32, opJMP_r8, opIN_AL_DX, opIN_EAX_DX, opOUT_AL_DX, opOUT_EAX_DX, -/*f0*/ opLOCK, ILLEGAL, opREPNE, opREPE, opHLT, opCMC, opF6_a32, opF7_l_a32, opCLC, opSTC, opCLI, opSTI, opCLD, opSTD, opINCDEC_b_a32, opFF_l_a32, +/*f0*/ opLOCK, opINT1, opREPNE, opREPE, opHLT, opCMC, opF6_a32, opF7_l_a32, opCLC, opSTC, opCLI, opSTI, opCLD, opSTD, opINCDEC_b_a32, opFF_l_a32, }; diff --git a/src/808x.c b/src/808x.c index 07f8ed95b..6f72fb613 100644 --- a/src/808x.c +++ b/src/808x.c @@ -1,8 +1,6 @@ /* Copyright holders: Sarah Walker, Tenshi see COPYING for more details */ -//1B64 - Vid_SetMode (Vid_Vesa.c) -//6689c - CONS_Printf /*SHR AX,1 4 clocks - fetch opcode @@ -13,6 +11,8 @@ 2 clocks - fetch opcode 1 2 clocks - execute 2 clocks - fetch opcode 2 etc*/ #include +#include + #include "ibm.h" #include "cpu.h" @@ -25,6 +25,7 @@ int xt_cpu_multi; int nmi = 0; +int nmi_auto_clear = 0; int nextcyc=0; int cycdiff; @@ -95,7 +96,7 @@ void writememl(uint32_t s, uint32_t a, uint32_t v) } -void dumpregs(); +void dumpregs(int); uint16_t oldcs; int oldcpl; @@ -109,14 +110,13 @@ int output=0; int shadowbios=0; int ins=0; -//#define readmemb(a) (((a)<0xA0000)?ram[a]:readmembl(a)) int fetchcycles=0,memcycs,fetchclocks; uint8_t prefetchqueue[6]; uint16_t prefetchpc; int prefetchw=0; -static inline uint8_t FETCH() +static __inline uint8_t FETCH() { uint8_t temp; /* temp=prefetchqueue[0]; @@ -134,20 +134,16 @@ static inline uint8_t FETCH() } }*/ -// uint8_t temp=readmemb(cs+pc); -// if (output) printf("FETCH %04X %i\n",pc,fetchcycles); - if (prefetchw==0) //(fetchcycles<4) + if (prefetchw==0) { cycles-=(4-(fetchcycles&3)); fetchclocks+=(4-(fetchcycles&3)); fetchcycles=4; temp=readmembf(cs+cpu_state.pc); prefetchpc = cpu_state.pc = cpu_state.pc + 1; -// if (output) printf(" FETCH %04X:%04X %02X %04X %04X %i\n",CS,pc-1,temp,pc,prefetchpc,prefetchw); if (is8086 && (cpu_state.pc&1)) { prefetchqueue[0]=readmembf(cs+cpu_state.pc); -// if (output) printf(" PREFETCHED from %04X:%04X %02X 8086\n",CS,prefetchpc,prefetchqueue[prefetchw]); prefetchpc++; prefetchw++; } @@ -161,19 +157,15 @@ static inline uint8_t FETCH() prefetchqueue[3]=prefetchqueue[4]; prefetchqueue[4]=prefetchqueue[5]; prefetchw--; -// if (output) printf("PREFETCH %04X:%04X %02X %04X %04X %i\n",CS,pc,temp,pc,prefetchpc,prefetchw); fetchcycles-=4; -// fetchclocks+=4; cpu_state.pc++; } -// if (output) printf("%i\n",fetchcycles); return temp; } -static inline void FETCHADD(int c) +static __inline void FETCHADD(int c) { int d; -// if (output) printf("FETCHADD %i\n",c); if (c<0) return; if (prefetchw>((is8086)?4:3)) return; d=c+(fetchcycles&3); @@ -183,26 +175,22 @@ static inline void FETCHADD(int c) if (is8086 && !(prefetchpc&1)) { prefetchqueue[prefetchw]=readmembf(cs+prefetchpc); -// printf("PREFETCHED from %04X:%04X %02X 8086\n",CS,prefetchpc,prefetchqueue[prefetchw]); prefetchpc++; prefetchw++; } if (prefetchw<6) { prefetchqueue[prefetchw]=readmembf(cs+prefetchpc); -// printf("PREFETCHED from %04X:%04X %02X\n",CS,prefetchpc,prefetchqueue[prefetchw]); prefetchpc++; prefetchw++; } } fetchcycles+=c; if (fetchcycles>16) fetchcycles=16; -// if (fetchcycles>24) fetchcycles=24; } void FETCHCOMPLETE() { -// pclog("Fetchcomplete %i %i %i\n",fetchcycles&3,fetchcycles,prefetchw); if (!(fetchcycles&3)) return; if (prefetchw>((is8086)?4:3)) return; if (!prefetchw) nextcyc=(4-(fetchcycles&3)); @@ -211,47 +199,24 @@ void FETCHCOMPLETE() if (is8086 && !(prefetchpc&1)) { prefetchqueue[prefetchw]=readmembf(cs+prefetchpc); -// printf("PREFETCHEDc from %04X:%04X %02X 8086\n",CS,prefetchpc,prefetchqueue[prefetchw]); prefetchpc++; prefetchw++; } if (prefetchw<6) { prefetchqueue[prefetchw]=readmembf(cs+prefetchpc); -// printf("PREFETCHEDc from %04X:%04X %02X\n",CS,prefetchpc,prefetchqueue[prefetchw]); prefetchpc++; prefetchw++; } fetchcycles+=(4-(fetchcycles&3)); } -static inline void FETCHCLEAR() +static __inline void FETCHCLEAR() { -/* int c; - fetchcycles=0; - prefetchpc=pc; - if (is8086 && (prefetchpc&1)) cycles-=4; - for (c=0;c<((is8086)?6:4);c++) - { - prefetchqueue[c]=readmembf(cs+prefetchpc); - if (!is8086 || !(prefetchpc&1)) cycles-=4; - prefetchpc++; - } - prefetchw=(is8086)?6:4;*/ -// fetchcycles=0; prefetchpc=cpu_state.pc; prefetchw=0; memcycs=cycdiff-cycles; fetchclocks=0; -// memcycs=cycles; -/* prefetchqueue[0]=readmembf(cs+prefetchpc); - prefetchpc++; - prefetchw=1; - if (is8086 && prefetchpc&1) - { - prefetchqueue[1]=readmembf(cs+prefetchpc); - prefetchpc++; - }*/ } static uint16_t getword() @@ -270,13 +235,13 @@ r16(/r) AX CX DX BX SP BP SI DI r32(/r) EAX ECX EDX EBX ESP EBP ESI EDI /digit (Opcode) 0 1 2 3 4 5 6 7 REG = 000 001 010 011 100 101 110 111 - ����Address + ÚÄÄÄAddress disp8 denotes an 8-bit displacement following the ModR/M byte, to be sign-extended and added to the index. disp16 denotes a 16-bit displacement following the ModR/M byte, to be added to the index. Default segment register is SS for the effective addresses containing a BP index, DS for other effective addresses. - �Ŀ �Mod R/M� ���������ModR/M Values in Hexadecimal�������Ŀ + ÄÄ¿ ÚMod R/M¿ ÚÄÄÄÄÄÄÄÄModR/M Values in HexadecimalÄÄÄÄÄÄÄÄ¿ [BX + SI] 000 00 08 10 18 20 28 30 38 [BX + DI] 001 01 09 11 19 21 29 31 39 @@ -391,30 +356,28 @@ static void fetcheal() cpu_state.last_ea = cpu_state.eaaddr; } -static inline uint8_t geteab() +static __inline uint8_t geteab() { if (cpu_mod == 3) return (cpu_rm & 4) ? cpu_state.regs[cpu_rm & 3].b.h : cpu_state.regs[cpu_rm & 3].b.l; return readmemb(easeg+cpu_state.eaaddr); } -static inline uint16_t geteaw() +static __inline uint16_t geteaw() { if (cpu_mod == 3) return cpu_state.regs[cpu_rm].w; -// if (output==3) printf("GETEAW %04X:%08X\n",easeg,eaaddr); return readmemw(easeg,cpu_state.eaaddr); } -static inline uint16_t geteaw2() +static __inline uint16_t geteaw2() { if (cpu_mod == 3) return cpu_state.regs[cpu_rm].w; -// printf("Getting addr from %04X:%04X %05X\n",easeg,eaaddr+2,easeg+eaaddr+2); return readmemw(easeg,(cpu_state.eaaddr+2)&0xFFFF); } -static inline void seteab(uint8_t val) +static __inline void seteab(uint8_t val) { if (cpu_mod == 3) { @@ -429,19 +392,20 @@ static inline void seteab(uint8_t val) } } -static inline void seteaw(uint16_t val) +static __inline void seteaw(uint16_t val) { if (cpu_mod == 3) cpu_state.regs[cpu_rm].w = val; else { writememw(easeg,cpu_state.eaaddr,val); -// writememb(easeg+eaaddr+1,val>>8); } } +#undef getr8 #define getr8(r) ((r & 4) ? cpu_state.regs[r & 3].b.h : cpu_state.regs[r & 3].b.l) +#undef setr8 #define setr8(r,v) if (r & 4) cpu_state.regs[r & 3].b.h = v; \ else cpu_state.regs[r & 3].b.l = v; @@ -465,10 +429,14 @@ void makeznptable() if (c&64) d++; if (c&128) d++; if (d&1) + { znptable8[c]=0; + } else + { znptable8[c]=P_FLAG; - if (c == 0xb1) pclog("znp8 b1 = %i %02X\n", d, znptable8[c]); + } + if (c == 0xb1) pclog("znp8 b1 = %i %02X\n", d, znptable8[c]); if (!c) znptable8[c]|=Z_FLAG; if (c&0x80) znptable8[c]|=N_FLAG; } @@ -491,9 +459,7 @@ void makeznptable() if (c == 0x65b1) pclog("znp16 65b1 = %i %02X\n", d, znptable16[c]); if (!c) znptable16[c]|=Z_FLAG; if (c&0x8000) znptable16[c]|=N_FLAG; - } - -// makemod1table(); + } } int timetolive=0; @@ -502,46 +468,28 @@ extern uint32_t oldpc2; int indump = 0; -void dumpregs() +void dumpregs(int force) { int c,d=0,e=0; #ifndef RELEASE_BUILD FILE *f; - if (indump) return; +#endif + + /* Only dump when needed, and only once.. */ + if (indump || (!force && !dump_on_exit)) return; + +#ifndef RELEASE_BUILD indump = 1; -// return; output=0; -// return; -// savenvr(); -// return; -chdir(pcempath); + chdir(pcempath); nopageerrors=1; -/* f=fopen("rram3.dmp","wb"); - for (c=0;c<0x8000000;c++) putc(readmemb(c+0x10000000),f); - fclose(f);*/ f=fopen("ram.dmp","wb"); fwrite(ram,mem_size*1024,1,f); fclose(f); -/* pclog("Dumping rram5.dmp\n"); - f=fopen("rram5.dmp","wb"); - for (c=0;c<0x1000000;c++) putc(readmemb(c+0x10150000),f); - fclose(f);*/ pclog("Dumping rram.dmp\n"); f=fopen("rram.dmp","wb"); for (c=0;c<0x1000000;c++) putc(readmemb(c),f); fclose(f); -/* f=fopen("rram2.dmp","wb"); - for (c=0;c<0x100000;c++) putc(readmemb(c+0xbff00000),f); - fclose(f); - f = fopen("stack.dmp","wb"); - for (c = 0; c < 0x6000; c++) putc(readmemb(c+0xFFDFA000), f); - fclose(f); - f = fopen("tempx.dmp","wb"); - for (c = 0; c < 0x10000; c++) putc(readmemb(c+0xFC816000), f); - fclose(f); - f = fopen("tempx2.dmp","wb"); - for (c = 0; c < 0x10000; c++) putc(readmemb(c+0xFDEF5000), f); - fclose(f);*/ pclog("Dumping rram4.dmp\n"); f=fopen("rram4.dmp","wb"); for (c=0;c<0x0050000;c++) @@ -551,36 +499,6 @@ chdir(pcempath); } fclose(f); pclog("Dumping done\n"); -/* f=fopen("rram6.dmp","wb"); - for (c=0;c<0x1000000;c++) putc(readmemb(c+0xBF000000),f); - fclose(f);*/ -/* f=fopen("ram6.bin","wb"); - fwrite(ram+0x10100,0xA000,1,f); - fclose(f); - f=fopen("boot.bin","wb"); - fwrite(ram+0x7C00,0x200,1,f); - fclose(f); - f=fopen("ram7.bin","wb"); - fwrite(ram+0x11100,0x2000,1,f); - fclose(f); - f=fopen("ram8.bin","wb"); - fwrite(ram+0x3D210,0x200,1,f); - fclose(f); */ -/* f=fopen("bios.dmp","wb"); - fwrite(rom,0x20000,1,f); - fclose(f);*/ -/* f=fopen("kernel.dmp","wb"); - for (c=0;c<0x200000;c++) putc(readmemb(c+0xC0000000),f); - fclose(f);*/ -/* f=fopen("rram.dmp","wb"); - for (c=0;c<0x1500000;c++) putc(readmemb(c),f); - fclose(f); - if (!times) - { - f=fopen("thing.dmp","wb"); - fwrite(ram+0x11E50,0x1000,1,f); - fclose(f); - }*/ #endif if (is386) printf("EAX=%08X EBX=%08X ECX=%08X EDX=%08X\nEDI=%08X ESI=%08X EBP=%08X ESP=%08X\n",EAX,EBX,ECX,EDX,EDI,ESI,EBP,ESP); @@ -631,8 +549,6 @@ void resetx86() ins = 0; use32=0; stack32=0; -// i86_Reset(); -// cs=0xFFFF0; cpu_state.pc=0; msw=0; if (is486) @@ -655,6 +571,7 @@ void resetx86() FETCHCLEAR(); x87_reset(); cpu_set_edx(); + EAX = 0; ESP=0; mmu_perm=4; memset(inscounts, 0, sizeof(inscounts)); @@ -667,12 +584,8 @@ void resetx86() void softresetx86() { -// dumpregs(); -// exit(-1); use32=0; stack32=0; -// i86_Reset(); -// cs=0xFFFF0; cpu_state.pc=0; msw=0; cr0=0; @@ -680,7 +593,6 @@ void softresetx86() eflags=0; cgate32=0; loadcs(0xFFFF); - //rammask=0xFFFFFFFF; flags=2; idt.base = 0; x86seg_reset(); @@ -787,7 +699,6 @@ static void setsub16(uint16_t a, uint16_t b) flags|=znptable16[c&0xFFFF]; if (c&0x10000) flags|=C_FLAG; if ((a^b)&(a^c)&0x8000) flags|=V_FLAG; -// if (output) printf("%04X %04X %i\n",a^b,a^c,flags&V_FLAG); if (((a&0xF)-(b&0xF))&0x10) flags|=A_FLAG; } static void setsub16nc(uint16_t a, uint16_t b) @@ -827,18 +738,16 @@ int firstrepcycle=1; void rep(int fv) { - uint8_t temp; + uint8_t temp = 0; int c=CX; uint8_t temp2; uint16_t tempw,tempw2; - uint16_t ipc=cpu_state.oldpc;//pc-1; + uint16_t ipc=cpu_state.oldpc; int changeds=0; - uint32_t oldds; + uint32_t oldds = 0; startrep: temp=FETCH(); -// if (firstrepcycle && temp==0xA5) printf("REP MOVSW %06X:%04X %06X:%04X\n",ds,SI,es,DI); -// if (output) printf("REP %02X %04X\n",temp,ipc); switch (temp) { case 0x08: @@ -885,7 +794,6 @@ void rep(int fv) { temp2=readmemb(ds+SI); writememb(es+DI,temp2); -// if (output) printf("Moved %02X from %04X:%04X to %04X:%04X\n",temp2,ds>>4,SI,es>>4,DI); if (flags&D_FLAG) { DI--; SI--; } else { DI++; SI++; } c--; @@ -894,9 +802,6 @@ void rep(int fv) FETCHADD(17-memcycs); } if (IRQTEST && c>0) cpu_state.pc=ipc; -// if (c>0) { firstrepcycle=0; pc=ipc; if (cpu_state.ssegs) cpu_state.ssegs++; FETCHCLEAR(); } -// else firstrepcycle=1; -// } break; case 0xA5: /*REP MOVSW*/ while (c>0 && !IRQTEST) @@ -912,9 +817,6 @@ void rep(int fv) FETCHADD(17 - memcycs); } if (IRQTEST && c>0) cpu_state.pc=ipc; -// if (c>0) { firstrepcycle=0; pc=ipc; if (cpu_state.ssegs) cpu_state.ssegs++; FETCHCLEAR(); } -// else firstrepcycle=1; -// } break; case 0xA6: /*REP CMPSB*/ if (fv) flags|=Z_FLAG; @@ -924,7 +826,6 @@ void rep(int fv) memcycs=0; temp=readmemb(ds+SI); temp2=readmemb(es+DI); -// printf("CMPSB %c %c %i %05X %05X %04X:%04X\n",temp,temp2,c,ds+SI,es+DI,cs>>4,pc); if (flags&D_FLAG) { DI--; SI--; } else { DI++; SI++; } c--; @@ -934,8 +835,6 @@ void rep(int fv) FETCHADD(30 - memcycs); } if (IRQTEST && c>0 && (fv==((flags&Z_FLAG)?1:0))) cpu_state.pc=ipc; -// if ((c>0) && (fv==((flags&Z_FLAG)?1:0))) { pc=ipc; firstrepcycle=0; if (cpu_state.ssegs) cpu_state.ssegs++; FETCHCLEAR(); } -// else firstrepcycle=1; break; case 0xA7: /*REP CMPSW*/ if (fv) flags|=Z_FLAG; @@ -954,9 +853,6 @@ void rep(int fv) FETCHADD(30 - memcycs); } if (IRQTEST && c>0 && (fv==((flags&Z_FLAG)?1:0))) cpu_state.pc=ipc; -// if ((c>0) && (fv==((flags&Z_FLAG)?1:0))) { pc=ipc; firstrepcycle=0; if (cpu_state.ssegs) cpu_state.ssegs++; FETCHCLEAR(); } -// else firstrepcycle=1; -// if (firstrepcycle) printf("REP CMPSW %06X:%04X %06X:%04X %04X %04X\n",ds,SI,es,DI,tempw,tempw2); break; case 0xAA: /*REP STOSB*/ while (c>0 && !IRQTEST) @@ -971,8 +867,6 @@ void rep(int fv) FETCHADD(10 - memcycs); } if (IRQTEST && c>0) cpu_state.pc=ipc; -// if (c>0) { firstrepcycle=0; pc=ipc; if (ssegs) ssegs++; FETCHCLEAR(); } -// else firstrepcycle=1; break; case 0xAB: /*REP STOSW*/ while (c>0 && !IRQTEST) @@ -987,8 +881,6 @@ void rep(int fv) FETCHADD(10 - memcycs); } if (IRQTEST && c>0) cpu_state.pc=ipc; -// if (c>0) { firstrepcycle=0; pc=ipc; if (ssegs) ssegs++; FETCHCLEAR(); } -// else firstrepcycle=1; break; case 0xAC: /*REP LODSB*/ if (c>0) @@ -1020,18 +912,14 @@ void rep(int fv) if ((c>0) && (fv==((flags&Z_FLAG)?1:0))) { temp2=readmemb(es+DI); -// if (output) printf("SCASB %02X %c %02X %05X ",temp2,temp2,AL,es+DI); setsub8(AL,temp2); -// if (output && flags&Z_FLAG) printf("Match %02X %02X\n",AL,temp2); if (flags&D_FLAG) DI--; else DI++; c--; cycles -= 15; } -//if (output) printf("%i %i %i %i\n",c,(c>0),(fv==((flags&Z_FLAG)?1:0)),((c>0) && (fv==((flags&Z_FLAG)?1:0)))); if ((c>0) && (fv==((flags&Z_FLAG)?1:0))) { cpu_state.pc=ipc; firstrepcycle=0; if (cpu_state.ssegs) cpu_state.ssegs++; FETCHCLEAR(); } else firstrepcycle=1; -// cycles-=120; break; case 0xAF: /*REP SCASW*/ if (fv) flags|=Z_FLAG; @@ -1052,15 +940,11 @@ void rep(int fv) cpu_state.pc = ipc+1; cycles-=20; FETCHCLEAR(); -// printf("Bad REP %02X\n",temp); -// dumpregs(); -// exit(-1); } CX=c; if (changeds) ds=oldds; if (IRQTEST) takeint = 1; -// if (pc==ipc) FETCHCLEAR(); } @@ -1070,10 +954,9 @@ int firstrepcycle; int skipnextprint=0; int instime=0; -//#if 0 void execx86(int cycs) { - uint8_t temp,temp2; + uint8_t temp = 0,temp2; uint16_t addr,tempw,tempw2,tempw3,tempw4; int8_t offset; int tempws; @@ -1082,24 +965,14 @@ void execx86(int cycs) int tempi; int trap; -// printf("Run x86! %i %i\n",cycles,cycs); cycles+=cycs; -// i86_Execute(cycs); -// return; while (cycles>0) { -// old83=old82; -// old82=old8; -// old8=oldpc|(oldcs<<16); -// if (pc==0x96B && cs==0x9E040) { printf("Hit it\n"); output=1; timetolive=150; } -// if (pc<0x8000) printf("%04X : %04X %04X %04X %04X %04X %04X %04X %04X %04X %04X %04X %04X %02X %04X %i\n",pc,AX,BX,CX,DX,cs>>4,ds>>4,es>>4,ss>>4,DI,SI,BP,SP,opcode,flags,disctime); cycdiff=cycles; timer_start_period(cycles*xt_cpu_multi); current_diff = 0; cycles-=nextcyc; -// if (instime) pclog("Cycles %i %i\n",cycles,cycdiff); nextcyc=0; -// if (output) printf("CLOCK %i %i\n",cycdiff,cycles); fetchclocks=0; oldcs=CS; cpu_state.oldpc=cpu_state.pc; @@ -1108,33 +981,17 @@ void execx86(int cycs) tempc=flags&C_FLAG; trap=flags&T_FLAG; cpu_state.pc--; -// output=1; -// if (output) printf("%04X:%04X : %04X %04X %04X %04X %04X %04X %04X %04X %04X %04X %04X %04X %02X %04X\n",cs>>4,pc,AX,BX,CX,DX,cs>>4,ds>>4,es>>4,ss>>4,DI,SI,BP,SP,opcode,flags&~0x200,rmdat); -//#if 0 if (output) { -// if ((opcode!=0xF2 && opcode!=0xF3) || firstrepcycle) -// { if (!skipnextprint) printf("%04X:%04X : %04X %04X %04X %04X %04X %04X %04X %04X %04X %04X %04X %04X %02X %04X %i %p %02X\n",cs,cpu_state.pc,AX,BX,CX,DX,CS,DS,ES,SS,DI,SI,BP,SP,opcode,flags, ins, ram, ram[0x1a925]); skipnextprint=0; -// ins++; -// } } -//#endif cpu_state.pc++; inhlt=0; -// if (ins==500000) { dumpregs(); exit(0); }*/ switch (opcode) { case 0x00: /*ADD 8,reg*/ fetchea(); -/* if (!rmdat) pc--; - if (!rmdat) - { - fatal("Crashed\n"); -// clear_keybuf(); -// readkey(); - }*/ temp=geteab(); setadd8(temp,getr8(cpu_reg)); temp+=getr8(cpu_reg); @@ -1317,7 +1174,6 @@ void execx86(int cycs) cpu_state.last_ea = SP; noint=1; cycles-=12; -// output=1; break; case 0x18: /*SBB 8,reg*/ @@ -1333,7 +1189,6 @@ void execx86(int cycs) fetchea(); tempw=geteaw(); tempw2=cpu_state.regs[cpu_reg].w; -// printf("%04X:%04X SBB %04X-%04X,%i\n",cs>>4,pc,tempw,tempw2,tempc); setsbc16(tempw,tempw2); tempw-=(tempw2+tempc); seteaw(tempw); @@ -1350,7 +1205,6 @@ void execx86(int cycs) fetchea(); tempw=geteaw(); tempw2=cpu_state.regs[cpu_reg].w; -// printf("%04X:%04X SBB %04X-%04X,%i\n",cs>>4,pc,tempw,tempw2,tempc); setsbc16(tempw2,tempw); tempw2-=(tempw+tempc); cpu_state.regs[cpu_reg].w=tempw2; @@ -1442,7 +1296,6 @@ void execx86(int cycs) cpu_state.ssegs=2; cycles-=4; goto opcodestart; -// break; case 0x27: /*DAA*/ if ((flags&A_FLAG) || ((AL&0xF)>9)) @@ -1452,15 +1305,11 @@ void execx86(int cycs) flags|=A_FLAG; if (tempi&0x100) flags|=C_FLAG; } -// else -// flags&=~A_FLAG; if ((flags&C_FLAG) || (AL>0x9F)) { AL+=0x60; flags|=C_FLAG; } -// else -// flags&=~C_FLAG; setznp8(AL); cycles-=4; break; @@ -1476,7 +1325,6 @@ void execx86(int cycs) case 0x29: /*SUB 16,reg*/ fetchea(); tempw=geteaw(); -// printf("%04X:%04X %04X-%04X\n",cs>>4,pc,tempw,cpu_state.regs[cpu_reg].w); setsub16(tempw,cpu_state.regs[cpu_reg].w); tempw-=cpu_state.regs[cpu_reg].w; seteaw(tempw); @@ -1492,7 +1340,6 @@ void execx86(int cycs) case 0x2B: /*SUB cpu_reg,16*/ fetchea(); tempw=geteaw(); -// printf("%04X:%04X %04X-%04X\n",cs>>4,pc,cpu_state.regs[cpu_reg].w,tempw); setsub16(cpu_state.regs[cpu_reg].w,tempw); cpu_state.regs[cpu_reg].w-=tempw; cycles-=((cpu_mod==3)?3:13); @@ -1504,8 +1351,6 @@ void execx86(int cycs) cycles-=4; break; case 0x2D: /*SUB AX,#16*/ -// printf("INS %i\n",ins); -// output=1; tempw=getword(); setsub16(AX,tempw); AX-=tempw; @@ -1526,15 +1371,11 @@ void execx86(int cycs) flags|=A_FLAG; if (tempi&0x100) flags|=C_FLAG; } -// else -// flags&=~A_FLAG; if ((flags&C_FLAG)||(AL>0x9F)) { AL-=0x60; flags|=C_FLAG; } -// else -// flags&=~C_FLAG; setznp8(AL); cycles-=4; break; @@ -1594,7 +1435,6 @@ void execx86(int cycs) cpu_state.ssegs=2; cycles-=4; goto opcodestart; -// break; case 0x37: /*AAA*/ if ((flags&A_FLAG)||((AL&0xF)>9)) @@ -1612,28 +1452,24 @@ void execx86(int cycs) case 0x38: /*CMP 8,reg*/ fetchea(); temp=geteab(); -// if (output) printf("CMP %02X-%02X\n",temp,getr8(cpu_reg)); setsub8(temp,getr8(cpu_reg)); cycles-=((cpu_mod==3)?3:13); break; case 0x39: /*CMP 16,reg*/ fetchea(); tempw=geteaw(); -// if (output) printf("CMP %04X-%04X\n",tempw,cpu_state.regs[cpu_reg].w); setsub16(tempw,cpu_state.regs[cpu_reg].w); cycles-=((cpu_mod==3)?3:13); break; case 0x3A: /*CMP cpu_reg,8*/ fetchea(); temp=geteab(); -// if (output) printf("CMP %02X-%02X\n",getr8(cpu_reg),temp); setsub8(getr8(cpu_reg),temp); cycles-=((cpu_mod==3)?3:13); break; case 0x3B: /*CMP cpu_reg,16*/ fetchea(); tempw=geteaw(); -// printf("CMP %04X-%04X\n",cpu_state.regs[cpu_reg].w,tempw); setsub16(cpu_state.regs[cpu_reg].w,tempw); cycles-=((cpu_mod==3)?3:13); break; @@ -1655,7 +1491,6 @@ void execx86(int cycs) cpu_state.ssegs=2; cycles-=4; goto opcodestart; -// break; case 0x3F: /*AAS*/ if ((flags&A_FLAG)||((AL&0xF)>9)) @@ -1825,13 +1660,11 @@ void execx86(int cycs) cycles-=((cpu_mod==3)?4:23); break; case 0x10: /*ADC b,#8*/ -// temp2+=(flags&C_FLAG); setadc8(temp,temp2); seteab(temp+temp2+tempc); cycles-=((cpu_mod==3)?4:23); break; case 0x18: /*SBB b,#8*/ -// temp2+=(flags&C_FLAG); setsbc8(temp,temp2); seteab(temp-(temp2+tempc)); cycles-=((cpu_mod==3)?4:23); @@ -1859,11 +1692,6 @@ void execx86(int cycs) setsub8(temp,temp2); cycles-=((cpu_mod==3)?4:14); break; - -// default: -// printf("Bad 80 opcode %02X\n",rmdat&0x38); -// dumpregs(); -// exit(-1); } break; @@ -1887,7 +1715,6 @@ void execx86(int cycs) cycles-=((cpu_mod==3)?4:23); break; case 0x10: /*ADC w,#16*/ -// tempw2+=(flags&C_FLAG); setadc16(tempw,tempw2); tempw+=tempw2+tempc; seteaw(tempw); @@ -1901,7 +1728,6 @@ void execx86(int cycs) cycles-=((cpu_mod==3)?4:23); break; case 0x18: /*SBB w,#16*/ -// tempw2+=(flags&C_FLAG); setsbc16(tempw,tempw2); seteaw(tempw-(tempw2+tempc)); cycles-=((cpu_mod==3)?4:23); @@ -1920,15 +1746,9 @@ void execx86(int cycs) cycles-=((cpu_mod==3)?4:23); break; case 0x38: /*CMP w,#16*/ -// printf("CMP %04X %04X\n",tempw,tempw2); setsub16(tempw,tempw2); cycles-=((cpu_mod==3)?4:14); break; - -// default: -// printf("Bad 81 opcode %02X\n",rmdat&0x38); -// dumpregs(); -// exit(-1); } break; @@ -1953,14 +1773,12 @@ void execx86(int cycs) cycles-=((cpu_mod==3)?4:23); break; case 0x10: /*ADC w,#8*/ -// tempw2+=(flags&C_FLAG); setadc16(tempw,tempw2); tempw+=tempw2+tempc; seteaw(tempw); cycles-=((cpu_mod==3)?4:23); break; case 0x18: /*SBB w,#8*/ -// tempw2+=(flags&C_FLAG); setsbc16(tempw,tempw2); tempw-=(tempw2+tempc); seteaw(tempw); @@ -1990,11 +1808,6 @@ void execx86(int cycs) setsub16(tempw,tempw2); cycles-=((cpu_mod==3)?4:14); break; - -// default: -// printf("Bad 83 opcode %02X\n",rmdat&0x38); -// dumpregs(); -// exit(-1); } break; @@ -2081,9 +1894,7 @@ void execx86(int cycs) break; case 0x8E: /*MOV sreg,w*/ -// if (output) printf("MOV %04X ",pc); fetchea(); -// if (output) printf("%04X %02X\n",pc,rmdat); switch (rmdat&0x38) { case 0x00: /*ES*/ @@ -2103,8 +1914,6 @@ void execx86(int cycs) tempw=geteaw(); loadseg(tempw,&_ss); if (cpu_state.ssegs) oldss=ss; -// printf("LOAD SS %04X %04X\n",tempw,SS); -// printf("SS loaded with %04X %04X:%04X %04X %04X %04X\n",ss>>4,cs>>4,pc,CX,DX,es>>4); break; } cycles-=((cpu_mod==3)?2:12); @@ -2149,7 +1958,6 @@ void execx86(int cycs) tempw4=cpu_state.pc; if (cpu_state.ssegs) ss=oldss; cpu_state.pc=tempw; -// printf("0x9a"); loadcs(tempw2); writememw(ss,(SP-2)&0xFFFF,tempw3); writememw(ss,(SP-4)&0xFFFF,tempw4); @@ -2191,7 +1999,6 @@ void execx86(int cycs) break; case 0xA1: /*MOV AX,(w)*/ addr=getword(); -// printf("Reading AX from %05X %04X:%04X\n",ds+addr,ds>>4,addr); AX=readmemw(ds,addr); cycles-=!4; break; @@ -2202,7 +2009,6 @@ void execx86(int cycs) break; case 0xA3: /*MOV (w),AX*/ addr=getword(); -// if (!addr) printf("Write !addr %04X:%04X\n",cs>>4,pc); writememw(ds,addr,AX); cycles-=14; break; @@ -2232,7 +2038,6 @@ void execx86(int cycs) case 0xA7: /*CMPSW*/ tempw =readmemw(ds,SI); tempw2=readmemw(es,DI); -// printf("CMPSW %04X %04X\n",tempw,tempw2); setsub16(tempw,tempw2); if (flags&D_FLAG) { DI-=2; SI-=2; } else { DI+=2; SI+=2; } @@ -2264,13 +2069,11 @@ void execx86(int cycs) break; case 0xAC: /*LODSB*/ AL=readmemb(ds+SI); -// printf("LODSB %04X:%04X %02X %04X:%04X\n",cs>>4,pc,AL,ds>>4,SI); if (flags&D_FLAG) SI--; else SI++; cycles-=16; break; case 0xAD: /*LODSW*/ -// if (times) printf("LODSW %04X:%04X\n",cs>>4,pc); AX=readmemw(ds,SI); if (flags&D_FLAG) SI-=2; else SI+=2; @@ -2334,8 +2137,6 @@ void execx86(int cycs) tempw=getword(); if (cpu_state.ssegs) ss=oldss; cpu_state.pc=readmemw(ss,SP); -// printf("C2\n"); -// printf("RET to %04X\n",pc); SP+=2+tempw; cycles-=24; FETCHCLEAR(); @@ -2344,16 +2145,14 @@ void execx86(int cycs) case 0xC3: /*RET*/ if (cpu_state.ssegs) ss=oldss; cpu_state.pc=readmemw(ss,SP); -// printf("C3\n"); -// if (output) printf("RET to %04X %05X\n",pc,ss+SP); SP+=2; cycles-=20; FETCHCLEAR(); break; case 0xC4: /*LES*/ fetchea(); - cpu_state.regs[cpu_reg].w=readmemw(easeg,cpu_state.eaaddr); //geteaw(); - tempw=readmemw(easeg,(cpu_state.eaaddr+2)&0xFFFF); //geteaw2(); + cpu_state.regs[cpu_reg].w=readmemw(easeg,cpu_state.eaaddr); + tempw=readmemw(easeg,(cpu_state.eaaddr+2)&0xFFFF); loadseg(tempw,&_es); cycles-=24; break; @@ -2383,7 +2182,6 @@ void execx86(int cycs) tempw=getword(); if (cpu_state.ssegs) ss=oldss; cpu_state.pc=readmemw(ss,SP); -// printf("CA\n"); loadcs(readmemw(ss,SP+2)); SP+=4; SP+=tempw; @@ -2394,7 +2192,6 @@ void execx86(int cycs) case 0xCB: /*RETF*/ if (cpu_state.ssegs) ss=oldss; cpu_state.pc=readmemw(ss,SP); -// printf("CB\n"); loadcs(readmemw(ss,SP+2)); SP+=4; cycles-=34; @@ -2409,11 +2206,9 @@ void execx86(int cycs) addr=3<<2; flags&=~I_FLAG; flags&=~T_FLAG; -// printf("CC %04X:%04X ",CS,pc); cpu_state.pc=readmemw(0,addr); loadcs(readmemw(0,addr+2)); FETCHCLEAR(); -// printf("%04X:%04X\n",CS,pc); cycles-=72; break; case 0xCD: /*INT*/ @@ -2440,7 +2235,6 @@ void execx86(int cycs) tempw=CS; tempw2=cpu_state.pc; cpu_state.pc=readmemw(ss,SP); -// printf("CF\n"); loadcs(readmemw(ss,((SP+2)&0xFFFF))); flags=readmemw(ss,((SP+4)&0xFFFF))&0xFFF; SP+=6; @@ -2459,7 +2253,6 @@ void execx86(int cycs) temp<<=1; if (flags&C_FLAG) temp|=1; seteab(temp); -// setznp8(temp); if ((flags&C_FLAG)^(temp>>7)) flags|=V_FLAG; else flags&=~V_FLAG; cycles-=((cpu_mod==3)?2:23); @@ -2470,7 +2263,6 @@ void execx86(int cycs) temp>>=1; if (flags&C_FLAG) temp|=0x80; seteab(temp); -// setznp8(temp); if ((temp^(temp>>1))&0x40) flags|=V_FLAG; else flags&=~V_FLAG; cycles-=((cpu_mod==3)?2:23); @@ -2482,7 +2274,6 @@ void execx86(int cycs) temp<<=1; if (temp2) temp|=1; seteab(temp); -// setznp8(temp); if ((flags&C_FLAG)^(temp>>7)) flags|=V_FLAG; else flags&=~V_FLAG; cycles-=((cpu_mod==3)?2:23); @@ -2494,7 +2285,6 @@ void execx86(int cycs) temp>>=1; if (temp2) temp|=0x80; seteab(temp); -// setznp8(temp); if ((temp^(temp>>1))&0x40) flags|=V_FLAG; else flags&=~V_FLAG; cycles-=((cpu_mod==3)?2:23); @@ -2532,11 +2322,6 @@ void execx86(int cycs) flags|=A_FLAG; flags&=~V_FLAG; break; - -// default: -// printf("Bad D0 opcode %02X\n",rmdat&0x38); -// dumpregs(); -// exit(-1); } break; @@ -2551,7 +2336,6 @@ void execx86(int cycs) tempw<<=1; if (flags&C_FLAG) tempw|=1; seteaw(tempw); -// setznp16(tempw); if ((flags&C_FLAG)^(tempw>>15)) flags|=V_FLAG; else flags&=~V_FLAG; cycles-=((cpu_mod==3)?2:23); @@ -2562,7 +2346,6 @@ void execx86(int cycs) tempw>>=1; if (flags&C_FLAG) tempw|=0x8000; seteaw(tempw); -// setznp16(tempw); if ((tempw^(tempw>>1))&0x4000) flags|=V_FLAG; else flags&=~V_FLAG; cycles-=((cpu_mod==3)?2:23); @@ -2585,7 +2368,6 @@ void execx86(int cycs) tempw>>=1; if (temp2) tempw|=0x8000; seteaw(tempw); -// setznp16(tempw); if ((tempw^(tempw>>1))&0x4000) flags|=V_FLAG; else flags&=~V_FLAG; cycles-=((cpu_mod==3)?2:23); @@ -2624,11 +2406,6 @@ void execx86(int cycs) flags|=A_FLAG; flags&=~V_FLAG; break; - -// default: -// printf("Bad D1 opcode %02X\n",rmdat&0x38); -// dumpregs(); -// exit(-1); } break; @@ -2636,9 +2413,7 @@ void execx86(int cycs) fetchea(); temp=geteab(); c=CL; -// cycles-=c; if (!c) break; -// if (c>7) printf("Shiftb %i %02X\n",rmdat&0x38,c); switch (rmdat&0x38) { case 0x00: /*ROL b,CL*/ @@ -2652,7 +2427,6 @@ void execx86(int cycs) if (temp2) flags|=C_FLAG; else flags&=~C_FLAG; seteab(temp); -// setznp8(temp); if ((flags&C_FLAG)^(temp>>7)) flags|=V_FLAG; else flags&=~V_FLAG; cycles-=((cpu_mod==3)?8:28); @@ -2674,7 +2448,6 @@ void execx86(int cycs) cycles-=((cpu_mod==3)?8:28); break; case 0x10: /*RCL b,CL*/ -// printf("RCL %i %02X %02X\n",c,CL,temp); while (c>0) { templ=flags&C_FLAG; @@ -2686,7 +2459,6 @@ void execx86(int cycs) c--; cycles-=4; } -// printf("Now %02X\n",temp); seteab(temp); if ((flags&C_FLAG)^(temp>>7)) flags|=V_FLAG; else flags&=~V_FLAG; @@ -2704,8 +2476,6 @@ void execx86(int cycs) c--; cycles-=4; } -// if (temp2) flags|=C_FLAG; -// else flags&=~C_FLAG; seteab(temp); if ((temp^(temp>>1))&0x40) flags|=V_FLAG; else flags&=~V_FLAG; @@ -2746,11 +2516,6 @@ void execx86(int cycs) cycles-=((cpu_mod==3)?8:28); flags|=A_FLAG; break; - -// default: -// printf("Bad D2 opcode %02X\n",rmdat&0x38); -// dumpregs(); -// exit(-1); } break; @@ -2758,9 +2523,7 @@ void execx86(int cycs) fetchea(); tempw=geteaw(); c=CL; -// cycles-=c; if (!c) break; -// if (c>15) printf("Shiftw %i %02X\n",rmdat&0x38,c); switch (rmdat&0x38) { case 0x00: /*ROL w,CL*/ @@ -2874,11 +2637,6 @@ void execx86(int cycs) cycles-=((cpu_mod==3)?8:28); flags|=A_FLAG; break; - -// default: -// printf("Bad D3 opcode %02X\n",rmdat&0x38); -// dumpregs(); -// exit(-1); } break; @@ -2925,12 +2683,10 @@ void execx86(int cycs) cycles-=6; break; case 0xE2: /*LOOP*/ -// printf("LOOP start\n"); offset=(int8_t)FETCH(); CX--; if (CX) { cpu_state.pc+=offset; cycles-=12; FETCHCLEAR(); } cycles-=5; -// printf("LOOP end!\n"); break; case 0xE3: /*JCXZ*/ offset=(int8_t)FETCH(); @@ -2964,7 +2720,6 @@ void execx86(int cycs) case 0xE8: /*CALL rel 16*/ tempw=getword(); if (cpu_state.ssegs) ss=oldss; -// writememb(ss+((SP-1)&0xFFFF),pc>>8); writememw(ss,((SP-2)&0xFFFF),cpu_state.pc); SP-=2; cpu_state.last_ea = SP; @@ -2973,10 +2728,8 @@ void execx86(int cycs) FETCHCLEAR(); break; case 0xE9: /*JMP rel 16*/ -// pclog("PC was %04X\n",cpu_state.pc); tempw = getword(); cpu_state.pc += tempw; -// pclog("PC now %04X\n",cpu_state.pc); cycles-=15; FETCHCLEAR(); break; @@ -2984,10 +2737,7 @@ void execx86(int cycs) addr=getword(); tempw=getword(); cpu_state.pc=addr; -// printf("EA\n"); loadcs(tempw); -// cs=loadcs(CS); -// cs=CS<<4; cycles-=15; FETCHCLEAR(); break; @@ -3029,13 +2779,6 @@ void execx86(int cycs) break; case 0xF4: /*HLT*/ -// printf("IN HLT!!!! %04X:%04X %08X %08X %08X\n",oldcs,oldpc,old8,old82,old83); -/* if (!(flags & I_FLAG)) - { - pclog("HLT\n"); - dumpregs(); - exit(-1); - }*/ inhlt=1; cpu_state.pc--; FETCHCLEAR(); @@ -3052,6 +2795,7 @@ void execx86(int cycs) switch (rmdat&0x38) { case 0x00: /*TEST b,#8*/ + case 0x08: temp2=FETCH(); temp&=temp2; setznp8(temp); @@ -3093,25 +2837,9 @@ void execx86(int cycs) if (temp) { tempw2=tempw%temp; -/* if (!tempw) - { - writememw((ss+SP)-2,flags|0xF000); - writememw((ss+SP)-4,cs>>4); - writememw((ss+SP)-6,pc); - SP-=6; - flags&=~I_FLAG; - pc=readmemw(0); - cs=readmemw(2)<<4; - printf("Div by zero %04X:%04X\n",cs>>4,pc); -// dumpregs(); -// exit(-1); - } - else - {*/ AH=tempw2; tempw/=temp; AL=tempw&0xFF; -// } } else { @@ -3123,14 +2851,8 @@ void execx86(int cycs) flags&=~I_FLAG; flags&=~T_FLAG; cpu_state.pc=readmemw(0,0); -// printf("F6 30\n"); loadcs(readmemw(0,2)); FETCHCLEAR(); -// cs=loadcs(CS); -// cs=CS<<4; -// printf("Div by zero %04X:%04X %02X %02X\n",cs>>4,pc,0xf6,0x30); -// dumpregs(); -// exit(-1); } cycles-=80; break; @@ -3139,23 +2861,9 @@ void execx86(int cycs) if (temp) { tempw2=tempws%(int)((int8_t)temp); -/* if (!tempw) - { - writememw((ss+SP)-2,flags|0xF000); - writememw((ss+SP)-4,cs>>4); - writememw((ss+SP)-6,pc); - SP-=6; - flags&=~I_FLAG; - pc=readmemw(0); - cs=readmemw(2)<<4; - printf("Div by zero %04X:%04X\n",cs>>4,pc); - } - else - {*/ AH=tempw2&0xFF; tempws/=(int)((int8_t)temp); AL=tempws&0xFF; -// } } else { @@ -3167,20 +2875,11 @@ void execx86(int cycs) flags&=~I_FLAG; flags&=~T_FLAG; cpu_state.pc=readmemw(0,0); -// printf("F6 38\n"); loadcs(readmemw(0,2)); FETCHCLEAR(); -// cs=loadcs(CS); -// cs=CS<<4; -// printf("Div by zero %04X:%04X %02X %02X\n",cs>>4,pc,0xf6,0x38); } cycles-=101; break; - -// default: -// printf("Bad F6 opcode %02X\n",rmdat&0x38); -// dumpregs(); -// exit(-1); } break; @@ -3190,6 +2889,7 @@ void execx86(int cycs) switch (rmdat&0x38) { case 0x00: /*TEST w*/ + case 0x08: tempw2=getword(); setznp16(tempw&tempw2); flags&=~(C_FLAG|V_FLAG|A_FLAG); @@ -3208,7 +2908,6 @@ void execx86(int cycs) case 0x20: /*MUL AX,w*/ setznp16(AX); templ=AX*tempw; -// if (output) printf("%04X*%04X=%08X\n",AX,tempw,templ); AX=templ&0xFFFF; DX=templ>>16; if (AX|DX) flags&=~Z_FLAG; @@ -3219,24 +2918,18 @@ void execx86(int cycs) break; case 0x28: /*IMUL AX,w*/ setznp16(AX); -// printf("IMUL %i %i ",(int)((int16_t)AX),(int)((int16_t)tempw)); tempws=(int)((int16_t)AX)*(int)((int16_t)tempw); if ((tempws>>15) && ((tempws>>15)!=-1)) flags|=(C_FLAG|V_FLAG); else flags&=~(C_FLAG|V_FLAG); -// printf("%i ",tempws); AX=tempws&0xFFFF; tempws=(uint16_t)(tempws>>16); DX=tempws&0xFFFF; -// printf("%04X %04X\n",AX,DX); -// dumpregs(); -// exit(-1); if (AX|DX) flags&=~Z_FLAG; else flags|=Z_FLAG; cycles-=128; break; case 0x30: /*DIV AX,w*/ templ=(DX<<16)|AX; -// printf("DIV %08X/%04X\n",templ,tempw); if (tempw) { tempw2=templ%tempw; @@ -3254,7 +2947,6 @@ void execx86(int cycs) flags&=~I_FLAG; flags&=~T_FLAG; cpu_state.pc=readmemw(0,0); -// printf("F7 30\n"); loadcs(readmemw(0,2)); FETCHCLEAR(); } @@ -3262,11 +2954,9 @@ void execx86(int cycs) break; case 0x38: /*IDIV AX,w*/ tempws=(int)((DX<<16)|AX); -// printf("IDIV %i %i ",tempws,tempw); if (tempw) { tempw2=tempws%(int)((int16_t)tempw); -// printf("%04X ",tempw2); DX=tempw2; tempws/=(int)((int16_t)tempw); AX=tempws&0xFFFF; @@ -3281,17 +2971,11 @@ void execx86(int cycs) flags&=~I_FLAG; flags&=~T_FLAG; cpu_state.pc=readmemw(0,0); -// printf("F7 38\n"); loadcs(readmemw(0,2)); FETCHCLEAR(); } cycles-=165; break; - -// default: -// printf("Bad F7 opcode %02X\n",rmdat&0x38); -// dumpregs(); -// exit(-1); } break; @@ -3300,18 +2984,15 @@ void execx86(int cycs) cycles-=2; break; case 0xF9: /*STC*/ -// printf("STC %04X\n",pc); flags|=C_FLAG; cycles-=2; break; case 0xFA: /*CLI*/ flags&=~I_FLAG; -// printf("CLI at %04X:%04X\n",cs>>4,pc); cycles-=3; break; case 0xFB: /*STI*/ flags|=I_FLAG; -// printf("STI at %04X:%04X\n",cs>>4,pc); cycles-=2; break; case 0xFC: /*CLD*/ @@ -3339,7 +3020,6 @@ void execx86(int cycs) temp2=temp+1; if ((temp2&0x80) && !(temp&0x80)) flags|=V_FLAG; } -// setznp8(temp2); seteab(temp2); cycles-=((cpu_mod==3)?3:23); break; @@ -3351,17 +3031,13 @@ void execx86(int cycs) case 0x00: /*INC w*/ tempw=geteaw(); setadd16nc(tempw,1); -// setznp16(tempw+1); seteaw(tempw+1); cycles-=((cpu_mod==3)?3:23); break; case 0x08: /*DEC w*/ tempw=geteaw(); -// setsub16(tempw,1); setsub16nc(tempw,1); -// setznp16(tempw-1); seteaw(tempw-1); -// if (output) printf("DEC - %04X\n",tempw); cycles-=((cpu_mod==3)?3:23); break; case 0x10: /*CALL*/ @@ -3371,18 +3047,16 @@ void execx86(int cycs) SP-=2; cpu_state.last_ea = SP; cpu_state.pc=tempw; -// printf("FF 10\n"); cycles-=((cpu_mod==3)?20:29); FETCHCLEAR(); break; case 0x18: /*CALL far*/ tempw=readmemw(easeg,cpu_state.eaaddr); - tempw2=readmemw(easeg,(cpu_state.eaaddr+2)&0xFFFF); //geteaw2(); + tempw2=readmemw(easeg,(cpu_state.eaaddr+2)&0xFFFF); tempw3=CS; tempw4=cpu_state.pc; if (cpu_state.ssegs) ss=oldss; cpu_state.pc=tempw; -// printf("FF 18\n"); loadcs(tempw2); writememw(ss,(SP-2)&0xFFFF,tempw3); writememw(ss,((SP-4)&0xFFFF),tempw4); @@ -3393,34 +3067,24 @@ void execx86(int cycs) break; case 0x20: /*JMP*/ cpu_state.pc=geteaw(); -// printf("FF 20\n"); cycles-=((cpu_mod==3)?11:18); FETCHCLEAR(); break; case 0x28: /*JMP far*/ - cpu_state.pc=readmemw(easeg,cpu_state.eaaddr); //geteaw(); -// printf("FF 28\n"); - loadcs(readmemw(easeg,(cpu_state.eaaddr+2)&0xFFFF)); //geteaw2(); -// cs=loadcs(CS); -// cs=CS<<4; + cpu_state.pc=readmemw(easeg,cpu_state.eaaddr); + loadcs(readmemw(easeg,(cpu_state.eaaddr+2)&0xFFFF)); cycles-=24; FETCHCLEAR(); break; case 0x30: /*PUSH w*/ case 0x38: /*PUSH w alias, reported by reenigne*/ tempw=geteaw(); -// if (output) printf("PUSH %04X %i %02X %04X %04X %02X %02X\n",tempw,rm,rmdat,easeg,eaaddr,ram[0x22340+0x5638],ram[0x22340+0x5639]); if (cpu_state.ssegs) ss=oldss; writememw(ss,((SP-2)&0xFFFF),tempw); SP-=2; cpu_state.last_ea = SP; cycles-=((cpu_mod==3)?15:24); break; - -// default: -// printf("Bad FF opcode %02X\n",rmdat&0x38); -// dumpregs(); -// exit(-1); } break; @@ -3428,25 +3092,9 @@ void execx86(int cycs) FETCH(); cycles-=8; break; - -/* printf("Bad opcode %02X at %04X:%04X from %04X:%04X %08X\n",opcode,cs>>4,pc,old8>>16,old8&0xFFFF,old82); - dumpregs(); - exit(-1);*/ } cpu_state.pc&=0xFFFF; -/* if ((CS & 0xf000) == 0xa000) - { - dumpregs(); - exit(-1); - }*/ -// output = 3; -/* if (CS == 0xf000) - { - dumpregs(); - exit(-1); - } - output = 3;*/ if (cpu_state.ssegs) { ds=oldds; @@ -3454,8 +3102,6 @@ void execx86(int cycs) cpu_state.ssegs=0; } -// output = 3; - // if (instime) printf("%i %i %i %i\n",cycdiff,cycles,memcycs,fetchclocks); FETCHADD(((cycdiff-cycles)-memcycs)-fetchclocks); if ((cycdiff-cycles) -Your application description here. +Emulator for X86-based systems. + +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +STATUSBARMENU MENU DISCARDABLE +BEGIN + POPUP "FDD 1" + BEGIN + MENUITEM "&Change...", IDM_DISC_1 + MENUITEM "Change FDD 1 (&Write-protected)...", IDM_DISC_1_WP + MENUITEM "&Eject FDD 1", IDM_EJECT_1 + END + POPUP "FDD 2" + BEGIN + MENUITEM "&Change...", IDM_DISC_2 + MENUITEM "Change FDD 2 (&Write-protected)...", IDM_DISC_2_WP + MENUITEM "&Eject FDD 2", IDM_EJECT_2 + END + POPUP "FDD 3" + BEGIN + MENUITEM "&Change...", IDM_DISC_3 + MENUITEM "Change FDD 3 (&Write-protected)...", IDM_DISC_3_WP + MENUITEM "&Eject FDD 3", IDM_EJECT_3 + END + POPUP "FDD 4" + BEGIN + MENUITEM "&Change...", IDM_DISC_4 + MENUITEM "Change FDD 4 (&Write-protected)...", IDM_DISC_4_WP + MENUITEM "&Eject FDD 4", IDM_EJECT_4 + END + POPUP "CD-ROM 1" + BEGIN + MENUITEM "&Mute", IDM_CDROM_1_MUTE + MENUITEM SEPARATOR + MENUITEM "E&mpty", IDM_CDROM_1_EMPTY + MENUITEM "&Reload previous disc", IDM_CDROM_1_RELOAD + MENUITEM SEPARATOR + MENUITEM "&ISO...", IDM_CDROM_1_ISO + END + POPUP "CD-ROM 2" + BEGIN + MENUITEM "&Mute", IDM_CDROM_2_MUTE + MENUITEM SEPARATOR + MENUITEM "E&mpty", IDM_CDROM_2_EMPTY + MENUITEM "&Reload previous disc", IDM_CDROM_2_RELOAD + MENUITEM SEPARATOR + MENUITEM "&ISO...", IDM_CDROM_2_ISO + END + POPUP "CD-ROM 3" + BEGIN + MENUITEM "&Mute", IDM_CDROM_3_MUTE + MENUITEM SEPARATOR + MENUITEM "E&mpty", IDM_CDROM_3_EMPTY + MENUITEM "&Reload previous disc", IDM_CDROM_3_RELOAD + MENUITEM SEPARATOR + MENUITEM "&ISO...", IDM_CDROM_3_ISO + END + POPUP "CD-ROM 4" + BEGIN + MENUITEM "&Mute", IDM_CDROM_4_MUTE + MENUITEM SEPARATOR + MENUITEM "E&mpty", IDM_CDROM_4_EMPTY + MENUITEM "&Reload previous disc", IDM_CDROM_4_RELOAD + MENUITEM SEPARATOR + MENUITEM "&ISO...", IDM_CDROM_4_ISO + END +END + +MAINMENU MENU DISCARDABLE +BEGIN + POPUP "&Action" + BEGIN + MENUITEM "&Hard Reset", IDM_FILE_HRESET + MENUITEM "&Ctrl+Alt+Del\tCtrl+F12", IDM_FILE_RESET_CAD + MENUITEM SEPARATOR + MENUITEM "E&xit", IDM_FILE_EXIT + END + POPUP "&Tools" + BEGIN + MENUITEM "&Settings...", IDM_CONFIG + MENUITEM SEPARATOR + MENUITEM "&Load configuration...", IDM_CONFIG_LOAD + MENUITEM "&Save configuration...", IDM_CONFIG_SAVE + MENUITEM SEPARATOR + POPUP "&Video" + BEGIN + MENUITEM "&Resizeable window", IDM_VID_RESIZE + MENUITEM "R&emember size && position", IDM_VID_REMEMBER + MENUITEM SEPARATOR + MENUITEM "&DirectDraw", IDM_VID_DDRAW + MENUITEM "Direct&3D 9", IDM_VID_D3D + MENUITEM SEPARATOR + POPUP "&Window scale factor" + BEGIN + MENUITEM "&0.5x", IDM_VID_SCALE_1X + MENUITEM "&1x", IDM_VID_SCALE_2X + MENUITEM "1.&5x", IDM_VID_SCALE_3X + MENUITEM "&2x", IDM_VID_SCALE_4X + END + MENUITEM SEPARATOR + MENUITEM "&Fullscreen", IDM_VID_FULLSCREEN + POPUP "Fullscreen &stretch mode" + BEGIN + MENUITEM "&Full screen stretch", IDM_VID_FS_FULL + MENUITEM "&4:3", IDM_VID_FS_43 + MENUITEM "&Square pixels", IDM_VID_FS_SQ + MENUITEM "&Integer scale", IDM_VID_FS_INT + END + MENUITEM "&Inverted VGA monitor", IDM_VID_INVERT + MENUITEM SEPARATOR + MENUITEM "F&orce 4:3 display ratio", IDM_VID_FORCE43 + MENUITEM "E&GA/(S)VGA overscan", IDM_VID_OVERSCAN + MENUITEM SEPARATOR + MENUITEM "Take s&creenshot\tCtrl+F11", IDM_VID_SCREENSHOT + END + MENUITEM "S&tatus", IDM_STATUS + END + POPUP "&Help" + BEGIN + MENUITEM "&About 86Box...", IDM_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +MAINACCEL ACCELERATORS MOVEABLE PURE +BEGIN + VK_F11, IDM_VID_SCREENSHOT, VIRTKEY, CONTROL + VK_F12, IDM_FILE_RESET_CAD, VIRTKEY, CONTROL +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +CONFIGUREDLG_MAIN DIALOG DISCARDABLE 0, 0, 366, 241 +STYLE DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "86Box Settings" +FONT 9, "Segoe UI" +BEGIN + DEFPUSHBUTTON "OK",IDOK,246,220,50,14 + PUSHBUTTON "Cancel",IDCANCEL,307,220,50,14 + CONTROL "List2",IDC_SETTINGSCATLIST,"SysListView32",LVS_LIST | + LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,7,7,90,197 + CONTROL "",-1,"Static",SS_BLACKFRAME | SS_SUNKEN,1,211,363,1 + LTEXT "Language:",2047,7,222,41,10 + COMBOBOX IDC_COMBO_LANG,48,221,108,120,CBS_DROPDOWN | WS_VSCROLL | + WS_TABSTOP +END + +CONFIGUREDLG_HARD_DISKS_ADD DIALOG DISCARDABLE 0, 0, 219, 111 +STYLE DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Add Hard Disk" +FONT 9, "Segoe UI" +BEGIN + DEFPUSHBUTTON "OK",IDOK,55,89,50,14 + PUSHBUTTON "Cancel",IDCANCEL,112,89,50,14 + EDITTEXT IDC_EDIT_HD_FILE_NAME,7,16,188,12 + PUSHBUTTON "...",IDC_CFILE,195,16,16,12 + EDITTEXT IDC_EDIT_HD_SPT,183,34,28,12 + EDITTEXT IDC_EDIT_HD_HPC,112,34,28,12 + EDITTEXT IDC_EDIT_HD_CYL,42,34,28,12 + EDITTEXT IDC_EDIT_HD_SIZE,42,52,28,12 + COMBOBOX IDC_COMBO_HD_TYPE,113,52,98,12,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "Sectors:",IDC_STATIC,154,35,27,10 + LTEXT "Heads:",1793,81,35,29,8 + LTEXT "Cylinders:",1794,7,35,32,12 + LTEXT "Size (MB):",1795,7,54,33,8 + LTEXT "Type:",1797,86,54,24,8 + LTEXT "File name:",-1,7,7,204,9 + COMBOBOX IDC_COMBO_HD_BUS,33,71,58,12,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "Bus:",1798,7,72,24,8 + COMBOBOX IDC_COMBO_HD_CHANNEL,134,71,77,12,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "Channel:",1799,99,72,34,8 + COMBOBOX IDC_COMBO_HD_ID,133,71,26,12,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "ID:",1800,117,72,15,8 + COMBOBOX IDC_COMBO_HD_LUN,185,71,26,12,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "LUN:",1801,168,72,15,8 + COMBOBOX IDC_COMBO_HD_CHANNEL_IDE,134,71,77,12,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "Channel:",1802,99,72,34,8 +END + +STATUSDLG DIALOG DISCARDABLE 0, 0, 186, 386 +STYLE DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Status" +FONT 9, "Segoe UI" +BEGIN + LTEXT "1",IDC_STEXT_DEVICE,16,16,180,1000 + LTEXT "1",IDC_STEXT1,16,186,180,1000 +END + +ABOUTDLG DIALOG DISCARDABLE 0, 0, 209, 114 +STYLE DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "About 86Box" +FONT 9, "Segoe UI" +BEGIN + DEFPUSHBUTTON "OK",IDOK,129,94,71,12 + ICON 100,IDC_ABOUT_ICON,7,7,20,20 + LTEXT "86Box v1.20 - A fork of PCem\n\nAuthors: Sarah Walker, Tohka, waltje, SA1988, MoochMcGee, reenigne, leilei, JohnElliott, greatpsycho, and others.\n\nReleased under the GNU General Public License version 2. See LICENSE for more information.", + IDC_ABOUT_ICON,54,7,146,73 + CONTROL "",IDC_ABOUT_ICON,"Static",SS_BLACKFRAME | SS_SUNKEN,0, + 86,208,1 +END + +CONFIGUREDLG_MACHINE DIALOG DISCARDABLE 97, 0, 267, 112 +STYLE DS_CONTROL | WS_CHILD +FONT 9, "Segoe UI" +BEGIN + COMBOBOX IDC_COMBO_MACHINE,71,7,138,120,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "Machine:",1794,7,8,60,10 + PUSHBUTTON "Configure",IDC_CONFIGURE_MACHINE,214,7,46,12 + COMBOBOX IDC_COMBO_CPU_TYPE,71,25,45,120,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "CPU type:",1796,7,26,59,10 + COMBOBOX IDC_COMBO_WS,71,44,189,120,CBS_DROPDOWNLIST | WS_VSCROLL | + WS_TABSTOP + LTEXT "Wait states:",1798,7,45,60,10 + COMBOBOX IDC_COMBO_CPU,145,25,115,120,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "CPU:",1797,124,26,18,10 + CONTROL "Dynamic Recompiler",IDC_CHECK_DYNAREC,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,80,94,10 + CONTROL "Enable FPU",IDC_CHECK_FPU,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,147,81,113,10 + EDITTEXT IDC_MEMTEXT,70,63,45,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_MEMSPIN,"msctls_updown32",UDS_SETBUDDYINT | + UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS,113,63, + 12,12 + LTEXT "MB",IDC_TEXT_MB,123,64,10,10 + LTEXT "Memory:",1802,7,64,30,10 + CONTROL "Enable time sync",IDC_CHECK_SYNC,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,95,102,10 +END + +CONFIGUREDLG_VIDEO DIALOG DISCARDABLE 97, 0, 267, 63 +STYLE DS_CONTROL | WS_CHILD +FONT 9, "Segoe UI" +BEGIN + COMBOBOX IDC_COMBO_VIDEO,71,7,140,120,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "Video:",1795,7,8,55,10 + COMBOBOX IDC_COMBO_VIDEO_SPEED,71,25,189,120,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "Video speed:",1800,7,26,58,10 + CONTROL "Voodoo Graphics",IDC_CHECK_VOODOO,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,45,199,10 + PUSHBUTTON "Configure",IDC_CONFIGURE_VOODOO,215,44,45,12 + PUSHBUTTON "Configure",IDC_CONFIGUREVID,214,7,46,12 +END + +CONFIGUREDLG_INPUT DIALOG DISCARDABLE 97, 0, 267, 65 +STYLE DS_CONTROL | WS_CHILD +FONT 9, "Segoe UI" +BEGIN + LTEXT "Mouse :",IDC_STATIC,7,8,57,10 + COMBOBOX IDC_COMBO_MOUSE,71,7,189,120,CBS_DROPDOWN | WS_VSCROLL | + WS_TABSTOP + LTEXT "Joystick :",1793,7,26,58,10 + COMBOBOX IDC_COMBO_JOYSTICK,71,25,189,120,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + DEFPUSHBUTTON "Joystick 1...",IDC_JOY1,7,44,50,14 + PUSHBUTTON "Joystick 2...",IDC_JOY2,74,44,50,14 + DEFPUSHBUTTON "Joystick 3...",IDC_JOY3,141,44,50,14 + PUSHBUTTON "Joystick 4...",IDC_JOY4,209,44,50,14 +END + +CONFIGUREDLG_SOUND DIALOG DISCARDABLE 97, 0, 267, 60 +STYLE DS_CONTROL | WS_CHILD +FONT 9, "Segoe UI" +BEGIN + COMBOBOX IDC_COMBOSND,71,7,141,120,CBS_DROPDOWNLIST | WS_VSCROLL | + WS_TABSTOP + LTEXT "Sound card:",1800,7,8,59,10 + PUSHBUTTON "Configure",IDC_CONFIGURESND,215,7,45,14 + CONTROL "CMS / Game Blaster",IDC_CHECKCMS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,87,25,80,10 + CONTROL "Innovation SSI-2001",IDC_CHECKSSI,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,25,80,10 + CONTROL "Gravis Ultrasound",IDC_CHECKGUS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,174,25,80,10 + CONTROL "Use Nuked OPL",IDC_CHECKNUKEDOPL,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,43,80,10 +END + +CONFIGUREDLG_PERIPHERALS DIALOG DISCARDABLE 97, 0, 267, 132 +STYLE DS_CONTROL | WS_CHILD +FONT 9, "Segoe UI" +BEGIN + PUSHBUTTON "Configure",IDC_CONFIGURE_SCSI,215,24,45,14 + LTEXT "HD Controller:",1799,7,44,61,10 + COMBOBOX IDC_COMBO_HDC,71,43,189,120,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "Network adapter:",1801,7,8,59,10 + COMBOBOX IDC_COMBONET,71,7,141,120,CBS_DROPDOWNLIST | WS_VSCROLL | + WS_TABSTOP + PUSHBUTTON "Configure",IDC_CONFIGURENET,215,6,45,14 + LTEXT "Tertiary IDE:",1802,7,62,61,10 + COMBOBOX IDC_COMBO_IDE_TER,71,61,189,120,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "Quaternary IDE:",1803,7,81,61,10 + COMBOBOX IDC_COMBO_IDE_QUA,71,79,189,120,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "SCSI Controller:",1804,7,26,59,10 + COMBOBOX IDC_COMBO_SCSI,71,25,141,120,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + CONTROL "Serial port 1",IDC_CHECKSERIAL1,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,97,80,10 + CONTROL "Parallel port",IDC_CHECKPARALLEL,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,174,97,80,10 + CONTROL "Serial port 2",IDC_CHECKSERIAL2,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,87,97,80,10 + CONTROL "ISABugger device",IDC_CHECKBUGGER,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,115,80,10 +END + +CONFIGUREDLG_HARD_DISKS DIALOG DISCARDABLE 97, 0, 267, 154 +STYLE DS_CONTROL | WS_CHILD +FONT 9, "Segoe UI" +BEGIN + CONTROL "List1",IDC_LIST_HARD_DISKS,"SysListView32",LVS_REPORT | + LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,7,18,253,92 + LTEXT "Hard disks:",-1,7,7,34,8 + PUSHBUTTON "&New...",IDC_BUTTON_HDD_ADD_NEW,60,137,62,10 + PUSHBUTTON "&Existing...",IDC_BUTTON_HDD_ADD,129,137,62,10 + PUSHBUTTON "&Remove",IDC_BUTTON_HDD_REMOVE,198,137,62,10 + COMBOBOX IDC_COMBO_HD_BUS,33,117,90,12,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "Bus:",1798,7,118,24,8 + COMBOBOX IDC_COMBO_HD_CHANNEL,170,117,90,12,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "Channel:",1799,131,118,38,8 + COMBOBOX IDC_COMBO_HD_ID,170,117,22,12,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "ID:",1800,131,118,38,8 + COMBOBOX IDC_COMBO_HD_LUN,239,117,22,12,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "LUN:",1801,200,118,38,8 + COMBOBOX IDC_COMBO_HD_CHANNEL_IDE,170,117,90,12,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "Channel:",1802,131,118,38,8 +END + +CONFIGUREDLG_REMOVABLE_DEVICES DIALOG DISCARDABLE 97, 0, 267, 202 +STYLE DS_CONTROL | WS_CHILD +FONT 9, "Segoe UI" +BEGIN + CONTROL "List1",IDC_LIST_FLOPPY_DRIVES,"SysListView32", + LVS_REPORT | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, + 7,18,253,60 + LTEXT "Floppy drives:",-1,7,7,43,8 + CONTROL "List1",IDC_LIST_CDROM_DRIVES,"SysListView32",LVS_REPORT | + LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,7,116,253,60 + LTEXT "CD-ROM drives:",-1,7,106,50,8 + COMBOBOX IDC_COMBO_FD_TYPE,33,85,90,12,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "Type:",1803,7,86,24,8 + COMBOBOX IDC_COMBO_CD_BUS,33,183,90,12,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "Bus:",1798,7,184,24,8 + COMBOBOX IDC_COMBO_CD_ID,170,183,22,12,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "ID:",1800,131,184,38,8 + COMBOBOX IDC_COMBO_CD_LUN,239,183,22,12,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "LUN:",1801,200,184,38,8 + COMBOBOX IDC_COMBO_CD_CHANNEL_IDE,170,183,90,12,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "Channel:",1802,131,184,38,8 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// 24 +// + +1 24 MOVEABLE PURE "86Box.manifest" + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +#ifdef RELEASE_BUILD +/* Icon by Devcore - https://commons.wikimedia.org/wiki/File:Icon_PC_256x256.png */ +100 ICON DISCARDABLE "ICONS/86Box-RB.ico" +#else +/* Icon by Devcore - https://commons.wikimedia.org/wiki/File:Icon_PC2_256x256.png */ +100 ICON DISCARDABLE "ICONS/86Box.ico" +#endif +128 ICON DISCARDABLE "ICONS/floppy_525_1dd.ico" +129 ICON DISCARDABLE "ICONS/floppy_525_1dd_active.ico" +130 ICON DISCARDABLE "ICONS/floppy_525_2dd.ico" +131 ICON DISCARDABLE "ICONS/floppy_525_2dd_active.ico" +132 ICON DISCARDABLE "ICONS/floppy_525_2qd.ico" +133 ICON DISCARDABLE "ICONS/floppy_525_2qd_active.ico" +134 ICON DISCARDABLE "ICONS/floppy_525_2hd.ico" +135 ICON DISCARDABLE "ICONS/floppy_525_2hd_active.ico" +144 ICON DISCARDABLE "ICONS/floppy_35_1dd.ico" +145 ICON DISCARDABLE "ICONS/floppy_35_1dd_active.ico" +146 ICON DISCARDABLE "ICONS/floppy_35_2dd.ico" +147 ICON DISCARDABLE "ICONS/floppy_35_2dd_active.ico" +150 ICON DISCARDABLE "ICONS/floppy_35_2hd.ico" +151 ICON DISCARDABLE "ICONS/floppy_35_2hd_active.ico" +152 ICON DISCARDABLE "ICONS/floppy_35_2ed.ico" +153 ICON DISCARDABLE "ICONS/floppy_35_2ed_active.ico" +160 ICON DISCARDABLE "ICONS/cdrom_atapi.ico" +161 ICON DISCARDABLE "ICONS/cdrom_atapi_active.ico" +162 ICON DISCARDABLE "ICONS/cdrom_atapi_dma.ico" +163 ICON DISCARDABLE "ICONS/cdrom_atapi_dma_active.ico" +164 ICON DISCARDABLE "ICONS/cdrom_scsi.ico" +165 ICON DISCARDABLE "ICONS/cdrom_scsi_active.ico" +176 ICON DISCARDABLE "ICONS/hard_disk.ico" +177 ICON DISCARDABLE "ICONS/hard_disk_active.ico" +178 ICON DISCARDABLE "ICONS/hard_disk_ide.ico" +179 ICON DISCARDABLE "ICONS/hard_disk_ide_active.ico" +180 ICON DISCARDABLE "ICONS/hard_disk_scsi.ico" +181 ICON DISCARDABLE "ICONS/hard_disk_scsi_active.ico" +256 ICON DISCARDABLE "ICONS/machine.ico" +257 ICON DISCARDABLE "ICONS/video.ico" +258 ICON DISCARDABLE "ICONS/input_devices.ico" +259 ICON DISCARDABLE "ICONS/sound.ico" +260 ICON DISCARDABLE "ICONS/other_peripherals.ico" +261 ICON DISCARDABLE "ICONS/hard_disk.ico" +262 ICON DISCARDABLE "ICONS/removable_devices.ico" +384 ICON DISCARDABLE "ICONS/floppy_525_1dd_empty.ico" +385 ICON DISCARDABLE "ICONS/floppy_525_1dd_empty_active.ico" +386 ICON DISCARDABLE "ICONS/floppy_525_2dd_empty.ico" +387 ICON DISCARDABLE "ICONS/floppy_525_2dd_empty_active.ico" +388 ICON DISCARDABLE "ICONS/floppy_525_2qd_empty.ico" +389 ICON DISCARDABLE "ICONS/floppy_525_2qd_empty_active.ico" +390 ICON DISCARDABLE "ICONS/floppy_525_2hd_empty.ico" +391 ICON DISCARDABLE "ICONS/floppy_525_2hd_empty_active.ico" +400 ICON DISCARDABLE "ICONS/floppy_35_1dd_empty.ico" +401 ICON DISCARDABLE "ICONS/floppy_35_1dd_empty_active.ico" +402 ICON DISCARDABLE "ICONS/floppy_35_2dd_empty.ico" +403 ICON DISCARDABLE "ICONS/floppy_35_2dd_empty_active.ico" +406 ICON DISCARDABLE "ICONS/floppy_35_2hd_empty.ico" +407 ICON DISCARDABLE "ICONS/floppy_35_2hd_empty_active.ico" +408 ICON DISCARDABLE "ICONS/floppy_35_2ed_empty.ico" +409 ICON DISCARDABLE "ICONS/floppy_35_2ed_empty_active.ico" +416 ICON DISCARDABLE "ICONS/cdrom_atapi_empty.ico" +417 ICON DISCARDABLE "ICONS/cdrom_atapi_empty_active.ico" +418 ICON DISCARDABLE "ICONS/cdrom_atapi_dma_empty.ico" +419 ICON DISCARDABLE "ICONS/cdrom_atapi_dma_empty_active.ico" +420 ICON DISCARDABLE "ICONS/cdrom_scsi_empty.ico" +421 ICON DISCARDABLE "ICONS/cdrom_scsi_empty_active.ico" +512 ICON DISCARDABLE "ICONS/floppy_disabled.ico" +514 ICON DISCARDABLE "ICONS/cdrom_disabled.ico" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""resources.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + CONFIGUREDLG_MAIN, DIALOG + BEGIN + RIGHTMARGIN, 365 + END + + ABOUTDLG, DIALOG + BEGIN + RIGHTMARGIN, 208 + END + + CONFIGUREDLG_MACHINE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 260 + TOPMARGIN, 7 + BOTTOMMARGIN, 105 + END + + CONFIGUREDLG_VIDEO, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 260 + TOPMARGIN, 7 + BOTTOMMARGIN, 56 + END + + CONFIGUREDLG_INPUT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 260 + TOPMARGIN, 7 + BOTTOMMARGIN, 58 + END + + CONFIGUREDLG_PERIPHERALS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 260 + TOPMARGIN, 7 + BOTTOMMARGIN, 125 + END + + CONFIGUREDLG_HARD_DISKS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 260 + TOPMARGIN, 7 + BOTTOMMARGIN, 137 + END + + CONFIGUREDLG_REMOVABLE_DEVICES, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 260 + TOPMARGIN, 7 + BOTTOMMARGIN, 195 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + 2048 "86Box" + IDS_STRING2049 "86Box Error" + IDS_STRING2050 "86Box Fatal Error" + IDS_STRING2051 "This will reset 86Box.\nDo you want to save the settings?" + IDS_STRING2052 "DirectDraw Screenshot Error" + IDS_STRING2053 "Invalid number of sectors (valid values are between 1 and 63)" + IDS_STRING2054 "Invalid number of heads (valid values are between 1 and 16)" + IDS_STRING2055 "Invalid number of cylinders (valid values are between 1 and 266305)" + IDS_STRING2056 "Please enter a valid file name" + IDS_STRING2057 "Unable to open the file for write" + IDS_STRING2058 "Attempting to create a HDI image larger than 4 GB" + IDS_STRING2059 "Remember to partition and format the new drive" + IDS_STRING2060 "Unable to open the file for read" + IDS_STRING2061 "HDI or HDX image with a sector size that is not 512 are not supported" + IDS_STRING2062 "86Box was unable to find any ROMs.\nAt least one ROM set is required to use 86Box." + IDS_STRING2063 "Configured ROM set not available.\nDefaulting to an available ROM set." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING2064 "Configured video BIOS not available.\nDefaulting to an available video BIOS." + IDS_STRING2065 "Machine" + IDS_STRING2066 "Video" + IDS_STRING2067 "Input devices" + IDS_STRING2068 "Sound" + IDS_STRING2069 "Other peripherals" + IDS_STRING2070 "Hard disks" + IDS_STRING2071 "Removable devices" + IDS_STRING2072 "Disabled floppy drive" + IDS_STRING2073 "%i"" floppy drive: %s" + IDS_STRING2074 "Disabled CD-ROM drive" + IDS_STRING2075 "%s CD-ROM drive: %s" + IDS_STRING2076 "Host CD/DVD Drive (%c:)" + IDS_STRING2077 "Click to capture mouse" + IDS_STRING2078 "Press F12-F8 to release mouse" + IDS_STRING2079 "Press F12-F8 or middle button to release mouse" +END + +STRINGTABLE DISCARDABLE +BEGIN + 2080 "Drive" + 2081 "Location" + 2082 "Bus" + 2083 "File" + 2084 "C" + 2085 "H" + 2086 "S" + 2087 "MB" + 2088 "%i" + 2089 "Enabled" + 2090 "Mute" + 2091 "Type" + 2092 "Bus" + 2093 "DMA" + 2094 "KB" + 2095 "Master" +END + +STRINGTABLE DISCARDABLE +BEGIN + 2096 "Slave" + 2097 "SCSI (ID %s, LUN %s)" + 2098 "Adapter Type" + 2099 "Base Address" + 2100 "IRQ" + 2101 "8-bit DMA" + 2102 "16-bit DMA" + 2103 "BIOS" + 2104 "Network Type" + 2105 "Surround Module" + 2106 "MPU-401 Base Address" + 2107 "MIDI Out Device" + 2108 "On-board RAM" + 2109 "Memory Size" + 2110 "Display Type" + 2111 "RGB" +END + +STRINGTABLE DISCARDABLE +BEGIN + 2112 "Composite" + 2113 "Composite Type" + 2114 "Old" + 2115 "New" + 2116 "RGB Type" + 2117 "Color" + 2118 "Monochrome (Green)" + 2119 "Monochrome (Amber)" + 2120 "Monochrome (Gray)" + 2121 "Color (no brown)" + 2122 "Monochrome (Default)" + 2123 "Snow Emulation" + 2124 "Bilinear Filtering" + 2125 "Dithering" + 2126 "Framebuffer Memory Size" + 2127 "Texture Memory Size" +END + +STRINGTABLE DISCARDABLE +BEGIN + 2128 "Screen Filter" + 2129 "Render Threads" + 2130 "Recompiler" + 2131 "System Default" + 2132 "%i Wait state(s)" + 2133 "8-bit" + 2134 "Slow 16-bit" + 2135 "Fast 16-bit" + 2136 "Slow VLB/PCI" + 2137 "Mid VLB/PCI" + 2138 "Fast VLB/PCI" + 2139 "Microsoft 2-button mouse (serial)" + 2140 "2-button mouse (PS/2)" + 2141 "Microsoft Intellimouse (PS/2)" + 2142 "Amstrad mouse" + 2143 "Olivetti M24 mouse" +END + +STRINGTABLE DISCARDABLE +BEGIN + 2144 "Standard 2-button joystick(s)" + 2145 "Standard 4-button joystick" + 2146 "Standard 6-button joystick" + 2147 "Standard 8-button joystick" + 2148 "CH Flightstick Pro" + 2149 "Microsoft SideWinder Pad" + 2150 "Thrustmaster Flight Control System" + 2151 "Disabled" + 2152 "None" + 2153 "AT Fixed Disk Adapter" + 2154 "Internal IDE" + 2155 "IRQ %i" + 2156 "MFM (%01i:%01i)" + 2157 "IDE (%01i:%01i)" + 2158 "SCSI (%02i:%02i)" + 2159 "IDE (PIO-only)" + 2160 "%" PRIu64 + 2161 "Microsoft Bus mouse" + 2162 "Mouse Systems mouse" + 2163 "Attempting to create a spuriously large hard disk image" + 2164 "Invalid number of sectors (valid values are between 1 and 99)" + 2165 "Invalid number of cylinders (valid values are between 1 and 1023)" + 2166 "MFM" + 2167 "IDE" + 2168 "SCSI" + 2169 "%01i:%01i" + 2170 "Custom..." + 2171 "%" PRIu64 " MB (CHS: %" PRIu64 ", %" PRIu64 ", %" PRIu64 ")" + 2172 "Hard disk images (*.HDI;*.HDX;*.IMA;*.IMG)\0*.HDI;*.HDX;*.IMA;*.IMG\0All files (*.*)\0*.*\0" + 2173 "All floppy images (*.0??;*.12;*.144;*.360;*.720;*.86F;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMD;*.IMG;*.TD0;*.VFD;*.XDF)\0*.0??;*.12;*.144;*.360;*.720;*.86F;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMD;*.IMG;*.TD0;*.VFD;*.XDF\0Advanced sector-based images (*.IMD;*.TD0)\0*.IMD;*.TD0\0Basic sector-based images (*.0??;*.12;*.144;*.360;*.720;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMG;*.VFD;*.XDF)\0*.0??;*.12;*.144;*.360;*.720;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMG;*.VFD;*.XDF\0Flux images (*.FDI)\0*.FDI\0Surface-based images (*.86F)\0*.86F\0All files (*.*)\0*.*\0" + 2174 "Configuration files (*.CFG)\0*.CFG\0All files (*.*)\0*.*\0" + 2175 "CD-ROM image (*.ISO)\0*.ISO\0All files (*.*)\0*.*\0" + 2176 "Use CTRL + ALT + PAGE DOWN to return to windowed mode" + 2177 "Microsoft InPort mouse" + 2178 "Genius Bus mouse" + 2179 "Floppy %i (%s): %s" + 2180 "CD-ROM %i: %s" + 2181 "Removable disk %i: %s" + 2182 "MFM hard disk" + 2183 "IDE hard disk" + 2184 "SCSI hard disk" + 2185 "(empty)" + 2186 "(host drive %c:)" + 2187 "Custom (large)..." + 2188 "Type" + 2189 "ATAPI (PIO-only)" + 2190 "ATAPI (PIO and DMA)" + 2191 "ATAPI (PIO-only) (%01i:%01i)" + 2192 "ATAPI (PIO and DMA) (%01i:%01i)" + 2193 "Use CTRL + ALT + PAGE DOWN to return to windowed mode" + 2194 "" + 2195 "English (United States)" +END + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,20,0,0 + PRODUCTVERSION 1,20,0,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "IRC #SoftHistory\0" + VALUE "FileDescription", "86Box - an emulator for X86-based systems\0" + VALUE "FileVersion", "1.20\0" + VALUE "InternalName", "pc_new\0" + VALUE "LegalCopyright", "Copyright © SoftHistory, Sarah Walker, 2007-2017, Released under the GNU GPL v2\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "86Box.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "86Box Emulator\0" + VALUE "ProductVersion", "1.20\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/86box.h b/src/86box.h index 0b4ca1f9c..09f0a8a15 100644 --- a/src/86box.h +++ b/src/86box.h @@ -1,4 +1,4 @@ /* Copyright holders: Tenshi see COPYING for more details */ -#define emulator_version "1.10" +#define emulator_version "1.20" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt deleted file mode 100644 index dc84277c5..000000000 --- a/src/CMakeLists.txt +++ /dev/null @@ -1,59 +0,0 @@ -cmake_minimum_required(VERSION 2.8.8) -project(86box) - -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/CMakeModules) - -ENABLE_LANGUAGE(RC) - -set(CMAKE_RC_COMPILE_OBJECT "${CMAKE_RC_COMPILER} -O coff -I${CMAKE_CURRENT_SOURCE_DIR} ") - -set(SRCS -386.c 386_dynarec.c 386_dynarec_ops.c 808x.c acer386sx.c acerm3a.c ali1429.c amstrad.c buslogic.c cdrom.c cdrom-ioctl.c cdrom-iso.c -cdrom-null.c codegen.c codegen_ops.c codegen_timing_486.c codegen_timing_686.c codegen_timing_pentium.c codegen_timing_winchip.c compaq.c config.c cpu.c dac.c -device.c disc.c disc_86f.c disc_fdi.c disc_imd.c disc_img.c disc_random.c disc_td0.c dma.c fdc.c fdc37c665.c fdc37c932fr.c fdd.c fdi2raw.c gameport.c hdd.c headland.c i430hx.c i430lx.c i430fx.c -i430nx.c i430vx.c i440fx.c ide.c intel.c intel_flash.c io.c jim.c joystick_ch_flightstick_pro.c joystick_standard.c joystick_sw_pad.c joystick_tm_fcs.c keyboard.c keyboard_amstrad.c keyboard_at.c -keyboard_olim24.c keyboard_pcjr.c keyboard_xt.c lpt.c mcr.c mem.c memregs.c mfm_at.c model.c mouse.c mouse_ps2.c -mouse_serial.c ne2000.c neat.c nethandler.c nmi.c nvr.c olivetti_m24.c opti495.c pc.c pc87306.c pci.c pic.c piix.c pit.c ppi.c ps1.c ps2.c rom.c rtc.c -scat.c scsi.c serial.c sis496.c sis85c471.c sio.c sound.c sound_ad1848.c sound_adlib.c sound_adlibgold.c sound_cms.c -sound_dbopl.cc sound_emu8k.c sound_gus.c sound_mpu401_uart.c sound_opl.c sound_pas16.c sound_ps1.c sound_pssj.c sound_resid.cc -sound_sb.c sound_sb_dsp.c sound_sn76489.c sound_speaker.c sound_ssi2001.c sound_wss.c sound_ym7128.c -soundopenal.c tandy_eeprom.c tandy_rom.c timer.c um8669f.c usb.c vid_ati_eeprom.c vid_ati_mach64.c vid_ati18800.c -vid_ati28800.c vid_ati68860_ramdac.c vid_bt485_ramdac.c vid_cga.c vid_cl_gd.c vid_cl_gd_blit.c vid_cl_ramdac.c vid_colorplus.c vid_ega.c vid_et4000.c -vid_et4000w32.c vid_hercules.c vid_herculesplus.c vid_icd2061.c vid_ics2595.c vid_incolor.c vid_mda.c vid_nv_riva128.c -vid_olivetti_m24.c vid_oti067.c vid_paradise.c vid_pc1512.c vid_pc1640.c vid_pc200.c -vid_pcjr.c vid_ps1_svga.c vid_s3.c vid_s3_virge.c vid_sdac_ramdac.c vid_stg_ramdac.c vid_svga.c -vid_svga_render.c vid_tandy.c vid_tandysl.c vid_tgui9440.c vid_tkd8001_ramdac.c vid_tvga.c vid_unk_ramdac.c -vid_vga.c vid_wy700.c vid_voodoo.c video.c w83877f.c wd76c10.c win.c win-config.c win-d3d.cc win-d3d-fs.cc win-ddraw.cc -win-ddraw-fs.cc win-ddraw-screenshot.cc win-deviceconfig.c win-hdconf.c win-joystick.cc win-joystickconfig.c win-keyboard.cc win-midi.c win-mouse.cc -win-status.c win-video.c x86seg.c x87.c xtide.c pc.rc -dosbox/dbopl.cpp dosbox/nukedopl.cpp dosbox/vid_cga_comp.c -lzf/lzf_c.c lzf/lzf_d.c -resid-fp/convolve.cc resid-fp/convolve-sse.cc resid-fp/envelope.cc resid-fp/extfilt.cc resid-fp/filter.cc resid-fp/pot.cc resid-fp/sid.cc resid-fp/voice.cc resid-fp/wave6581__ST.cc resid-fp/wave6581_P_T.cc resid-fp/wave6581_PS_.cc resid-fp/wave6581_PST.cc resid-fp/wave8580__ST.cc resid-fp/wave8580_P_T.cc resid-fp/wave8580_PS_.cc resid-fp/wave8580_PST.cc resid-fp/wave.cc -slirp/bootp.c slirp/ip_icmp.c slirp/misc.c slirp/socket.c slirp/tcp_timer.c slirp/cksum.c slirp/ip_input.c slirp/queue.c slirp/tcp_input.c slirp/tftp.c slirp/debug.c slirp/ip_output.c slirp/sbuf.c slirp/tcp_output.c slirp/udp.c slirp/if.c slirp/mbuf.c slirp/slirp.c slirp/tcp_subr.c -) - -if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(_ARCH_64 1) -else() - set(_ARCH_32 1) -endif() - -include(FindOpenAL REQUIRED) -include(FindDirectInput REQUIRED) -include(FindDirectDraw REQUIRED) - -if(_ARCH_32) -set(SRCS ${SRCS} -codegen_x86.c -) -else() -set(SRCS ${SRCS} -codegen_x86-64.c -) -endif() - -add_definitions(-msse2 -mstackrealign -mwindows -g) - -add_executable(86box ${SRCS}) - -target_link_libraries(86box winmm openal.dll openal ddraw dinput8 dxguid d3d9 d3dx9 wsock32 iphlpapi stdc++ psapi wpcapdelay comdlg32 gdi32) \ No newline at end of file diff --git a/src/86Box-RB.ico b/src/ICONS/86Box-RB.ico similarity index 100% rename from src/86Box-RB.ico rename to src/ICONS/86Box-RB.ico diff --git a/src/86Box.ico b/src/ICONS/86Box.ico similarity index 100% rename from src/86Box.ico rename to src/ICONS/86Box.ico diff --git a/src/ICONS/cdrom_atapi.ico b/src/ICONS/cdrom_atapi.ico new file mode 100644 index 000000000..cef9124ad Binary files /dev/null and b/src/ICONS/cdrom_atapi.ico differ diff --git a/src/ICONS/cdrom_atapi_active.ico b/src/ICONS/cdrom_atapi_active.ico new file mode 100644 index 000000000..e3e84541b Binary files /dev/null and b/src/ICONS/cdrom_atapi_active.ico differ diff --git a/src/ICONS/cdrom_atapi_dma.ico b/src/ICONS/cdrom_atapi_dma.ico new file mode 100644 index 000000000..972e1001f Binary files /dev/null and b/src/ICONS/cdrom_atapi_dma.ico differ diff --git a/src/ICONS/cdrom_atapi_dma_active.ico b/src/ICONS/cdrom_atapi_dma_active.ico new file mode 100644 index 000000000..17c857426 Binary files /dev/null and b/src/ICONS/cdrom_atapi_dma_active.ico differ diff --git a/src/ICONS/cdrom_atapi_dma_empty.ico b/src/ICONS/cdrom_atapi_dma_empty.ico new file mode 100644 index 000000000..d78f3fc82 Binary files /dev/null and b/src/ICONS/cdrom_atapi_dma_empty.ico differ diff --git a/src/ICONS/cdrom_atapi_dma_empty_active.ico b/src/ICONS/cdrom_atapi_dma_empty_active.ico new file mode 100644 index 000000000..3ddba4e8b Binary files /dev/null and b/src/ICONS/cdrom_atapi_dma_empty_active.ico differ diff --git a/src/ICONS/cdrom_atapi_empty.ico b/src/ICONS/cdrom_atapi_empty.ico new file mode 100644 index 000000000..67c2c8347 Binary files /dev/null and b/src/ICONS/cdrom_atapi_empty.ico differ diff --git a/src/ICONS/cdrom_atapi_empty_active.ico b/src/ICONS/cdrom_atapi_empty_active.ico new file mode 100644 index 000000000..a6d204499 Binary files /dev/null and b/src/ICONS/cdrom_atapi_empty_active.ico differ diff --git a/src/ICONS/cdrom_disabled.ico b/src/ICONS/cdrom_disabled.ico new file mode 100644 index 000000000..442daf320 Binary files /dev/null and b/src/ICONS/cdrom_disabled.ico differ diff --git a/src/ICONS/cdrom_scsi.ico b/src/ICONS/cdrom_scsi.ico new file mode 100644 index 000000000..50111bc5a Binary files /dev/null and b/src/ICONS/cdrom_scsi.ico differ diff --git a/src/ICONS/cdrom_scsi_active.ico b/src/ICONS/cdrom_scsi_active.ico new file mode 100644 index 000000000..d51e28c82 Binary files /dev/null and b/src/ICONS/cdrom_scsi_active.ico differ diff --git a/src/ICONS/cdrom_scsi_empty.ico b/src/ICONS/cdrom_scsi_empty.ico new file mode 100644 index 000000000..c10d00b48 Binary files /dev/null and b/src/ICONS/cdrom_scsi_empty.ico differ diff --git a/src/ICONS/cdrom_scsi_empty_active.ico b/src/ICONS/cdrom_scsi_empty_active.ico new file mode 100644 index 000000000..36ac042d0 Binary files /dev/null and b/src/ICONS/cdrom_scsi_empty_active.ico differ diff --git a/src/ICONS/floppy_35_1dd.ico b/src/ICONS/floppy_35_1dd.ico new file mode 100644 index 000000000..55842ba5d Binary files /dev/null and b/src/ICONS/floppy_35_1dd.ico differ diff --git a/src/ICONS/floppy_35_1dd_active.ico b/src/ICONS/floppy_35_1dd_active.ico new file mode 100644 index 000000000..b6728029a Binary files /dev/null and b/src/ICONS/floppy_35_1dd_active.ico differ diff --git a/src/ICONS/floppy_35_1dd_empty.ico b/src/ICONS/floppy_35_1dd_empty.ico new file mode 100644 index 000000000..4299c47ed Binary files /dev/null and b/src/ICONS/floppy_35_1dd_empty.ico differ diff --git a/src/ICONS/floppy_35_1dd_empty_active.ico b/src/ICONS/floppy_35_1dd_empty_active.ico new file mode 100644 index 000000000..c774f369a Binary files /dev/null and b/src/ICONS/floppy_35_1dd_empty_active.ico differ diff --git a/src/ICONS/floppy_35_2dd.ico b/src/ICONS/floppy_35_2dd.ico new file mode 100644 index 000000000..7957e2e2f Binary files /dev/null and b/src/ICONS/floppy_35_2dd.ico differ diff --git a/src/ICONS/floppy_35_2dd_active.ico b/src/ICONS/floppy_35_2dd_active.ico new file mode 100644 index 000000000..19522bc03 Binary files /dev/null and b/src/ICONS/floppy_35_2dd_active.ico differ diff --git a/src/ICONS/floppy_35_2dd_empty.ico b/src/ICONS/floppy_35_2dd_empty.ico new file mode 100644 index 000000000..732514db2 Binary files /dev/null and b/src/ICONS/floppy_35_2dd_empty.ico differ diff --git a/src/ICONS/floppy_35_2dd_empty_active.ico b/src/ICONS/floppy_35_2dd_empty_active.ico new file mode 100644 index 000000000..c3dd58afe Binary files /dev/null and b/src/ICONS/floppy_35_2dd_empty_active.ico differ diff --git a/src/ICONS/floppy_35_2ed.ico b/src/ICONS/floppy_35_2ed.ico new file mode 100644 index 000000000..449d68203 Binary files /dev/null and b/src/ICONS/floppy_35_2ed.ico differ diff --git a/src/ICONS/floppy_35_2ed_active.ico b/src/ICONS/floppy_35_2ed_active.ico new file mode 100644 index 000000000..e8ba0a579 Binary files /dev/null and b/src/ICONS/floppy_35_2ed_active.ico differ diff --git a/src/ICONS/floppy_35_2ed_empty.ico b/src/ICONS/floppy_35_2ed_empty.ico new file mode 100644 index 000000000..5801518ac Binary files /dev/null and b/src/ICONS/floppy_35_2ed_empty.ico differ diff --git a/src/ICONS/floppy_35_2ed_empty_active.ico b/src/ICONS/floppy_35_2ed_empty_active.ico new file mode 100644 index 000000000..1bf185022 Binary files /dev/null and b/src/ICONS/floppy_35_2ed_empty_active.ico differ diff --git a/src/ICONS/floppy_35_2hd.ico b/src/ICONS/floppy_35_2hd.ico new file mode 100644 index 000000000..36bbc5a2f Binary files /dev/null and b/src/ICONS/floppy_35_2hd.ico differ diff --git a/src/ICONS/floppy_35_2hd_active.ico b/src/ICONS/floppy_35_2hd_active.ico new file mode 100644 index 000000000..a5849237d Binary files /dev/null and b/src/ICONS/floppy_35_2hd_active.ico differ diff --git a/src/ICONS/floppy_35_2hd_empty.ico b/src/ICONS/floppy_35_2hd_empty.ico new file mode 100644 index 000000000..012b42c5a Binary files /dev/null and b/src/ICONS/floppy_35_2hd_empty.ico differ diff --git a/src/ICONS/floppy_35_2hd_empty_active.ico b/src/ICONS/floppy_35_2hd_empty_active.ico new file mode 100644 index 000000000..62527c891 Binary files /dev/null and b/src/ICONS/floppy_35_2hd_empty_active.ico differ diff --git a/src/ICONS/floppy_525_1dd.ico b/src/ICONS/floppy_525_1dd.ico new file mode 100644 index 000000000..64963661b Binary files /dev/null and b/src/ICONS/floppy_525_1dd.ico differ diff --git a/src/ICONS/floppy_525_1dd_active.ico b/src/ICONS/floppy_525_1dd_active.ico new file mode 100644 index 000000000..71ba656cb Binary files /dev/null and b/src/ICONS/floppy_525_1dd_active.ico differ diff --git a/src/ICONS/floppy_525_1dd_empty.ico b/src/ICONS/floppy_525_1dd_empty.ico new file mode 100644 index 000000000..51a42b835 Binary files /dev/null and b/src/ICONS/floppy_525_1dd_empty.ico differ diff --git a/src/ICONS/floppy_525_1dd_empty_active.ico b/src/ICONS/floppy_525_1dd_empty_active.ico new file mode 100644 index 000000000..99621601c Binary files /dev/null and b/src/ICONS/floppy_525_1dd_empty_active.ico differ diff --git a/src/ICONS/floppy_525_2dd.ico b/src/ICONS/floppy_525_2dd.ico new file mode 100644 index 000000000..b08b379c4 Binary files /dev/null and b/src/ICONS/floppy_525_2dd.ico differ diff --git a/src/ICONS/floppy_525_2dd_active.ico b/src/ICONS/floppy_525_2dd_active.ico new file mode 100644 index 000000000..382c5b62e Binary files /dev/null and b/src/ICONS/floppy_525_2dd_active.ico differ diff --git a/src/ICONS/floppy_525_2dd_empty.ico b/src/ICONS/floppy_525_2dd_empty.ico new file mode 100644 index 000000000..00feded42 Binary files /dev/null and b/src/ICONS/floppy_525_2dd_empty.ico differ diff --git a/src/ICONS/floppy_525_2dd_empty_active.ico b/src/ICONS/floppy_525_2dd_empty_active.ico new file mode 100644 index 000000000..c0e50f4c0 Binary files /dev/null and b/src/ICONS/floppy_525_2dd_empty_active.ico differ diff --git a/src/ICONS/floppy_525_2hd.ico b/src/ICONS/floppy_525_2hd.ico new file mode 100644 index 000000000..fffae20e1 Binary files /dev/null and b/src/ICONS/floppy_525_2hd.ico differ diff --git a/src/ICONS/floppy_525_2hd_active.ico b/src/ICONS/floppy_525_2hd_active.ico new file mode 100644 index 000000000..d865b19bd Binary files /dev/null and b/src/ICONS/floppy_525_2hd_active.ico differ diff --git a/src/ICONS/floppy_525_2hd_empty.ico b/src/ICONS/floppy_525_2hd_empty.ico new file mode 100644 index 000000000..2cdb251d3 Binary files /dev/null and b/src/ICONS/floppy_525_2hd_empty.ico differ diff --git a/src/ICONS/floppy_525_2hd_empty_active.ico b/src/ICONS/floppy_525_2hd_empty_active.ico new file mode 100644 index 000000000..30c65587e Binary files /dev/null and b/src/ICONS/floppy_525_2hd_empty_active.ico differ diff --git a/src/ICONS/floppy_525_2qd.ico b/src/ICONS/floppy_525_2qd.ico new file mode 100644 index 000000000..e3f370d93 Binary files /dev/null and b/src/ICONS/floppy_525_2qd.ico differ diff --git a/src/ICONS/floppy_525_2qd_active.ico b/src/ICONS/floppy_525_2qd_active.ico new file mode 100644 index 000000000..3abc238fc Binary files /dev/null and b/src/ICONS/floppy_525_2qd_active.ico differ diff --git a/src/ICONS/floppy_525_2qd_empty.ico b/src/ICONS/floppy_525_2qd_empty.ico new file mode 100644 index 000000000..880961b76 Binary files /dev/null and b/src/ICONS/floppy_525_2qd_empty.ico differ diff --git a/src/ICONS/floppy_525_2qd_empty_active.ico b/src/ICONS/floppy_525_2qd_empty_active.ico new file mode 100644 index 000000000..34a6a3777 Binary files /dev/null and b/src/ICONS/floppy_525_2qd_empty_active.ico differ diff --git a/src/ICONS/floppy_disabled.ico b/src/ICONS/floppy_disabled.ico new file mode 100644 index 000000000..8203863cb Binary files /dev/null and b/src/ICONS/floppy_disabled.ico differ diff --git a/src/ICONS/hard_disk.ico b/src/ICONS/hard_disk.ico new file mode 100644 index 000000000..9672a2454 Binary files /dev/null and b/src/ICONS/hard_disk.ico differ diff --git a/src/ICONS/hard_disk_active.ico b/src/ICONS/hard_disk_active.ico new file mode 100644 index 000000000..e888fb45c Binary files /dev/null and b/src/ICONS/hard_disk_active.ico differ diff --git a/src/ICONS/hard_disk_ide.ico b/src/ICONS/hard_disk_ide.ico new file mode 100644 index 000000000..91ded91a7 Binary files /dev/null and b/src/ICONS/hard_disk_ide.ico differ diff --git a/src/ICONS/hard_disk_ide_active.ico b/src/ICONS/hard_disk_ide_active.ico new file mode 100644 index 000000000..9f33e8c14 Binary files /dev/null and b/src/ICONS/hard_disk_ide_active.ico differ diff --git a/src/ICONS/hard_disk_scsi.ico b/src/ICONS/hard_disk_scsi.ico new file mode 100644 index 000000000..7a31cc1f1 Binary files /dev/null and b/src/ICONS/hard_disk_scsi.ico differ diff --git a/src/ICONS/hard_disk_scsi_active.ico b/src/ICONS/hard_disk_scsi_active.ico new file mode 100644 index 000000000..e7579fd8e Binary files /dev/null and b/src/ICONS/hard_disk_scsi_active.ico differ diff --git a/src/ICONS/input_devices.ico b/src/ICONS/input_devices.ico new file mode 100644 index 000000000..d18ad23d0 Binary files /dev/null and b/src/ICONS/input_devices.ico differ diff --git a/src/ICONS/machine.ico b/src/ICONS/machine.ico new file mode 100644 index 000000000..a247316c3 Binary files /dev/null and b/src/ICONS/machine.ico differ diff --git a/src/ICONS/other_peripherals.ico b/src/ICONS/other_peripherals.ico new file mode 100644 index 000000000..b078387d3 Binary files /dev/null and b/src/ICONS/other_peripherals.ico differ diff --git a/src/ICONS/removable_devices.ico b/src/ICONS/removable_devices.ico new file mode 100644 index 000000000..45e15d3b4 Binary files /dev/null and b/src/ICONS/removable_devices.ico differ diff --git a/src/ICONS/sound.ico b/src/ICONS/sound.ico new file mode 100644 index 000000000..dfdc1b86c Binary files /dev/null and b/src/ICONS/sound.ico differ diff --git a/src/ICONS/video.ico b/src/ICONS/video.ico new file mode 100644 index 000000000..664132269 Binary files /dev/null and b/src/ICONS/video.ico differ diff --git a/src/Makefile.am b/src/Makefile.am deleted file mode 100644 index 233d3c6a0..000000000 --- a/src/Makefile.am +++ /dev/null @@ -1,51 +0,0 @@ -# Makefile.am for PCem - -bin_PROGRAMS = pcem -noinst_SCRIPTS = ../pcem -CLEANFILES = $(noinst_SCRIPTS) - -../pcem: pcem - cp pcem .. - -amrefresh: - - -pcem_CFLAGS = $(allegro_CFLAGS) - -pcem_LDADD = $(allegro_LIBS) -lopenal -lalut - -pcem_SOURCES = 386.c 386_dynarec.c 386_dynarec_ops.c 808x.c acer386sx.c ali1429.c allegro-gui.c \ -allegro-gui-configure.c allegro-gui-deviceconfig.c allegro-gui-hdconf.c allegro-joystick.c allegro-keyboard.c allegro-main.c \ -allegro-midi.c allegro-mouse.c allegro-video.c amstrad.c cdrom-ioctl-linux.c cdrom-iso.c cdrom-null.c \ -codegen.c codegen_ops.c codegen_timing_486.c codegen_timing_686.c codegen_timing_pentium.c codegen_timing_winchip.c compaq.c config.c cpu.c \ -dac.c device.c disc.c disc_fdi.c disc_img.c disc_sector.c dma.c fdc.c fdc37c665.c fdd.c fdi2raw.c gameport.c \ -headland.c i430lx.c i430fx.c i430vx.c ide.c intel.c intel_flash.c io.c jim.c \ -keyboard.c keyboard_amstrad.c keyboard_at.c keyboard_olim24.c keyboard_pcjr.c keyboard_xt.c \ -linux-time.c lpt.c mcr.c mem.c model.c mouse.c mouse_ps2.c mouse_serial.c neat.c nmi.c nvr.c \ -olivetti_m24.c opti.c pc.c pci.c pic.c piix.c pit.c ppi.c ps1.c rom.c scat.c serial.c sis496.c sound.c \ -sound_ad1848.c sound_adlib.c sound_adlibgold.c sound_cms.c sound_emu8k.c sound_gus.c \ -sound_mpu401_uart.c sound_opl.c sound_pas16.c sound_ps1.c sound_pssj.c sound_sb.c sound_sb_dsp.c sound_sn76489.c \ -sound_speaker.c sound_ssi2001.c sound_wss.c sound_ym7128.c soundopenal.c tandy_eeprom.c tandy_rom.c thread-pthread.c \ -timer.c um8669f.c um8881f.c usb.c vid_ati_eeprom.c vid_ati_mach64.c vid_ati18800.c vid_ati28800.c \ -vid_ati68860_ramdac.c vid_cga.c vid_cl_gd.c vid_cl_gd_blit.c vid_cl_ramdac.c vid_ega.c vid_et4000.c vid_et4000w32.c vid_hercules.c vid_herculesplus.c\ -vid_icd2061.c vid_ics2595.c vid_incolor.c vid_mda.c vid_nv_riva128.c vid_olivetti_m24.c vid_oti067.c vid_paradise.c vid_pc200.c \ -vid_pc1512.c vid_pc1640.c vid_pcjr.c vid_ps1_svga.c vid_s3.c vid_s3_virge.c vid_sdac_ramdac.c \ -vid_stg_ramdac.c vid_svga.c vid_svga_render.c vid_tandy.c vid_tandysl.c vid_tgui9440.c \ -vid_tkd8001_ramdac.c vid_tvga.c vid_unk_ramdac.c vid_vga.c vid_voodoo.c video.c wd76c10.c \ -x86seg.c x87.c xtide.c sound_dbopl.cc sound_resid.cc dosbox/dbopl.cpp \ -resid-fp/convolve.cc resid-fp/convolve-sse.cc resid-fp/envelope.cc \ -resid-fp/extfilt.cc resid-fp/filter.cc resid-fp/pot.cc resid-fp/sid.cc \ -resid-fp/voice.cc resid-fp/wave6581_PS_.cc resid-fp/wave6581_PST.cc \ -resid-fp/wave6581_P_T.cc resid-fp/wave6581__ST.cc resid-fp/wave8580_PS_.cc \ -resid-fp/wave8580_PST.cc resid-fp/wave8580_P_T.cc resid-fp/wave8580__ST.cc \ -resid-fp/wave.cc - -if CPU_I386 -pcem_SOURCES += codegen_x86.c -pcem_CFLAGS += -msse2 -endif - -if CPU_X86_64 -pcem_SOURCES += codegen_x86-64.c -endif - diff --git a/src/Makefile.in b/src/Makefile.in deleted file mode 100644 index 1d3455bca..000000000 --- a/src/Makefile.in +++ /dev/null @@ -1,2956 +0,0 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# Makefile.am for PCem - - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -bin_PROGRAMS = pcem$(EXEEXT) -@CPU_I386_TRUE@am__append_1 = codegen_x86.c -@CPU_X86_64_TRUE@am__append_2 = codegen_x86-64.c -subdir = src -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" -PROGRAMS = $(bin_PROGRAMS) -am__pcem_SOURCES_DIST = 386.c 386_dynarec.c 386_dynarec_ops.c 808x.c \ - acer386sx.c ali1429.c allegro-gui.c allegro-gui-configure.c \ - allegro-gui-hdconf.c allegro-joystick.c allegro-keyboard.c \ - allegro-main.c allegro-midi.c allegro-mouse.c allegro-video.c \ - amstrad.c cdrom-ioctl-linux.c cdrom-null.c codegen.c \ - codegen_ops.c codegen_timing_486.c codegen_timing_pentium.c \ - compaq.c config.c cpu.c dac.c device.c disc.c disc_fdi.c \ - disc_img.c dma.c fdc.c fdc37c665.c fdi2raw.c gameport.c \ - headland.c i430lx.c i430fx.c i430vx.c ide.c intel.c \ - intel_flash.c io.c jim.c keyboard.c keyboard_amstrad.c \ - keyboard_at.c keyboard_olim24.c keyboard_pcjr.c keyboard_xt.c \ - linux-time.c lpt.c mcr.c mem.c model.c mouse.c mouse_ps2.c \ - mouse_serial.c neat.c nmi.c nvr.c olivetti_m24.c opti.c pc.c \ - pci.c pic.c piix.c pit.c ppi.c ps1.c rom.c serial.c sis496.c \ - sound.c sound_ad1848.c sound_adlib.c sound_adlibgold.c \ - sound_cms.c sound_emu8k.c sound_gus.c sound_mpu401_uart.c \ - sound_opl.c sound_pas16.c sound_sb.c sound_sb_dsp.c \ - sound_sn76489.c sound_speaker.c sound_ssi2001.c sound_wss.c \ - soundopenal.c thread-pthread.c timer.c um8669f.c um8881f.c \ - vid_ati_eeprom.c vid_ati_mach64.c vid_ati18800.c \ - vid_ati28800.c vid_ati68860_ramdac.c vid_cga.c vid_cl5429.c \ - vid_ega.c vid_et4000.c vid_et4000w32.c vid_hercules.c \ - vid_icd2061.c vid_ics2595.c vid_mda.c vid_olivetti_m24.c \ - vid_oti067.c vid_paradise.c vid_pc200.c vid_pc1512.c \ - vid_pc1640.c vid_pcjr.c vid_s3.c vid_s3_virge.c \ - vid_sdac_ramdac.c vid_stg_ramdac.c vid_svga.c \ - vid_svga_render.c vid_tandy.c vid_tgui9440.c \ - vid_tkd8001_ramdac.c vid_tvga.c vid_unk_ramdac.c vid_vga.c \ - vid_voodoo.c video.c wd76c10.c x86seg.c x87.c xtide.c \ - sound_dbopl.cc sound_resid.cc dosbox/dbopl.cpp \ - resid-fp/convolve.cc resid-fp/convolve-sse.cc \ - resid-fp/envelope.cc resid-fp/extfilt.cc resid-fp/filter.cc \ - resid-fp/pot.cc resid-fp/sid.cc resid-fp/voice.cc \ - resid-fp/wave6581_PS_.cc resid-fp/wave6581_PST.cc \ - resid-fp/wave6581_P_T.cc resid-fp/wave6581__ST.cc \ - resid-fp/wave8580_PS_.cc resid-fp/wave8580_PST.cc \ - resid-fp/wave8580_P_T.cc resid-fp/wave8580__ST.cc \ - resid-fp/wave.cc codegen_x86.c codegen_x86-64.c -@CPU_I386_TRUE@am__objects_1 = pcem-codegen_x86.$(OBJEXT) -@CPU_X86_64_TRUE@am__objects_2 = pcem-codegen_x86-64.$(OBJEXT) -am_pcem_OBJECTS = pcem-386.$(OBJEXT) pcem-386_dynarec.$(OBJEXT) \ - pcem-386_dynarec_ops.$(OBJEXT) pcem-808x.$(OBJEXT) \ - pcem-acer386sx.$(OBJEXT) pcem-ali1429.$(OBJEXT) \ - pcem-allegro-gui.$(OBJEXT) \ - pcem-allegro-gui-configure.$(OBJEXT) \ - pcem-allegro-gui-hdconf.$(OBJEXT) \ - pcem-allegro-joystick.$(OBJEXT) \ - pcem-allegro-keyboard.$(OBJEXT) pcem-allegro-main.$(OBJEXT) \ - pcem-allegro-midi.$(OBJEXT) pcem-allegro-mouse.$(OBJEXT) \ - pcem-allegro-video.$(OBJEXT) pcem-amstrad.$(OBJEXT) \ - pcem-cdrom-ioctl-linux.$(OBJEXT) pcem-cdrom-null.$(OBJEXT) \ - pcem-codegen.$(OBJEXT) pcem-codegen_ops.$(OBJEXT) \ - pcem-codegen_timing_486.$(OBJEXT) \ - pcem-codegen_timing_pentium.$(OBJEXT) pcem-compaq.$(OBJEXT) \ - pcem-config.$(OBJEXT) pcem-cpu.$(OBJEXT) pcem-dac.$(OBJEXT) \ - pcem-device.$(OBJEXT) pcem-disc.$(OBJEXT) \ - pcem-disc_fdi.$(OBJEXT) pcem-disc_img.$(OBJEXT) \ - pcem-dma.$(OBJEXT) pcem-fdc.$(OBJEXT) pcem-fdc37c665.$(OBJEXT) \ - pcem-fdi2raw.$(OBJEXT) pcem-gameport.$(OBJEXT) \ - pcem-headland.$(OBJEXT) pcem-i430lx.$(OBJEXT) \ - pcem-i430fx.$(OBJEXT) pcem-i430vx.$(OBJEXT) pcem-ide.$(OBJEXT) \ - pcem-intel.$(OBJEXT) pcem-intel_flash.$(OBJEXT) \ - pcem-io.$(OBJEXT) pcem-jim.$(OBJEXT) pcem-keyboard.$(OBJEXT) \ - pcem-keyboard_amstrad.$(OBJEXT) pcem-keyboard_at.$(OBJEXT) \ - pcem-keyboard_olim24.$(OBJEXT) pcem-keyboard_pcjr.$(OBJEXT) \ - pcem-keyboard_xt.$(OBJEXT) pcem-linux-time.$(OBJEXT) \ - pcem-lpt.$(OBJEXT) pcem-mcr.$(OBJEXT) pcem-mem.$(OBJEXT) \ - pcem-model.$(OBJEXT) pcem-mouse.$(OBJEXT) \ - pcem-mouse_ps2.$(OBJEXT) pcem-mouse_serial.$(OBJEXT) \ - pcem-neat.$(OBJEXT) pcem-nmi.$(OBJEXT) pcem-nvr.$(OBJEXT) \ - pcem-olivetti_m24.$(OBJEXT) pcem-opti.$(OBJEXT) \ - pcem-pc.$(OBJEXT) pcem-pci.$(OBJEXT) pcem-pic.$(OBJEXT) \ - pcem-piix.$(OBJEXT) pcem-pit.$(OBJEXT) pcem-ppi.$(OBJEXT) \ - pcem-ps1.$(OBJEXT) pcem-rom.$(OBJEXT) pcem-serial.$(OBJEXT) \ - pcem-sis496.$(OBJEXT) pcem-sound.$(OBJEXT) \ - pcem-sound_ad1848.$(OBJEXT) pcem-sound_adlib.$(OBJEXT) \ - pcem-sound_adlibgold.$(OBJEXT) pcem-sound_cms.$(OBJEXT) \ - pcem-sound_emu8k.$(OBJEXT) pcem-sound_gus.$(OBJEXT) \ - pcem-sound_mpu401_uart.$(OBJEXT) pcem-sound_opl.$(OBJEXT) \ - pcem-sound_pas16.$(OBJEXT) pcem-sound_sb.$(OBJEXT) \ - pcem-sound_sb_dsp.$(OBJEXT) pcem-sound_sn76489.$(OBJEXT) \ - pcem-sound_speaker.$(OBJEXT) pcem-sound_ssi2001.$(OBJEXT) \ - pcem-sound_wss.$(OBJEXT) pcem-soundopenal.$(OBJEXT) \ - pcem-thread-pthread.$(OBJEXT) pcem-timer.$(OBJEXT) \ - pcem-um8669f.$(OBJEXT) pcem-um8881f.$(OBJEXT) \ - pcem-vid_ati_eeprom.$(OBJEXT) pcem-vid_ati_mach64.$(OBJEXT) \ - pcem-vid_ati18800.$(OBJEXT) pcem-vid_ati28800.$(OBJEXT) \ - pcem-vid_ati68860_ramdac.$(OBJEXT) pcem-vid_cga.$(OBJEXT) \ - pcem-vid_cl5429.$(OBJEXT) pcem-vid_ega.$(OBJEXT) \ - pcem-vid_et4000.$(OBJEXT) pcem-vid_et4000w32.$(OBJEXT) \ - pcem-vid_hercules.$(OBJEXT) pcem-vid_icd2061.$(OBJEXT) \ - pcem-vid_ics2595.$(OBJEXT) pcem-vid_mda.$(OBJEXT) \ - pcem-vid_olivetti_m24.$(OBJEXT) pcem-vid_oti067.$(OBJEXT) \ - pcem-vid_paradise.$(OBJEXT) pcem-vid_pc200.$(OBJEXT) \ - pcem-vid_pc1512.$(OBJEXT) pcem-vid_pc1640.$(OBJEXT) \ - pcem-vid_pcjr.$(OBJEXT) pcem-vid_s3.$(OBJEXT) \ - pcem-vid_s3_virge.$(OBJEXT) pcem-vid_sdac_ramdac.$(OBJEXT) \ - pcem-vid_stg_ramdac.$(OBJEXT) pcem-vid_svga.$(OBJEXT) \ - pcem-vid_svga_render.$(OBJEXT) pcem-vid_tandy.$(OBJEXT) \ - pcem-vid_tgui9440.$(OBJEXT) pcem-vid_tkd8001_ramdac.$(OBJEXT) \ - pcem-vid_tvga.$(OBJEXT) pcem-vid_unk_ramdac.$(OBJEXT) \ - pcem-vid_vga.$(OBJEXT) pcem-vid_voodoo.$(OBJEXT) \ - pcem-video.$(OBJEXT) pcem-wd76c10.$(OBJEXT) \ - pcem-x86seg.$(OBJEXT) pcem-x87.$(OBJEXT) pcem-xtide.$(OBJEXT) \ - sound_dbopl.$(OBJEXT) sound_resid.$(OBJEXT) dbopl.$(OBJEXT) \ - convolve.$(OBJEXT) convolve-sse.$(OBJEXT) envelope.$(OBJEXT) \ - extfilt.$(OBJEXT) filter.$(OBJEXT) pot.$(OBJEXT) sid.$(OBJEXT) \ - voice.$(OBJEXT) wave6581_PS_.$(OBJEXT) wave6581_PST.$(OBJEXT) \ - wave6581_P_T.$(OBJEXT) wave6581__ST.$(OBJEXT) \ - wave8580_PS_.$(OBJEXT) wave8580_PST.$(OBJEXT) \ - wave8580_P_T.$(OBJEXT) wave8580__ST.$(OBJEXT) wave.$(OBJEXT) \ - $(am__objects_1) $(am__objects_2) -pcem_OBJECTS = $(am_pcem_OBJECTS) -am__DEPENDENCIES_1 = -pcem_DEPENDENCIES = $(am__DEPENDENCIES_1) -SCRIPTS = $(noinst_SCRIPTS) -DEFAULT_INCLUDES = -I.@am__isrc@ -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -CXXLD = $(CXX) -CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ - -o $@ -SOURCES = $(pcem_SOURCES) -DIST_SOURCES = $(am__pcem_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLEGRO_CONFIG = @ALLEGRO_CONFIG@ -AMTAR = @AMTAR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EXEEXT = @EXEEXT@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -allegro_CFLAGS = @allegro_CFLAGS@ -allegro_LIBS = @allegro_LIBS@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -noinst_SCRIPTS = ../pcem -CLEANFILES = $(noinst_SCRIPTS) -pcem_CFLAGS = $(allegro_CFLAGS) -pcem_LDADD = $(allegro_LIBS) -lopenal -lalut -pcem_SOURCES = 386.c 386_dynarec.c 386_dynarec_ops.c 808x.c \ - acer386sx.c ali1429.c allegro-gui.c allegro-gui-configure.c \ - allegro-gui-hdconf.c allegro-joystick.c allegro-keyboard.c \ - allegro-main.c allegro-midi.c allegro-mouse.c allegro-video.c \ - amstrad.c cdrom-ioctl-linux.c cdrom-null.c codegen.c \ - codegen_ops.c codegen_timing_486.c codegen_timing_pentium.c \ - compaq.c config.c cpu.c dac.c device.c disc.c disc_fdi.c \ - disc_img.c dma.c fdc.c fdc37c665.c fdi2raw.c gameport.c \ - headland.c i430lx.c i430fx.c i430vx.c ide.c intel.c \ - intel_flash.c io.c jim.c keyboard.c keyboard_amstrad.c \ - keyboard_at.c keyboard_olim24.c keyboard_pcjr.c keyboard_xt.c \ - linux-time.c lpt.c mcr.c mem.c model.c mouse.c mouse_ps2.c \ - mouse_serial.c neat.c nmi.c nvr.c olivetti_m24.c opti.c pc.c \ - pci.c pic.c piix.c pit.c ppi.c ps1.c rom.c serial.c sis496.c \ - sound.c sound_ad1848.c sound_adlib.c sound_adlibgold.c \ - sound_cms.c sound_emu8k.c sound_gus.c sound_mpu401_uart.c \ - sound_opl.c sound_pas16.c sound_sb.c sound_sb_dsp.c \ - sound_sn76489.c sound_speaker.c sound_ssi2001.c sound_wss.c \ - soundopenal.c thread-pthread.c timer.c um8669f.c um8881f.c \ - vid_ati_eeprom.c vid_ati_mach64.c vid_ati18800.c \ - vid_ati28800.c vid_ati68860_ramdac.c vid_cga.c vid_cl5429.c \ - vid_ega.c vid_et4000.c vid_et4000w32.c vid_hercules.c \ - vid_icd2061.c vid_ics2595.c vid_mda.c vid_olivetti_m24.c \ - vid_oti067.c vid_paradise.c vid_pc200.c vid_pc1512.c \ - vid_pc1640.c vid_pcjr.c vid_s3.c vid_s3_virge.c \ - vid_sdac_ramdac.c vid_stg_ramdac.c vid_svga.c \ - vid_svga_render.c vid_tandy.c vid_tgui9440.c \ - vid_tkd8001_ramdac.c vid_tvga.c vid_unk_ramdac.c vid_vga.c \ - vid_voodoo.c video.c wd76c10.c x86seg.c x87.c xtide.c \ - sound_dbopl.cc sound_resid.cc dosbox/dbopl.cpp \ - resid-fp/convolve.cc resid-fp/convolve-sse.cc \ - resid-fp/envelope.cc resid-fp/extfilt.cc resid-fp/filter.cc \ - resid-fp/pot.cc resid-fp/sid.cc resid-fp/voice.cc \ - resid-fp/wave6581_PS_.cc resid-fp/wave6581_PST.cc \ - resid-fp/wave6581_P_T.cc resid-fp/wave6581__ST.cc \ - resid-fp/wave8580_PS_.cc resid-fp/wave8580_PST.cc \ - resid-fp/wave8580_P_T.cc resid-fp/wave8580__ST.cc \ - resid-fp/wave.cc $(am__append_1) $(am__append_2) -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .cc .cpp .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - for p in $$list; do echo "$$p $$p"; done | \ - sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p; \ - then echo "$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ - -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ - sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) files[d] = files[d] " " $$1; \ - else { print "f", $$3 "/" $$4, $$1; } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ - $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' `; \ - test -n "$$list" || exit 0; \ - echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(bindir)" && rm -f $$files - -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) -pcem$(EXEEXT): $(pcem_OBJECTS) $(pcem_DEPENDENCIES) - @rm -f pcem$(EXEEXT) - $(CXXLINK) $(pcem_OBJECTS) $(pcem_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/convolve-sse.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/convolve.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbopl.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/envelope.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extfilt.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-386.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-386_dynarec.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-386_dynarec_ops.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-808x.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-acer386sx.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-ali1429.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-allegro-gui-configure.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-allegro-gui-hdconf.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-allegro-gui.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-allegro-joystick.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-allegro-keyboard.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-allegro-main.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-allegro-midi.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-allegro-mouse.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-allegro-video.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-amstrad.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-cdrom-ioctl-linux.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-cdrom-null.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-codegen.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-codegen_ops.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-codegen_timing_486.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-codegen_timing_pentium.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-codegen_x86-64.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-codegen_x86.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-compaq.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-config.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-cpu.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-dac.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-device.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-disc.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-disc_fdi.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-disc_img.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-dma.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-fdc.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-fdc37c665.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-fdi2raw.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-gameport.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-headland.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-i430fx.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-i430lx.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-i430vx.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-ide.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-intel.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-intel_flash.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-jim.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-keyboard.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-keyboard_amstrad.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-keyboard_at.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-keyboard_olim24.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-keyboard_pcjr.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-keyboard_xt.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-linux-time.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-lpt.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-mcr.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-mem.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-model.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-mouse.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-mouse_ps2.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-mouse_serial.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-neat.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-nmi.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-nvr.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-olivetti_m24.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-opti.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-pc.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-pci.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-pic.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-piix.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-pit.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-ppi.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-ps1.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-rom.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-serial.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-sis496.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-sound.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-sound_ad1848.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-sound_adlib.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-sound_adlibgold.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-sound_cms.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-sound_emu8k.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-sound_gus.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-sound_mpu401_uart.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-sound_opl.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-sound_pas16.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-sound_sb.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-sound_sb_dsp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-sound_sn76489.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-sound_speaker.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-sound_ssi2001.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-sound_wss.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-soundopenal.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-thread-pthread.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-timer.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-um8669f.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-um8881f.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_ati18800.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_ati28800.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_ati68860_ramdac.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_ati_eeprom.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_ati_mach64.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_cga.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_cl5429.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_ega.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_et4000.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_et4000w32.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_hercules.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_icd2061.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_ics2595.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_mda.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_olivetti_m24.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_oti067.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_paradise.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_pc1512.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_pc1640.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_pc200.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_pcjr.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_s3.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_s3_virge.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_sdac_ramdac.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_stg_ramdac.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_svga.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_svga_render.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_tandy.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_tgui9440.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_tkd8001_ramdac.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_tvga.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_unk_ramdac.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_vga.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-vid_voodoo.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-video.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-wd76c10.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-x86seg.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-x87.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-xtide.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pot.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sid.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sound_dbopl.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sound_resid.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/voice.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wave.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wave6581_PST.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wave6581_PS_.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wave6581_P_T.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wave6581__ST.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wave8580_PST.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wave8580_PS_.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wave8580_P_T.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wave8580__ST.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -pcem-386.o: 386.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-386.o -MD -MP -MF $(DEPDIR)/pcem-386.Tpo -c -o pcem-386.o `test -f '386.c' || echo '$(srcdir)/'`386.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-386.Tpo $(DEPDIR)/pcem-386.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='386.c' object='pcem-386.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-386.o `test -f '386.c' || echo '$(srcdir)/'`386.c - -pcem-386.obj: 386.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-386.obj -MD -MP -MF $(DEPDIR)/pcem-386.Tpo -c -o pcem-386.obj `if test -f '386.c'; then $(CYGPATH_W) '386.c'; else $(CYGPATH_W) '$(srcdir)/386.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-386.Tpo $(DEPDIR)/pcem-386.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='386.c' object='pcem-386.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-386.obj `if test -f '386.c'; then $(CYGPATH_W) '386.c'; else $(CYGPATH_W) '$(srcdir)/386.c'; fi` - -pcem-386_dynarec.o: 386_dynarec.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-386_dynarec.o -MD -MP -MF $(DEPDIR)/pcem-386_dynarec.Tpo -c -o pcem-386_dynarec.o `test -f '386_dynarec.c' || echo '$(srcdir)/'`386_dynarec.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-386_dynarec.Tpo $(DEPDIR)/pcem-386_dynarec.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='386_dynarec.c' object='pcem-386_dynarec.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-386_dynarec.o `test -f '386_dynarec.c' || echo '$(srcdir)/'`386_dynarec.c - -pcem-386_dynarec.obj: 386_dynarec.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-386_dynarec.obj -MD -MP -MF $(DEPDIR)/pcem-386_dynarec.Tpo -c -o pcem-386_dynarec.obj `if test -f '386_dynarec.c'; then $(CYGPATH_W) '386_dynarec.c'; else $(CYGPATH_W) '$(srcdir)/386_dynarec.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-386_dynarec.Tpo $(DEPDIR)/pcem-386_dynarec.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='386_dynarec.c' object='pcem-386_dynarec.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-386_dynarec.obj `if test -f '386_dynarec.c'; then $(CYGPATH_W) '386_dynarec.c'; else $(CYGPATH_W) '$(srcdir)/386_dynarec.c'; fi` - -pcem-386_dynarec_ops.o: 386_dynarec_ops.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-386_dynarec_ops.o -MD -MP -MF $(DEPDIR)/pcem-386_dynarec_ops.Tpo -c -o pcem-386_dynarec_ops.o `test -f '386_dynarec_ops.c' || echo '$(srcdir)/'`386_dynarec_ops.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-386_dynarec_ops.Tpo $(DEPDIR)/pcem-386_dynarec_ops.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='386_dynarec_ops.c' object='pcem-386_dynarec_ops.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-386_dynarec_ops.o `test -f '386_dynarec_ops.c' || echo '$(srcdir)/'`386_dynarec_ops.c - -pcem-386_dynarec_ops.obj: 386_dynarec_ops.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-386_dynarec_ops.obj -MD -MP -MF $(DEPDIR)/pcem-386_dynarec_ops.Tpo -c -o pcem-386_dynarec_ops.obj `if test -f '386_dynarec_ops.c'; then $(CYGPATH_W) '386_dynarec_ops.c'; else $(CYGPATH_W) '$(srcdir)/386_dynarec_ops.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-386_dynarec_ops.Tpo $(DEPDIR)/pcem-386_dynarec_ops.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='386_dynarec_ops.c' object='pcem-386_dynarec_ops.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-386_dynarec_ops.obj `if test -f '386_dynarec_ops.c'; then $(CYGPATH_W) '386_dynarec_ops.c'; else $(CYGPATH_W) '$(srcdir)/386_dynarec_ops.c'; fi` - -pcem-808x.o: 808x.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-808x.o -MD -MP -MF $(DEPDIR)/pcem-808x.Tpo -c -o pcem-808x.o `test -f '808x.c' || echo '$(srcdir)/'`808x.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-808x.Tpo $(DEPDIR)/pcem-808x.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='808x.c' object='pcem-808x.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-808x.o `test -f '808x.c' || echo '$(srcdir)/'`808x.c - -pcem-808x.obj: 808x.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-808x.obj -MD -MP -MF $(DEPDIR)/pcem-808x.Tpo -c -o pcem-808x.obj `if test -f '808x.c'; then $(CYGPATH_W) '808x.c'; else $(CYGPATH_W) '$(srcdir)/808x.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-808x.Tpo $(DEPDIR)/pcem-808x.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='808x.c' object='pcem-808x.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-808x.obj `if test -f '808x.c'; then $(CYGPATH_W) '808x.c'; else $(CYGPATH_W) '$(srcdir)/808x.c'; fi` - -pcem-acer386sx.o: acer386sx.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-acer386sx.o -MD -MP -MF $(DEPDIR)/pcem-acer386sx.Tpo -c -o pcem-acer386sx.o `test -f 'acer386sx.c' || echo '$(srcdir)/'`acer386sx.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-acer386sx.Tpo $(DEPDIR)/pcem-acer386sx.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='acer386sx.c' object='pcem-acer386sx.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-acer386sx.o `test -f 'acer386sx.c' || echo '$(srcdir)/'`acer386sx.c - -pcem-acer386sx.obj: acer386sx.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-acer386sx.obj -MD -MP -MF $(DEPDIR)/pcem-acer386sx.Tpo -c -o pcem-acer386sx.obj `if test -f 'acer386sx.c'; then $(CYGPATH_W) 'acer386sx.c'; else $(CYGPATH_W) '$(srcdir)/acer386sx.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-acer386sx.Tpo $(DEPDIR)/pcem-acer386sx.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='acer386sx.c' object='pcem-acer386sx.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-acer386sx.obj `if test -f 'acer386sx.c'; then $(CYGPATH_W) 'acer386sx.c'; else $(CYGPATH_W) '$(srcdir)/acer386sx.c'; fi` - -pcem-ali1429.o: ali1429.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-ali1429.o -MD -MP -MF $(DEPDIR)/pcem-ali1429.Tpo -c -o pcem-ali1429.o `test -f 'ali1429.c' || echo '$(srcdir)/'`ali1429.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-ali1429.Tpo $(DEPDIR)/pcem-ali1429.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ali1429.c' object='pcem-ali1429.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-ali1429.o `test -f 'ali1429.c' || echo '$(srcdir)/'`ali1429.c - -pcem-ali1429.obj: ali1429.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-ali1429.obj -MD -MP -MF $(DEPDIR)/pcem-ali1429.Tpo -c -o pcem-ali1429.obj `if test -f 'ali1429.c'; then $(CYGPATH_W) 'ali1429.c'; else $(CYGPATH_W) '$(srcdir)/ali1429.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-ali1429.Tpo $(DEPDIR)/pcem-ali1429.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ali1429.c' object='pcem-ali1429.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-ali1429.obj `if test -f 'ali1429.c'; then $(CYGPATH_W) 'ali1429.c'; else $(CYGPATH_W) '$(srcdir)/ali1429.c'; fi` - -pcem-allegro-gui.o: allegro-gui.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-allegro-gui.o -MD -MP -MF $(DEPDIR)/pcem-allegro-gui.Tpo -c -o pcem-allegro-gui.o `test -f 'allegro-gui.c' || echo '$(srcdir)/'`allegro-gui.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-allegro-gui.Tpo $(DEPDIR)/pcem-allegro-gui.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='allegro-gui.c' object='pcem-allegro-gui.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-allegro-gui.o `test -f 'allegro-gui.c' || echo '$(srcdir)/'`allegro-gui.c - -pcem-allegro-gui.obj: allegro-gui.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-allegro-gui.obj -MD -MP -MF $(DEPDIR)/pcem-allegro-gui.Tpo -c -o pcem-allegro-gui.obj `if test -f 'allegro-gui.c'; then $(CYGPATH_W) 'allegro-gui.c'; else $(CYGPATH_W) '$(srcdir)/allegro-gui.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-allegro-gui.Tpo $(DEPDIR)/pcem-allegro-gui.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='allegro-gui.c' object='pcem-allegro-gui.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-allegro-gui.obj `if test -f 'allegro-gui.c'; then $(CYGPATH_W) 'allegro-gui.c'; else $(CYGPATH_W) '$(srcdir)/allegro-gui.c'; fi` - -pcem-allegro-gui-configure.o: allegro-gui-configure.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-allegro-gui-configure.o -MD -MP -MF $(DEPDIR)/pcem-allegro-gui-configure.Tpo -c -o pcem-allegro-gui-configure.o `test -f 'allegro-gui-configure.c' || echo '$(srcdir)/'`allegro-gui-configure.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-allegro-gui-configure.Tpo $(DEPDIR)/pcem-allegro-gui-configure.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='allegro-gui-configure.c' object='pcem-allegro-gui-configure.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-allegro-gui-configure.o `test -f 'allegro-gui-configure.c' || echo '$(srcdir)/'`allegro-gui-configure.c - -pcem-allegro-gui-configure.obj: allegro-gui-configure.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-allegro-gui-configure.obj -MD -MP -MF $(DEPDIR)/pcem-allegro-gui-configure.Tpo -c -o pcem-allegro-gui-configure.obj `if test -f 'allegro-gui-configure.c'; then $(CYGPATH_W) 'allegro-gui-configure.c'; else $(CYGPATH_W) '$(srcdir)/allegro-gui-configure.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-allegro-gui-configure.Tpo $(DEPDIR)/pcem-allegro-gui-configure.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='allegro-gui-configure.c' object='pcem-allegro-gui-configure.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-allegro-gui-configure.obj `if test -f 'allegro-gui-configure.c'; then $(CYGPATH_W) 'allegro-gui-configure.c'; else $(CYGPATH_W) '$(srcdir)/allegro-gui-configure.c'; fi` - -pcem-allegro-gui-hdconf.o: allegro-gui-hdconf.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-allegro-gui-hdconf.o -MD -MP -MF $(DEPDIR)/pcem-allegro-gui-hdconf.Tpo -c -o pcem-allegro-gui-hdconf.o `test -f 'allegro-gui-hdconf.c' || echo '$(srcdir)/'`allegro-gui-hdconf.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-allegro-gui-hdconf.Tpo $(DEPDIR)/pcem-allegro-gui-hdconf.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='allegro-gui-hdconf.c' object='pcem-allegro-gui-hdconf.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-allegro-gui-hdconf.o `test -f 'allegro-gui-hdconf.c' || echo '$(srcdir)/'`allegro-gui-hdconf.c - -pcem-allegro-gui-hdconf.obj: allegro-gui-hdconf.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-allegro-gui-hdconf.obj -MD -MP -MF $(DEPDIR)/pcem-allegro-gui-hdconf.Tpo -c -o pcem-allegro-gui-hdconf.obj `if test -f 'allegro-gui-hdconf.c'; then $(CYGPATH_W) 'allegro-gui-hdconf.c'; else $(CYGPATH_W) '$(srcdir)/allegro-gui-hdconf.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-allegro-gui-hdconf.Tpo $(DEPDIR)/pcem-allegro-gui-hdconf.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='allegro-gui-hdconf.c' object='pcem-allegro-gui-hdconf.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-allegro-gui-hdconf.obj `if test -f 'allegro-gui-hdconf.c'; then $(CYGPATH_W) 'allegro-gui-hdconf.c'; else $(CYGPATH_W) '$(srcdir)/allegro-gui-hdconf.c'; fi` - -pcem-allegro-joystick.o: allegro-joystick.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-allegro-joystick.o -MD -MP -MF $(DEPDIR)/pcem-allegro-joystick.Tpo -c -o pcem-allegro-joystick.o `test -f 'allegro-joystick.c' || echo '$(srcdir)/'`allegro-joystick.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-allegro-joystick.Tpo $(DEPDIR)/pcem-allegro-joystick.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='allegro-joystick.c' object='pcem-allegro-joystick.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-allegro-joystick.o `test -f 'allegro-joystick.c' || echo '$(srcdir)/'`allegro-joystick.c - -pcem-allegro-joystick.obj: allegro-joystick.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-allegro-joystick.obj -MD -MP -MF $(DEPDIR)/pcem-allegro-joystick.Tpo -c -o pcem-allegro-joystick.obj `if test -f 'allegro-joystick.c'; then $(CYGPATH_W) 'allegro-joystick.c'; else $(CYGPATH_W) '$(srcdir)/allegro-joystick.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-allegro-joystick.Tpo $(DEPDIR)/pcem-allegro-joystick.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='allegro-joystick.c' object='pcem-allegro-joystick.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-allegro-joystick.obj `if test -f 'allegro-joystick.c'; then $(CYGPATH_W) 'allegro-joystick.c'; else $(CYGPATH_W) '$(srcdir)/allegro-joystick.c'; fi` - -pcem-allegro-keyboard.o: allegro-keyboard.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-allegro-keyboard.o -MD -MP -MF $(DEPDIR)/pcem-allegro-keyboard.Tpo -c -o pcem-allegro-keyboard.o `test -f 'allegro-keyboard.c' || echo '$(srcdir)/'`allegro-keyboard.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-allegro-keyboard.Tpo $(DEPDIR)/pcem-allegro-keyboard.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='allegro-keyboard.c' object='pcem-allegro-keyboard.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-allegro-keyboard.o `test -f 'allegro-keyboard.c' || echo '$(srcdir)/'`allegro-keyboard.c - -pcem-allegro-keyboard.obj: allegro-keyboard.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-allegro-keyboard.obj -MD -MP -MF $(DEPDIR)/pcem-allegro-keyboard.Tpo -c -o pcem-allegro-keyboard.obj `if test -f 'allegro-keyboard.c'; then $(CYGPATH_W) 'allegro-keyboard.c'; else $(CYGPATH_W) '$(srcdir)/allegro-keyboard.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-allegro-keyboard.Tpo $(DEPDIR)/pcem-allegro-keyboard.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='allegro-keyboard.c' object='pcem-allegro-keyboard.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-allegro-keyboard.obj `if test -f 'allegro-keyboard.c'; then $(CYGPATH_W) 'allegro-keyboard.c'; else $(CYGPATH_W) '$(srcdir)/allegro-keyboard.c'; fi` - -pcem-allegro-main.o: allegro-main.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-allegro-main.o -MD -MP -MF $(DEPDIR)/pcem-allegro-main.Tpo -c -o pcem-allegro-main.o `test -f 'allegro-main.c' || echo '$(srcdir)/'`allegro-main.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-allegro-main.Tpo $(DEPDIR)/pcem-allegro-main.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='allegro-main.c' object='pcem-allegro-main.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-allegro-main.o `test -f 'allegro-main.c' || echo '$(srcdir)/'`allegro-main.c - -pcem-allegro-main.obj: allegro-main.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-allegro-main.obj -MD -MP -MF $(DEPDIR)/pcem-allegro-main.Tpo -c -o pcem-allegro-main.obj `if test -f 'allegro-main.c'; then $(CYGPATH_W) 'allegro-main.c'; else $(CYGPATH_W) '$(srcdir)/allegro-main.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-allegro-main.Tpo $(DEPDIR)/pcem-allegro-main.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='allegro-main.c' object='pcem-allegro-main.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-allegro-main.obj `if test -f 'allegro-main.c'; then $(CYGPATH_W) 'allegro-main.c'; else $(CYGPATH_W) '$(srcdir)/allegro-main.c'; fi` - -pcem-allegro-midi.o: allegro-midi.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-allegro-midi.o -MD -MP -MF $(DEPDIR)/pcem-allegro-midi.Tpo -c -o pcem-allegro-midi.o `test -f 'allegro-midi.c' || echo '$(srcdir)/'`allegro-midi.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-allegro-midi.Tpo $(DEPDIR)/pcem-allegro-midi.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='allegro-midi.c' object='pcem-allegro-midi.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-allegro-midi.o `test -f 'allegro-midi.c' || echo '$(srcdir)/'`allegro-midi.c - -pcem-allegro-midi.obj: allegro-midi.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-allegro-midi.obj -MD -MP -MF $(DEPDIR)/pcem-allegro-midi.Tpo -c -o pcem-allegro-midi.obj `if test -f 'allegro-midi.c'; then $(CYGPATH_W) 'allegro-midi.c'; else $(CYGPATH_W) '$(srcdir)/allegro-midi.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-allegro-midi.Tpo $(DEPDIR)/pcem-allegro-midi.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='allegro-midi.c' object='pcem-allegro-midi.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-allegro-midi.obj `if test -f 'allegro-midi.c'; then $(CYGPATH_W) 'allegro-midi.c'; else $(CYGPATH_W) '$(srcdir)/allegro-midi.c'; fi` - -pcem-allegro-mouse.o: allegro-mouse.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-allegro-mouse.o -MD -MP -MF $(DEPDIR)/pcem-allegro-mouse.Tpo -c -o pcem-allegro-mouse.o `test -f 'allegro-mouse.c' || echo '$(srcdir)/'`allegro-mouse.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-allegro-mouse.Tpo $(DEPDIR)/pcem-allegro-mouse.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='allegro-mouse.c' object='pcem-allegro-mouse.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-allegro-mouse.o `test -f 'allegro-mouse.c' || echo '$(srcdir)/'`allegro-mouse.c - -pcem-allegro-mouse.obj: allegro-mouse.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-allegro-mouse.obj -MD -MP -MF $(DEPDIR)/pcem-allegro-mouse.Tpo -c -o pcem-allegro-mouse.obj `if test -f 'allegro-mouse.c'; then $(CYGPATH_W) 'allegro-mouse.c'; else $(CYGPATH_W) '$(srcdir)/allegro-mouse.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-allegro-mouse.Tpo $(DEPDIR)/pcem-allegro-mouse.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='allegro-mouse.c' object='pcem-allegro-mouse.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-allegro-mouse.obj `if test -f 'allegro-mouse.c'; then $(CYGPATH_W) 'allegro-mouse.c'; else $(CYGPATH_W) '$(srcdir)/allegro-mouse.c'; fi` - -pcem-allegro-video.o: allegro-video.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-allegro-video.o -MD -MP -MF $(DEPDIR)/pcem-allegro-video.Tpo -c -o pcem-allegro-video.o `test -f 'allegro-video.c' || echo '$(srcdir)/'`allegro-video.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-allegro-video.Tpo $(DEPDIR)/pcem-allegro-video.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='allegro-video.c' object='pcem-allegro-video.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-allegro-video.o `test -f 'allegro-video.c' || echo '$(srcdir)/'`allegro-video.c - -pcem-allegro-video.obj: allegro-video.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-allegro-video.obj -MD -MP -MF $(DEPDIR)/pcem-allegro-video.Tpo -c -o pcem-allegro-video.obj `if test -f 'allegro-video.c'; then $(CYGPATH_W) 'allegro-video.c'; else $(CYGPATH_W) '$(srcdir)/allegro-video.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-allegro-video.Tpo $(DEPDIR)/pcem-allegro-video.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='allegro-video.c' object='pcem-allegro-video.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-allegro-video.obj `if test -f 'allegro-video.c'; then $(CYGPATH_W) 'allegro-video.c'; else $(CYGPATH_W) '$(srcdir)/allegro-video.c'; fi` - -pcem-amstrad.o: amstrad.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-amstrad.o -MD -MP -MF $(DEPDIR)/pcem-amstrad.Tpo -c -o pcem-amstrad.o `test -f 'amstrad.c' || echo '$(srcdir)/'`amstrad.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-amstrad.Tpo $(DEPDIR)/pcem-amstrad.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='amstrad.c' object='pcem-amstrad.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-amstrad.o `test -f 'amstrad.c' || echo '$(srcdir)/'`amstrad.c - -pcem-amstrad.obj: amstrad.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-amstrad.obj -MD -MP -MF $(DEPDIR)/pcem-amstrad.Tpo -c -o pcem-amstrad.obj `if test -f 'amstrad.c'; then $(CYGPATH_W) 'amstrad.c'; else $(CYGPATH_W) '$(srcdir)/amstrad.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-amstrad.Tpo $(DEPDIR)/pcem-amstrad.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='amstrad.c' object='pcem-amstrad.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-amstrad.obj `if test -f 'amstrad.c'; then $(CYGPATH_W) 'amstrad.c'; else $(CYGPATH_W) '$(srcdir)/amstrad.c'; fi` - -pcem-cdrom-ioctl-linux.o: cdrom-ioctl-linux.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-cdrom-ioctl-linux.o -MD -MP -MF $(DEPDIR)/pcem-cdrom-ioctl-linux.Tpo -c -o pcem-cdrom-ioctl-linux.o `test -f 'cdrom-ioctl-linux.c' || echo '$(srcdir)/'`cdrom-ioctl-linux.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-cdrom-ioctl-linux.Tpo $(DEPDIR)/pcem-cdrom-ioctl-linux.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdrom-ioctl-linux.c' object='pcem-cdrom-ioctl-linux.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-cdrom-ioctl-linux.o `test -f 'cdrom-ioctl-linux.c' || echo '$(srcdir)/'`cdrom-ioctl-linux.c - -pcem-cdrom-ioctl-linux.obj: cdrom-ioctl-linux.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-cdrom-ioctl-linux.obj -MD -MP -MF $(DEPDIR)/pcem-cdrom-ioctl-linux.Tpo -c -o pcem-cdrom-ioctl-linux.obj `if test -f 'cdrom-ioctl-linux.c'; then $(CYGPATH_W) 'cdrom-ioctl-linux.c'; else $(CYGPATH_W) '$(srcdir)/cdrom-ioctl-linux.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-cdrom-ioctl-linux.Tpo $(DEPDIR)/pcem-cdrom-ioctl-linux.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdrom-ioctl-linux.c' object='pcem-cdrom-ioctl-linux.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-cdrom-ioctl-linux.obj `if test -f 'cdrom-ioctl-linux.c'; then $(CYGPATH_W) 'cdrom-ioctl-linux.c'; else $(CYGPATH_W) '$(srcdir)/cdrom-ioctl-linux.c'; fi` - -pcem-cdrom-null.o: cdrom-null.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-cdrom-null.o -MD -MP -MF $(DEPDIR)/pcem-cdrom-null.Tpo -c -o pcem-cdrom-null.o `test -f 'cdrom-null.c' || echo '$(srcdir)/'`cdrom-null.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-cdrom-null.Tpo $(DEPDIR)/pcem-cdrom-null.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdrom-null.c' object='pcem-cdrom-null.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-cdrom-null.o `test -f 'cdrom-null.c' || echo '$(srcdir)/'`cdrom-null.c - -pcem-cdrom-null.obj: cdrom-null.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-cdrom-null.obj -MD -MP -MF $(DEPDIR)/pcem-cdrom-null.Tpo -c -o pcem-cdrom-null.obj `if test -f 'cdrom-null.c'; then $(CYGPATH_W) 'cdrom-null.c'; else $(CYGPATH_W) '$(srcdir)/cdrom-null.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-cdrom-null.Tpo $(DEPDIR)/pcem-cdrom-null.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdrom-null.c' object='pcem-cdrom-null.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-cdrom-null.obj `if test -f 'cdrom-null.c'; then $(CYGPATH_W) 'cdrom-null.c'; else $(CYGPATH_W) '$(srcdir)/cdrom-null.c'; fi` - -pcem-codegen.o: codegen.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-codegen.o -MD -MP -MF $(DEPDIR)/pcem-codegen.Tpo -c -o pcem-codegen.o `test -f 'codegen.c' || echo '$(srcdir)/'`codegen.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-codegen.Tpo $(DEPDIR)/pcem-codegen.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='codegen.c' object='pcem-codegen.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-codegen.o `test -f 'codegen.c' || echo '$(srcdir)/'`codegen.c - -pcem-codegen.obj: codegen.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-codegen.obj -MD -MP -MF $(DEPDIR)/pcem-codegen.Tpo -c -o pcem-codegen.obj `if test -f 'codegen.c'; then $(CYGPATH_W) 'codegen.c'; else $(CYGPATH_W) '$(srcdir)/codegen.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-codegen.Tpo $(DEPDIR)/pcem-codegen.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='codegen.c' object='pcem-codegen.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-codegen.obj `if test -f 'codegen.c'; then $(CYGPATH_W) 'codegen.c'; else $(CYGPATH_W) '$(srcdir)/codegen.c'; fi` - -pcem-codegen_ops.o: codegen_ops.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-codegen_ops.o -MD -MP -MF $(DEPDIR)/pcem-codegen_ops.Tpo -c -o pcem-codegen_ops.o `test -f 'codegen_ops.c' || echo '$(srcdir)/'`codegen_ops.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-codegen_ops.Tpo $(DEPDIR)/pcem-codegen_ops.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='codegen_ops.c' object='pcem-codegen_ops.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-codegen_ops.o `test -f 'codegen_ops.c' || echo '$(srcdir)/'`codegen_ops.c - -pcem-codegen_ops.obj: codegen_ops.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-codegen_ops.obj -MD -MP -MF $(DEPDIR)/pcem-codegen_ops.Tpo -c -o pcem-codegen_ops.obj `if test -f 'codegen_ops.c'; then $(CYGPATH_W) 'codegen_ops.c'; else $(CYGPATH_W) '$(srcdir)/codegen_ops.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-codegen_ops.Tpo $(DEPDIR)/pcem-codegen_ops.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='codegen_ops.c' object='pcem-codegen_ops.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-codegen_ops.obj `if test -f 'codegen_ops.c'; then $(CYGPATH_W) 'codegen_ops.c'; else $(CYGPATH_W) '$(srcdir)/codegen_ops.c'; fi` - -pcem-codegen_timing_486.o: codegen_timing_486.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-codegen_timing_486.o -MD -MP -MF $(DEPDIR)/pcem-codegen_timing_486.Tpo -c -o pcem-codegen_timing_486.o `test -f 'codegen_timing_486.c' || echo '$(srcdir)/'`codegen_timing_486.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-codegen_timing_486.Tpo $(DEPDIR)/pcem-codegen_timing_486.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='codegen_timing_486.c' object='pcem-codegen_timing_486.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-codegen_timing_486.o `test -f 'codegen_timing_486.c' || echo '$(srcdir)/'`codegen_timing_486.c - -pcem-codegen_timing_486.obj: codegen_timing_486.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-codegen_timing_486.obj -MD -MP -MF $(DEPDIR)/pcem-codegen_timing_486.Tpo -c -o pcem-codegen_timing_486.obj `if test -f 'codegen_timing_486.c'; then $(CYGPATH_W) 'codegen_timing_486.c'; else $(CYGPATH_W) '$(srcdir)/codegen_timing_486.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-codegen_timing_486.Tpo $(DEPDIR)/pcem-codegen_timing_486.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='codegen_timing_486.c' object='pcem-codegen_timing_486.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-codegen_timing_486.obj `if test -f 'codegen_timing_486.c'; then $(CYGPATH_W) 'codegen_timing_486.c'; else $(CYGPATH_W) '$(srcdir)/codegen_timing_486.c'; fi` - -pcem-codegen_timing_pentium.o: codegen_timing_pentium.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-codegen_timing_pentium.o -MD -MP -MF $(DEPDIR)/pcem-codegen_timing_pentium.Tpo -c -o pcem-codegen_timing_pentium.o `test -f 'codegen_timing_pentium.c' || echo '$(srcdir)/'`codegen_timing_pentium.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-codegen_timing_pentium.Tpo $(DEPDIR)/pcem-codegen_timing_pentium.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='codegen_timing_pentium.c' object='pcem-codegen_timing_pentium.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-codegen_timing_pentium.o `test -f 'codegen_timing_pentium.c' || echo '$(srcdir)/'`codegen_timing_pentium.c - -pcem-codegen_timing_pentium.obj: codegen_timing_pentium.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-codegen_timing_pentium.obj -MD -MP -MF $(DEPDIR)/pcem-codegen_timing_pentium.Tpo -c -o pcem-codegen_timing_pentium.obj `if test -f 'codegen_timing_pentium.c'; then $(CYGPATH_W) 'codegen_timing_pentium.c'; else $(CYGPATH_W) '$(srcdir)/codegen_timing_pentium.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-codegen_timing_pentium.Tpo $(DEPDIR)/pcem-codegen_timing_pentium.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='codegen_timing_pentium.c' object='pcem-codegen_timing_pentium.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-codegen_timing_pentium.obj `if test -f 'codegen_timing_pentium.c'; then $(CYGPATH_W) 'codegen_timing_pentium.c'; else $(CYGPATH_W) '$(srcdir)/codegen_timing_pentium.c'; fi` - -pcem-compaq.o: compaq.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-compaq.o -MD -MP -MF $(DEPDIR)/pcem-compaq.Tpo -c -o pcem-compaq.o `test -f 'compaq.c' || echo '$(srcdir)/'`compaq.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-compaq.Tpo $(DEPDIR)/pcem-compaq.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='compaq.c' object='pcem-compaq.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-compaq.o `test -f 'compaq.c' || echo '$(srcdir)/'`compaq.c - -pcem-compaq.obj: compaq.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-compaq.obj -MD -MP -MF $(DEPDIR)/pcem-compaq.Tpo -c -o pcem-compaq.obj `if test -f 'compaq.c'; then $(CYGPATH_W) 'compaq.c'; else $(CYGPATH_W) '$(srcdir)/compaq.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-compaq.Tpo $(DEPDIR)/pcem-compaq.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='compaq.c' object='pcem-compaq.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-compaq.obj `if test -f 'compaq.c'; then $(CYGPATH_W) 'compaq.c'; else $(CYGPATH_W) '$(srcdir)/compaq.c'; fi` - -pcem-config.o: config.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-config.o -MD -MP -MF $(DEPDIR)/pcem-config.Tpo -c -o pcem-config.o `test -f 'config.c' || echo '$(srcdir)/'`config.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-config.Tpo $(DEPDIR)/pcem-config.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='config.c' object='pcem-config.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-config.o `test -f 'config.c' || echo '$(srcdir)/'`config.c - -pcem-config.obj: config.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-config.obj -MD -MP -MF $(DEPDIR)/pcem-config.Tpo -c -o pcem-config.obj `if test -f 'config.c'; then $(CYGPATH_W) 'config.c'; else $(CYGPATH_W) '$(srcdir)/config.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-config.Tpo $(DEPDIR)/pcem-config.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='config.c' object='pcem-config.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-config.obj `if test -f 'config.c'; then $(CYGPATH_W) 'config.c'; else $(CYGPATH_W) '$(srcdir)/config.c'; fi` - -pcem-cpu.o: cpu.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-cpu.o -MD -MP -MF $(DEPDIR)/pcem-cpu.Tpo -c -o pcem-cpu.o `test -f 'cpu.c' || echo '$(srcdir)/'`cpu.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-cpu.Tpo $(DEPDIR)/pcem-cpu.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpu.c' object='pcem-cpu.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-cpu.o `test -f 'cpu.c' || echo '$(srcdir)/'`cpu.c - -pcem-cpu.obj: cpu.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-cpu.obj -MD -MP -MF $(DEPDIR)/pcem-cpu.Tpo -c -o pcem-cpu.obj `if test -f 'cpu.c'; then $(CYGPATH_W) 'cpu.c'; else $(CYGPATH_W) '$(srcdir)/cpu.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-cpu.Tpo $(DEPDIR)/pcem-cpu.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpu.c' object='pcem-cpu.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-cpu.obj `if test -f 'cpu.c'; then $(CYGPATH_W) 'cpu.c'; else $(CYGPATH_W) '$(srcdir)/cpu.c'; fi` - -pcem-dac.o: dac.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-dac.o -MD -MP -MF $(DEPDIR)/pcem-dac.Tpo -c -o pcem-dac.o `test -f 'dac.c' || echo '$(srcdir)/'`dac.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-dac.Tpo $(DEPDIR)/pcem-dac.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dac.c' object='pcem-dac.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-dac.o `test -f 'dac.c' || echo '$(srcdir)/'`dac.c - -pcem-dac.obj: dac.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-dac.obj -MD -MP -MF $(DEPDIR)/pcem-dac.Tpo -c -o pcem-dac.obj `if test -f 'dac.c'; then $(CYGPATH_W) 'dac.c'; else $(CYGPATH_W) '$(srcdir)/dac.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-dac.Tpo $(DEPDIR)/pcem-dac.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dac.c' object='pcem-dac.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-dac.obj `if test -f 'dac.c'; then $(CYGPATH_W) 'dac.c'; else $(CYGPATH_W) '$(srcdir)/dac.c'; fi` - -pcem-device.o: device.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-device.o -MD -MP -MF $(DEPDIR)/pcem-device.Tpo -c -o pcem-device.o `test -f 'device.c' || echo '$(srcdir)/'`device.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-device.Tpo $(DEPDIR)/pcem-device.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='device.c' object='pcem-device.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-device.o `test -f 'device.c' || echo '$(srcdir)/'`device.c - -pcem-device.obj: device.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-device.obj -MD -MP -MF $(DEPDIR)/pcem-device.Tpo -c -o pcem-device.obj `if test -f 'device.c'; then $(CYGPATH_W) 'device.c'; else $(CYGPATH_W) '$(srcdir)/device.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-device.Tpo $(DEPDIR)/pcem-device.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='device.c' object='pcem-device.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-device.obj `if test -f 'device.c'; then $(CYGPATH_W) 'device.c'; else $(CYGPATH_W) '$(srcdir)/device.c'; fi` - -pcem-disc.o: disc.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-disc.o -MD -MP -MF $(DEPDIR)/pcem-disc.Tpo -c -o pcem-disc.o `test -f 'disc.c' || echo '$(srcdir)/'`disc.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-disc.Tpo $(DEPDIR)/pcem-disc.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disc.c' object='pcem-disc.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-disc.o `test -f 'disc.c' || echo '$(srcdir)/'`disc.c - -pcem-disc.obj: disc.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-disc.obj -MD -MP -MF $(DEPDIR)/pcem-disc.Tpo -c -o pcem-disc.obj `if test -f 'disc.c'; then $(CYGPATH_W) 'disc.c'; else $(CYGPATH_W) '$(srcdir)/disc.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-disc.Tpo $(DEPDIR)/pcem-disc.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disc.c' object='pcem-disc.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-disc.obj `if test -f 'disc.c'; then $(CYGPATH_W) 'disc.c'; else $(CYGPATH_W) '$(srcdir)/disc.c'; fi` - -pcem-disc_fdi.o: disc_fdi.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-disc_fdi.o -MD -MP -MF $(DEPDIR)/pcem-disc_fdi.Tpo -c -o pcem-disc_fdi.o `test -f 'disc_fdi.c' || echo '$(srcdir)/'`disc_fdi.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-disc_fdi.Tpo $(DEPDIR)/pcem-disc_fdi.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disc_fdi.c' object='pcem-disc_fdi.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-disc_fdi.o `test -f 'disc_fdi.c' || echo '$(srcdir)/'`disc_fdi.c - -pcem-disc_fdi.obj: disc_fdi.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-disc_fdi.obj -MD -MP -MF $(DEPDIR)/pcem-disc_fdi.Tpo -c -o pcem-disc_fdi.obj `if test -f 'disc_fdi.c'; then $(CYGPATH_W) 'disc_fdi.c'; else $(CYGPATH_W) '$(srcdir)/disc_fdi.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-disc_fdi.Tpo $(DEPDIR)/pcem-disc_fdi.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disc_fdi.c' object='pcem-disc_fdi.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-disc_fdi.obj `if test -f 'disc_fdi.c'; then $(CYGPATH_W) 'disc_fdi.c'; else $(CYGPATH_W) '$(srcdir)/disc_fdi.c'; fi` - -pcem-disc_img.o: disc_img.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-disc_img.o -MD -MP -MF $(DEPDIR)/pcem-disc_img.Tpo -c -o pcem-disc_img.o `test -f 'disc_img.c' || echo '$(srcdir)/'`disc_img.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-disc_img.Tpo $(DEPDIR)/pcem-disc_img.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disc_img.c' object='pcem-disc_img.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-disc_img.o `test -f 'disc_img.c' || echo '$(srcdir)/'`disc_img.c - -pcem-disc_img.obj: disc_img.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-disc_img.obj -MD -MP -MF $(DEPDIR)/pcem-disc_img.Tpo -c -o pcem-disc_img.obj `if test -f 'disc_img.c'; then $(CYGPATH_W) 'disc_img.c'; else $(CYGPATH_W) '$(srcdir)/disc_img.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-disc_img.Tpo $(DEPDIR)/pcem-disc_img.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disc_img.c' object='pcem-disc_img.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-disc_img.obj `if test -f 'disc_img.c'; then $(CYGPATH_W) 'disc_img.c'; else $(CYGPATH_W) '$(srcdir)/disc_img.c'; fi` - -pcem-dma.o: dma.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-dma.o -MD -MP -MF $(DEPDIR)/pcem-dma.Tpo -c -o pcem-dma.o `test -f 'dma.c' || echo '$(srcdir)/'`dma.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-dma.Tpo $(DEPDIR)/pcem-dma.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dma.c' object='pcem-dma.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-dma.o `test -f 'dma.c' || echo '$(srcdir)/'`dma.c - -pcem-dma.obj: dma.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-dma.obj -MD -MP -MF $(DEPDIR)/pcem-dma.Tpo -c -o pcem-dma.obj `if test -f 'dma.c'; then $(CYGPATH_W) 'dma.c'; else $(CYGPATH_W) '$(srcdir)/dma.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-dma.Tpo $(DEPDIR)/pcem-dma.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dma.c' object='pcem-dma.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-dma.obj `if test -f 'dma.c'; then $(CYGPATH_W) 'dma.c'; else $(CYGPATH_W) '$(srcdir)/dma.c'; fi` - -pcem-fdc.o: fdc.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-fdc.o -MD -MP -MF $(DEPDIR)/pcem-fdc.Tpo -c -o pcem-fdc.o `test -f 'fdc.c' || echo '$(srcdir)/'`fdc.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-fdc.Tpo $(DEPDIR)/pcem-fdc.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fdc.c' object='pcem-fdc.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-fdc.o `test -f 'fdc.c' || echo '$(srcdir)/'`fdc.c - -pcem-fdc.obj: fdc.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-fdc.obj -MD -MP -MF $(DEPDIR)/pcem-fdc.Tpo -c -o pcem-fdc.obj `if test -f 'fdc.c'; then $(CYGPATH_W) 'fdc.c'; else $(CYGPATH_W) '$(srcdir)/fdc.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-fdc.Tpo $(DEPDIR)/pcem-fdc.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fdc.c' object='pcem-fdc.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-fdc.obj `if test -f 'fdc.c'; then $(CYGPATH_W) 'fdc.c'; else $(CYGPATH_W) '$(srcdir)/fdc.c'; fi` - -pcem-fdc37c665.o: fdc37c665.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-fdc37c665.o -MD -MP -MF $(DEPDIR)/pcem-fdc37c665.Tpo -c -o pcem-fdc37c665.o `test -f 'fdc37c665.c' || echo '$(srcdir)/'`fdc37c665.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-fdc37c665.Tpo $(DEPDIR)/pcem-fdc37c665.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fdc37c665.c' object='pcem-fdc37c665.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-fdc37c665.o `test -f 'fdc37c665.c' || echo '$(srcdir)/'`fdc37c665.c - -pcem-fdc37c665.obj: fdc37c665.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-fdc37c665.obj -MD -MP -MF $(DEPDIR)/pcem-fdc37c665.Tpo -c -o pcem-fdc37c665.obj `if test -f 'fdc37c665.c'; then $(CYGPATH_W) 'fdc37c665.c'; else $(CYGPATH_W) '$(srcdir)/fdc37c665.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-fdc37c665.Tpo $(DEPDIR)/pcem-fdc37c665.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fdc37c665.c' object='pcem-fdc37c665.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-fdc37c665.obj `if test -f 'fdc37c665.c'; then $(CYGPATH_W) 'fdc37c665.c'; else $(CYGPATH_W) '$(srcdir)/fdc37c665.c'; fi` - -pcem-fdi2raw.o: fdi2raw.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-fdi2raw.o -MD -MP -MF $(DEPDIR)/pcem-fdi2raw.Tpo -c -o pcem-fdi2raw.o `test -f 'fdi2raw.c' || echo '$(srcdir)/'`fdi2raw.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-fdi2raw.Tpo $(DEPDIR)/pcem-fdi2raw.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fdi2raw.c' object='pcem-fdi2raw.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-fdi2raw.o `test -f 'fdi2raw.c' || echo '$(srcdir)/'`fdi2raw.c - -pcem-fdi2raw.obj: fdi2raw.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-fdi2raw.obj -MD -MP -MF $(DEPDIR)/pcem-fdi2raw.Tpo -c -o pcem-fdi2raw.obj `if test -f 'fdi2raw.c'; then $(CYGPATH_W) 'fdi2raw.c'; else $(CYGPATH_W) '$(srcdir)/fdi2raw.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-fdi2raw.Tpo $(DEPDIR)/pcem-fdi2raw.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fdi2raw.c' object='pcem-fdi2raw.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-fdi2raw.obj `if test -f 'fdi2raw.c'; then $(CYGPATH_W) 'fdi2raw.c'; else $(CYGPATH_W) '$(srcdir)/fdi2raw.c'; fi` - -pcem-gameport.o: gameport.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-gameport.o -MD -MP -MF $(DEPDIR)/pcem-gameport.Tpo -c -o pcem-gameport.o `test -f 'gameport.c' || echo '$(srcdir)/'`gameport.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-gameport.Tpo $(DEPDIR)/pcem-gameport.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gameport.c' object='pcem-gameport.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-gameport.o `test -f 'gameport.c' || echo '$(srcdir)/'`gameport.c - -pcem-gameport.obj: gameport.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-gameport.obj -MD -MP -MF $(DEPDIR)/pcem-gameport.Tpo -c -o pcem-gameport.obj `if test -f 'gameport.c'; then $(CYGPATH_W) 'gameport.c'; else $(CYGPATH_W) '$(srcdir)/gameport.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-gameport.Tpo $(DEPDIR)/pcem-gameport.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gameport.c' object='pcem-gameport.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-gameport.obj `if test -f 'gameport.c'; then $(CYGPATH_W) 'gameport.c'; else $(CYGPATH_W) '$(srcdir)/gameport.c'; fi` - -pcem-headland.o: headland.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-headland.o -MD -MP -MF $(DEPDIR)/pcem-headland.Tpo -c -o pcem-headland.o `test -f 'headland.c' || echo '$(srcdir)/'`headland.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-headland.Tpo $(DEPDIR)/pcem-headland.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='headland.c' object='pcem-headland.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-headland.o `test -f 'headland.c' || echo '$(srcdir)/'`headland.c - -pcem-headland.obj: headland.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-headland.obj -MD -MP -MF $(DEPDIR)/pcem-headland.Tpo -c -o pcem-headland.obj `if test -f 'headland.c'; then $(CYGPATH_W) 'headland.c'; else $(CYGPATH_W) '$(srcdir)/headland.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-headland.Tpo $(DEPDIR)/pcem-headland.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='headland.c' object='pcem-headland.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-headland.obj `if test -f 'headland.c'; then $(CYGPATH_W) 'headland.c'; else $(CYGPATH_W) '$(srcdir)/headland.c'; fi` - -pcem-i430lx.o: i430lx.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-i430lx.o -MD -MP -MF $(DEPDIR)/pcem-i430lx.Tpo -c -o pcem-i430lx.o `test -f 'i430lx.c' || echo '$(srcdir)/'`i430lx.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-i430lx.Tpo $(DEPDIR)/pcem-i430lx.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='i430lx.c' object='pcem-i430lx.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-i430lx.o `test -f 'i430lx.c' || echo '$(srcdir)/'`i430lx.c - -pcem-i430lx.obj: i430lx.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-i430lx.obj -MD -MP -MF $(DEPDIR)/pcem-i430lx.Tpo -c -o pcem-i430lx.obj `if test -f 'i430lx.c'; then $(CYGPATH_W) 'i430lx.c'; else $(CYGPATH_W) '$(srcdir)/i430lx.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-i430lx.Tpo $(DEPDIR)/pcem-i430lx.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='i430lx.c' object='pcem-i430lx.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-i430lx.obj `if test -f 'i430lx.c'; then $(CYGPATH_W) 'i430lx.c'; else $(CYGPATH_W) '$(srcdir)/i430lx.c'; fi` - -pcem-i430fx.o: i430fx.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-i430fx.o -MD -MP -MF $(DEPDIR)/pcem-i430fx.Tpo -c -o pcem-i430fx.o `test -f 'i430fx.c' || echo '$(srcdir)/'`i430fx.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-i430fx.Tpo $(DEPDIR)/pcem-i430fx.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='i430fx.c' object='pcem-i430fx.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-i430fx.o `test -f 'i430fx.c' || echo '$(srcdir)/'`i430fx.c - -pcem-i430fx.obj: i430fx.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-i430fx.obj -MD -MP -MF $(DEPDIR)/pcem-i430fx.Tpo -c -o pcem-i430fx.obj `if test -f 'i430fx.c'; then $(CYGPATH_W) 'i430fx.c'; else $(CYGPATH_W) '$(srcdir)/i430fx.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-i430fx.Tpo $(DEPDIR)/pcem-i430fx.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='i430fx.c' object='pcem-i430fx.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-i430fx.obj `if test -f 'i430fx.c'; then $(CYGPATH_W) 'i430fx.c'; else $(CYGPATH_W) '$(srcdir)/i430fx.c'; fi` - -pcem-i430vx.o: i430vx.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-i430vx.o -MD -MP -MF $(DEPDIR)/pcem-i430vx.Tpo -c -o pcem-i430vx.o `test -f 'i430vx.c' || echo '$(srcdir)/'`i430vx.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-i430vx.Tpo $(DEPDIR)/pcem-i430vx.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='i430vx.c' object='pcem-i430vx.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-i430vx.o `test -f 'i430vx.c' || echo '$(srcdir)/'`i430vx.c - -pcem-i430vx.obj: i430vx.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-i430vx.obj -MD -MP -MF $(DEPDIR)/pcem-i430vx.Tpo -c -o pcem-i430vx.obj `if test -f 'i430vx.c'; then $(CYGPATH_W) 'i430vx.c'; else $(CYGPATH_W) '$(srcdir)/i430vx.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-i430vx.Tpo $(DEPDIR)/pcem-i430vx.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='i430vx.c' object='pcem-i430vx.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-i430vx.obj `if test -f 'i430vx.c'; then $(CYGPATH_W) 'i430vx.c'; else $(CYGPATH_W) '$(srcdir)/i430vx.c'; fi` - -pcem-ide.o: ide.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-ide.o -MD -MP -MF $(DEPDIR)/pcem-ide.Tpo -c -o pcem-ide.o `test -f 'ide.c' || echo '$(srcdir)/'`ide.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-ide.Tpo $(DEPDIR)/pcem-ide.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ide.c' object='pcem-ide.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-ide.o `test -f 'ide.c' || echo '$(srcdir)/'`ide.c - -pcem-ide.obj: ide.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-ide.obj -MD -MP -MF $(DEPDIR)/pcem-ide.Tpo -c -o pcem-ide.obj `if test -f 'ide.c'; then $(CYGPATH_W) 'ide.c'; else $(CYGPATH_W) '$(srcdir)/ide.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-ide.Tpo $(DEPDIR)/pcem-ide.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ide.c' object='pcem-ide.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-ide.obj `if test -f 'ide.c'; then $(CYGPATH_W) 'ide.c'; else $(CYGPATH_W) '$(srcdir)/ide.c'; fi` - -pcem-intel.o: intel.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-intel.o -MD -MP -MF $(DEPDIR)/pcem-intel.Tpo -c -o pcem-intel.o `test -f 'intel.c' || echo '$(srcdir)/'`intel.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-intel.Tpo $(DEPDIR)/pcem-intel.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='intel.c' object='pcem-intel.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-intel.o `test -f 'intel.c' || echo '$(srcdir)/'`intel.c - -pcem-intel.obj: intel.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-intel.obj -MD -MP -MF $(DEPDIR)/pcem-intel.Tpo -c -o pcem-intel.obj `if test -f 'intel.c'; then $(CYGPATH_W) 'intel.c'; else $(CYGPATH_W) '$(srcdir)/intel.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-intel.Tpo $(DEPDIR)/pcem-intel.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='intel.c' object='pcem-intel.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-intel.obj `if test -f 'intel.c'; then $(CYGPATH_W) 'intel.c'; else $(CYGPATH_W) '$(srcdir)/intel.c'; fi` - -pcem-intel_flash.o: intel_flash.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-intel_flash.o -MD -MP -MF $(DEPDIR)/pcem-intel_flash.Tpo -c -o pcem-intel_flash.o `test -f 'intel_flash.c' || echo '$(srcdir)/'`intel_flash.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-intel_flash.Tpo $(DEPDIR)/pcem-intel_flash.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='intel_flash.c' object='pcem-intel_flash.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-intel_flash.o `test -f 'intel_flash.c' || echo '$(srcdir)/'`intel_flash.c - -pcem-intel_flash.obj: intel_flash.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-intel_flash.obj -MD -MP -MF $(DEPDIR)/pcem-intel_flash.Tpo -c -o pcem-intel_flash.obj `if test -f 'intel_flash.c'; then $(CYGPATH_W) 'intel_flash.c'; else $(CYGPATH_W) '$(srcdir)/intel_flash.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-intel_flash.Tpo $(DEPDIR)/pcem-intel_flash.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='intel_flash.c' object='pcem-intel_flash.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-intel_flash.obj `if test -f 'intel_flash.c'; then $(CYGPATH_W) 'intel_flash.c'; else $(CYGPATH_W) '$(srcdir)/intel_flash.c'; fi` - -pcem-io.o: io.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-io.o -MD -MP -MF $(DEPDIR)/pcem-io.Tpo -c -o pcem-io.o `test -f 'io.c' || echo '$(srcdir)/'`io.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-io.Tpo $(DEPDIR)/pcem-io.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='io.c' object='pcem-io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-io.o `test -f 'io.c' || echo '$(srcdir)/'`io.c - -pcem-io.obj: io.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-io.obj -MD -MP -MF $(DEPDIR)/pcem-io.Tpo -c -o pcem-io.obj `if test -f 'io.c'; then $(CYGPATH_W) 'io.c'; else $(CYGPATH_W) '$(srcdir)/io.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-io.Tpo $(DEPDIR)/pcem-io.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='io.c' object='pcem-io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-io.obj `if test -f 'io.c'; then $(CYGPATH_W) 'io.c'; else $(CYGPATH_W) '$(srcdir)/io.c'; fi` - -pcem-jim.o: jim.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-jim.o -MD -MP -MF $(DEPDIR)/pcem-jim.Tpo -c -o pcem-jim.o `test -f 'jim.c' || echo '$(srcdir)/'`jim.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-jim.Tpo $(DEPDIR)/pcem-jim.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jim.c' object='pcem-jim.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-jim.o `test -f 'jim.c' || echo '$(srcdir)/'`jim.c - -pcem-jim.obj: jim.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-jim.obj -MD -MP -MF $(DEPDIR)/pcem-jim.Tpo -c -o pcem-jim.obj `if test -f 'jim.c'; then $(CYGPATH_W) 'jim.c'; else $(CYGPATH_W) '$(srcdir)/jim.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-jim.Tpo $(DEPDIR)/pcem-jim.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jim.c' object='pcem-jim.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-jim.obj `if test -f 'jim.c'; then $(CYGPATH_W) 'jim.c'; else $(CYGPATH_W) '$(srcdir)/jim.c'; fi` - -pcem-keyboard.o: keyboard.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-keyboard.o -MD -MP -MF $(DEPDIR)/pcem-keyboard.Tpo -c -o pcem-keyboard.o `test -f 'keyboard.c' || echo '$(srcdir)/'`keyboard.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-keyboard.Tpo $(DEPDIR)/pcem-keyboard.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='keyboard.c' object='pcem-keyboard.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-keyboard.o `test -f 'keyboard.c' || echo '$(srcdir)/'`keyboard.c - -pcem-keyboard.obj: keyboard.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-keyboard.obj -MD -MP -MF $(DEPDIR)/pcem-keyboard.Tpo -c -o pcem-keyboard.obj `if test -f 'keyboard.c'; then $(CYGPATH_W) 'keyboard.c'; else $(CYGPATH_W) '$(srcdir)/keyboard.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-keyboard.Tpo $(DEPDIR)/pcem-keyboard.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='keyboard.c' object='pcem-keyboard.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-keyboard.obj `if test -f 'keyboard.c'; then $(CYGPATH_W) 'keyboard.c'; else $(CYGPATH_W) '$(srcdir)/keyboard.c'; fi` - -pcem-keyboard_amstrad.o: keyboard_amstrad.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-keyboard_amstrad.o -MD -MP -MF $(DEPDIR)/pcem-keyboard_amstrad.Tpo -c -o pcem-keyboard_amstrad.o `test -f 'keyboard_amstrad.c' || echo '$(srcdir)/'`keyboard_amstrad.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-keyboard_amstrad.Tpo $(DEPDIR)/pcem-keyboard_amstrad.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='keyboard_amstrad.c' object='pcem-keyboard_amstrad.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-keyboard_amstrad.o `test -f 'keyboard_amstrad.c' || echo '$(srcdir)/'`keyboard_amstrad.c - -pcem-keyboard_amstrad.obj: keyboard_amstrad.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-keyboard_amstrad.obj -MD -MP -MF $(DEPDIR)/pcem-keyboard_amstrad.Tpo -c -o pcem-keyboard_amstrad.obj `if test -f 'keyboard_amstrad.c'; then $(CYGPATH_W) 'keyboard_amstrad.c'; else $(CYGPATH_W) '$(srcdir)/keyboard_amstrad.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-keyboard_amstrad.Tpo $(DEPDIR)/pcem-keyboard_amstrad.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='keyboard_amstrad.c' object='pcem-keyboard_amstrad.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-keyboard_amstrad.obj `if test -f 'keyboard_amstrad.c'; then $(CYGPATH_W) 'keyboard_amstrad.c'; else $(CYGPATH_W) '$(srcdir)/keyboard_amstrad.c'; fi` - -pcem-keyboard_at.o: keyboard_at.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-keyboard_at.o -MD -MP -MF $(DEPDIR)/pcem-keyboard_at.Tpo -c -o pcem-keyboard_at.o `test -f 'keyboard_at.c' || echo '$(srcdir)/'`keyboard_at.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-keyboard_at.Tpo $(DEPDIR)/pcem-keyboard_at.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='keyboard_at.c' object='pcem-keyboard_at.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-keyboard_at.o `test -f 'keyboard_at.c' || echo '$(srcdir)/'`keyboard_at.c - -pcem-keyboard_at.obj: keyboard_at.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-keyboard_at.obj -MD -MP -MF $(DEPDIR)/pcem-keyboard_at.Tpo -c -o pcem-keyboard_at.obj `if test -f 'keyboard_at.c'; then $(CYGPATH_W) 'keyboard_at.c'; else $(CYGPATH_W) '$(srcdir)/keyboard_at.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-keyboard_at.Tpo $(DEPDIR)/pcem-keyboard_at.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='keyboard_at.c' object='pcem-keyboard_at.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-keyboard_at.obj `if test -f 'keyboard_at.c'; then $(CYGPATH_W) 'keyboard_at.c'; else $(CYGPATH_W) '$(srcdir)/keyboard_at.c'; fi` - -pcem-keyboard_olim24.o: keyboard_olim24.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-keyboard_olim24.o -MD -MP -MF $(DEPDIR)/pcem-keyboard_olim24.Tpo -c -o pcem-keyboard_olim24.o `test -f 'keyboard_olim24.c' || echo '$(srcdir)/'`keyboard_olim24.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-keyboard_olim24.Tpo $(DEPDIR)/pcem-keyboard_olim24.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='keyboard_olim24.c' object='pcem-keyboard_olim24.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-keyboard_olim24.o `test -f 'keyboard_olim24.c' || echo '$(srcdir)/'`keyboard_olim24.c - -pcem-keyboard_olim24.obj: keyboard_olim24.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-keyboard_olim24.obj -MD -MP -MF $(DEPDIR)/pcem-keyboard_olim24.Tpo -c -o pcem-keyboard_olim24.obj `if test -f 'keyboard_olim24.c'; then $(CYGPATH_W) 'keyboard_olim24.c'; else $(CYGPATH_W) '$(srcdir)/keyboard_olim24.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-keyboard_olim24.Tpo $(DEPDIR)/pcem-keyboard_olim24.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='keyboard_olim24.c' object='pcem-keyboard_olim24.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-keyboard_olim24.obj `if test -f 'keyboard_olim24.c'; then $(CYGPATH_W) 'keyboard_olim24.c'; else $(CYGPATH_W) '$(srcdir)/keyboard_olim24.c'; fi` - -pcem-keyboard_pcjr.o: keyboard_pcjr.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-keyboard_pcjr.o -MD -MP -MF $(DEPDIR)/pcem-keyboard_pcjr.Tpo -c -o pcem-keyboard_pcjr.o `test -f 'keyboard_pcjr.c' || echo '$(srcdir)/'`keyboard_pcjr.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-keyboard_pcjr.Tpo $(DEPDIR)/pcem-keyboard_pcjr.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='keyboard_pcjr.c' object='pcem-keyboard_pcjr.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-keyboard_pcjr.o `test -f 'keyboard_pcjr.c' || echo '$(srcdir)/'`keyboard_pcjr.c - -pcem-keyboard_pcjr.obj: keyboard_pcjr.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-keyboard_pcjr.obj -MD -MP -MF $(DEPDIR)/pcem-keyboard_pcjr.Tpo -c -o pcem-keyboard_pcjr.obj `if test -f 'keyboard_pcjr.c'; then $(CYGPATH_W) 'keyboard_pcjr.c'; else $(CYGPATH_W) '$(srcdir)/keyboard_pcjr.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-keyboard_pcjr.Tpo $(DEPDIR)/pcem-keyboard_pcjr.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='keyboard_pcjr.c' object='pcem-keyboard_pcjr.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-keyboard_pcjr.obj `if test -f 'keyboard_pcjr.c'; then $(CYGPATH_W) 'keyboard_pcjr.c'; else $(CYGPATH_W) '$(srcdir)/keyboard_pcjr.c'; fi` - -pcem-keyboard_xt.o: keyboard_xt.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-keyboard_xt.o -MD -MP -MF $(DEPDIR)/pcem-keyboard_xt.Tpo -c -o pcem-keyboard_xt.o `test -f 'keyboard_xt.c' || echo '$(srcdir)/'`keyboard_xt.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-keyboard_xt.Tpo $(DEPDIR)/pcem-keyboard_xt.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='keyboard_xt.c' object='pcem-keyboard_xt.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-keyboard_xt.o `test -f 'keyboard_xt.c' || echo '$(srcdir)/'`keyboard_xt.c - -pcem-keyboard_xt.obj: keyboard_xt.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-keyboard_xt.obj -MD -MP -MF $(DEPDIR)/pcem-keyboard_xt.Tpo -c -o pcem-keyboard_xt.obj `if test -f 'keyboard_xt.c'; then $(CYGPATH_W) 'keyboard_xt.c'; else $(CYGPATH_W) '$(srcdir)/keyboard_xt.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-keyboard_xt.Tpo $(DEPDIR)/pcem-keyboard_xt.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='keyboard_xt.c' object='pcem-keyboard_xt.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-keyboard_xt.obj `if test -f 'keyboard_xt.c'; then $(CYGPATH_W) 'keyboard_xt.c'; else $(CYGPATH_W) '$(srcdir)/keyboard_xt.c'; fi` - -pcem-linux-time.o: linux-time.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-linux-time.o -MD -MP -MF $(DEPDIR)/pcem-linux-time.Tpo -c -o pcem-linux-time.o `test -f 'linux-time.c' || echo '$(srcdir)/'`linux-time.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-linux-time.Tpo $(DEPDIR)/pcem-linux-time.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='linux-time.c' object='pcem-linux-time.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-linux-time.o `test -f 'linux-time.c' || echo '$(srcdir)/'`linux-time.c - -pcem-linux-time.obj: linux-time.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-linux-time.obj -MD -MP -MF $(DEPDIR)/pcem-linux-time.Tpo -c -o pcem-linux-time.obj `if test -f 'linux-time.c'; then $(CYGPATH_W) 'linux-time.c'; else $(CYGPATH_W) '$(srcdir)/linux-time.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-linux-time.Tpo $(DEPDIR)/pcem-linux-time.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='linux-time.c' object='pcem-linux-time.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-linux-time.obj `if test -f 'linux-time.c'; then $(CYGPATH_W) 'linux-time.c'; else $(CYGPATH_W) '$(srcdir)/linux-time.c'; fi` - -pcem-lpt.o: lpt.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-lpt.o -MD -MP -MF $(DEPDIR)/pcem-lpt.Tpo -c -o pcem-lpt.o `test -f 'lpt.c' || echo '$(srcdir)/'`lpt.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-lpt.Tpo $(DEPDIR)/pcem-lpt.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lpt.c' object='pcem-lpt.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-lpt.o `test -f 'lpt.c' || echo '$(srcdir)/'`lpt.c - -pcem-lpt.obj: lpt.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-lpt.obj -MD -MP -MF $(DEPDIR)/pcem-lpt.Tpo -c -o pcem-lpt.obj `if test -f 'lpt.c'; then $(CYGPATH_W) 'lpt.c'; else $(CYGPATH_W) '$(srcdir)/lpt.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-lpt.Tpo $(DEPDIR)/pcem-lpt.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lpt.c' object='pcem-lpt.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-lpt.obj `if test -f 'lpt.c'; then $(CYGPATH_W) 'lpt.c'; else $(CYGPATH_W) '$(srcdir)/lpt.c'; fi` - -pcem-mcr.o: mcr.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-mcr.o -MD -MP -MF $(DEPDIR)/pcem-mcr.Tpo -c -o pcem-mcr.o `test -f 'mcr.c' || echo '$(srcdir)/'`mcr.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-mcr.Tpo $(DEPDIR)/pcem-mcr.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mcr.c' object='pcem-mcr.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-mcr.o `test -f 'mcr.c' || echo '$(srcdir)/'`mcr.c - -pcem-mcr.obj: mcr.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-mcr.obj -MD -MP -MF $(DEPDIR)/pcem-mcr.Tpo -c -o pcem-mcr.obj `if test -f 'mcr.c'; then $(CYGPATH_W) 'mcr.c'; else $(CYGPATH_W) '$(srcdir)/mcr.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-mcr.Tpo $(DEPDIR)/pcem-mcr.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mcr.c' object='pcem-mcr.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-mcr.obj `if test -f 'mcr.c'; then $(CYGPATH_W) 'mcr.c'; else $(CYGPATH_W) '$(srcdir)/mcr.c'; fi` - -pcem-mem.o: mem.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-mem.o -MD -MP -MF $(DEPDIR)/pcem-mem.Tpo -c -o pcem-mem.o `test -f 'mem.c' || echo '$(srcdir)/'`mem.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-mem.Tpo $(DEPDIR)/pcem-mem.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mem.c' object='pcem-mem.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-mem.o `test -f 'mem.c' || echo '$(srcdir)/'`mem.c - -pcem-mem.obj: mem.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-mem.obj -MD -MP -MF $(DEPDIR)/pcem-mem.Tpo -c -o pcem-mem.obj `if test -f 'mem.c'; then $(CYGPATH_W) 'mem.c'; else $(CYGPATH_W) '$(srcdir)/mem.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-mem.Tpo $(DEPDIR)/pcem-mem.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mem.c' object='pcem-mem.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-mem.obj `if test -f 'mem.c'; then $(CYGPATH_W) 'mem.c'; else $(CYGPATH_W) '$(srcdir)/mem.c'; fi` - -pcem-model.o: model.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-model.o -MD -MP -MF $(DEPDIR)/pcem-model.Tpo -c -o pcem-model.o `test -f 'model.c' || echo '$(srcdir)/'`model.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-model.Tpo $(DEPDIR)/pcem-model.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='model.c' object='pcem-model.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-model.o `test -f 'model.c' || echo '$(srcdir)/'`model.c - -pcem-model.obj: model.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-model.obj -MD -MP -MF $(DEPDIR)/pcem-model.Tpo -c -o pcem-model.obj `if test -f 'model.c'; then $(CYGPATH_W) 'model.c'; else $(CYGPATH_W) '$(srcdir)/model.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-model.Tpo $(DEPDIR)/pcem-model.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='model.c' object='pcem-model.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-model.obj `if test -f 'model.c'; then $(CYGPATH_W) 'model.c'; else $(CYGPATH_W) '$(srcdir)/model.c'; fi` - -pcem-mouse.o: mouse.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-mouse.o -MD -MP -MF $(DEPDIR)/pcem-mouse.Tpo -c -o pcem-mouse.o `test -f 'mouse.c' || echo '$(srcdir)/'`mouse.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-mouse.Tpo $(DEPDIR)/pcem-mouse.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mouse.c' object='pcem-mouse.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-mouse.o `test -f 'mouse.c' || echo '$(srcdir)/'`mouse.c - -pcem-mouse.obj: mouse.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-mouse.obj -MD -MP -MF $(DEPDIR)/pcem-mouse.Tpo -c -o pcem-mouse.obj `if test -f 'mouse.c'; then $(CYGPATH_W) 'mouse.c'; else $(CYGPATH_W) '$(srcdir)/mouse.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-mouse.Tpo $(DEPDIR)/pcem-mouse.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mouse.c' object='pcem-mouse.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-mouse.obj `if test -f 'mouse.c'; then $(CYGPATH_W) 'mouse.c'; else $(CYGPATH_W) '$(srcdir)/mouse.c'; fi` - -pcem-mouse_ps2.o: mouse_ps2.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-mouse_ps2.o -MD -MP -MF $(DEPDIR)/pcem-mouse_ps2.Tpo -c -o pcem-mouse_ps2.o `test -f 'mouse_ps2.c' || echo '$(srcdir)/'`mouse_ps2.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-mouse_ps2.Tpo $(DEPDIR)/pcem-mouse_ps2.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mouse_ps2.c' object='pcem-mouse_ps2.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-mouse_ps2.o `test -f 'mouse_ps2.c' || echo '$(srcdir)/'`mouse_ps2.c - -pcem-mouse_ps2.obj: mouse_ps2.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-mouse_ps2.obj -MD -MP -MF $(DEPDIR)/pcem-mouse_ps2.Tpo -c -o pcem-mouse_ps2.obj `if test -f 'mouse_ps2.c'; then $(CYGPATH_W) 'mouse_ps2.c'; else $(CYGPATH_W) '$(srcdir)/mouse_ps2.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-mouse_ps2.Tpo $(DEPDIR)/pcem-mouse_ps2.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mouse_ps2.c' object='pcem-mouse_ps2.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-mouse_ps2.obj `if test -f 'mouse_ps2.c'; then $(CYGPATH_W) 'mouse_ps2.c'; else $(CYGPATH_W) '$(srcdir)/mouse_ps2.c'; fi` - -pcem-mouse_serial.o: mouse_serial.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-mouse_serial.o -MD -MP -MF $(DEPDIR)/pcem-mouse_serial.Tpo -c -o pcem-mouse_serial.o `test -f 'mouse_serial.c' || echo '$(srcdir)/'`mouse_serial.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-mouse_serial.Tpo $(DEPDIR)/pcem-mouse_serial.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mouse_serial.c' object='pcem-mouse_serial.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-mouse_serial.o `test -f 'mouse_serial.c' || echo '$(srcdir)/'`mouse_serial.c - -pcem-mouse_serial.obj: mouse_serial.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-mouse_serial.obj -MD -MP -MF $(DEPDIR)/pcem-mouse_serial.Tpo -c -o pcem-mouse_serial.obj `if test -f 'mouse_serial.c'; then $(CYGPATH_W) 'mouse_serial.c'; else $(CYGPATH_W) '$(srcdir)/mouse_serial.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-mouse_serial.Tpo $(DEPDIR)/pcem-mouse_serial.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mouse_serial.c' object='pcem-mouse_serial.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-mouse_serial.obj `if test -f 'mouse_serial.c'; then $(CYGPATH_W) 'mouse_serial.c'; else $(CYGPATH_W) '$(srcdir)/mouse_serial.c'; fi` - -pcem-neat.o: neat.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-neat.o -MD -MP -MF $(DEPDIR)/pcem-neat.Tpo -c -o pcem-neat.o `test -f 'neat.c' || echo '$(srcdir)/'`neat.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-neat.Tpo $(DEPDIR)/pcem-neat.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='neat.c' object='pcem-neat.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-neat.o `test -f 'neat.c' || echo '$(srcdir)/'`neat.c - -pcem-neat.obj: neat.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-neat.obj -MD -MP -MF $(DEPDIR)/pcem-neat.Tpo -c -o pcem-neat.obj `if test -f 'neat.c'; then $(CYGPATH_W) 'neat.c'; else $(CYGPATH_W) '$(srcdir)/neat.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-neat.Tpo $(DEPDIR)/pcem-neat.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='neat.c' object='pcem-neat.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-neat.obj `if test -f 'neat.c'; then $(CYGPATH_W) 'neat.c'; else $(CYGPATH_W) '$(srcdir)/neat.c'; fi` - -pcem-nmi.o: nmi.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-nmi.o -MD -MP -MF $(DEPDIR)/pcem-nmi.Tpo -c -o pcem-nmi.o `test -f 'nmi.c' || echo '$(srcdir)/'`nmi.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-nmi.Tpo $(DEPDIR)/pcem-nmi.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nmi.c' object='pcem-nmi.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-nmi.o `test -f 'nmi.c' || echo '$(srcdir)/'`nmi.c - -pcem-nmi.obj: nmi.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-nmi.obj -MD -MP -MF $(DEPDIR)/pcem-nmi.Tpo -c -o pcem-nmi.obj `if test -f 'nmi.c'; then $(CYGPATH_W) 'nmi.c'; else $(CYGPATH_W) '$(srcdir)/nmi.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-nmi.Tpo $(DEPDIR)/pcem-nmi.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nmi.c' object='pcem-nmi.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-nmi.obj `if test -f 'nmi.c'; then $(CYGPATH_W) 'nmi.c'; else $(CYGPATH_W) '$(srcdir)/nmi.c'; fi` - -pcem-nvr.o: nvr.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-nvr.o -MD -MP -MF $(DEPDIR)/pcem-nvr.Tpo -c -o pcem-nvr.o `test -f 'nvr.c' || echo '$(srcdir)/'`nvr.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-nvr.Tpo $(DEPDIR)/pcem-nvr.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nvr.c' object='pcem-nvr.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-nvr.o `test -f 'nvr.c' || echo '$(srcdir)/'`nvr.c - -pcem-nvr.obj: nvr.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-nvr.obj -MD -MP -MF $(DEPDIR)/pcem-nvr.Tpo -c -o pcem-nvr.obj `if test -f 'nvr.c'; then $(CYGPATH_W) 'nvr.c'; else $(CYGPATH_W) '$(srcdir)/nvr.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-nvr.Tpo $(DEPDIR)/pcem-nvr.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nvr.c' object='pcem-nvr.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-nvr.obj `if test -f 'nvr.c'; then $(CYGPATH_W) 'nvr.c'; else $(CYGPATH_W) '$(srcdir)/nvr.c'; fi` - -pcem-olivetti_m24.o: olivetti_m24.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-olivetti_m24.o -MD -MP -MF $(DEPDIR)/pcem-olivetti_m24.Tpo -c -o pcem-olivetti_m24.o `test -f 'olivetti_m24.c' || echo '$(srcdir)/'`olivetti_m24.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-olivetti_m24.Tpo $(DEPDIR)/pcem-olivetti_m24.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='olivetti_m24.c' object='pcem-olivetti_m24.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-olivetti_m24.o `test -f 'olivetti_m24.c' || echo '$(srcdir)/'`olivetti_m24.c - -pcem-olivetti_m24.obj: olivetti_m24.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-olivetti_m24.obj -MD -MP -MF $(DEPDIR)/pcem-olivetti_m24.Tpo -c -o pcem-olivetti_m24.obj `if test -f 'olivetti_m24.c'; then $(CYGPATH_W) 'olivetti_m24.c'; else $(CYGPATH_W) '$(srcdir)/olivetti_m24.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-olivetti_m24.Tpo $(DEPDIR)/pcem-olivetti_m24.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='olivetti_m24.c' object='pcem-olivetti_m24.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-olivetti_m24.obj `if test -f 'olivetti_m24.c'; then $(CYGPATH_W) 'olivetti_m24.c'; else $(CYGPATH_W) '$(srcdir)/olivetti_m24.c'; fi` - -pcem-opti.o: opti.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-opti.o -MD -MP -MF $(DEPDIR)/pcem-opti.Tpo -c -o pcem-opti.o `test -f 'opti.c' || echo '$(srcdir)/'`opti.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-opti.Tpo $(DEPDIR)/pcem-opti.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='opti.c' object='pcem-opti.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-opti.o `test -f 'opti.c' || echo '$(srcdir)/'`opti.c - -pcem-opti.obj: opti.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-opti.obj -MD -MP -MF $(DEPDIR)/pcem-opti.Tpo -c -o pcem-opti.obj `if test -f 'opti.c'; then $(CYGPATH_W) 'opti.c'; else $(CYGPATH_W) '$(srcdir)/opti.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-opti.Tpo $(DEPDIR)/pcem-opti.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='opti.c' object='pcem-opti.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-opti.obj `if test -f 'opti.c'; then $(CYGPATH_W) 'opti.c'; else $(CYGPATH_W) '$(srcdir)/opti.c'; fi` - -pcem-pc.o: pc.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-pc.o -MD -MP -MF $(DEPDIR)/pcem-pc.Tpo -c -o pcem-pc.o `test -f 'pc.c' || echo '$(srcdir)/'`pc.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-pc.Tpo $(DEPDIR)/pcem-pc.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pc.c' object='pcem-pc.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-pc.o `test -f 'pc.c' || echo '$(srcdir)/'`pc.c - -pcem-pc.obj: pc.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-pc.obj -MD -MP -MF $(DEPDIR)/pcem-pc.Tpo -c -o pcem-pc.obj `if test -f 'pc.c'; then $(CYGPATH_W) 'pc.c'; else $(CYGPATH_W) '$(srcdir)/pc.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-pc.Tpo $(DEPDIR)/pcem-pc.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pc.c' object='pcem-pc.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-pc.obj `if test -f 'pc.c'; then $(CYGPATH_W) 'pc.c'; else $(CYGPATH_W) '$(srcdir)/pc.c'; fi` - -pcem-pci.o: pci.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-pci.o -MD -MP -MF $(DEPDIR)/pcem-pci.Tpo -c -o pcem-pci.o `test -f 'pci.c' || echo '$(srcdir)/'`pci.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-pci.Tpo $(DEPDIR)/pcem-pci.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pci.c' object='pcem-pci.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-pci.o `test -f 'pci.c' || echo '$(srcdir)/'`pci.c - -pcem-pci.obj: pci.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-pci.obj -MD -MP -MF $(DEPDIR)/pcem-pci.Tpo -c -o pcem-pci.obj `if test -f 'pci.c'; then $(CYGPATH_W) 'pci.c'; else $(CYGPATH_W) '$(srcdir)/pci.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-pci.Tpo $(DEPDIR)/pcem-pci.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pci.c' object='pcem-pci.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-pci.obj `if test -f 'pci.c'; then $(CYGPATH_W) 'pci.c'; else $(CYGPATH_W) '$(srcdir)/pci.c'; fi` - -pcem-pic.o: pic.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-pic.o -MD -MP -MF $(DEPDIR)/pcem-pic.Tpo -c -o pcem-pic.o `test -f 'pic.c' || echo '$(srcdir)/'`pic.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-pic.Tpo $(DEPDIR)/pcem-pic.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pic.c' object='pcem-pic.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-pic.o `test -f 'pic.c' || echo '$(srcdir)/'`pic.c - -pcem-pic.obj: pic.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-pic.obj -MD -MP -MF $(DEPDIR)/pcem-pic.Tpo -c -o pcem-pic.obj `if test -f 'pic.c'; then $(CYGPATH_W) 'pic.c'; else $(CYGPATH_W) '$(srcdir)/pic.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-pic.Tpo $(DEPDIR)/pcem-pic.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pic.c' object='pcem-pic.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-pic.obj `if test -f 'pic.c'; then $(CYGPATH_W) 'pic.c'; else $(CYGPATH_W) '$(srcdir)/pic.c'; fi` - -pcem-piix.o: piix.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-piix.o -MD -MP -MF $(DEPDIR)/pcem-piix.Tpo -c -o pcem-piix.o `test -f 'piix.c' || echo '$(srcdir)/'`piix.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-piix.Tpo $(DEPDIR)/pcem-piix.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='piix.c' object='pcem-piix.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-piix.o `test -f 'piix.c' || echo '$(srcdir)/'`piix.c - -pcem-piix.obj: piix.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-piix.obj -MD -MP -MF $(DEPDIR)/pcem-piix.Tpo -c -o pcem-piix.obj `if test -f 'piix.c'; then $(CYGPATH_W) 'piix.c'; else $(CYGPATH_W) '$(srcdir)/piix.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-piix.Tpo $(DEPDIR)/pcem-piix.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='piix.c' object='pcem-piix.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-piix.obj `if test -f 'piix.c'; then $(CYGPATH_W) 'piix.c'; else $(CYGPATH_W) '$(srcdir)/piix.c'; fi` - -pcem-pit.o: pit.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-pit.o -MD -MP -MF $(DEPDIR)/pcem-pit.Tpo -c -o pcem-pit.o `test -f 'pit.c' || echo '$(srcdir)/'`pit.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-pit.Tpo $(DEPDIR)/pcem-pit.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pit.c' object='pcem-pit.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-pit.o `test -f 'pit.c' || echo '$(srcdir)/'`pit.c - -pcem-pit.obj: pit.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-pit.obj -MD -MP -MF $(DEPDIR)/pcem-pit.Tpo -c -o pcem-pit.obj `if test -f 'pit.c'; then $(CYGPATH_W) 'pit.c'; else $(CYGPATH_W) '$(srcdir)/pit.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-pit.Tpo $(DEPDIR)/pcem-pit.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pit.c' object='pcem-pit.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-pit.obj `if test -f 'pit.c'; then $(CYGPATH_W) 'pit.c'; else $(CYGPATH_W) '$(srcdir)/pit.c'; fi` - -pcem-ppi.o: ppi.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-ppi.o -MD -MP -MF $(DEPDIR)/pcem-ppi.Tpo -c -o pcem-ppi.o `test -f 'ppi.c' || echo '$(srcdir)/'`ppi.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-ppi.Tpo $(DEPDIR)/pcem-ppi.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ppi.c' object='pcem-ppi.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-ppi.o `test -f 'ppi.c' || echo '$(srcdir)/'`ppi.c - -pcem-ppi.obj: ppi.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-ppi.obj -MD -MP -MF $(DEPDIR)/pcem-ppi.Tpo -c -o pcem-ppi.obj `if test -f 'ppi.c'; then $(CYGPATH_W) 'ppi.c'; else $(CYGPATH_W) '$(srcdir)/ppi.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-ppi.Tpo $(DEPDIR)/pcem-ppi.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ppi.c' object='pcem-ppi.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-ppi.obj `if test -f 'ppi.c'; then $(CYGPATH_W) 'ppi.c'; else $(CYGPATH_W) '$(srcdir)/ppi.c'; fi` - -pcem-ps1.o: ps1.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-ps1.o -MD -MP -MF $(DEPDIR)/pcem-ps1.Tpo -c -o pcem-ps1.o `test -f 'ps1.c' || echo '$(srcdir)/'`ps1.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-ps1.Tpo $(DEPDIR)/pcem-ps1.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ps1.c' object='pcem-ps1.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-ps1.o `test -f 'ps1.c' || echo '$(srcdir)/'`ps1.c - -pcem-ps1.obj: ps1.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-ps1.obj -MD -MP -MF $(DEPDIR)/pcem-ps1.Tpo -c -o pcem-ps1.obj `if test -f 'ps1.c'; then $(CYGPATH_W) 'ps1.c'; else $(CYGPATH_W) '$(srcdir)/ps1.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-ps1.Tpo $(DEPDIR)/pcem-ps1.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ps1.c' object='pcem-ps1.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-ps1.obj `if test -f 'ps1.c'; then $(CYGPATH_W) 'ps1.c'; else $(CYGPATH_W) '$(srcdir)/ps1.c'; fi` - -pcem-rom.o: rom.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-rom.o -MD -MP -MF $(DEPDIR)/pcem-rom.Tpo -c -o pcem-rom.o `test -f 'rom.c' || echo '$(srcdir)/'`rom.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-rom.Tpo $(DEPDIR)/pcem-rom.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='rom.c' object='pcem-rom.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-rom.o `test -f 'rom.c' || echo '$(srcdir)/'`rom.c - -pcem-rom.obj: rom.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-rom.obj -MD -MP -MF $(DEPDIR)/pcem-rom.Tpo -c -o pcem-rom.obj `if test -f 'rom.c'; then $(CYGPATH_W) 'rom.c'; else $(CYGPATH_W) '$(srcdir)/rom.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-rom.Tpo $(DEPDIR)/pcem-rom.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='rom.c' object='pcem-rom.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-rom.obj `if test -f 'rom.c'; then $(CYGPATH_W) 'rom.c'; else $(CYGPATH_W) '$(srcdir)/rom.c'; fi` - -pcem-serial.o: serial.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-serial.o -MD -MP -MF $(DEPDIR)/pcem-serial.Tpo -c -o pcem-serial.o `test -f 'serial.c' || echo '$(srcdir)/'`serial.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-serial.Tpo $(DEPDIR)/pcem-serial.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='serial.c' object='pcem-serial.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-serial.o `test -f 'serial.c' || echo '$(srcdir)/'`serial.c - -pcem-serial.obj: serial.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-serial.obj -MD -MP -MF $(DEPDIR)/pcem-serial.Tpo -c -o pcem-serial.obj `if test -f 'serial.c'; then $(CYGPATH_W) 'serial.c'; else $(CYGPATH_W) '$(srcdir)/serial.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-serial.Tpo $(DEPDIR)/pcem-serial.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='serial.c' object='pcem-serial.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-serial.obj `if test -f 'serial.c'; then $(CYGPATH_W) 'serial.c'; else $(CYGPATH_W) '$(srcdir)/serial.c'; fi` - -pcem-sis496.o: sis496.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sis496.o -MD -MP -MF $(DEPDIR)/pcem-sis496.Tpo -c -o pcem-sis496.o `test -f 'sis496.c' || echo '$(srcdir)/'`sis496.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sis496.Tpo $(DEPDIR)/pcem-sis496.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sis496.c' object='pcem-sis496.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sis496.o `test -f 'sis496.c' || echo '$(srcdir)/'`sis496.c - -pcem-sis496.obj: sis496.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sis496.obj -MD -MP -MF $(DEPDIR)/pcem-sis496.Tpo -c -o pcem-sis496.obj `if test -f 'sis496.c'; then $(CYGPATH_W) 'sis496.c'; else $(CYGPATH_W) '$(srcdir)/sis496.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sis496.Tpo $(DEPDIR)/pcem-sis496.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sis496.c' object='pcem-sis496.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sis496.obj `if test -f 'sis496.c'; then $(CYGPATH_W) 'sis496.c'; else $(CYGPATH_W) '$(srcdir)/sis496.c'; fi` - -pcem-sound.o: sound.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound.o -MD -MP -MF $(DEPDIR)/pcem-sound.Tpo -c -o pcem-sound.o `test -f 'sound.c' || echo '$(srcdir)/'`sound.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound.Tpo $(DEPDIR)/pcem-sound.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound.c' object='pcem-sound.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound.o `test -f 'sound.c' || echo '$(srcdir)/'`sound.c - -pcem-sound.obj: sound.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound.obj -MD -MP -MF $(DEPDIR)/pcem-sound.Tpo -c -o pcem-sound.obj `if test -f 'sound.c'; then $(CYGPATH_W) 'sound.c'; else $(CYGPATH_W) '$(srcdir)/sound.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound.Tpo $(DEPDIR)/pcem-sound.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound.c' object='pcem-sound.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound.obj `if test -f 'sound.c'; then $(CYGPATH_W) 'sound.c'; else $(CYGPATH_W) '$(srcdir)/sound.c'; fi` - -pcem-sound_ad1848.o: sound_ad1848.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound_ad1848.o -MD -MP -MF $(DEPDIR)/pcem-sound_ad1848.Tpo -c -o pcem-sound_ad1848.o `test -f 'sound_ad1848.c' || echo '$(srcdir)/'`sound_ad1848.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound_ad1848.Tpo $(DEPDIR)/pcem-sound_ad1848.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound_ad1848.c' object='pcem-sound_ad1848.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound_ad1848.o `test -f 'sound_ad1848.c' || echo '$(srcdir)/'`sound_ad1848.c - -pcem-sound_ad1848.obj: sound_ad1848.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound_ad1848.obj -MD -MP -MF $(DEPDIR)/pcem-sound_ad1848.Tpo -c -o pcem-sound_ad1848.obj `if test -f 'sound_ad1848.c'; then $(CYGPATH_W) 'sound_ad1848.c'; else $(CYGPATH_W) '$(srcdir)/sound_ad1848.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound_ad1848.Tpo $(DEPDIR)/pcem-sound_ad1848.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound_ad1848.c' object='pcem-sound_ad1848.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound_ad1848.obj `if test -f 'sound_ad1848.c'; then $(CYGPATH_W) 'sound_ad1848.c'; else $(CYGPATH_W) '$(srcdir)/sound_ad1848.c'; fi` - -pcem-sound_adlib.o: sound_adlib.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound_adlib.o -MD -MP -MF $(DEPDIR)/pcem-sound_adlib.Tpo -c -o pcem-sound_adlib.o `test -f 'sound_adlib.c' || echo '$(srcdir)/'`sound_adlib.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound_adlib.Tpo $(DEPDIR)/pcem-sound_adlib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound_adlib.c' object='pcem-sound_adlib.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound_adlib.o `test -f 'sound_adlib.c' || echo '$(srcdir)/'`sound_adlib.c - -pcem-sound_adlib.obj: sound_adlib.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound_adlib.obj -MD -MP -MF $(DEPDIR)/pcem-sound_adlib.Tpo -c -o pcem-sound_adlib.obj `if test -f 'sound_adlib.c'; then $(CYGPATH_W) 'sound_adlib.c'; else $(CYGPATH_W) '$(srcdir)/sound_adlib.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound_adlib.Tpo $(DEPDIR)/pcem-sound_adlib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound_adlib.c' object='pcem-sound_adlib.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound_adlib.obj `if test -f 'sound_adlib.c'; then $(CYGPATH_W) 'sound_adlib.c'; else $(CYGPATH_W) '$(srcdir)/sound_adlib.c'; fi` - -pcem-sound_adlibgold.o: sound_adlibgold.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound_adlibgold.o -MD -MP -MF $(DEPDIR)/pcem-sound_adlibgold.Tpo -c -o pcem-sound_adlibgold.o `test -f 'sound_adlibgold.c' || echo '$(srcdir)/'`sound_adlibgold.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound_adlibgold.Tpo $(DEPDIR)/pcem-sound_adlibgold.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound_adlibgold.c' object='pcem-sound_adlibgold.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound_adlibgold.o `test -f 'sound_adlibgold.c' || echo '$(srcdir)/'`sound_adlibgold.c - -pcem-sound_adlibgold.obj: sound_adlibgold.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound_adlibgold.obj -MD -MP -MF $(DEPDIR)/pcem-sound_adlibgold.Tpo -c -o pcem-sound_adlibgold.obj `if test -f 'sound_adlibgold.c'; then $(CYGPATH_W) 'sound_adlibgold.c'; else $(CYGPATH_W) '$(srcdir)/sound_adlibgold.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound_adlibgold.Tpo $(DEPDIR)/pcem-sound_adlibgold.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound_adlibgold.c' object='pcem-sound_adlibgold.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound_adlibgold.obj `if test -f 'sound_adlibgold.c'; then $(CYGPATH_W) 'sound_adlibgold.c'; else $(CYGPATH_W) '$(srcdir)/sound_adlibgold.c'; fi` - -pcem-sound_cms.o: sound_cms.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound_cms.o -MD -MP -MF $(DEPDIR)/pcem-sound_cms.Tpo -c -o pcem-sound_cms.o `test -f 'sound_cms.c' || echo '$(srcdir)/'`sound_cms.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound_cms.Tpo $(DEPDIR)/pcem-sound_cms.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound_cms.c' object='pcem-sound_cms.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound_cms.o `test -f 'sound_cms.c' || echo '$(srcdir)/'`sound_cms.c - -pcem-sound_cms.obj: sound_cms.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound_cms.obj -MD -MP -MF $(DEPDIR)/pcem-sound_cms.Tpo -c -o pcem-sound_cms.obj `if test -f 'sound_cms.c'; then $(CYGPATH_W) 'sound_cms.c'; else $(CYGPATH_W) '$(srcdir)/sound_cms.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound_cms.Tpo $(DEPDIR)/pcem-sound_cms.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound_cms.c' object='pcem-sound_cms.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound_cms.obj `if test -f 'sound_cms.c'; then $(CYGPATH_W) 'sound_cms.c'; else $(CYGPATH_W) '$(srcdir)/sound_cms.c'; fi` - -pcem-sound_emu8k.o: sound_emu8k.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound_emu8k.o -MD -MP -MF $(DEPDIR)/pcem-sound_emu8k.Tpo -c -o pcem-sound_emu8k.o `test -f 'sound_emu8k.c' || echo '$(srcdir)/'`sound_emu8k.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound_emu8k.Tpo $(DEPDIR)/pcem-sound_emu8k.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound_emu8k.c' object='pcem-sound_emu8k.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound_emu8k.o `test -f 'sound_emu8k.c' || echo '$(srcdir)/'`sound_emu8k.c - -pcem-sound_emu8k.obj: sound_emu8k.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound_emu8k.obj -MD -MP -MF $(DEPDIR)/pcem-sound_emu8k.Tpo -c -o pcem-sound_emu8k.obj `if test -f 'sound_emu8k.c'; then $(CYGPATH_W) 'sound_emu8k.c'; else $(CYGPATH_W) '$(srcdir)/sound_emu8k.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound_emu8k.Tpo $(DEPDIR)/pcem-sound_emu8k.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound_emu8k.c' object='pcem-sound_emu8k.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound_emu8k.obj `if test -f 'sound_emu8k.c'; then $(CYGPATH_W) 'sound_emu8k.c'; else $(CYGPATH_W) '$(srcdir)/sound_emu8k.c'; fi` - -pcem-sound_gus.o: sound_gus.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound_gus.o -MD -MP -MF $(DEPDIR)/pcem-sound_gus.Tpo -c -o pcem-sound_gus.o `test -f 'sound_gus.c' || echo '$(srcdir)/'`sound_gus.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound_gus.Tpo $(DEPDIR)/pcem-sound_gus.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound_gus.c' object='pcem-sound_gus.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound_gus.o `test -f 'sound_gus.c' || echo '$(srcdir)/'`sound_gus.c - -pcem-sound_gus.obj: sound_gus.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound_gus.obj -MD -MP -MF $(DEPDIR)/pcem-sound_gus.Tpo -c -o pcem-sound_gus.obj `if test -f 'sound_gus.c'; then $(CYGPATH_W) 'sound_gus.c'; else $(CYGPATH_W) '$(srcdir)/sound_gus.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound_gus.Tpo $(DEPDIR)/pcem-sound_gus.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound_gus.c' object='pcem-sound_gus.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound_gus.obj `if test -f 'sound_gus.c'; then $(CYGPATH_W) 'sound_gus.c'; else $(CYGPATH_W) '$(srcdir)/sound_gus.c'; fi` - -pcem-sound_mpu401_uart.o: sound_mpu401_uart.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound_mpu401_uart.o -MD -MP -MF $(DEPDIR)/pcem-sound_mpu401_uart.Tpo -c -o pcem-sound_mpu401_uart.o `test -f 'sound_mpu401_uart.c' || echo '$(srcdir)/'`sound_mpu401_uart.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound_mpu401_uart.Tpo $(DEPDIR)/pcem-sound_mpu401_uart.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound_mpu401_uart.c' object='pcem-sound_mpu401_uart.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound_mpu401_uart.o `test -f 'sound_mpu401_uart.c' || echo '$(srcdir)/'`sound_mpu401_uart.c - -pcem-sound_mpu401_uart.obj: sound_mpu401_uart.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound_mpu401_uart.obj -MD -MP -MF $(DEPDIR)/pcem-sound_mpu401_uart.Tpo -c -o pcem-sound_mpu401_uart.obj `if test -f 'sound_mpu401_uart.c'; then $(CYGPATH_W) 'sound_mpu401_uart.c'; else $(CYGPATH_W) '$(srcdir)/sound_mpu401_uart.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound_mpu401_uart.Tpo $(DEPDIR)/pcem-sound_mpu401_uart.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound_mpu401_uart.c' object='pcem-sound_mpu401_uart.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound_mpu401_uart.obj `if test -f 'sound_mpu401_uart.c'; then $(CYGPATH_W) 'sound_mpu401_uart.c'; else $(CYGPATH_W) '$(srcdir)/sound_mpu401_uart.c'; fi` - -pcem-sound_opl.o: sound_opl.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound_opl.o -MD -MP -MF $(DEPDIR)/pcem-sound_opl.Tpo -c -o pcem-sound_opl.o `test -f 'sound_opl.c' || echo '$(srcdir)/'`sound_opl.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound_opl.Tpo $(DEPDIR)/pcem-sound_opl.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound_opl.c' object='pcem-sound_opl.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound_opl.o `test -f 'sound_opl.c' || echo '$(srcdir)/'`sound_opl.c - -pcem-sound_opl.obj: sound_opl.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound_opl.obj -MD -MP -MF $(DEPDIR)/pcem-sound_opl.Tpo -c -o pcem-sound_opl.obj `if test -f 'sound_opl.c'; then $(CYGPATH_W) 'sound_opl.c'; else $(CYGPATH_W) '$(srcdir)/sound_opl.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound_opl.Tpo $(DEPDIR)/pcem-sound_opl.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound_opl.c' object='pcem-sound_opl.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound_opl.obj `if test -f 'sound_opl.c'; then $(CYGPATH_W) 'sound_opl.c'; else $(CYGPATH_W) '$(srcdir)/sound_opl.c'; fi` - -pcem-sound_pas16.o: sound_pas16.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound_pas16.o -MD -MP -MF $(DEPDIR)/pcem-sound_pas16.Tpo -c -o pcem-sound_pas16.o `test -f 'sound_pas16.c' || echo '$(srcdir)/'`sound_pas16.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound_pas16.Tpo $(DEPDIR)/pcem-sound_pas16.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound_pas16.c' object='pcem-sound_pas16.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound_pas16.o `test -f 'sound_pas16.c' || echo '$(srcdir)/'`sound_pas16.c - -pcem-sound_pas16.obj: sound_pas16.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound_pas16.obj -MD -MP -MF $(DEPDIR)/pcem-sound_pas16.Tpo -c -o pcem-sound_pas16.obj `if test -f 'sound_pas16.c'; then $(CYGPATH_W) 'sound_pas16.c'; else $(CYGPATH_W) '$(srcdir)/sound_pas16.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound_pas16.Tpo $(DEPDIR)/pcem-sound_pas16.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound_pas16.c' object='pcem-sound_pas16.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound_pas16.obj `if test -f 'sound_pas16.c'; then $(CYGPATH_W) 'sound_pas16.c'; else $(CYGPATH_W) '$(srcdir)/sound_pas16.c'; fi` - -pcem-sound_sb.o: sound_sb.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound_sb.o -MD -MP -MF $(DEPDIR)/pcem-sound_sb.Tpo -c -o pcem-sound_sb.o `test -f 'sound_sb.c' || echo '$(srcdir)/'`sound_sb.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound_sb.Tpo $(DEPDIR)/pcem-sound_sb.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound_sb.c' object='pcem-sound_sb.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound_sb.o `test -f 'sound_sb.c' || echo '$(srcdir)/'`sound_sb.c - -pcem-sound_sb.obj: sound_sb.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound_sb.obj -MD -MP -MF $(DEPDIR)/pcem-sound_sb.Tpo -c -o pcem-sound_sb.obj `if test -f 'sound_sb.c'; then $(CYGPATH_W) 'sound_sb.c'; else $(CYGPATH_W) '$(srcdir)/sound_sb.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound_sb.Tpo $(DEPDIR)/pcem-sound_sb.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound_sb.c' object='pcem-sound_sb.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound_sb.obj `if test -f 'sound_sb.c'; then $(CYGPATH_W) 'sound_sb.c'; else $(CYGPATH_W) '$(srcdir)/sound_sb.c'; fi` - -pcem-sound_sb_dsp.o: sound_sb_dsp.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound_sb_dsp.o -MD -MP -MF $(DEPDIR)/pcem-sound_sb_dsp.Tpo -c -o pcem-sound_sb_dsp.o `test -f 'sound_sb_dsp.c' || echo '$(srcdir)/'`sound_sb_dsp.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound_sb_dsp.Tpo $(DEPDIR)/pcem-sound_sb_dsp.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound_sb_dsp.c' object='pcem-sound_sb_dsp.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound_sb_dsp.o `test -f 'sound_sb_dsp.c' || echo '$(srcdir)/'`sound_sb_dsp.c - -pcem-sound_sb_dsp.obj: sound_sb_dsp.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound_sb_dsp.obj -MD -MP -MF $(DEPDIR)/pcem-sound_sb_dsp.Tpo -c -o pcem-sound_sb_dsp.obj `if test -f 'sound_sb_dsp.c'; then $(CYGPATH_W) 'sound_sb_dsp.c'; else $(CYGPATH_W) '$(srcdir)/sound_sb_dsp.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound_sb_dsp.Tpo $(DEPDIR)/pcem-sound_sb_dsp.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound_sb_dsp.c' object='pcem-sound_sb_dsp.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound_sb_dsp.obj `if test -f 'sound_sb_dsp.c'; then $(CYGPATH_W) 'sound_sb_dsp.c'; else $(CYGPATH_W) '$(srcdir)/sound_sb_dsp.c'; fi` - -pcem-sound_sn76489.o: sound_sn76489.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound_sn76489.o -MD -MP -MF $(DEPDIR)/pcem-sound_sn76489.Tpo -c -o pcem-sound_sn76489.o `test -f 'sound_sn76489.c' || echo '$(srcdir)/'`sound_sn76489.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound_sn76489.Tpo $(DEPDIR)/pcem-sound_sn76489.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound_sn76489.c' object='pcem-sound_sn76489.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound_sn76489.o `test -f 'sound_sn76489.c' || echo '$(srcdir)/'`sound_sn76489.c - -pcem-sound_sn76489.obj: sound_sn76489.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound_sn76489.obj -MD -MP -MF $(DEPDIR)/pcem-sound_sn76489.Tpo -c -o pcem-sound_sn76489.obj `if test -f 'sound_sn76489.c'; then $(CYGPATH_W) 'sound_sn76489.c'; else $(CYGPATH_W) '$(srcdir)/sound_sn76489.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound_sn76489.Tpo $(DEPDIR)/pcem-sound_sn76489.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound_sn76489.c' object='pcem-sound_sn76489.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound_sn76489.obj `if test -f 'sound_sn76489.c'; then $(CYGPATH_W) 'sound_sn76489.c'; else $(CYGPATH_W) '$(srcdir)/sound_sn76489.c'; fi` - -pcem-sound_speaker.o: sound_speaker.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound_speaker.o -MD -MP -MF $(DEPDIR)/pcem-sound_speaker.Tpo -c -o pcem-sound_speaker.o `test -f 'sound_speaker.c' || echo '$(srcdir)/'`sound_speaker.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound_speaker.Tpo $(DEPDIR)/pcem-sound_speaker.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound_speaker.c' object='pcem-sound_speaker.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound_speaker.o `test -f 'sound_speaker.c' || echo '$(srcdir)/'`sound_speaker.c - -pcem-sound_speaker.obj: sound_speaker.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound_speaker.obj -MD -MP -MF $(DEPDIR)/pcem-sound_speaker.Tpo -c -o pcem-sound_speaker.obj `if test -f 'sound_speaker.c'; then $(CYGPATH_W) 'sound_speaker.c'; else $(CYGPATH_W) '$(srcdir)/sound_speaker.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound_speaker.Tpo $(DEPDIR)/pcem-sound_speaker.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound_speaker.c' object='pcem-sound_speaker.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound_speaker.obj `if test -f 'sound_speaker.c'; then $(CYGPATH_W) 'sound_speaker.c'; else $(CYGPATH_W) '$(srcdir)/sound_speaker.c'; fi` - -pcem-sound_ssi2001.o: sound_ssi2001.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound_ssi2001.o -MD -MP -MF $(DEPDIR)/pcem-sound_ssi2001.Tpo -c -o pcem-sound_ssi2001.o `test -f 'sound_ssi2001.c' || echo '$(srcdir)/'`sound_ssi2001.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound_ssi2001.Tpo $(DEPDIR)/pcem-sound_ssi2001.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound_ssi2001.c' object='pcem-sound_ssi2001.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound_ssi2001.o `test -f 'sound_ssi2001.c' || echo '$(srcdir)/'`sound_ssi2001.c - -pcem-sound_ssi2001.obj: sound_ssi2001.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound_ssi2001.obj -MD -MP -MF $(DEPDIR)/pcem-sound_ssi2001.Tpo -c -o pcem-sound_ssi2001.obj `if test -f 'sound_ssi2001.c'; then $(CYGPATH_W) 'sound_ssi2001.c'; else $(CYGPATH_W) '$(srcdir)/sound_ssi2001.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound_ssi2001.Tpo $(DEPDIR)/pcem-sound_ssi2001.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound_ssi2001.c' object='pcem-sound_ssi2001.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound_ssi2001.obj `if test -f 'sound_ssi2001.c'; then $(CYGPATH_W) 'sound_ssi2001.c'; else $(CYGPATH_W) '$(srcdir)/sound_ssi2001.c'; fi` - -pcem-sound_wss.o: sound_wss.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound_wss.o -MD -MP -MF $(DEPDIR)/pcem-sound_wss.Tpo -c -o pcem-sound_wss.o `test -f 'sound_wss.c' || echo '$(srcdir)/'`sound_wss.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound_wss.Tpo $(DEPDIR)/pcem-sound_wss.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound_wss.c' object='pcem-sound_wss.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound_wss.o `test -f 'sound_wss.c' || echo '$(srcdir)/'`sound_wss.c - -pcem-sound_wss.obj: sound_wss.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-sound_wss.obj -MD -MP -MF $(DEPDIR)/pcem-sound_wss.Tpo -c -o pcem-sound_wss.obj `if test -f 'sound_wss.c'; then $(CYGPATH_W) 'sound_wss.c'; else $(CYGPATH_W) '$(srcdir)/sound_wss.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-sound_wss.Tpo $(DEPDIR)/pcem-sound_wss.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound_wss.c' object='pcem-sound_wss.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-sound_wss.obj `if test -f 'sound_wss.c'; then $(CYGPATH_W) 'sound_wss.c'; else $(CYGPATH_W) '$(srcdir)/sound_wss.c'; fi` - -pcem-soundopenal.o: soundopenal.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-soundopenal.o -MD -MP -MF $(DEPDIR)/pcem-soundopenal.Tpo -c -o pcem-soundopenal.o `test -f 'soundopenal.c' || echo '$(srcdir)/'`soundopenal.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-soundopenal.Tpo $(DEPDIR)/pcem-soundopenal.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='soundopenal.c' object='pcem-soundopenal.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-soundopenal.o `test -f 'soundopenal.c' || echo '$(srcdir)/'`soundopenal.c - -pcem-soundopenal.obj: soundopenal.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-soundopenal.obj -MD -MP -MF $(DEPDIR)/pcem-soundopenal.Tpo -c -o pcem-soundopenal.obj `if test -f 'soundopenal.c'; then $(CYGPATH_W) 'soundopenal.c'; else $(CYGPATH_W) '$(srcdir)/soundopenal.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-soundopenal.Tpo $(DEPDIR)/pcem-soundopenal.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='soundopenal.c' object='pcem-soundopenal.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-soundopenal.obj `if test -f 'soundopenal.c'; then $(CYGPATH_W) 'soundopenal.c'; else $(CYGPATH_W) '$(srcdir)/soundopenal.c'; fi` - -pcem-thread-pthread.o: thread-pthread.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-thread-pthread.o -MD -MP -MF $(DEPDIR)/pcem-thread-pthread.Tpo -c -o pcem-thread-pthread.o `test -f 'thread-pthread.c' || echo '$(srcdir)/'`thread-pthread.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-thread-pthread.Tpo $(DEPDIR)/pcem-thread-pthread.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='thread-pthread.c' object='pcem-thread-pthread.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-thread-pthread.o `test -f 'thread-pthread.c' || echo '$(srcdir)/'`thread-pthread.c - -pcem-thread-pthread.obj: thread-pthread.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-thread-pthread.obj -MD -MP -MF $(DEPDIR)/pcem-thread-pthread.Tpo -c -o pcem-thread-pthread.obj `if test -f 'thread-pthread.c'; then $(CYGPATH_W) 'thread-pthread.c'; else $(CYGPATH_W) '$(srcdir)/thread-pthread.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-thread-pthread.Tpo $(DEPDIR)/pcem-thread-pthread.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='thread-pthread.c' object='pcem-thread-pthread.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-thread-pthread.obj `if test -f 'thread-pthread.c'; then $(CYGPATH_W) 'thread-pthread.c'; else $(CYGPATH_W) '$(srcdir)/thread-pthread.c'; fi` - -pcem-timer.o: timer.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-timer.o -MD -MP -MF $(DEPDIR)/pcem-timer.Tpo -c -o pcem-timer.o `test -f 'timer.c' || echo '$(srcdir)/'`timer.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-timer.Tpo $(DEPDIR)/pcem-timer.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='timer.c' object='pcem-timer.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-timer.o `test -f 'timer.c' || echo '$(srcdir)/'`timer.c - -pcem-timer.obj: timer.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-timer.obj -MD -MP -MF $(DEPDIR)/pcem-timer.Tpo -c -o pcem-timer.obj `if test -f 'timer.c'; then $(CYGPATH_W) 'timer.c'; else $(CYGPATH_W) '$(srcdir)/timer.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-timer.Tpo $(DEPDIR)/pcem-timer.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='timer.c' object='pcem-timer.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-timer.obj `if test -f 'timer.c'; then $(CYGPATH_W) 'timer.c'; else $(CYGPATH_W) '$(srcdir)/timer.c'; fi` - -pcem-um8669f.o: um8669f.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-um8669f.o -MD -MP -MF $(DEPDIR)/pcem-um8669f.Tpo -c -o pcem-um8669f.o `test -f 'um8669f.c' || echo '$(srcdir)/'`um8669f.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-um8669f.Tpo $(DEPDIR)/pcem-um8669f.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um8669f.c' object='pcem-um8669f.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-um8669f.o `test -f 'um8669f.c' || echo '$(srcdir)/'`um8669f.c - -pcem-um8669f.obj: um8669f.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-um8669f.obj -MD -MP -MF $(DEPDIR)/pcem-um8669f.Tpo -c -o pcem-um8669f.obj `if test -f 'um8669f.c'; then $(CYGPATH_W) 'um8669f.c'; else $(CYGPATH_W) '$(srcdir)/um8669f.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-um8669f.Tpo $(DEPDIR)/pcem-um8669f.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um8669f.c' object='pcem-um8669f.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-um8669f.obj `if test -f 'um8669f.c'; then $(CYGPATH_W) 'um8669f.c'; else $(CYGPATH_W) '$(srcdir)/um8669f.c'; fi` - -pcem-um8881f.o: um8881f.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-um8881f.o -MD -MP -MF $(DEPDIR)/pcem-um8881f.Tpo -c -o pcem-um8881f.o `test -f 'um8881f.c' || echo '$(srcdir)/'`um8881f.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-um8881f.Tpo $(DEPDIR)/pcem-um8881f.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um8881f.c' object='pcem-um8881f.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-um8881f.o `test -f 'um8881f.c' || echo '$(srcdir)/'`um8881f.c - -pcem-um8881f.obj: um8881f.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-um8881f.obj -MD -MP -MF $(DEPDIR)/pcem-um8881f.Tpo -c -o pcem-um8881f.obj `if test -f 'um8881f.c'; then $(CYGPATH_W) 'um8881f.c'; else $(CYGPATH_W) '$(srcdir)/um8881f.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-um8881f.Tpo $(DEPDIR)/pcem-um8881f.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='um8881f.c' object='pcem-um8881f.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-um8881f.obj `if test -f 'um8881f.c'; then $(CYGPATH_W) 'um8881f.c'; else $(CYGPATH_W) '$(srcdir)/um8881f.c'; fi` - -pcem-vid_ati_eeprom.o: vid_ati_eeprom.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_ati_eeprom.o -MD -MP -MF $(DEPDIR)/pcem-vid_ati_eeprom.Tpo -c -o pcem-vid_ati_eeprom.o `test -f 'vid_ati_eeprom.c' || echo '$(srcdir)/'`vid_ati_eeprom.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_ati_eeprom.Tpo $(DEPDIR)/pcem-vid_ati_eeprom.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_ati_eeprom.c' object='pcem-vid_ati_eeprom.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_ati_eeprom.o `test -f 'vid_ati_eeprom.c' || echo '$(srcdir)/'`vid_ati_eeprom.c - -pcem-vid_ati_eeprom.obj: vid_ati_eeprom.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_ati_eeprom.obj -MD -MP -MF $(DEPDIR)/pcem-vid_ati_eeprom.Tpo -c -o pcem-vid_ati_eeprom.obj `if test -f 'vid_ati_eeprom.c'; then $(CYGPATH_W) 'vid_ati_eeprom.c'; else $(CYGPATH_W) '$(srcdir)/vid_ati_eeprom.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_ati_eeprom.Tpo $(DEPDIR)/pcem-vid_ati_eeprom.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_ati_eeprom.c' object='pcem-vid_ati_eeprom.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_ati_eeprom.obj `if test -f 'vid_ati_eeprom.c'; then $(CYGPATH_W) 'vid_ati_eeprom.c'; else $(CYGPATH_W) '$(srcdir)/vid_ati_eeprom.c'; fi` - -pcem-vid_ati_mach64.o: vid_ati_mach64.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_ati_mach64.o -MD -MP -MF $(DEPDIR)/pcem-vid_ati_mach64.Tpo -c -o pcem-vid_ati_mach64.o `test -f 'vid_ati_mach64.c' || echo '$(srcdir)/'`vid_ati_mach64.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_ati_mach64.Tpo $(DEPDIR)/pcem-vid_ati_mach64.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_ati_mach64.c' object='pcem-vid_ati_mach64.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_ati_mach64.o `test -f 'vid_ati_mach64.c' || echo '$(srcdir)/'`vid_ati_mach64.c - -pcem-vid_ati_mach64.obj: vid_ati_mach64.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_ati_mach64.obj -MD -MP -MF $(DEPDIR)/pcem-vid_ati_mach64.Tpo -c -o pcem-vid_ati_mach64.obj `if test -f 'vid_ati_mach64.c'; then $(CYGPATH_W) 'vid_ati_mach64.c'; else $(CYGPATH_W) '$(srcdir)/vid_ati_mach64.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_ati_mach64.Tpo $(DEPDIR)/pcem-vid_ati_mach64.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_ati_mach64.c' object='pcem-vid_ati_mach64.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_ati_mach64.obj `if test -f 'vid_ati_mach64.c'; then $(CYGPATH_W) 'vid_ati_mach64.c'; else $(CYGPATH_W) '$(srcdir)/vid_ati_mach64.c'; fi` - -pcem-vid_ati18800.o: vid_ati18800.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_ati18800.o -MD -MP -MF $(DEPDIR)/pcem-vid_ati18800.Tpo -c -o pcem-vid_ati18800.o `test -f 'vid_ati18800.c' || echo '$(srcdir)/'`vid_ati18800.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_ati18800.Tpo $(DEPDIR)/pcem-vid_ati18800.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_ati18800.c' object='pcem-vid_ati18800.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_ati18800.o `test -f 'vid_ati18800.c' || echo '$(srcdir)/'`vid_ati18800.c - -pcem-vid_ati18800.obj: vid_ati18800.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_ati18800.obj -MD -MP -MF $(DEPDIR)/pcem-vid_ati18800.Tpo -c -o pcem-vid_ati18800.obj `if test -f 'vid_ati18800.c'; then $(CYGPATH_W) 'vid_ati18800.c'; else $(CYGPATH_W) '$(srcdir)/vid_ati18800.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_ati18800.Tpo $(DEPDIR)/pcem-vid_ati18800.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_ati18800.c' object='pcem-vid_ati18800.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_ati18800.obj `if test -f 'vid_ati18800.c'; then $(CYGPATH_W) 'vid_ati18800.c'; else $(CYGPATH_W) '$(srcdir)/vid_ati18800.c'; fi` - -pcem-vid_ati28800.o: vid_ati28800.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_ati28800.o -MD -MP -MF $(DEPDIR)/pcem-vid_ati28800.Tpo -c -o pcem-vid_ati28800.o `test -f 'vid_ati28800.c' || echo '$(srcdir)/'`vid_ati28800.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_ati28800.Tpo $(DEPDIR)/pcem-vid_ati28800.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_ati28800.c' object='pcem-vid_ati28800.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_ati28800.o `test -f 'vid_ati28800.c' || echo '$(srcdir)/'`vid_ati28800.c - -pcem-vid_ati28800.obj: vid_ati28800.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_ati28800.obj -MD -MP -MF $(DEPDIR)/pcem-vid_ati28800.Tpo -c -o pcem-vid_ati28800.obj `if test -f 'vid_ati28800.c'; then $(CYGPATH_W) 'vid_ati28800.c'; else $(CYGPATH_W) '$(srcdir)/vid_ati28800.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_ati28800.Tpo $(DEPDIR)/pcem-vid_ati28800.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_ati28800.c' object='pcem-vid_ati28800.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_ati28800.obj `if test -f 'vid_ati28800.c'; then $(CYGPATH_W) 'vid_ati28800.c'; else $(CYGPATH_W) '$(srcdir)/vid_ati28800.c'; fi` - -pcem-vid_ati68860_ramdac.o: vid_ati68860_ramdac.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_ati68860_ramdac.o -MD -MP -MF $(DEPDIR)/pcem-vid_ati68860_ramdac.Tpo -c -o pcem-vid_ati68860_ramdac.o `test -f 'vid_ati68860_ramdac.c' || echo '$(srcdir)/'`vid_ati68860_ramdac.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_ati68860_ramdac.Tpo $(DEPDIR)/pcem-vid_ati68860_ramdac.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_ati68860_ramdac.c' object='pcem-vid_ati68860_ramdac.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_ati68860_ramdac.o `test -f 'vid_ati68860_ramdac.c' || echo '$(srcdir)/'`vid_ati68860_ramdac.c - -pcem-vid_ati68860_ramdac.obj: vid_ati68860_ramdac.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_ati68860_ramdac.obj -MD -MP -MF $(DEPDIR)/pcem-vid_ati68860_ramdac.Tpo -c -o pcem-vid_ati68860_ramdac.obj `if test -f 'vid_ati68860_ramdac.c'; then $(CYGPATH_W) 'vid_ati68860_ramdac.c'; else $(CYGPATH_W) '$(srcdir)/vid_ati68860_ramdac.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_ati68860_ramdac.Tpo $(DEPDIR)/pcem-vid_ati68860_ramdac.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_ati68860_ramdac.c' object='pcem-vid_ati68860_ramdac.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_ati68860_ramdac.obj `if test -f 'vid_ati68860_ramdac.c'; then $(CYGPATH_W) 'vid_ati68860_ramdac.c'; else $(CYGPATH_W) '$(srcdir)/vid_ati68860_ramdac.c'; fi` - -pcem-vid_cga.o: vid_cga.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_cga.o -MD -MP -MF $(DEPDIR)/pcem-vid_cga.Tpo -c -o pcem-vid_cga.o `test -f 'vid_cga.c' || echo '$(srcdir)/'`vid_cga.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_cga.Tpo $(DEPDIR)/pcem-vid_cga.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_cga.c' object='pcem-vid_cga.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_cga.o `test -f 'vid_cga.c' || echo '$(srcdir)/'`vid_cga.c - -pcem-vid_cga.obj: vid_cga.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_cga.obj -MD -MP -MF $(DEPDIR)/pcem-vid_cga.Tpo -c -o pcem-vid_cga.obj `if test -f 'vid_cga.c'; then $(CYGPATH_W) 'vid_cga.c'; else $(CYGPATH_W) '$(srcdir)/vid_cga.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_cga.Tpo $(DEPDIR)/pcem-vid_cga.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_cga.c' object='pcem-vid_cga.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_cga.obj `if test -f 'vid_cga.c'; then $(CYGPATH_W) 'vid_cga.c'; else $(CYGPATH_W) '$(srcdir)/vid_cga.c'; fi` - -pcem-vid_cl5429.o: vid_cl5429.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_cl5429.o -MD -MP -MF $(DEPDIR)/pcem-vid_cl5429.Tpo -c -o pcem-vid_cl5429.o `test -f 'vid_cl5429.c' || echo '$(srcdir)/'`vid_cl5429.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_cl5429.Tpo $(DEPDIR)/pcem-vid_cl5429.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_cl5429.c' object='pcem-vid_cl5429.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_cl5429.o `test -f 'vid_cl5429.c' || echo '$(srcdir)/'`vid_cl5429.c - -pcem-vid_cl5429.obj: vid_cl5429.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_cl5429.obj -MD -MP -MF $(DEPDIR)/pcem-vid_cl5429.Tpo -c -o pcem-vid_cl5429.obj `if test -f 'vid_cl5429.c'; then $(CYGPATH_W) 'vid_cl5429.c'; else $(CYGPATH_W) '$(srcdir)/vid_cl5429.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_cl5429.Tpo $(DEPDIR)/pcem-vid_cl5429.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_cl5429.c' object='pcem-vid_cl5429.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_cl5429.obj `if test -f 'vid_cl5429.c'; then $(CYGPATH_W) 'vid_cl5429.c'; else $(CYGPATH_W) '$(srcdir)/vid_cl5429.c'; fi` - -pcem-vid_ega.o: vid_ega.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_ega.o -MD -MP -MF $(DEPDIR)/pcem-vid_ega.Tpo -c -o pcem-vid_ega.o `test -f 'vid_ega.c' || echo '$(srcdir)/'`vid_ega.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_ega.Tpo $(DEPDIR)/pcem-vid_ega.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_ega.c' object='pcem-vid_ega.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_ega.o `test -f 'vid_ega.c' || echo '$(srcdir)/'`vid_ega.c - -pcem-vid_ega.obj: vid_ega.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_ega.obj -MD -MP -MF $(DEPDIR)/pcem-vid_ega.Tpo -c -o pcem-vid_ega.obj `if test -f 'vid_ega.c'; then $(CYGPATH_W) 'vid_ega.c'; else $(CYGPATH_W) '$(srcdir)/vid_ega.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_ega.Tpo $(DEPDIR)/pcem-vid_ega.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_ega.c' object='pcem-vid_ega.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_ega.obj `if test -f 'vid_ega.c'; then $(CYGPATH_W) 'vid_ega.c'; else $(CYGPATH_W) '$(srcdir)/vid_ega.c'; fi` - -pcem-vid_et4000.o: vid_et4000.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_et4000.o -MD -MP -MF $(DEPDIR)/pcem-vid_et4000.Tpo -c -o pcem-vid_et4000.o `test -f 'vid_et4000.c' || echo '$(srcdir)/'`vid_et4000.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_et4000.Tpo $(DEPDIR)/pcem-vid_et4000.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_et4000.c' object='pcem-vid_et4000.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_et4000.o `test -f 'vid_et4000.c' || echo '$(srcdir)/'`vid_et4000.c - -pcem-vid_et4000.obj: vid_et4000.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_et4000.obj -MD -MP -MF $(DEPDIR)/pcem-vid_et4000.Tpo -c -o pcem-vid_et4000.obj `if test -f 'vid_et4000.c'; then $(CYGPATH_W) 'vid_et4000.c'; else $(CYGPATH_W) '$(srcdir)/vid_et4000.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_et4000.Tpo $(DEPDIR)/pcem-vid_et4000.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_et4000.c' object='pcem-vid_et4000.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_et4000.obj `if test -f 'vid_et4000.c'; then $(CYGPATH_W) 'vid_et4000.c'; else $(CYGPATH_W) '$(srcdir)/vid_et4000.c'; fi` - -pcem-vid_et4000w32.o: vid_et4000w32.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_et4000w32.o -MD -MP -MF $(DEPDIR)/pcem-vid_et4000w32.Tpo -c -o pcem-vid_et4000w32.o `test -f 'vid_et4000w32.c' || echo '$(srcdir)/'`vid_et4000w32.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_et4000w32.Tpo $(DEPDIR)/pcem-vid_et4000w32.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_et4000w32.c' object='pcem-vid_et4000w32.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_et4000w32.o `test -f 'vid_et4000w32.c' || echo '$(srcdir)/'`vid_et4000w32.c - -pcem-vid_et4000w32.obj: vid_et4000w32.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_et4000w32.obj -MD -MP -MF $(DEPDIR)/pcem-vid_et4000w32.Tpo -c -o pcem-vid_et4000w32.obj `if test -f 'vid_et4000w32.c'; then $(CYGPATH_W) 'vid_et4000w32.c'; else $(CYGPATH_W) '$(srcdir)/vid_et4000w32.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_et4000w32.Tpo $(DEPDIR)/pcem-vid_et4000w32.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_et4000w32.c' object='pcem-vid_et4000w32.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_et4000w32.obj `if test -f 'vid_et4000w32.c'; then $(CYGPATH_W) 'vid_et4000w32.c'; else $(CYGPATH_W) '$(srcdir)/vid_et4000w32.c'; fi` - -pcem-vid_hercules.o: vid_hercules.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_hercules.o -MD -MP -MF $(DEPDIR)/pcem-vid_hercules.Tpo -c -o pcem-vid_hercules.o `test -f 'vid_hercules.c' || echo '$(srcdir)/'`vid_hercules.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_hercules.Tpo $(DEPDIR)/pcem-vid_hercules.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_hercules.c' object='pcem-vid_hercules.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_hercules.o `test -f 'vid_hercules.c' || echo '$(srcdir)/'`vid_hercules.c - -pcem-vid_hercules.obj: vid_hercules.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_hercules.obj -MD -MP -MF $(DEPDIR)/pcem-vid_hercules.Tpo -c -o pcem-vid_hercules.obj `if test -f 'vid_hercules.c'; then $(CYGPATH_W) 'vid_hercules.c'; else $(CYGPATH_W) '$(srcdir)/vid_hercules.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_hercules.Tpo $(DEPDIR)/pcem-vid_hercules.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_hercules.c' object='pcem-vid_hercules.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_hercules.obj `if test -f 'vid_hercules.c'; then $(CYGPATH_W) 'vid_hercules.c'; else $(CYGPATH_W) '$(srcdir)/vid_hercules.c'; fi` - -pcem-vid_icd2061.o: vid_icd2061.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_icd2061.o -MD -MP -MF $(DEPDIR)/pcem-vid_icd2061.Tpo -c -o pcem-vid_icd2061.o `test -f 'vid_icd2061.c' || echo '$(srcdir)/'`vid_icd2061.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_icd2061.Tpo $(DEPDIR)/pcem-vid_icd2061.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_icd2061.c' object='pcem-vid_icd2061.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_icd2061.o `test -f 'vid_icd2061.c' || echo '$(srcdir)/'`vid_icd2061.c - -pcem-vid_icd2061.obj: vid_icd2061.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_icd2061.obj -MD -MP -MF $(DEPDIR)/pcem-vid_icd2061.Tpo -c -o pcem-vid_icd2061.obj `if test -f 'vid_icd2061.c'; then $(CYGPATH_W) 'vid_icd2061.c'; else $(CYGPATH_W) '$(srcdir)/vid_icd2061.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_icd2061.Tpo $(DEPDIR)/pcem-vid_icd2061.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_icd2061.c' object='pcem-vid_icd2061.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_icd2061.obj `if test -f 'vid_icd2061.c'; then $(CYGPATH_W) 'vid_icd2061.c'; else $(CYGPATH_W) '$(srcdir)/vid_icd2061.c'; fi` - -pcem-vid_ics2595.o: vid_ics2595.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_ics2595.o -MD -MP -MF $(DEPDIR)/pcem-vid_ics2595.Tpo -c -o pcem-vid_ics2595.o `test -f 'vid_ics2595.c' || echo '$(srcdir)/'`vid_ics2595.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_ics2595.Tpo $(DEPDIR)/pcem-vid_ics2595.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_ics2595.c' object='pcem-vid_ics2595.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_ics2595.o `test -f 'vid_ics2595.c' || echo '$(srcdir)/'`vid_ics2595.c - -pcem-vid_ics2595.obj: vid_ics2595.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_ics2595.obj -MD -MP -MF $(DEPDIR)/pcem-vid_ics2595.Tpo -c -o pcem-vid_ics2595.obj `if test -f 'vid_ics2595.c'; then $(CYGPATH_W) 'vid_ics2595.c'; else $(CYGPATH_W) '$(srcdir)/vid_ics2595.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_ics2595.Tpo $(DEPDIR)/pcem-vid_ics2595.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_ics2595.c' object='pcem-vid_ics2595.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_ics2595.obj `if test -f 'vid_ics2595.c'; then $(CYGPATH_W) 'vid_ics2595.c'; else $(CYGPATH_W) '$(srcdir)/vid_ics2595.c'; fi` - -pcem-vid_mda.o: vid_mda.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_mda.o -MD -MP -MF $(DEPDIR)/pcem-vid_mda.Tpo -c -o pcem-vid_mda.o `test -f 'vid_mda.c' || echo '$(srcdir)/'`vid_mda.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_mda.Tpo $(DEPDIR)/pcem-vid_mda.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_mda.c' object='pcem-vid_mda.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_mda.o `test -f 'vid_mda.c' || echo '$(srcdir)/'`vid_mda.c - -pcem-vid_mda.obj: vid_mda.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_mda.obj -MD -MP -MF $(DEPDIR)/pcem-vid_mda.Tpo -c -o pcem-vid_mda.obj `if test -f 'vid_mda.c'; then $(CYGPATH_W) 'vid_mda.c'; else $(CYGPATH_W) '$(srcdir)/vid_mda.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_mda.Tpo $(DEPDIR)/pcem-vid_mda.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_mda.c' object='pcem-vid_mda.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_mda.obj `if test -f 'vid_mda.c'; then $(CYGPATH_W) 'vid_mda.c'; else $(CYGPATH_W) '$(srcdir)/vid_mda.c'; fi` - -pcem-vid_olivetti_m24.o: vid_olivetti_m24.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_olivetti_m24.o -MD -MP -MF $(DEPDIR)/pcem-vid_olivetti_m24.Tpo -c -o pcem-vid_olivetti_m24.o `test -f 'vid_olivetti_m24.c' || echo '$(srcdir)/'`vid_olivetti_m24.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_olivetti_m24.Tpo $(DEPDIR)/pcem-vid_olivetti_m24.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_olivetti_m24.c' object='pcem-vid_olivetti_m24.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_olivetti_m24.o `test -f 'vid_olivetti_m24.c' || echo '$(srcdir)/'`vid_olivetti_m24.c - -pcem-vid_olivetti_m24.obj: vid_olivetti_m24.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_olivetti_m24.obj -MD -MP -MF $(DEPDIR)/pcem-vid_olivetti_m24.Tpo -c -o pcem-vid_olivetti_m24.obj `if test -f 'vid_olivetti_m24.c'; then $(CYGPATH_W) 'vid_olivetti_m24.c'; else $(CYGPATH_W) '$(srcdir)/vid_olivetti_m24.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_olivetti_m24.Tpo $(DEPDIR)/pcem-vid_olivetti_m24.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_olivetti_m24.c' object='pcem-vid_olivetti_m24.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_olivetti_m24.obj `if test -f 'vid_olivetti_m24.c'; then $(CYGPATH_W) 'vid_olivetti_m24.c'; else $(CYGPATH_W) '$(srcdir)/vid_olivetti_m24.c'; fi` - -pcem-vid_oti067.o: vid_oti067.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_oti067.o -MD -MP -MF $(DEPDIR)/pcem-vid_oti067.Tpo -c -o pcem-vid_oti067.o `test -f 'vid_oti067.c' || echo '$(srcdir)/'`vid_oti067.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_oti067.Tpo $(DEPDIR)/pcem-vid_oti067.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_oti067.c' object='pcem-vid_oti067.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_oti067.o `test -f 'vid_oti067.c' || echo '$(srcdir)/'`vid_oti067.c - -pcem-vid_oti067.obj: vid_oti067.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_oti067.obj -MD -MP -MF $(DEPDIR)/pcem-vid_oti067.Tpo -c -o pcem-vid_oti067.obj `if test -f 'vid_oti067.c'; then $(CYGPATH_W) 'vid_oti067.c'; else $(CYGPATH_W) '$(srcdir)/vid_oti067.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_oti067.Tpo $(DEPDIR)/pcem-vid_oti067.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_oti067.c' object='pcem-vid_oti067.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_oti067.obj `if test -f 'vid_oti067.c'; then $(CYGPATH_W) 'vid_oti067.c'; else $(CYGPATH_W) '$(srcdir)/vid_oti067.c'; fi` - -pcem-vid_paradise.o: vid_paradise.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_paradise.o -MD -MP -MF $(DEPDIR)/pcem-vid_paradise.Tpo -c -o pcem-vid_paradise.o `test -f 'vid_paradise.c' || echo '$(srcdir)/'`vid_paradise.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_paradise.Tpo $(DEPDIR)/pcem-vid_paradise.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_paradise.c' object='pcem-vid_paradise.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_paradise.o `test -f 'vid_paradise.c' || echo '$(srcdir)/'`vid_paradise.c - -pcem-vid_paradise.obj: vid_paradise.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_paradise.obj -MD -MP -MF $(DEPDIR)/pcem-vid_paradise.Tpo -c -o pcem-vid_paradise.obj `if test -f 'vid_paradise.c'; then $(CYGPATH_W) 'vid_paradise.c'; else $(CYGPATH_W) '$(srcdir)/vid_paradise.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_paradise.Tpo $(DEPDIR)/pcem-vid_paradise.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_paradise.c' object='pcem-vid_paradise.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_paradise.obj `if test -f 'vid_paradise.c'; then $(CYGPATH_W) 'vid_paradise.c'; else $(CYGPATH_W) '$(srcdir)/vid_paradise.c'; fi` - -pcem-vid_pc200.o: vid_pc200.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_pc200.o -MD -MP -MF $(DEPDIR)/pcem-vid_pc200.Tpo -c -o pcem-vid_pc200.o `test -f 'vid_pc200.c' || echo '$(srcdir)/'`vid_pc200.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_pc200.Tpo $(DEPDIR)/pcem-vid_pc200.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_pc200.c' object='pcem-vid_pc200.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_pc200.o `test -f 'vid_pc200.c' || echo '$(srcdir)/'`vid_pc200.c - -pcem-vid_pc200.obj: vid_pc200.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_pc200.obj -MD -MP -MF $(DEPDIR)/pcem-vid_pc200.Tpo -c -o pcem-vid_pc200.obj `if test -f 'vid_pc200.c'; then $(CYGPATH_W) 'vid_pc200.c'; else $(CYGPATH_W) '$(srcdir)/vid_pc200.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_pc200.Tpo $(DEPDIR)/pcem-vid_pc200.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_pc200.c' object='pcem-vid_pc200.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_pc200.obj `if test -f 'vid_pc200.c'; then $(CYGPATH_W) 'vid_pc200.c'; else $(CYGPATH_W) '$(srcdir)/vid_pc200.c'; fi` - -pcem-vid_pc1512.o: vid_pc1512.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_pc1512.o -MD -MP -MF $(DEPDIR)/pcem-vid_pc1512.Tpo -c -o pcem-vid_pc1512.o `test -f 'vid_pc1512.c' || echo '$(srcdir)/'`vid_pc1512.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_pc1512.Tpo $(DEPDIR)/pcem-vid_pc1512.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_pc1512.c' object='pcem-vid_pc1512.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_pc1512.o `test -f 'vid_pc1512.c' || echo '$(srcdir)/'`vid_pc1512.c - -pcem-vid_pc1512.obj: vid_pc1512.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_pc1512.obj -MD -MP -MF $(DEPDIR)/pcem-vid_pc1512.Tpo -c -o pcem-vid_pc1512.obj `if test -f 'vid_pc1512.c'; then $(CYGPATH_W) 'vid_pc1512.c'; else $(CYGPATH_W) '$(srcdir)/vid_pc1512.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_pc1512.Tpo $(DEPDIR)/pcem-vid_pc1512.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_pc1512.c' object='pcem-vid_pc1512.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_pc1512.obj `if test -f 'vid_pc1512.c'; then $(CYGPATH_W) 'vid_pc1512.c'; else $(CYGPATH_W) '$(srcdir)/vid_pc1512.c'; fi` - -pcem-vid_pc1640.o: vid_pc1640.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_pc1640.o -MD -MP -MF $(DEPDIR)/pcem-vid_pc1640.Tpo -c -o pcem-vid_pc1640.o `test -f 'vid_pc1640.c' || echo '$(srcdir)/'`vid_pc1640.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_pc1640.Tpo $(DEPDIR)/pcem-vid_pc1640.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_pc1640.c' object='pcem-vid_pc1640.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_pc1640.o `test -f 'vid_pc1640.c' || echo '$(srcdir)/'`vid_pc1640.c - -pcem-vid_pc1640.obj: vid_pc1640.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_pc1640.obj -MD -MP -MF $(DEPDIR)/pcem-vid_pc1640.Tpo -c -o pcem-vid_pc1640.obj `if test -f 'vid_pc1640.c'; then $(CYGPATH_W) 'vid_pc1640.c'; else $(CYGPATH_W) '$(srcdir)/vid_pc1640.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_pc1640.Tpo $(DEPDIR)/pcem-vid_pc1640.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_pc1640.c' object='pcem-vid_pc1640.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_pc1640.obj `if test -f 'vid_pc1640.c'; then $(CYGPATH_W) 'vid_pc1640.c'; else $(CYGPATH_W) '$(srcdir)/vid_pc1640.c'; fi` - -pcem-vid_pcjr.o: vid_pcjr.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_pcjr.o -MD -MP -MF $(DEPDIR)/pcem-vid_pcjr.Tpo -c -o pcem-vid_pcjr.o `test -f 'vid_pcjr.c' || echo '$(srcdir)/'`vid_pcjr.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_pcjr.Tpo $(DEPDIR)/pcem-vid_pcjr.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_pcjr.c' object='pcem-vid_pcjr.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_pcjr.o `test -f 'vid_pcjr.c' || echo '$(srcdir)/'`vid_pcjr.c - -pcem-vid_pcjr.obj: vid_pcjr.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_pcjr.obj -MD -MP -MF $(DEPDIR)/pcem-vid_pcjr.Tpo -c -o pcem-vid_pcjr.obj `if test -f 'vid_pcjr.c'; then $(CYGPATH_W) 'vid_pcjr.c'; else $(CYGPATH_W) '$(srcdir)/vid_pcjr.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_pcjr.Tpo $(DEPDIR)/pcem-vid_pcjr.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_pcjr.c' object='pcem-vid_pcjr.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_pcjr.obj `if test -f 'vid_pcjr.c'; then $(CYGPATH_W) 'vid_pcjr.c'; else $(CYGPATH_W) '$(srcdir)/vid_pcjr.c'; fi` - -pcem-vid_s3.o: vid_s3.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_s3.o -MD -MP -MF $(DEPDIR)/pcem-vid_s3.Tpo -c -o pcem-vid_s3.o `test -f 'vid_s3.c' || echo '$(srcdir)/'`vid_s3.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_s3.Tpo $(DEPDIR)/pcem-vid_s3.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_s3.c' object='pcem-vid_s3.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_s3.o `test -f 'vid_s3.c' || echo '$(srcdir)/'`vid_s3.c - -pcem-vid_s3.obj: vid_s3.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_s3.obj -MD -MP -MF $(DEPDIR)/pcem-vid_s3.Tpo -c -o pcem-vid_s3.obj `if test -f 'vid_s3.c'; then $(CYGPATH_W) 'vid_s3.c'; else $(CYGPATH_W) '$(srcdir)/vid_s3.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_s3.Tpo $(DEPDIR)/pcem-vid_s3.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_s3.c' object='pcem-vid_s3.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_s3.obj `if test -f 'vid_s3.c'; then $(CYGPATH_W) 'vid_s3.c'; else $(CYGPATH_W) '$(srcdir)/vid_s3.c'; fi` - -pcem-vid_s3_virge.o: vid_s3_virge.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_s3_virge.o -MD -MP -MF $(DEPDIR)/pcem-vid_s3_virge.Tpo -c -o pcem-vid_s3_virge.o `test -f 'vid_s3_virge.c' || echo '$(srcdir)/'`vid_s3_virge.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_s3_virge.Tpo $(DEPDIR)/pcem-vid_s3_virge.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_s3_virge.c' object='pcem-vid_s3_virge.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_s3_virge.o `test -f 'vid_s3_virge.c' || echo '$(srcdir)/'`vid_s3_virge.c - -pcem-vid_s3_virge.obj: vid_s3_virge.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_s3_virge.obj -MD -MP -MF $(DEPDIR)/pcem-vid_s3_virge.Tpo -c -o pcem-vid_s3_virge.obj `if test -f 'vid_s3_virge.c'; then $(CYGPATH_W) 'vid_s3_virge.c'; else $(CYGPATH_W) '$(srcdir)/vid_s3_virge.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_s3_virge.Tpo $(DEPDIR)/pcem-vid_s3_virge.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_s3_virge.c' object='pcem-vid_s3_virge.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_s3_virge.obj `if test -f 'vid_s3_virge.c'; then $(CYGPATH_W) 'vid_s3_virge.c'; else $(CYGPATH_W) '$(srcdir)/vid_s3_virge.c'; fi` - -pcem-vid_sdac_ramdac.o: vid_sdac_ramdac.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_sdac_ramdac.o -MD -MP -MF $(DEPDIR)/pcem-vid_sdac_ramdac.Tpo -c -o pcem-vid_sdac_ramdac.o `test -f 'vid_sdac_ramdac.c' || echo '$(srcdir)/'`vid_sdac_ramdac.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_sdac_ramdac.Tpo $(DEPDIR)/pcem-vid_sdac_ramdac.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_sdac_ramdac.c' object='pcem-vid_sdac_ramdac.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_sdac_ramdac.o `test -f 'vid_sdac_ramdac.c' || echo '$(srcdir)/'`vid_sdac_ramdac.c - -pcem-vid_sdac_ramdac.obj: vid_sdac_ramdac.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_sdac_ramdac.obj -MD -MP -MF $(DEPDIR)/pcem-vid_sdac_ramdac.Tpo -c -o pcem-vid_sdac_ramdac.obj `if test -f 'vid_sdac_ramdac.c'; then $(CYGPATH_W) 'vid_sdac_ramdac.c'; else $(CYGPATH_W) '$(srcdir)/vid_sdac_ramdac.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_sdac_ramdac.Tpo $(DEPDIR)/pcem-vid_sdac_ramdac.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_sdac_ramdac.c' object='pcem-vid_sdac_ramdac.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_sdac_ramdac.obj `if test -f 'vid_sdac_ramdac.c'; then $(CYGPATH_W) 'vid_sdac_ramdac.c'; else $(CYGPATH_W) '$(srcdir)/vid_sdac_ramdac.c'; fi` - -pcem-vid_stg_ramdac.o: vid_stg_ramdac.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_stg_ramdac.o -MD -MP -MF $(DEPDIR)/pcem-vid_stg_ramdac.Tpo -c -o pcem-vid_stg_ramdac.o `test -f 'vid_stg_ramdac.c' || echo '$(srcdir)/'`vid_stg_ramdac.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_stg_ramdac.Tpo $(DEPDIR)/pcem-vid_stg_ramdac.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_stg_ramdac.c' object='pcem-vid_stg_ramdac.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_stg_ramdac.o `test -f 'vid_stg_ramdac.c' || echo '$(srcdir)/'`vid_stg_ramdac.c - -pcem-vid_stg_ramdac.obj: vid_stg_ramdac.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_stg_ramdac.obj -MD -MP -MF $(DEPDIR)/pcem-vid_stg_ramdac.Tpo -c -o pcem-vid_stg_ramdac.obj `if test -f 'vid_stg_ramdac.c'; then $(CYGPATH_W) 'vid_stg_ramdac.c'; else $(CYGPATH_W) '$(srcdir)/vid_stg_ramdac.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_stg_ramdac.Tpo $(DEPDIR)/pcem-vid_stg_ramdac.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_stg_ramdac.c' object='pcem-vid_stg_ramdac.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_stg_ramdac.obj `if test -f 'vid_stg_ramdac.c'; then $(CYGPATH_W) 'vid_stg_ramdac.c'; else $(CYGPATH_W) '$(srcdir)/vid_stg_ramdac.c'; fi` - -pcem-vid_svga.o: vid_svga.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_svga.o -MD -MP -MF $(DEPDIR)/pcem-vid_svga.Tpo -c -o pcem-vid_svga.o `test -f 'vid_svga.c' || echo '$(srcdir)/'`vid_svga.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_svga.Tpo $(DEPDIR)/pcem-vid_svga.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_svga.c' object='pcem-vid_svga.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_svga.o `test -f 'vid_svga.c' || echo '$(srcdir)/'`vid_svga.c - -pcem-vid_svga.obj: vid_svga.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_svga.obj -MD -MP -MF $(DEPDIR)/pcem-vid_svga.Tpo -c -o pcem-vid_svga.obj `if test -f 'vid_svga.c'; then $(CYGPATH_W) 'vid_svga.c'; else $(CYGPATH_W) '$(srcdir)/vid_svga.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_svga.Tpo $(DEPDIR)/pcem-vid_svga.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_svga.c' object='pcem-vid_svga.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_svga.obj `if test -f 'vid_svga.c'; then $(CYGPATH_W) 'vid_svga.c'; else $(CYGPATH_W) '$(srcdir)/vid_svga.c'; fi` - -pcem-vid_svga_render.o: vid_svga_render.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_svga_render.o -MD -MP -MF $(DEPDIR)/pcem-vid_svga_render.Tpo -c -o pcem-vid_svga_render.o `test -f 'vid_svga_render.c' || echo '$(srcdir)/'`vid_svga_render.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_svga_render.Tpo $(DEPDIR)/pcem-vid_svga_render.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_svga_render.c' object='pcem-vid_svga_render.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_svga_render.o `test -f 'vid_svga_render.c' || echo '$(srcdir)/'`vid_svga_render.c - -pcem-vid_svga_render.obj: vid_svga_render.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_svga_render.obj -MD -MP -MF $(DEPDIR)/pcem-vid_svga_render.Tpo -c -o pcem-vid_svga_render.obj `if test -f 'vid_svga_render.c'; then $(CYGPATH_W) 'vid_svga_render.c'; else $(CYGPATH_W) '$(srcdir)/vid_svga_render.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_svga_render.Tpo $(DEPDIR)/pcem-vid_svga_render.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_svga_render.c' object='pcem-vid_svga_render.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_svga_render.obj `if test -f 'vid_svga_render.c'; then $(CYGPATH_W) 'vid_svga_render.c'; else $(CYGPATH_W) '$(srcdir)/vid_svga_render.c'; fi` - -pcem-vid_tandy.o: vid_tandy.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_tandy.o -MD -MP -MF $(DEPDIR)/pcem-vid_tandy.Tpo -c -o pcem-vid_tandy.o `test -f 'vid_tandy.c' || echo '$(srcdir)/'`vid_tandy.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_tandy.Tpo $(DEPDIR)/pcem-vid_tandy.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_tandy.c' object='pcem-vid_tandy.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_tandy.o `test -f 'vid_tandy.c' || echo '$(srcdir)/'`vid_tandy.c - -pcem-vid_tandy.obj: vid_tandy.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_tandy.obj -MD -MP -MF $(DEPDIR)/pcem-vid_tandy.Tpo -c -o pcem-vid_tandy.obj `if test -f 'vid_tandy.c'; then $(CYGPATH_W) 'vid_tandy.c'; else $(CYGPATH_W) '$(srcdir)/vid_tandy.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_tandy.Tpo $(DEPDIR)/pcem-vid_tandy.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_tandy.c' object='pcem-vid_tandy.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_tandy.obj `if test -f 'vid_tandy.c'; then $(CYGPATH_W) 'vid_tandy.c'; else $(CYGPATH_W) '$(srcdir)/vid_tandy.c'; fi` - -pcem-vid_tgui9440.o: vid_tgui9440.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_tgui9440.o -MD -MP -MF $(DEPDIR)/pcem-vid_tgui9440.Tpo -c -o pcem-vid_tgui9440.o `test -f 'vid_tgui9440.c' || echo '$(srcdir)/'`vid_tgui9440.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_tgui9440.Tpo $(DEPDIR)/pcem-vid_tgui9440.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_tgui9440.c' object='pcem-vid_tgui9440.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_tgui9440.o `test -f 'vid_tgui9440.c' || echo '$(srcdir)/'`vid_tgui9440.c - -pcem-vid_tgui9440.obj: vid_tgui9440.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_tgui9440.obj -MD -MP -MF $(DEPDIR)/pcem-vid_tgui9440.Tpo -c -o pcem-vid_tgui9440.obj `if test -f 'vid_tgui9440.c'; then $(CYGPATH_W) 'vid_tgui9440.c'; else $(CYGPATH_W) '$(srcdir)/vid_tgui9440.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_tgui9440.Tpo $(DEPDIR)/pcem-vid_tgui9440.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_tgui9440.c' object='pcem-vid_tgui9440.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_tgui9440.obj `if test -f 'vid_tgui9440.c'; then $(CYGPATH_W) 'vid_tgui9440.c'; else $(CYGPATH_W) '$(srcdir)/vid_tgui9440.c'; fi` - -pcem-vid_tkd8001_ramdac.o: vid_tkd8001_ramdac.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_tkd8001_ramdac.o -MD -MP -MF $(DEPDIR)/pcem-vid_tkd8001_ramdac.Tpo -c -o pcem-vid_tkd8001_ramdac.o `test -f 'vid_tkd8001_ramdac.c' || echo '$(srcdir)/'`vid_tkd8001_ramdac.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_tkd8001_ramdac.Tpo $(DEPDIR)/pcem-vid_tkd8001_ramdac.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_tkd8001_ramdac.c' object='pcem-vid_tkd8001_ramdac.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_tkd8001_ramdac.o `test -f 'vid_tkd8001_ramdac.c' || echo '$(srcdir)/'`vid_tkd8001_ramdac.c - -pcem-vid_tkd8001_ramdac.obj: vid_tkd8001_ramdac.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_tkd8001_ramdac.obj -MD -MP -MF $(DEPDIR)/pcem-vid_tkd8001_ramdac.Tpo -c -o pcem-vid_tkd8001_ramdac.obj `if test -f 'vid_tkd8001_ramdac.c'; then $(CYGPATH_W) 'vid_tkd8001_ramdac.c'; else $(CYGPATH_W) '$(srcdir)/vid_tkd8001_ramdac.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_tkd8001_ramdac.Tpo $(DEPDIR)/pcem-vid_tkd8001_ramdac.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_tkd8001_ramdac.c' object='pcem-vid_tkd8001_ramdac.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_tkd8001_ramdac.obj `if test -f 'vid_tkd8001_ramdac.c'; then $(CYGPATH_W) 'vid_tkd8001_ramdac.c'; else $(CYGPATH_W) '$(srcdir)/vid_tkd8001_ramdac.c'; fi` - -pcem-vid_tvga.o: vid_tvga.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_tvga.o -MD -MP -MF $(DEPDIR)/pcem-vid_tvga.Tpo -c -o pcem-vid_tvga.o `test -f 'vid_tvga.c' || echo '$(srcdir)/'`vid_tvga.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_tvga.Tpo $(DEPDIR)/pcem-vid_tvga.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_tvga.c' object='pcem-vid_tvga.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_tvga.o `test -f 'vid_tvga.c' || echo '$(srcdir)/'`vid_tvga.c - -pcem-vid_tvga.obj: vid_tvga.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_tvga.obj -MD -MP -MF $(DEPDIR)/pcem-vid_tvga.Tpo -c -o pcem-vid_tvga.obj `if test -f 'vid_tvga.c'; then $(CYGPATH_W) 'vid_tvga.c'; else $(CYGPATH_W) '$(srcdir)/vid_tvga.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_tvga.Tpo $(DEPDIR)/pcem-vid_tvga.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_tvga.c' object='pcem-vid_tvga.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_tvga.obj `if test -f 'vid_tvga.c'; then $(CYGPATH_W) 'vid_tvga.c'; else $(CYGPATH_W) '$(srcdir)/vid_tvga.c'; fi` - -pcem-vid_unk_ramdac.o: vid_unk_ramdac.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_unk_ramdac.o -MD -MP -MF $(DEPDIR)/pcem-vid_unk_ramdac.Tpo -c -o pcem-vid_unk_ramdac.o `test -f 'vid_unk_ramdac.c' || echo '$(srcdir)/'`vid_unk_ramdac.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_unk_ramdac.Tpo $(DEPDIR)/pcem-vid_unk_ramdac.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_unk_ramdac.c' object='pcem-vid_unk_ramdac.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_unk_ramdac.o `test -f 'vid_unk_ramdac.c' || echo '$(srcdir)/'`vid_unk_ramdac.c - -pcem-vid_unk_ramdac.obj: vid_unk_ramdac.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_unk_ramdac.obj -MD -MP -MF $(DEPDIR)/pcem-vid_unk_ramdac.Tpo -c -o pcem-vid_unk_ramdac.obj `if test -f 'vid_unk_ramdac.c'; then $(CYGPATH_W) 'vid_unk_ramdac.c'; else $(CYGPATH_W) '$(srcdir)/vid_unk_ramdac.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_unk_ramdac.Tpo $(DEPDIR)/pcem-vid_unk_ramdac.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_unk_ramdac.c' object='pcem-vid_unk_ramdac.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_unk_ramdac.obj `if test -f 'vid_unk_ramdac.c'; then $(CYGPATH_W) 'vid_unk_ramdac.c'; else $(CYGPATH_W) '$(srcdir)/vid_unk_ramdac.c'; fi` - -pcem-vid_vga.o: vid_vga.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_vga.o -MD -MP -MF $(DEPDIR)/pcem-vid_vga.Tpo -c -o pcem-vid_vga.o `test -f 'vid_vga.c' || echo '$(srcdir)/'`vid_vga.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_vga.Tpo $(DEPDIR)/pcem-vid_vga.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_vga.c' object='pcem-vid_vga.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_vga.o `test -f 'vid_vga.c' || echo '$(srcdir)/'`vid_vga.c - -pcem-vid_vga.obj: vid_vga.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_vga.obj -MD -MP -MF $(DEPDIR)/pcem-vid_vga.Tpo -c -o pcem-vid_vga.obj `if test -f 'vid_vga.c'; then $(CYGPATH_W) 'vid_vga.c'; else $(CYGPATH_W) '$(srcdir)/vid_vga.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_vga.Tpo $(DEPDIR)/pcem-vid_vga.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_vga.c' object='pcem-vid_vga.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_vga.obj `if test -f 'vid_vga.c'; then $(CYGPATH_W) 'vid_vga.c'; else $(CYGPATH_W) '$(srcdir)/vid_vga.c'; fi` - -pcem-vid_voodoo.o: vid_voodoo.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_voodoo.o -MD -MP -MF $(DEPDIR)/pcem-vid_voodoo.Tpo -c -o pcem-vid_voodoo.o `test -f 'vid_voodoo.c' || echo '$(srcdir)/'`vid_voodoo.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_voodoo.Tpo $(DEPDIR)/pcem-vid_voodoo.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_voodoo.c' object='pcem-vid_voodoo.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_voodoo.o `test -f 'vid_voodoo.c' || echo '$(srcdir)/'`vid_voodoo.c - -pcem-vid_voodoo.obj: vid_voodoo.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-vid_voodoo.obj -MD -MP -MF $(DEPDIR)/pcem-vid_voodoo.Tpo -c -o pcem-vid_voodoo.obj `if test -f 'vid_voodoo.c'; then $(CYGPATH_W) 'vid_voodoo.c'; else $(CYGPATH_W) '$(srcdir)/vid_voodoo.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-vid_voodoo.Tpo $(DEPDIR)/pcem-vid_voodoo.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vid_voodoo.c' object='pcem-vid_voodoo.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-vid_voodoo.obj `if test -f 'vid_voodoo.c'; then $(CYGPATH_W) 'vid_voodoo.c'; else $(CYGPATH_W) '$(srcdir)/vid_voodoo.c'; fi` - -pcem-video.o: video.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-video.o -MD -MP -MF $(DEPDIR)/pcem-video.Tpo -c -o pcem-video.o `test -f 'video.c' || echo '$(srcdir)/'`video.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-video.Tpo $(DEPDIR)/pcem-video.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='video.c' object='pcem-video.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-video.o `test -f 'video.c' || echo '$(srcdir)/'`video.c - -pcem-video.obj: video.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-video.obj -MD -MP -MF $(DEPDIR)/pcem-video.Tpo -c -o pcem-video.obj `if test -f 'video.c'; then $(CYGPATH_W) 'video.c'; else $(CYGPATH_W) '$(srcdir)/video.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-video.Tpo $(DEPDIR)/pcem-video.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='video.c' object='pcem-video.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-video.obj `if test -f 'video.c'; then $(CYGPATH_W) 'video.c'; else $(CYGPATH_W) '$(srcdir)/video.c'; fi` - -pcem-wd76c10.o: wd76c10.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-wd76c10.o -MD -MP -MF $(DEPDIR)/pcem-wd76c10.Tpo -c -o pcem-wd76c10.o `test -f 'wd76c10.c' || echo '$(srcdir)/'`wd76c10.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-wd76c10.Tpo $(DEPDIR)/pcem-wd76c10.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='wd76c10.c' object='pcem-wd76c10.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-wd76c10.o `test -f 'wd76c10.c' || echo '$(srcdir)/'`wd76c10.c - -pcem-wd76c10.obj: wd76c10.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-wd76c10.obj -MD -MP -MF $(DEPDIR)/pcem-wd76c10.Tpo -c -o pcem-wd76c10.obj `if test -f 'wd76c10.c'; then $(CYGPATH_W) 'wd76c10.c'; else $(CYGPATH_W) '$(srcdir)/wd76c10.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-wd76c10.Tpo $(DEPDIR)/pcem-wd76c10.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='wd76c10.c' object='pcem-wd76c10.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-wd76c10.obj `if test -f 'wd76c10.c'; then $(CYGPATH_W) 'wd76c10.c'; else $(CYGPATH_W) '$(srcdir)/wd76c10.c'; fi` - -pcem-x86seg.o: x86seg.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-x86seg.o -MD -MP -MF $(DEPDIR)/pcem-x86seg.Tpo -c -o pcem-x86seg.o `test -f 'x86seg.c' || echo '$(srcdir)/'`x86seg.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-x86seg.Tpo $(DEPDIR)/pcem-x86seg.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='x86seg.c' object='pcem-x86seg.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-x86seg.o `test -f 'x86seg.c' || echo '$(srcdir)/'`x86seg.c - -pcem-x86seg.obj: x86seg.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-x86seg.obj -MD -MP -MF $(DEPDIR)/pcem-x86seg.Tpo -c -o pcem-x86seg.obj `if test -f 'x86seg.c'; then $(CYGPATH_W) 'x86seg.c'; else $(CYGPATH_W) '$(srcdir)/x86seg.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-x86seg.Tpo $(DEPDIR)/pcem-x86seg.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='x86seg.c' object='pcem-x86seg.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-x86seg.obj `if test -f 'x86seg.c'; then $(CYGPATH_W) 'x86seg.c'; else $(CYGPATH_W) '$(srcdir)/x86seg.c'; fi` - -pcem-x87.o: x87.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-x87.o -MD -MP -MF $(DEPDIR)/pcem-x87.Tpo -c -o pcem-x87.o `test -f 'x87.c' || echo '$(srcdir)/'`x87.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-x87.Tpo $(DEPDIR)/pcem-x87.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='x87.c' object='pcem-x87.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-x87.o `test -f 'x87.c' || echo '$(srcdir)/'`x87.c - -pcem-x87.obj: x87.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-x87.obj -MD -MP -MF $(DEPDIR)/pcem-x87.Tpo -c -o pcem-x87.obj `if test -f 'x87.c'; then $(CYGPATH_W) 'x87.c'; else $(CYGPATH_W) '$(srcdir)/x87.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-x87.Tpo $(DEPDIR)/pcem-x87.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='x87.c' object='pcem-x87.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-x87.obj `if test -f 'x87.c'; then $(CYGPATH_W) 'x87.c'; else $(CYGPATH_W) '$(srcdir)/x87.c'; fi` - -pcem-xtide.o: xtide.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-xtide.o -MD -MP -MF $(DEPDIR)/pcem-xtide.Tpo -c -o pcem-xtide.o `test -f 'xtide.c' || echo '$(srcdir)/'`xtide.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-xtide.Tpo $(DEPDIR)/pcem-xtide.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xtide.c' object='pcem-xtide.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-xtide.o `test -f 'xtide.c' || echo '$(srcdir)/'`xtide.c - -pcem-xtide.obj: xtide.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-xtide.obj -MD -MP -MF $(DEPDIR)/pcem-xtide.Tpo -c -o pcem-xtide.obj `if test -f 'xtide.c'; then $(CYGPATH_W) 'xtide.c'; else $(CYGPATH_W) '$(srcdir)/xtide.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-xtide.Tpo $(DEPDIR)/pcem-xtide.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xtide.c' object='pcem-xtide.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-xtide.obj `if test -f 'xtide.c'; then $(CYGPATH_W) 'xtide.c'; else $(CYGPATH_W) '$(srcdir)/xtide.c'; fi` - -pcem-codegen_x86.o: codegen_x86.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-codegen_x86.o -MD -MP -MF $(DEPDIR)/pcem-codegen_x86.Tpo -c -o pcem-codegen_x86.o `test -f 'codegen_x86.c' || echo '$(srcdir)/'`codegen_x86.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-codegen_x86.Tpo $(DEPDIR)/pcem-codegen_x86.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='codegen_x86.c' object='pcem-codegen_x86.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-codegen_x86.o `test -f 'codegen_x86.c' || echo '$(srcdir)/'`codegen_x86.c - -pcem-codegen_x86.obj: codegen_x86.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-codegen_x86.obj -MD -MP -MF $(DEPDIR)/pcem-codegen_x86.Tpo -c -o pcem-codegen_x86.obj `if test -f 'codegen_x86.c'; then $(CYGPATH_W) 'codegen_x86.c'; else $(CYGPATH_W) '$(srcdir)/codegen_x86.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-codegen_x86.Tpo $(DEPDIR)/pcem-codegen_x86.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='codegen_x86.c' object='pcem-codegen_x86.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-codegen_x86.obj `if test -f 'codegen_x86.c'; then $(CYGPATH_W) 'codegen_x86.c'; else $(CYGPATH_W) '$(srcdir)/codegen_x86.c'; fi` - -pcem-codegen_x86-64.o: codegen_x86-64.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-codegen_x86-64.o -MD -MP -MF $(DEPDIR)/pcem-codegen_x86-64.Tpo -c -o pcem-codegen_x86-64.o `test -f 'codegen_x86-64.c' || echo '$(srcdir)/'`codegen_x86-64.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-codegen_x86-64.Tpo $(DEPDIR)/pcem-codegen_x86-64.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='codegen_x86-64.c' object='pcem-codegen_x86-64.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-codegen_x86-64.o `test -f 'codegen_x86-64.c' || echo '$(srcdir)/'`codegen_x86-64.c - -pcem-codegen_x86-64.obj: codegen_x86-64.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-codegen_x86-64.obj -MD -MP -MF $(DEPDIR)/pcem-codegen_x86-64.Tpo -c -o pcem-codegen_x86-64.obj `if test -f 'codegen_x86-64.c'; then $(CYGPATH_W) 'codegen_x86-64.c'; else $(CYGPATH_W) '$(srcdir)/codegen_x86-64.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pcem-codegen_x86-64.Tpo $(DEPDIR)/pcem-codegen_x86-64.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='codegen_x86-64.c' object='pcem-codegen_x86-64.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-codegen_x86-64.obj `if test -f 'codegen_x86-64.c'; then $(CYGPATH_W) 'codegen_x86-64.c'; else $(CYGPATH_W) '$(srcdir)/codegen_x86-64.c'; fi` - -.cc.o: -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< - -.cc.obj: -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -dbopl.o: dosbox/dbopl.cpp -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT dbopl.o -MD -MP -MF $(DEPDIR)/dbopl.Tpo -c -o dbopl.o `test -f 'dosbox/dbopl.cpp' || echo '$(srcdir)/'`dosbox/dbopl.cpp -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/dbopl.Tpo $(DEPDIR)/dbopl.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='dosbox/dbopl.cpp' object='dbopl.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dbopl.o `test -f 'dosbox/dbopl.cpp' || echo '$(srcdir)/'`dosbox/dbopl.cpp - -dbopl.obj: dosbox/dbopl.cpp -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT dbopl.obj -MD -MP -MF $(DEPDIR)/dbopl.Tpo -c -o dbopl.obj `if test -f 'dosbox/dbopl.cpp'; then $(CYGPATH_W) 'dosbox/dbopl.cpp'; else $(CYGPATH_W) '$(srcdir)/dosbox/dbopl.cpp'; fi` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/dbopl.Tpo $(DEPDIR)/dbopl.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='dosbox/dbopl.cpp' object='dbopl.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dbopl.obj `if test -f 'dosbox/dbopl.cpp'; then $(CYGPATH_W) 'dosbox/dbopl.cpp'; else $(CYGPATH_W) '$(srcdir)/dosbox/dbopl.cpp'; fi` - -convolve.o: resid-fp/convolve.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT convolve.o -MD -MP -MF $(DEPDIR)/convolve.Tpo -c -o convolve.o `test -f 'resid-fp/convolve.cc' || echo '$(srcdir)/'`resid-fp/convolve.cc -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/convolve.Tpo $(DEPDIR)/convolve.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/convolve.cc' object='convolve.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o convolve.o `test -f 'resid-fp/convolve.cc' || echo '$(srcdir)/'`resid-fp/convolve.cc - -convolve.obj: resid-fp/convolve.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT convolve.obj -MD -MP -MF $(DEPDIR)/convolve.Tpo -c -o convolve.obj `if test -f 'resid-fp/convolve.cc'; then $(CYGPATH_W) 'resid-fp/convolve.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/convolve.cc'; fi` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/convolve.Tpo $(DEPDIR)/convolve.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/convolve.cc' object='convolve.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o convolve.obj `if test -f 'resid-fp/convolve.cc'; then $(CYGPATH_W) 'resid-fp/convolve.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/convolve.cc'; fi` - -convolve-sse.o: resid-fp/convolve-sse.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT convolve-sse.o -MD -MP -MF $(DEPDIR)/convolve-sse.Tpo -c -o convolve-sse.o `test -f 'resid-fp/convolve-sse.cc' || echo '$(srcdir)/'`resid-fp/convolve-sse.cc -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/convolve-sse.Tpo $(DEPDIR)/convolve-sse.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/convolve-sse.cc' object='convolve-sse.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o convolve-sse.o `test -f 'resid-fp/convolve-sse.cc' || echo '$(srcdir)/'`resid-fp/convolve-sse.cc - -convolve-sse.obj: resid-fp/convolve-sse.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT convolve-sse.obj -MD -MP -MF $(DEPDIR)/convolve-sse.Tpo -c -o convolve-sse.obj `if test -f 'resid-fp/convolve-sse.cc'; then $(CYGPATH_W) 'resid-fp/convolve-sse.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/convolve-sse.cc'; fi` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/convolve-sse.Tpo $(DEPDIR)/convolve-sse.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/convolve-sse.cc' object='convolve-sse.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o convolve-sse.obj `if test -f 'resid-fp/convolve-sse.cc'; then $(CYGPATH_W) 'resid-fp/convolve-sse.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/convolve-sse.cc'; fi` - -envelope.o: resid-fp/envelope.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT envelope.o -MD -MP -MF $(DEPDIR)/envelope.Tpo -c -o envelope.o `test -f 'resid-fp/envelope.cc' || echo '$(srcdir)/'`resid-fp/envelope.cc -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/envelope.Tpo $(DEPDIR)/envelope.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/envelope.cc' object='envelope.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o envelope.o `test -f 'resid-fp/envelope.cc' || echo '$(srcdir)/'`resid-fp/envelope.cc - -envelope.obj: resid-fp/envelope.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT envelope.obj -MD -MP -MF $(DEPDIR)/envelope.Tpo -c -o envelope.obj `if test -f 'resid-fp/envelope.cc'; then $(CYGPATH_W) 'resid-fp/envelope.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/envelope.cc'; fi` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/envelope.Tpo $(DEPDIR)/envelope.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/envelope.cc' object='envelope.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o envelope.obj `if test -f 'resid-fp/envelope.cc'; then $(CYGPATH_W) 'resid-fp/envelope.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/envelope.cc'; fi` - -extfilt.o: resid-fp/extfilt.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT extfilt.o -MD -MP -MF $(DEPDIR)/extfilt.Tpo -c -o extfilt.o `test -f 'resid-fp/extfilt.cc' || echo '$(srcdir)/'`resid-fp/extfilt.cc -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/extfilt.Tpo $(DEPDIR)/extfilt.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/extfilt.cc' object='extfilt.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o extfilt.o `test -f 'resid-fp/extfilt.cc' || echo '$(srcdir)/'`resid-fp/extfilt.cc - -extfilt.obj: resid-fp/extfilt.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT extfilt.obj -MD -MP -MF $(DEPDIR)/extfilt.Tpo -c -o extfilt.obj `if test -f 'resid-fp/extfilt.cc'; then $(CYGPATH_W) 'resid-fp/extfilt.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/extfilt.cc'; fi` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/extfilt.Tpo $(DEPDIR)/extfilt.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/extfilt.cc' object='extfilt.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o extfilt.obj `if test -f 'resid-fp/extfilt.cc'; then $(CYGPATH_W) 'resid-fp/extfilt.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/extfilt.cc'; fi` - -filter.o: resid-fp/filter.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT filter.o -MD -MP -MF $(DEPDIR)/filter.Tpo -c -o filter.o `test -f 'resid-fp/filter.cc' || echo '$(srcdir)/'`resid-fp/filter.cc -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/filter.Tpo $(DEPDIR)/filter.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/filter.cc' object='filter.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o filter.o `test -f 'resid-fp/filter.cc' || echo '$(srcdir)/'`resid-fp/filter.cc - -filter.obj: resid-fp/filter.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT filter.obj -MD -MP -MF $(DEPDIR)/filter.Tpo -c -o filter.obj `if test -f 'resid-fp/filter.cc'; then $(CYGPATH_W) 'resid-fp/filter.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/filter.cc'; fi` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/filter.Tpo $(DEPDIR)/filter.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/filter.cc' object='filter.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o filter.obj `if test -f 'resid-fp/filter.cc'; then $(CYGPATH_W) 'resid-fp/filter.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/filter.cc'; fi` - -pot.o: resid-fp/pot.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT pot.o -MD -MP -MF $(DEPDIR)/pot.Tpo -c -o pot.o `test -f 'resid-fp/pot.cc' || echo '$(srcdir)/'`resid-fp/pot.cc -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/pot.Tpo $(DEPDIR)/pot.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/pot.cc' object='pot.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o pot.o `test -f 'resid-fp/pot.cc' || echo '$(srcdir)/'`resid-fp/pot.cc - -pot.obj: resid-fp/pot.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT pot.obj -MD -MP -MF $(DEPDIR)/pot.Tpo -c -o pot.obj `if test -f 'resid-fp/pot.cc'; then $(CYGPATH_W) 'resid-fp/pot.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/pot.cc'; fi` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/pot.Tpo $(DEPDIR)/pot.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/pot.cc' object='pot.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o pot.obj `if test -f 'resid-fp/pot.cc'; then $(CYGPATH_W) 'resid-fp/pot.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/pot.cc'; fi` - -sid.o: resid-fp/sid.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sid.o -MD -MP -MF $(DEPDIR)/sid.Tpo -c -o sid.o `test -f 'resid-fp/sid.cc' || echo '$(srcdir)/'`resid-fp/sid.cc -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/sid.Tpo $(DEPDIR)/sid.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/sid.cc' object='sid.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sid.o `test -f 'resid-fp/sid.cc' || echo '$(srcdir)/'`resid-fp/sid.cc - -sid.obj: resid-fp/sid.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sid.obj -MD -MP -MF $(DEPDIR)/sid.Tpo -c -o sid.obj `if test -f 'resid-fp/sid.cc'; then $(CYGPATH_W) 'resid-fp/sid.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/sid.cc'; fi` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/sid.Tpo $(DEPDIR)/sid.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/sid.cc' object='sid.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sid.obj `if test -f 'resid-fp/sid.cc'; then $(CYGPATH_W) 'resid-fp/sid.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/sid.cc'; fi` - -voice.o: resid-fp/voice.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT voice.o -MD -MP -MF $(DEPDIR)/voice.Tpo -c -o voice.o `test -f 'resid-fp/voice.cc' || echo '$(srcdir)/'`resid-fp/voice.cc -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/voice.Tpo $(DEPDIR)/voice.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/voice.cc' object='voice.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o voice.o `test -f 'resid-fp/voice.cc' || echo '$(srcdir)/'`resid-fp/voice.cc - -voice.obj: resid-fp/voice.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT voice.obj -MD -MP -MF $(DEPDIR)/voice.Tpo -c -o voice.obj `if test -f 'resid-fp/voice.cc'; then $(CYGPATH_W) 'resid-fp/voice.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/voice.cc'; fi` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/voice.Tpo $(DEPDIR)/voice.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/voice.cc' object='voice.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o voice.obj `if test -f 'resid-fp/voice.cc'; then $(CYGPATH_W) 'resid-fp/voice.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/voice.cc'; fi` - -wave6581_PS_.o: resid-fp/wave6581_PS_.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT wave6581_PS_.o -MD -MP -MF $(DEPDIR)/wave6581_PS_.Tpo -c -o wave6581_PS_.o `test -f 'resid-fp/wave6581_PS_.cc' || echo '$(srcdir)/'`resid-fp/wave6581_PS_.cc -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/wave6581_PS_.Tpo $(DEPDIR)/wave6581_PS_.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/wave6581_PS_.cc' object='wave6581_PS_.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o wave6581_PS_.o `test -f 'resid-fp/wave6581_PS_.cc' || echo '$(srcdir)/'`resid-fp/wave6581_PS_.cc - -wave6581_PS_.obj: resid-fp/wave6581_PS_.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT wave6581_PS_.obj -MD -MP -MF $(DEPDIR)/wave6581_PS_.Tpo -c -o wave6581_PS_.obj `if test -f 'resid-fp/wave6581_PS_.cc'; then $(CYGPATH_W) 'resid-fp/wave6581_PS_.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/wave6581_PS_.cc'; fi` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/wave6581_PS_.Tpo $(DEPDIR)/wave6581_PS_.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/wave6581_PS_.cc' object='wave6581_PS_.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o wave6581_PS_.obj `if test -f 'resid-fp/wave6581_PS_.cc'; then $(CYGPATH_W) 'resid-fp/wave6581_PS_.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/wave6581_PS_.cc'; fi` - -wave6581_PST.o: resid-fp/wave6581_PST.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT wave6581_PST.o -MD -MP -MF $(DEPDIR)/wave6581_PST.Tpo -c -o wave6581_PST.o `test -f 'resid-fp/wave6581_PST.cc' || echo '$(srcdir)/'`resid-fp/wave6581_PST.cc -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/wave6581_PST.Tpo $(DEPDIR)/wave6581_PST.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/wave6581_PST.cc' object='wave6581_PST.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o wave6581_PST.o `test -f 'resid-fp/wave6581_PST.cc' || echo '$(srcdir)/'`resid-fp/wave6581_PST.cc - -wave6581_PST.obj: resid-fp/wave6581_PST.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT wave6581_PST.obj -MD -MP -MF $(DEPDIR)/wave6581_PST.Tpo -c -o wave6581_PST.obj `if test -f 'resid-fp/wave6581_PST.cc'; then $(CYGPATH_W) 'resid-fp/wave6581_PST.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/wave6581_PST.cc'; fi` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/wave6581_PST.Tpo $(DEPDIR)/wave6581_PST.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/wave6581_PST.cc' object='wave6581_PST.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o wave6581_PST.obj `if test -f 'resid-fp/wave6581_PST.cc'; then $(CYGPATH_W) 'resid-fp/wave6581_PST.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/wave6581_PST.cc'; fi` - -wave6581_P_T.o: resid-fp/wave6581_P_T.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT wave6581_P_T.o -MD -MP -MF $(DEPDIR)/wave6581_P_T.Tpo -c -o wave6581_P_T.o `test -f 'resid-fp/wave6581_P_T.cc' || echo '$(srcdir)/'`resid-fp/wave6581_P_T.cc -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/wave6581_P_T.Tpo $(DEPDIR)/wave6581_P_T.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/wave6581_P_T.cc' object='wave6581_P_T.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o wave6581_P_T.o `test -f 'resid-fp/wave6581_P_T.cc' || echo '$(srcdir)/'`resid-fp/wave6581_P_T.cc - -wave6581_P_T.obj: resid-fp/wave6581_P_T.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT wave6581_P_T.obj -MD -MP -MF $(DEPDIR)/wave6581_P_T.Tpo -c -o wave6581_P_T.obj `if test -f 'resid-fp/wave6581_P_T.cc'; then $(CYGPATH_W) 'resid-fp/wave6581_P_T.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/wave6581_P_T.cc'; fi` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/wave6581_P_T.Tpo $(DEPDIR)/wave6581_P_T.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/wave6581_P_T.cc' object='wave6581_P_T.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o wave6581_P_T.obj `if test -f 'resid-fp/wave6581_P_T.cc'; then $(CYGPATH_W) 'resid-fp/wave6581_P_T.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/wave6581_P_T.cc'; fi` - -wave6581__ST.o: resid-fp/wave6581__ST.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT wave6581__ST.o -MD -MP -MF $(DEPDIR)/wave6581__ST.Tpo -c -o wave6581__ST.o `test -f 'resid-fp/wave6581__ST.cc' || echo '$(srcdir)/'`resid-fp/wave6581__ST.cc -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/wave6581__ST.Tpo $(DEPDIR)/wave6581__ST.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/wave6581__ST.cc' object='wave6581__ST.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o wave6581__ST.o `test -f 'resid-fp/wave6581__ST.cc' || echo '$(srcdir)/'`resid-fp/wave6581__ST.cc - -wave6581__ST.obj: resid-fp/wave6581__ST.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT wave6581__ST.obj -MD -MP -MF $(DEPDIR)/wave6581__ST.Tpo -c -o wave6581__ST.obj `if test -f 'resid-fp/wave6581__ST.cc'; then $(CYGPATH_W) 'resid-fp/wave6581__ST.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/wave6581__ST.cc'; fi` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/wave6581__ST.Tpo $(DEPDIR)/wave6581__ST.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/wave6581__ST.cc' object='wave6581__ST.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o wave6581__ST.obj `if test -f 'resid-fp/wave6581__ST.cc'; then $(CYGPATH_W) 'resid-fp/wave6581__ST.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/wave6581__ST.cc'; fi` - -wave8580_PS_.o: resid-fp/wave8580_PS_.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT wave8580_PS_.o -MD -MP -MF $(DEPDIR)/wave8580_PS_.Tpo -c -o wave8580_PS_.o `test -f 'resid-fp/wave8580_PS_.cc' || echo '$(srcdir)/'`resid-fp/wave8580_PS_.cc -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/wave8580_PS_.Tpo $(DEPDIR)/wave8580_PS_.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/wave8580_PS_.cc' object='wave8580_PS_.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o wave8580_PS_.o `test -f 'resid-fp/wave8580_PS_.cc' || echo '$(srcdir)/'`resid-fp/wave8580_PS_.cc - -wave8580_PS_.obj: resid-fp/wave8580_PS_.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT wave8580_PS_.obj -MD -MP -MF $(DEPDIR)/wave8580_PS_.Tpo -c -o wave8580_PS_.obj `if test -f 'resid-fp/wave8580_PS_.cc'; then $(CYGPATH_W) 'resid-fp/wave8580_PS_.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/wave8580_PS_.cc'; fi` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/wave8580_PS_.Tpo $(DEPDIR)/wave8580_PS_.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/wave8580_PS_.cc' object='wave8580_PS_.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o wave8580_PS_.obj `if test -f 'resid-fp/wave8580_PS_.cc'; then $(CYGPATH_W) 'resid-fp/wave8580_PS_.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/wave8580_PS_.cc'; fi` - -wave8580_PST.o: resid-fp/wave8580_PST.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT wave8580_PST.o -MD -MP -MF $(DEPDIR)/wave8580_PST.Tpo -c -o wave8580_PST.o `test -f 'resid-fp/wave8580_PST.cc' || echo '$(srcdir)/'`resid-fp/wave8580_PST.cc -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/wave8580_PST.Tpo $(DEPDIR)/wave8580_PST.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/wave8580_PST.cc' object='wave8580_PST.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o wave8580_PST.o `test -f 'resid-fp/wave8580_PST.cc' || echo '$(srcdir)/'`resid-fp/wave8580_PST.cc - -wave8580_PST.obj: resid-fp/wave8580_PST.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT wave8580_PST.obj -MD -MP -MF $(DEPDIR)/wave8580_PST.Tpo -c -o wave8580_PST.obj `if test -f 'resid-fp/wave8580_PST.cc'; then $(CYGPATH_W) 'resid-fp/wave8580_PST.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/wave8580_PST.cc'; fi` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/wave8580_PST.Tpo $(DEPDIR)/wave8580_PST.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/wave8580_PST.cc' object='wave8580_PST.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o wave8580_PST.obj `if test -f 'resid-fp/wave8580_PST.cc'; then $(CYGPATH_W) 'resid-fp/wave8580_PST.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/wave8580_PST.cc'; fi` - -wave8580_P_T.o: resid-fp/wave8580_P_T.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT wave8580_P_T.o -MD -MP -MF $(DEPDIR)/wave8580_P_T.Tpo -c -o wave8580_P_T.o `test -f 'resid-fp/wave8580_P_T.cc' || echo '$(srcdir)/'`resid-fp/wave8580_P_T.cc -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/wave8580_P_T.Tpo $(DEPDIR)/wave8580_P_T.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/wave8580_P_T.cc' object='wave8580_P_T.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o wave8580_P_T.o `test -f 'resid-fp/wave8580_P_T.cc' || echo '$(srcdir)/'`resid-fp/wave8580_P_T.cc - -wave8580_P_T.obj: resid-fp/wave8580_P_T.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT wave8580_P_T.obj -MD -MP -MF $(DEPDIR)/wave8580_P_T.Tpo -c -o wave8580_P_T.obj `if test -f 'resid-fp/wave8580_P_T.cc'; then $(CYGPATH_W) 'resid-fp/wave8580_P_T.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/wave8580_P_T.cc'; fi` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/wave8580_P_T.Tpo $(DEPDIR)/wave8580_P_T.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/wave8580_P_T.cc' object='wave8580_P_T.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o wave8580_P_T.obj `if test -f 'resid-fp/wave8580_P_T.cc'; then $(CYGPATH_W) 'resid-fp/wave8580_P_T.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/wave8580_P_T.cc'; fi` - -wave8580__ST.o: resid-fp/wave8580__ST.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT wave8580__ST.o -MD -MP -MF $(DEPDIR)/wave8580__ST.Tpo -c -o wave8580__ST.o `test -f 'resid-fp/wave8580__ST.cc' || echo '$(srcdir)/'`resid-fp/wave8580__ST.cc -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/wave8580__ST.Tpo $(DEPDIR)/wave8580__ST.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/wave8580__ST.cc' object='wave8580__ST.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o wave8580__ST.o `test -f 'resid-fp/wave8580__ST.cc' || echo '$(srcdir)/'`resid-fp/wave8580__ST.cc - -wave8580__ST.obj: resid-fp/wave8580__ST.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT wave8580__ST.obj -MD -MP -MF $(DEPDIR)/wave8580__ST.Tpo -c -o wave8580__ST.obj `if test -f 'resid-fp/wave8580__ST.cc'; then $(CYGPATH_W) 'resid-fp/wave8580__ST.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/wave8580__ST.cc'; fi` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/wave8580__ST.Tpo $(DEPDIR)/wave8580__ST.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/wave8580__ST.cc' object='wave8580__ST.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o wave8580__ST.obj `if test -f 'resid-fp/wave8580__ST.cc'; then $(CYGPATH_W) 'resid-fp/wave8580__ST.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/wave8580__ST.cc'; fi` - -wave.o: resid-fp/wave.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT wave.o -MD -MP -MF $(DEPDIR)/wave.Tpo -c -o wave.o `test -f 'resid-fp/wave.cc' || echo '$(srcdir)/'`resid-fp/wave.cc -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/wave.Tpo $(DEPDIR)/wave.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/wave.cc' object='wave.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o wave.o `test -f 'resid-fp/wave.cc' || echo '$(srcdir)/'`resid-fp/wave.cc - -wave.obj: resid-fp/wave.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT wave.obj -MD -MP -MF $(DEPDIR)/wave.Tpo -c -o wave.obj `if test -f 'resid-fp/wave.cc'; then $(CYGPATH_W) 'resid-fp/wave.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/wave.cc'; fi` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/wave.Tpo $(DEPDIR)/wave.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='resid-fp/wave.cc' object='wave.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o wave.obj `if test -f 'resid-fp/wave.cc'; then $(CYGPATH_W) 'resid-fp/wave.cc'; else $(CYGPATH_W) '$(srcdir)/resid-fp/wave.cc'; fi` - -.cpp.o: -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< - -.cpp.obj: -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - set x; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(PROGRAMS) $(SCRIPTS) -installdirs: - for dir in "$(DESTDIR)$(bindir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-binPROGRAMS clean-generic mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: install-binPROGRAMS - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-binPROGRAMS - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-generic ctags distclean distclean-compile \ - distclean-generic distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-binPROGRAMS \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-binPROGRAMS - - -../pcem: pcem - cp pcem .. - -amrefresh: - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/src/Makefile.mingw b/src/Makefile.mingw index e780126a3..c7850ce4a 100644 --- a/src/Makefile.mingw +++ b/src/Makefile.mingw @@ -1,56 +1,189 @@ -VPATH = . dosbox lzf resid-fp slirp -CPP = g++.exe -CC = gcc.exe -WINDRES = windres.exe -CFLAGS = -O3 -march=native -mtune=native -fbranch-probabilities -fvpt -fpeel-loops -ftracer -fomit-frame-pointer -ffast-math -msse -msse2 -msse3 -mssse3 -mfpmath=sse -mstackrealign -DFLAGS = -O3 -march=i686 -fomit-frame-pointer -msse2 -mstackrealign -OBJ = 386.o 386_dynarec.o 386_dynarec_ops.o 808x.o acer386sx.o acerm3a.o ali1429.o amstrad.o buslogic.o cdrom.o cdrom-ioctl.o cdrom-iso.o \ - cdrom-null.o codegen.o codegen_ops.o codegen_timing_486.o codegen_timing_686.o codegen_timing_pentium.o codegen_timing_winchip.o codegen_x86.o compaq.o config.o cpu.o dac.o \ - device.o disc.o disc_86f.o disc_fdi.o disc_imd.o disc_img.o disc_random.o disc_td0.o dma.o fdc.o fdc37c665.o fdc37c932fr.o fdd.o fdi2raw.o gameport.o hdd.o headland.o i430hx.o i430lx.o i430fx.o \ - i430nx.o i430vx.o i440fx.o ide.o intel.o intel_flash.o io.o jim.o joystick_ch_flightstick_pro.o joystick_standard.o joystick_sw_pad.o joystick_tm_fcs.o keyboard.o keyboard_amstrad.o keyboard_at.o \ - keyboard_olim24.o keyboard_pcjr.o keyboard_xt.o lpt.o mcr.o mem.o memregs.o mfm_at.o model.o mouse.o mouse_ps2.o \ - mouse_serial.o ne2000.o neat.o nethandler.o nmi.o nvr.o olivetti_m24.o opti495.o pc.o pc87306.o pci.o pic.o piix.o pit.o ppi.o ps1.o ps2.o rom.o rtc.o \ - scat.o scsi.o serial.o sis496.o sis85c471.o sio.o sound.o sound_ad1848.o sound_adlib.o sound_adlibgold.o sound_cms.o \ - sound_dbopl.o sound_emu8k.o sound_gus.o sound_mpu401_uart.o sound_opl.o sound_pas16.o sound_ps1.o sound_pssj.o sound_resid.o \ - sound_sb.o sound_sb_dsp.o sound_sn76489.o sound_speaker.o sound_ssi2001.o sound_wss.o sound_ym7128.o \ - soundopenal.o tandy_eeprom.o tandy_rom.o timer.o um8669f.o usb.o vid_ati_eeprom.o vid_ati_mach64.o vid_ati18800.o \ - vid_ati28800.o vid_ati68860_ramdac.o vid_bt485_ramdac.o vid_cga.o vid_cl_gd.o vid_cl_gd_blit.o vid_cl_ramdac.o vid_colorplus.o vid_ega.o vid_et4000.o \ - vid_et4000w32.o vid_hercules.o vid_herculesplus.o vid_icd2061.o vid_ics2595.o vid_incolor.o vid_mda.o vid_nv_riva128.o \ - vid_olivetti_m24.o vid_oti067.o vid_paradise.o vid_pc1512.o vid_pc1640.o vid_pc200.o \ - vid_pcjr.o vid_ps1_svga.o vid_s3.o vid_s3_virge.o vid_sdac_ramdac.o vid_stg_ramdac.o vid_svga.o \ - vid_svga_render.o vid_tandy.o vid_tandysl.o vid_tgui9440.o vid_tkd8001_ramdac.o vid_tvga.o vid_unk_ramdac.o \ - vid_vga.o vid_wy700.o vid_voodoo.o video.o w83877f.o wd76c10.o win.o win-config.o win-d3d.o win-d3d-fs.o win-ddraw.o \ - win-ddraw-fs.o win-ddraw-screenshot.o win-deviceconfig.o win-hdconf.o win-joystick.o win-joystickconfig.o win-keyboard.o win-midi.o win-mouse.o \ - win-status.o win-video.o x86seg.o x87.o xtide.o pc.res -DBOBJ = dbopl.o nukedopl.o vid_cga_comp.o -LZFOBJ = lzf_c.o lzf_d.o -SIDOBJ = convolve.o convolve-sse.o envelope.o extfilt.o filter.o pot.o sid.o voice.o wave6581__ST.o wave6581_P_T.o wave6581_PS_.o wave6581_PST.o wave8580__ST.o wave8580_P_T.o wave8580_PS_.o wave8580_PST.o wave.o -SLIRPOBJ = bootp.o ip_icmp.o misc.o socket.o tcp_timer.o cksum.o ip_input.o queue.o tcp_input.o tftp.o debug.o ip_output.o sbuf.o tcp_output.o udp.o if.o mbuf.o slirp.o tcp_subr.o +# +# 86Box A hypervisor and IBM PC system emulator that specializes in +# running old operating systems and software designed for IBM +# PC systems and compatibles from 1981 through fairly recent +# system designs based on the PCI bus. +# +# This file is part of the 86Box distribution. +# +# Modified Makefile for Win32 MinGW 32-bit environment. +# +# Version: @(#)Makefile.mingw 1.0.5 2017/05/05 +# +# Authors: Kotori, +# Fred N. van Kempen, +# Sarah Walker, +# Richard G., +# + +# Name of the executable. +PROG = 86Box + +# Various compile-time options. +# -DROM_TRACE=0xcd800 traces ROM access from segment C800 +# -DIO_TACE=0x66 traces I/O on port 0x66 +STUFF = + +# Add feature selections here. +# -DBUGGER adds the ISA BusBugger emulation. +EXTRAS = + +# Do we want a debugging build? +DEBUG = n -LIBS = -mwindows -lwinmm -lopenal.dll -lopenal -lddraw -ldinput8 -ldxguid -ld3d9 -ld3dx9 -lwsock32 -liphlpapi -lstdc++ -lpsapi -static-libstdc++ -static-libgcc -static -lwpcapdelay +######################################################################### +# Nothing should need changing from here on.. # +######################################################################### +VPATH = . dosbox lzf resid-fp slirp +CPP = g++.exe +CC = gcc.exe +WINDRES = windres.exe -86Box.exe: $(OBJ) $(DBOBJ) $(LZFOBJ) $(SIDOBJ) $(SLIRPOBJ) - $(CC) $(OBJ) $(DBOBJ) $(LZFOBJ) $(SIDOBJ) $(SLIRPOBJ) -o "86Box.exe" $(LIBS) - sleep 10 - strip "86Box.exe" - sleep 10 +OPTS = -DWIN32 $(EXTRAS) $(STUFF) +ifeq ($(DEBUG), y) +DFLAGS = -march=i686 -Og -ggdb -DDEBUG +else +DFLAGS = -march=native -mtune=native -O6 +UFLAGS = -march=i686 -O3 +endif +AFLAGS = -msse -msse2 -mfpmath=sse +CFLAGS = $(OPTS) $(DFLAGS) $(AFLAGS) \ + -fomit-frame-pointer -mstackrealign +RFLAGS = --input-format=rc -O coff -all : 86Box.exe -clean : - rm *.o - rm *.exe - rm *.res +MAINOBJ = pc.o config.o device.o timer.o dma.o io.o nmi.o pic.o \ + mca.o mcr.o pit.o ppi.o pci.o sio.o intel.o rom.o mem.o \ + memregs.o intel_flash.o rtc.o nvr.o ps2_nvr.o +CPUOBJ = cpu.o 386.o 386_dynarec.o 386_dynarec_ops.o 808x.o \ + codegen.o \ + codegen_ops.o codegen_timing_486.o \ + codegen_timing_686.o codegen_timing_pentium.o \ + codegen_timing_winchip.o codegen_x86.o \ + x86seg.o x87.o +SYSOBJ = model.o \ + headland.o \ + i430hx.o i430lx.o i430fx.o i430nx.o i430vx.o i440fx.o \ + neat.o \ + ali1429.o \ + opti495.o \ + scat.o \ + sis496.o \ + wd76c10.o \ + acer386sx.o acerm3a.o amstrad.o \ + compaq.o olivetti_m24.o jim.o ps1.o ps2.o ps2_mca.o \ + tandy_eeprom.o tandy_rom.o +DEVOBJ = bugger.o lpt.o serial.o \ + um8669f.o pc87306.o sis85c471.o w83877f.o \ + keyboard.o \ + keyboard_xt.o keyboard_at.o keyboard_pcjr.o \ + keyboard_amstrad.o keyboard_olim24.o \ + gameport.o \ + joystick_standard.o joystick_ch_flightstick_pro.o \ + joystick_sw_pad.o joystick_tm_fcs.o \ + mouse.o mouse_serial.o mouse_ps2.o mouse_bus.o \ + fdd.o fdc.o \ + fdc37c665.o fdc37c669.o fdc37c932fr.o fdi2raw.o \ + hdd.o hdd_esdi.o mfm_at.o mfm_xebec.o ide.o xtide.o piix.o scsi_hd.o \ + disc.o \ + disc_86f.o disc_fdi.o disc_imd.o disc_img.o \ + disc_random.o disc_td0.o \ + cdrom.o cdrom-ioctl.o cdrom-iso.o cdrom-null.o +USBOBJ = usb.o +NETOBJ = ne2000.o nethandler.o +SCSIOBJ = scsi.o scsi_buslogic.o scsi_aha154x.o +SNDOBJ = sound.o sound_speaker.o dac.o sound_ps1.o sound_pssj.o \ + sound_adlib.o sound_adlibgold.o sound_ad1848.o sound_sb.o \ + sound_sb_dsp.o sound_cms.o sound_dbopl.o sound_emu8k.o \ + sound_gus.o sound_opl.o sound_mpu401_uart.o sound_pas16.o \ + sound_resid.o sound_sn76489.o sound_ssi2001.o sound_wss.o \ + sound_ym7128.o soundopenal.o +VIDOBJ = video.o \ + vid_mda.o vid_cga.o vid_ega.o \ + vid_vga.o vid_svga.o vid_svga_render.o \ + vid_hercules.o vid_herculesplus.o vid_incolor.o \ + vid_colorplus.o \ + vid_genius.o \ + vid_s3.o vid_s3_virge.o \ + vid_et4000.o vid_et4000w32.o vid_icd2061.o \ + vid_oti067.o \ + vid_paradise.o \ + vid_tvga.o vid_tgui9440.o vid_tkd8001_ramdac.o \ + vid_ati_eeprom.o vid_ati18800.o vid_ati28800.o \ + vid_ati68860_ramdac.o vid_ati_mach64.o \ + vid_ics2595.o \ + vid_cl_gd.o vid_cl_gd_blit.o vid_cl_ramdac.o \ + vid_bt485_ramdac.o \ + vid_sdac_ramdac.o \ + vid_stg_ramdac.o \ + vid_unk_ramdac.o \ + vid_wy700.o \ + vid_nv_riva128.o \ + vid_voodoo.o \ + vid_pcjr.o vid_ps1_svga.o \ + vid_olivetti_m24.o \ + vid_pc1512.o vid_pc1640.o vid_pc200.o \ + vid_tandy.o vid_tandysl.o +WINOBJ = win.o \ + win-d3d.o win-d3d-fs.o \ + win-ddraw.o win-ddraw-fs.o win-ddraw-screenshot.o \ + win-language.o win-status.o win-video.o \ + win-keyboard.o win-mouse.o win-joystick.o win-midi.o \ + win-settings.o win-deviceconfig.o win-joystickconfig.o \ + 86Box.res +OBJ = $(MAINOBJ) $(CPUOBJ) $(SYSOBJ) $(DEVOBJ) $(USBOBJ) \ + $(NETOBJ) $(SCSIOBJ) $(SNDOBJ) $(VIDOBJ) $(WINOBJ) -%.o : %.c - $(CC) $(CFLAGS) -c $< +DBOBJ = dbopl.o nukedopl.o vid_cga_comp.o +LZFOBJ = lzf_c.o lzf_d.o +SIDOBJ = convolve.o convolve-sse.o envelope.o extfilt.o filter.o pot.o \ + sid.o voice.o wave6581__ST.o wave6581_P_T.o wave6581_PS_.o \ + wave6581_PST.o wave8580__ST.o wave8580_P_T.o wave8580_PS_.o \ + wave8580_PST.o wave.o +SLIRPOBJ= bootp.o ip_icmp.o misc.o socket.o tcp_timer.o cksum.o ip_input.o \ + queue.o tcp_input.o tftp.o debug.o ip_output.o sbuf.o tcp_output.o \ + udp.o if.o mbuf.o slirp.o tcp_subr.o -%.o : %.cc - $(CPP) $(CFLAGS) -c $< +LIBS = -mwindows -lcomctl32 -lwinmm -lopenal.dll -lopenal -lddraw \ + -ldinput8 -ldxguid -ld3d9 -ld3dx9 -lwsock32 -liphlpapi \ + -lstdc++ -lpsapi -static-libstdc++ -static-libgcc \ + -static -L. -lwpcapdelay -%.o : %.cpp - $(CPP) $(CFLAGS) -c $< -pc.res: pc.rc - $(WINDRES) $(RFLAGS) -i pc.rc --input-format=rc -o pc.res -O coff +# Build rules. +%.o: %.c + @echo $< + $(CC) $(CFLAGS) -c $< + +%.o: %.cc + @echo $< + @$(CPP) $(CFLAGS) -c $< + +%.o: %.cpp + @echo $< + @$(CPP) $(CFLAGS) -c $< + +$(PROG).exe: $(OBJ) $(DBOBJ) $(LZFOBJ) $(SIDOBJ) $(SLIRPOBJ) + @echo Linking $(PROG).exe .. + @$(CC) -o $(PROG).exe \ + $(OBJ) \ + $(DBOBJ) $(LZFOBJ) $(SIDOBJ) $(SLIRPOBJ) \ + $(LIBS) + +all: $(PROG).exe +ifeq ($(DEBUG), y) + strip $(PROG).exe +endif + +clean: + rm *.o + rm *.exe + rm *.res + +86Box.res: 86Box.rc + @echo Processing $< + @$(WINDRES) $(RFLAGS) -i 86Box.rc -o 86Box.res + + +# End of Makefile.mingw. diff --git a/src/Makefile.mingw64 b/src/Makefile.mingw64 index 2b285a556..c880ecaac 100644 --- a/src/Makefile.mingw64 +++ b/src/Makefile.mingw64 @@ -1,56 +1,189 @@ -VPATH = . dosbox lzf resid-fp slirp -CPP = g++.exe -CC = gcc.exe -WINDRES = windres.exe -CFLAGS = -O3 -march=native -mtune=native -fbranch-probabilities -fvpt -fpeel-loops -ftracer -fomit-frame-pointer -ffast-math -msse -msse2 -msse3 -mssse3 -mfpmath=sse -mstackrealign -DFLAGS = -O3 -fomit-frame-pointer -msse2 -mstackrealign -OBJ = 386.o 386_dynarec.o 386_dynarec_ops.o 808x.o acer386sx.o acerm3a.o ali1429.o amstrad.o buslogic.o cdrom.o cdrom-ioctl.o cdrom-iso.o \ - cdrom-null.o codegen.o codegen_ops.o codegen_timing_486.o codegen_timing_686.o codegen_timing_pentium.o codegen_timing_winchip.o codegen_x86-64.o compaq.o config.o cpu.o dac.o \ - device.o disc.o disc_86f.o disc_fdi.o disc_imd.o disc_img.o disc_random.o disc_td0.o dma.o fdc.o fdc37c665.o fdc37c932fr.o fdd.o fdi2raw.o gameport.o hdd.o headland.o i430hx.o i430lx.o i430fx.o \ - i430nx.o i430vx.o i440fx.o ide.o intel.o intel_flash.o io.o jim.o joystick_ch_flightstick_pro.o joystick_standard.o joystick_sw_pad.o joystick_tm_fcs.o keyboard.o keyboard_amstrad.o keyboard_at.o \ - keyboard_olim24.o keyboard_pcjr.o keyboard_xt.o lpt.o mcr.o mem.o memregs.o mfm_at.o model.o mouse.o mouse_ps2.o \ - mouse_serial.o ne2000.o neat.o nethandler.o nmi.o nvr.o olivetti_m24.o opti495.o pc.o pc87306.o pci.o pic.o piix.o pit.o ppi.o ps1.o ps2.o rom.o rtc.o \ - scat.o scsi.o serial.o sis496.o sis85c471.o sio.o sound.o sound_ad1848.o sound_adlib.o sound_adlibgold.o sound_cms.o \ - sound_dbopl.o sound_emu8k.o sound_gus.o sound_mpu401_uart.o sound_opl.o sound_pas16.o sound_ps1.o sound_pssj.o sound_resid.o \ - sound_sb.o sound_sb_dsp.o sound_sn76489.o sound_speaker.o sound_ssi2001.o sound_wss.o sound_ym7128.o \ - soundopenal.o tandy_eeprom.o tandy_rom.o timer.o um8669f.o usb.o vid_ati_eeprom.o vid_ati_mach64.o vid_ati18800.o \ - vid_ati28800.o vid_ati68860_ramdac.o vid_bt485_ramdac.o vid_cga.o vid_cl_gd.o vid_cl_gd_blit.o vid_cl_ramdac.o vid_colorplus.o vid_ega.o vid_et4000.o \ - vid_et4000w32.o vid_hercules.o vid_herculesplus.o vid_icd2061.o vid_ics2595.o vid_incolor.o vid_mda.o vid_nv_riva128.o \ - vid_olivetti_m24.o vid_oti067.o vid_paradise.o vid_pc1512.o vid_pc1640.o vid_pc200.o \ - vid_pcjr.o vid_ps1_svga.o vid_s3.o vid_s3_virge.o vid_sdac_ramdac.o vid_stg_ramdac.o vid_svga.o \ - vid_svga_render.o vid_tandy.o vid_tandysl.o vid_tgui9440.o vid_tkd8001_ramdac.o vid_tvga.o vid_unk_ramdac.o \ - vid_vga.o vid_wy700.o vid_voodoo.o video.o w83877f.o wd76c10.o win.o win-config.o win-d3d.o win-d3d-fs.o win-ddraw.o \ - win-ddraw-fs.o win-ddraw-screenshot.o win-deviceconfig.o win-hdconf.o win-joystick.o win-joystickconfig.o win-keyboard.o win-midi.o win-mouse.o \ - win-status.o win-video.o x86seg.o x87.o xtide.o pc.res -DBOBJ = dbopl.o nukedopl.o vid_cga_comp.o -LZFOBJ = lzf_c.o lzf_d.o -SIDOBJ = convolve.o convolve-sse.o envelope.o extfilt.o filter.o pot.o sid.o voice.o wave6581__ST.o wave6581_P_T.o wave6581_PS_.o wave6581_PST.o wave8580__ST.o wave8580_P_T.o wave8580_PS_.o wave8580_PST.o wave.o -SLIRPOBJ = bootp.o ip_icmp.o misc.o socket.o tcp_timer.o cksum.o ip_input.o queue.o tcp_input.o tftp.o debug.o ip_output.o sbuf.o tcp_output.o udp.o if.o mbuf.o slirp.o tcp_subr.o +# +# 86Box A hypervisor and IBM PC system emulator that specializes in +# running old operating systems and software designed for IBM +# PC systems and compatibles from 1981 through fairly recent +# system designs based on the PCI bus. +# +# This file is part of the 86Box distribution. +# +# Modified Makefile for Win32 MinGW 32-bit environment. +# +# Version: @(#)Makefile.mingw64 1.0.0 2017/05/05 +# +# Authors: Kotori, +# Fred N. van Kempen, +# Sarah Walker, +# Richard G., +# + +# Name of the executable. +PROG = 86Box64 + +# Various compile-time options. +# -DROM_TRACE=0xcd800 traces ROM access from segment C800 +# -DIO_TACE=0x66 traces I/O on port 0x66 +STUFF = + +# Add feature selections here. +# -DBUGGER adds the ISA BusBugger emulation. +EXTRAS = + +# Do we want a debugging build? +DEBUG = n -LIBS = -mwindows -lwinmm -lopenal -lddraw -ldinput8 -ldxguid -ld3d9 -ld3dx9 -lwsock32 -liphlpapi -lstdc++ -lpsapi -static-libstdc++ -static-libgcc -static -lopenal.dll -lgcov -lPacket -lwpcapdelay +######################################################################### +# Nothing should need changing from here on.. # +######################################################################### +VPATH = . dosbox lzf resid-fp slirp +CPP = g++.exe +CC = gcc.exe +WINDRES = windres.exe -86Box64.exe: $(OBJ) $(DBOBJ) $(LZFOBJ) $(SIDOBJ) $(SLIRPOBJ) - $(CC) $(OBJ) $(DBOBJ) $(LZFOBJ) $(SIDOBJ) $(SLIRPOBJ) -o "86Box64.exe" $(LIBS) - sleep 10 - strip "86Box64.exe" - sleep 10 +OPTS = -DWIN32 $(EXTRAS) $(STUFF) +ifeq ($(DEBUG), y) +DFLAGS = -march=i686 -Og -ggdb -DDEBUG +else +DFLAGS = -march=native -mtune=native -O6 +UFLAGS = -O3 +endif +AFLAGS = -msse -msse2 -mfpmath=sse +CFLAGS = $(OPTS) $(DFLAGS) $(AFLAGS) \ + -fomit-frame-pointer -mstackrealign +RFLAGS = --input-format=rc -O coff -all : 86Box64.exe -clean : - rm *.o - rm *.exe - rm *.res +MAINOBJ = pc.o config.o device.o timer.o dma.o io.o nmi.o pic.o \ + mca.o mcr.o pit.o ppi.o pci.o sio.o intel.o rom.o mem.o \ + memregs.o intel_flash.o rtc.o nvr.o ps2_nvr.o +CPUOBJ = cpu.o 386.o 386_dynarec.o 386_dynarec_ops.o 808x.o \ + codegen.o \ + codegen_ops.o codegen_timing_486.o \ + codegen_timing_686.o codegen_timing_pentium.o \ + codegen_timing_winchip.o codegen_x86-64.o \ + x86seg.o x87.o +SYSOBJ = model.o \ + headland.o \ + i430hx.o i430lx.o i430fx.o i430nx.o i430vx.o i440fx.o \ + neat.o \ + ali1429.o \ + opti495.o \ + scat.o \ + sis496.o \ + wd76c10.o \ + acer386sx.o acerm3a.o amstrad.o \ + compaq.o olivetti_m24.o jim.o ps1.o ps2.o ps2_mca.o \ + tandy_eeprom.o tandy_rom.o +DEVOBJ = bugger.o lpt.o serial.o \ + um8669f.o pc87306.o sis85c471.o w83877f.o \ + keyboard.o \ + keyboard_xt.o keyboard_at.o keyboard_pcjr.o \ + keyboard_amstrad.o keyboard_olim24.o \ + gameport.o \ + joystick_standard.o joystick_ch_flightstick_pro.o \ + joystick_sw_pad.o joystick_tm_fcs.o \ + mouse.o mouse_serial.o mouse_ps2.o mouse_bus.o \ + fdd.o fdc.o \ + fdc37c665.o fdc37c669.o fdc37c932fr.o fdi2raw.o \ + hdd.o hdd_esdi.o mfm_at.o mfm_xebec.o ide.o xtide.o piix.o scsi_hd.o \ + disc.o \ + disc_86f.o disc_fdi.o disc_imd.o disc_img.o \ + disc_random.o disc_td0.o \ + cdrom.o cdrom-ioctl.o cdrom-iso.o cdrom-null.o +USBOBJ = usb.o +NETOBJ = ne2000.o nethandler.o +SCSIOBJ = scsi.o scsi_buslogic.o scsi_aha154x.o +SNDOBJ = sound.o sound_speaker.o dac.o sound_ps1.o sound_pssj.o \ + sound_adlib.o sound_adlibgold.o sound_ad1848.o sound_sb.o \ + sound_sb_dsp.o sound_cms.o sound_dbopl.o sound_emu8k.o \ + sound_gus.o sound_opl.o sound_mpu401_uart.o sound_pas16.o \ + sound_resid.o sound_sn76489.o sound_ssi2001.o sound_wss.o \ + sound_ym7128.o soundopenal.o +VIDOBJ = video.o \ + vid_mda.o vid_cga.o vid_ega.o \ + vid_vga.o vid_svga.o vid_svga_render.o \ + vid_hercules.o vid_herculesplus.o vid_incolor.o \ + vid_colorplus.o \ + vid_genius.o \ + vid_s3.o vid_s3_virge.o \ + vid_et4000.o vid_et4000w32.o vid_icd2061.o \ + vid_oti067.o \ + vid_paradise.o \ + vid_tvga.o vid_tgui9440.o vid_tkd8001_ramdac.o \ + vid_ati_eeprom.o vid_ati18800.o vid_ati28800.o \ + vid_ati68860_ramdac.o vid_ati_mach64.o \ + vid_ics2595.o \ + vid_cl_gd.o vid_cl_gd_blit.o vid_cl_ramdac.o \ + vid_bt485_ramdac.o \ + vid_sdac_ramdac.o \ + vid_stg_ramdac.o \ + vid_unk_ramdac.o \ + vid_wy700.o \ + vid_nv_riva128.o \ + vid_voodoo.o \ + vid_pcjr.o vid_ps1_svga.o \ + vid_olivetti_m24.o \ + vid_pc1512.o vid_pc1640.o vid_pc200.o \ + vid_tandy.o vid_tandysl.o +WINOBJ = win.o \ + win-d3d.o win-d3d-fs.o \ + win-ddraw.o win-ddraw-fs.o win-ddraw-screenshot.o \ + win-language.o win-status.o win-video.o \ + win-keyboard.o win-mouse.o win-joystick.o win-midi.o \ + win-settings.o win-deviceconfig.o win-joystickconfig.o \ + 86Box.res +OBJ = $(MAINOBJ) $(CPUOBJ) $(SYSOBJ) $(DEVOBJ) $(USBOBJ) \ + $(NETOBJ) $(SCSIOBJ) $(SNDOBJ) $(VIDOBJ) $(WINOBJ) -%.o : %.c - $(CC) $(CFLAGS) -c $< +DBOBJ = dbopl.o nukedopl.o vid_cga_comp.o +LZFOBJ = lzf_c.o lzf_d.o +SIDOBJ = convolve.o convolve-sse.o envelope.o extfilt.o filter.o pot.o \ + sid.o voice.o wave6581__ST.o wave6581_P_T.o wave6581_PS_.o \ + wave6581_PST.o wave8580__ST.o wave8580_P_T.o wave8580_PS_.o \ + wave8580_PST.o wave.o +SLIRPOBJ= bootp.o ip_icmp.o misc.o socket.o tcp_timer.o cksum.o ip_input.o \ + queue.o tcp_input.o tftp.o debug.o ip_output.o sbuf.o tcp_output.o \ + udp.o if.o mbuf.o slirp.o tcp_subr.o -%.o : %.cc - $(CPP) $(CFLAGS) -c $< +LIBS = -mwindows -lcomctl32 -lwinmm -lopenal.dll -lopenal -lddraw \ + -ldinput8 -ldxguid -ld3d9 -ld3dx9 -lwsock32 -liphlpapi \ + -lstdc++ -lpsapi -static-libstdc++ -static-libgcc \ + -static -L. -lwpcapdelay -%.o : %.cpp - $(CPP) $(CFLAGS) -c $< -pc.res: pc.rc - $(WINDRES) $(RFLAGS) -i pc.rc --input-format=rc -o pc.res -O coff +# Build rules. +%.o: %.c + @echo $< + $(CC) $(CFLAGS) -c $< + +%.o: %.cc + @echo $< + @$(CPP) $(CFLAGS) -c $< + +%.o: %.cpp + @echo $< + @$(CPP) $(CFLAGS) -c $< + +$(PROG).exe: $(OBJ) $(DBOBJ) $(LZFOBJ) $(SIDOBJ) $(SLIRPOBJ) + @echo Linking $(PROG).exe .. + @$(CC) -o $(PROG).exe \ + $(OBJ) \ + $(DBOBJ) $(LZFOBJ) $(SIDOBJ) $(SLIRPOBJ) \ + $(LIBS) + +all: $(PROG).exe +ifeq ($(DEBUG), y) + strip $(PROG).exe +endif + +clean: + rm *.o + rm *.exe + rm *.res + +86Box.res: 86Box.rc + @echo Processing $< + @$(WINDRES) $(RFLAGS) -i 86Box.rc -o 86Box.res + + +# End of Makefile.mingw. diff --git a/src/ali1429.c b/src/ali1429.c index d01eaf863..f1fa8fa3f 100644 --- a/src/ali1429.c +++ b/src/ali1429.c @@ -46,14 +46,11 @@ static void ali1429_recalc() void ali1429_write(uint16_t port, uint8_t val, void *priv) { - int c; - if (!(port & 1)) ali1429_index = val; else { ali1429_regs[ali1429_index] = val; -// pclog("ALI1429 write %02X %02X %04X:%04X %i\n",ali1429_index,val,CS,pc,ins); switch (ali1429_index) { case 0x13: diff --git a/src/ali1429.h b/src/ali1429.h index 83362e746..baea23a44 100644 --- a/src/ali1429.h +++ b/src/ali1429.h @@ -2,3 +2,4 @@ see COPYING for more details */ void ali1429_init(); +void ali1429_reset(); diff --git a/src/amstrad.c b/src/amstrad.c index 4c728ff0f..c1f0ef763 100644 --- a/src/amstrad.c +++ b/src/amstrad.c @@ -1,3 +1,4 @@ +#include #include "ibm.h" #include "io.h" #include "keyboard.h" @@ -58,7 +59,7 @@ typedef struct mouse_amstrad_t int oldb; } mouse_amstrad_t; -static void mouse_amstrad_poll(int x, int y, int z, int b, void *p) +static uint8_t mouse_amstrad_poll(int x, int y, int z, int b, void *p) { mouse_amstrad_t *mouse = (mouse_amstrad_t *)p; @@ -75,6 +76,8 @@ static void mouse_amstrad_poll(int x, int y, int z, int b, void *p) keyboard_send(0xfd); mouse->oldb = b; + + return(0); } static void *mouse_amstrad_init() @@ -95,10 +98,11 @@ static void mouse_amstrad_close(void *p) mouse_t mouse_amstrad = { "Amstrad mouse", + "amstrad", + MOUSE_TYPE_AMSTRAD, mouse_amstrad_init, mouse_amstrad_close, - mouse_amstrad_poll, - MOUSE_TYPE_AMSTRAD + mouse_amstrad_poll }; void amstrad_init() diff --git a/src/bswap.h b/src/bswap.h index f3cfe6a37..a1f2f8052 100644 --- a/src/bswap.h +++ b/src/bswap.h @@ -4,117 +4,110 @@ #ifndef BSWAP_H #define BSWAP_H -//#include "config-host.h" - -#include +#include #ifdef HAVE_BYTESWAP_H #include #else +# define bswap_16(x) \ + ( \ + ((uint16_t)( \ + (((uint16_t)(x) & (uint16_t)0x00ffU) << 8) | \ + (((uint16_t)(x) & (uint16_t)0xff00U) >> 8) )) \ + ) -#define bswap_16(x) \ -({ \ - uint16_t __x = (x); \ - ((uint16_t)( \ - (((uint16_t)(__x) & (uint16_t)0x00ffU) << 8) | \ - (((uint16_t)(__x) & (uint16_t)0xff00U) >> 8) )); \ -}) +# define bswap_32(x) \ + ( \ + ((uint32_t)( \ + (((uint32_t)(x) & (uint32_t)0x000000ffUL) << 24) | \ + (((uint32_t)(x) & (uint32_t)0x0000ff00UL) << 8) | \ + (((uint32_t)(x) & (uint32_t)0x00ff0000UL) >> 8) | \ + (((uint32_t)(x) & (uint32_t)0xff000000UL) >> 24) )) \ + ) -#define bswap_32(x) \ -({ \ - uint32_t __x = (x); \ - ((uint32_t)( \ - (((uint32_t)(__x) & (uint32_t)0x000000ffUL) << 24) | \ - (((uint32_t)(__x) & (uint32_t)0x0000ff00UL) << 8) | \ - (((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >> 8) | \ - (((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) )); \ -}) +# define bswap_64(x) \ + ( \ + ((uint64_t)( \ + (uint64_t)(((uint64_t)(x) & (uint64_t)0x00000000000000ffULL) << 56) | \ + (uint64_t)(((uint64_t)(x) & (uint64_t)0x000000000000ff00ULL) << 40) | \ + (uint64_t)(((uint64_t)(x) & (uint64_t)0x0000000000ff0000ULL) << 24) | \ + (uint64_t)(((uint64_t)(x) & (uint64_t)0x00000000ff000000ULL) << 8) | \ + (uint64_t)(((uint64_t)(x) & (uint64_t)0x000000ff00000000ULL) >> 8) | \ + (uint64_t)(((uint64_t)(x) & (uint64_t)0x0000ff0000000000ULL) >> 24) | \ + (uint64_t)(((uint64_t)(x) & (uint64_t)0x00ff000000000000ULL) >> 40) | \ + (uint64_t)(((uint64_t)(x) & (uint64_t)0xff00000000000000ULL) >> 56) )) \ + ) +#endif /*HAVE_BYTESWAP_H*/ -#define bswap_64(x) \ -({ \ - uint64_t __x = (x); \ - ((uint64_t)( \ - (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000000000ffULL) << 56) | \ - (uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000000000ff00ULL) << 40) | \ - (uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000000000ff0000ULL) << 24) | \ - (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000ff000000ULL) << 8) | \ - (uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000ff00000000ULL) >> 8) | \ - (uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000ff0000000000ULL) >> 24) | \ - (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00ff000000000000ULL) >> 40) | \ - (uint64_t)(((uint64_t)(__x) & (uint64_t)0xff00000000000000ULL) >> 56) )); \ -}) - -#endif /* !HAVE_BYTESWAP_H */ - -static inline uint16_t bswap16(uint16_t x) +static __inline uint16_t bswap16(uint16_t x) { return bswap_16(x); } -static inline uint32_t bswap32(uint32_t x) +static __inline uint32_t bswap32(uint32_t x) { return bswap_32(x); } -static inline uint64_t bswap64(uint64_t x) +static __inline uint64_t bswap64(uint64_t x) { return bswap_64(x); } -static inline void bswap16s(uint16_t *s) +static __inline void bswap16s(uint16_t *s) { *s = bswap16(*s); } -static inline void bswap32s(uint32_t *s) +static __inline void bswap32s(uint32_t *s) { *s = bswap32(*s); } -static inline void bswap64s(uint64_t *s) +static __inline void bswap64s(uint64_t *s) { *s = bswap64(*s); } #if defined(WORDS_BIGENDIAN) -#define be_bswap(v, size) (v) -#define le_bswap(v, size) bswap ## size(v) -#define be_bswaps(v, size) -#define le_bswaps(p, size) *p = bswap ## size(*p); +# define be_bswap(v, size) (v) +# define le_bswap(v, size) bswap ## size(v) +# define be_bswaps(v, size) +# define le_bswaps(p, size) *p = bswap ## size(*p); #else -#define le_bswap(v, size) (v) -#define be_bswap(v, size) bswap ## size(v) -#define le_bswaps(v, size) -#define be_bswaps(p, size) *p = bswap ## size(*p); +# define le_bswap(v, size) (v) +# define be_bswap(v, size) bswap ## size(v) +# define le_bswaps(v, size) +# define be_bswaps(p, size) *p = bswap ## size(*p); #endif #define CPU_CONVERT(endian, size, type)\ -static inline type endian ## size ## _to_cpu(type v)\ +static __inline type endian ## size ## _to_cpu(type v)\ {\ return endian ## _bswap(v, size);\ }\ \ -static inline type cpu_to_ ## endian ## size(type v)\ +static __inline type cpu_to_ ## endian ## size(type v)\ {\ return endian ## _bswap(v, size);\ }\ \ -static inline void endian ## size ## _to_cpus(type *p)\ +static __inline void endian ## size ## _to_cpus(type *p)\ {\ endian ## _bswaps(p, size)\ }\ \ -static inline void cpu_to_ ## endian ## size ## s(type *p)\ +static __inline void cpu_to_ ## endian ## size ## s(type *p)\ {\ endian ## _bswaps(p, size)\ }\ \ -static inline type endian ## size ## _to_cpup(const type *p)\ +static __inline type endian ## size ## _to_cpup(const type *p)\ {\ return endian ## size ## _to_cpu(*p);\ }\ \ -static inline void cpu_to_ ## endian ## size ## w(type *p, type v)\ +static __inline void cpu_to_ ## endian ## size ## w(type *p, type v)\ {\ *p = cpu_to_ ## endian ## size(v);\ } @@ -141,7 +134,7 @@ CPU_CONVERT(le, 64, uint64_t) #else -static inline void cpu_to_le16wu(uint16_t *p, uint16_t v) +static __inline void cpu_to_le16wu(uint16_t *p, uint16_t v) { uint8_t *p1 = (uint8_t *)p; @@ -149,7 +142,7 @@ static inline void cpu_to_le16wu(uint16_t *p, uint16_t v) p1[1] = v >> 8; } -static inline void cpu_to_le32wu(uint32_t *p, uint32_t v) +static __inline void cpu_to_le32wu(uint32_t *p, uint32_t v) { uint8_t *p1 = (uint8_t *)p; @@ -159,19 +152,19 @@ static inline void cpu_to_le32wu(uint32_t *p, uint32_t v) p1[3] = v >> 24; } -static inline uint16_t le16_to_cpupu(const uint16_t *p) +static __inline uint16_t le16_to_cpupu(const uint16_t *p) { const uint8_t *p1 = (const uint8_t *)p; return p1[0] | (p1[1] << 8); } -static inline uint32_t le32_to_cpupu(const uint32_t *p) +static __inline uint32_t le32_to_cpupu(const uint32_t *p) { const uint8_t *p1 = (const uint8_t *)p; return p1[0] | (p1[1] << 8) | (p1[2] << 16) | (p1[3] << 24); } -static inline void cpu_to_be16wu(uint16_t *p, uint16_t v) +static __inline void cpu_to_be16wu(uint16_t *p, uint16_t v) { uint8_t *p1 = (uint8_t *)p; @@ -179,7 +172,7 @@ static inline void cpu_to_be16wu(uint16_t *p, uint16_t v) p1[1] = v; } -static inline void cpu_to_be32wu(uint32_t *p, uint32_t v) +static __inline void cpu_to_be32wu(uint32_t *p, uint32_t v) { uint8_t *p1 = (uint8_t *)p; diff --git a/src/bugger.c b/src/bugger.c new file mode 100644 index 000000000..d9a79aafa --- /dev/null +++ b/src/bugger.c @@ -0,0 +1,325 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Implementation of the ISA Bus (de)Bugger expansion card + * sold as a DIY kit in the late 1980's in The Netherlands. + * This card was a assemble-yourself 8bit ISA addon card for + * PC and AT systems that had several tools to aid in low- + * level debugging (mostly for faulty BIOSes, bootloaders + * and system kernels...) + * + * The standard version had a total of 16 LEDs (8 RED, plus + * 8 GREEN), two 7-segment displays and one 8-position DIP + * switch block on board for use as debugging tools. + * + * The "Plus" version, added an extra 2 7-segment displays, + * as well as a very simple RS-232 serial interface that + * could be used as a mini-console terminal. + * + * Two I/O ports were used; one for control, at offset 0 in + * I/O space, and one for data, at offset 1 in I/O space. + * Both registers could be read from and written to. Although + * the author has a vague memory of a DIP switch to set the + * board's I/O address, comments in old software seems to + * indicate that it was actually fixed to 0x7A (and 0x7B.) + * + * A READ on the data register always returned the actual + * state of the DIP switch. Writing data to the LEDs was done + * in two steps.. first, the block number (RED or GREEN) was + * written to the CTRL register, and then the actual LED data + * was written to the DATA register. Likewise, data for the + * 7-segment displays was written. + * + * The serial port was a bit different, and its operation is + * not verified, but two extra bits in the control register + * were used to set up parameters, and also the actual data + * input and output. + * + * TODO: Still have to implement the RS232 Serial Port Parameters + * configuration register (CTRL_SPCFG bit set) but have to + * remember that stuff first... + * + * Version: @(#)bugger.c 1.0.3 2017/04/07 + * + * Author: Fred N. van Kempen, + * Copyright 1989-2017 Fred N. van Kempen. + */ +#include "ibm.h" +#include "io.h" +#include "bugger.h" + + +/* BugBugger registers. */ +#define BUG_CTRL 0 +# define CTRL_RLED 0x00 /* write to the RED LED block */ +# define CTRL_GLED 0x01 /* write to the GREEN LED block */ +# define CTRL_SEG1 0x02 /* write to the RIGHT 7SEG displays */ +# define CTRL_SEG2 0x04 /* write to the LEFT 7SEG displays */ +# define CTRL_SPORT 0x20 /* enable the serial port */ +# define CTRL_SPCFG 0x40 /* set up the serial port */ +# define CTRL_INIT 0x80 /* enable and reset the card */ +# define CTRL_RESET 0xff /* this resets the board */ +#define BUG_DATA 1 + + +static uint8_t bug_ctrl, /* control register */ + bug_data, /* data register */ + bug_ledr, bug_ledg, /* RED and GREEN LEDs */ + bug_seg1, bug_seg2, /* LEFT and RIGHT 7SEG displays */ + bug_spcfg; /* serial port configuration */ +# define FIFO_LEN 256 +static uint8_t bug_buff[FIFO_LEN], /* serial port data buffer */ + *bug_bptr; +# define UISTR_LEN 24 +static char bug_str[UISTR_LEN]; /* UI output string */ + + +extern void set_bugui(char *__str); + + +/* Update the system's UI with the actual Bugger status. */ +static void +bug_setui(void) +{ + /* Format all current info in a string. */ + sprintf(bug_str, "%02X:%02X %c%c%c%c%c%c%c%c-%c%c%c%c%c%c%c%c", + bug_seg2, bug_seg1, + (bug_ledg&0x80)?'G':'g', (bug_ledg&0x40)?'G':'g', + (bug_ledg&0x20)?'G':'g', (bug_ledg&0x10)?'G':'g', + (bug_ledg&0x08)?'G':'g', (bug_ledg&0x04)?'G':'g', + (bug_ledg&0x02)?'G':'g', (bug_ledg&0x01)?'G':'g', + (bug_ledr&0x80)?'R':'r', (bug_ledr&0x40)?'R':'r', + (bug_ledr&0x20)?'R':'r', (bug_ledr&0x10)?'R':'r', + (bug_ledr&0x08)?'R':'r', (bug_ledr&0x04)?'R':'r', + (bug_ledr&0x02)?'R':'r', (bug_ledr&0x01)?'R':'r'); + +#if 0 + /* Send formatted string to the UI. */ + set_bugui(bug_str); +#endif +} + + +/* Flush the serial port. */ +static void +bug_spflsh(void) +{ + *bug_bptr = '\0'; + pclog("BUGGER- serial port [%s]\n", bug_buff); + bug_bptr = bug_buff; +} + + +/* Handle a write to the Serial Port Data register. */ +static void +bug_wsport(uint8_t val) +{ + uint8_t old = bug_ctrl; + + /* Clear the SPORT bit to indicate we are busy. */ + bug_ctrl &= ~CTRL_SPORT; + + /* Delay while processing byte.. */ + if (bug_bptr == &bug_buff[FIFO_LEN-1]) { + /* Buffer full, gotta flush. */ + bug_spflsh(); + } + + /* Write (store) the byte. */ + *bug_bptr++ = val; + + /* Restore the SPORT bit. */ + bug_ctrl |= (old & CTRL_SPORT); + + pclog("BUGGER- sport %02x\n", val); +} + + +/* Handle a write to the Serial Port Configuration register. */ +static void +bug_wspcfg(uint8_t val) +{ + bug_spcfg = val; + + pclog("BUGGER- spcfg %02x\n", bug_spcfg); +} + + +/* Handle a write to the control register. */ +static void +bug_wctrl(uint8_t val) +{ + if (val == CTRL_RESET) { + /* User wants us to reset. */ + bug_ctrl = CTRL_INIT; + bug_spcfg = 0x00; + bug_bptr = NULL; + } else { + /* If turning off the serial port, flush it. */ + if ((bug_ctrl & CTRL_SPORT) && !(val & CTRL_SPORT)) + bug_spflsh(); + + /* FIXME: did they do this using an XOR of operation bits? --FvK */ + + if (val & CTRL_SPCFG) { + /* User wants to configure the serial port. */ + bug_ctrl &= ~(CTRL_SPORT|CTRL_SEG2|CTRL_SEG1|CTRL_GLED); + bug_ctrl |= CTRL_SPCFG; + } else if (val & CTRL_SPORT) { + /* User wants to talk to the serial port. */ + bug_ctrl &= ~(CTRL_SPCFG|CTRL_SEG2|CTRL_SEG1|CTRL_GLED); + bug_ctrl |= CTRL_SPORT; + if (bug_bptr == NULL) + bug_bptr = bug_buff; + } else if (val & CTRL_SEG2) { + /* User selected SEG2 (LEFT, Plus only) for output. */ + bug_ctrl &= ~(CTRL_SPCFG|CTRL_SPORT|CTRL_SEG1|CTRL_GLED); + bug_ctrl |= CTRL_SEG2; + } else if (val & CTRL_SEG1) { + /* User selected SEG1 (RIGHT) for output. */ + bug_ctrl &= ~(CTRL_SPCFG|CTRL_SPORT|CTRL_SEG2|CTRL_GLED); + bug_ctrl |= CTRL_SEG1; + } else if (val & CTRL_GLED) { + /* User selected the GREEN LEDs for output. */ + bug_ctrl &= ~(CTRL_SPCFG|CTRL_SPORT|CTRL_SEG2|CTRL_SEG1); + bug_ctrl |= CTRL_GLED; + } else { + /* User selected the RED LEDs for output. */ + bug_ctrl &= + ~(CTRL_SPCFG|CTRL_SPORT|CTRL_SEG2|CTRL_SEG1|CTRL_GLED); + } + } + + /* Update the UI with active settings. */ + pclog("BUGGER- ctrl %02x\n", bug_ctrl); + bug_setui(); +} + + +/* Handle a write to the data register. */ +static void +bug_wdata(uint8_t val) +{ + bug_data = val; + + if (bug_ctrl & CTRL_SPCFG) + bug_wspcfg(val); + else if (bug_ctrl & CTRL_SPORT) + bug_wsport(val); + else { + if (bug_ctrl & CTRL_SEG2) + bug_seg2 = val; + else if (bug_ctrl & CTRL_SEG1) + bug_seg1 = val; + else if (bug_ctrl & CTRL_GLED) + bug_ledg = val; + else + bug_ledr = val; + + pclog("BUGGER- data %02x\n", bug_data); + } + + /* Update the UI with active settings. */ + bug_setui(); +} + + +/* Reset the ISA BusBugger controller. */ +static void +bug_reset(void) +{ + /* Clear the data register. */ + bug_data = 0x00; + + /* Clear the RED and GREEN LEDs. */ + bug_ledr = 0x00; bug_ledg = 0x00; + + /* Clear both 7SEG displays. */ + bug_seg1 = 0x00; bug_seg2 = 0x00; + + /* Reset the control register (updates UI.) */ + bug_wctrl(CTRL_RESET); +} + + +/* Handle a WRITE operation to one of our registers. */ +static void +bug_write(uint16_t port, uint8_t val, void *priv) +{ + switch (port-BUGGER_ADDR) { + case BUG_CTRL: /* control register */ + if (val == CTRL_RESET) { + /* Perform a full reset. */ + bug_reset(); + } else if (bug_ctrl & CTRL_INIT) { + /* Only allow writes if initialized. */ + bug_wctrl(val); + } + break; + + case BUG_DATA: /* data register */ + if (bug_ctrl & CTRL_INIT) { + bug_wdata(val); + } + break; + + } +} + + +/* Handle a READ operation from one of our registers. */ +static uint8_t +bug_read(uint16_t port, void *priv) +{ + uint8_t ret = 0xff; + + if (bug_ctrl & CTRL_INIT) switch (port-BUGGER_ADDR) { + case BUG_CTRL: /* control register */ + ret = bug_ctrl; + break; + + case BUG_DATA: /* data register */ + if (bug_ctrl & CTRL_SPCFG) { + ret = bug_spcfg; + } else if (bug_ctrl & CTRL_SPORT) { + ret = 0x00; /* input not supported */ + } else { + /* Just read the DIP switch. */ + ret = bug_data; + } + break; + + default: + break; + } + + return(ret); +} + + +/* Initialize the ISA BusBugger emulator. */ +void +bugger_init(void) +{ + pclog("ISA Bus (de)Bugger, I/O=%04x\n", BUGGER_ADDR); + + /* Initialize local registers. */ + bug_reset(); + + io_sethandler(BUGGER_ADDR, BUGGER_ADDRLEN, + bug_read, NULL, NULL, bug_write, NULL, NULL, NULL); +} + + +/* Remove the ISA BusBugger emulator from the system. */ +void +bugger_remove(void) +{ + io_removehandler(BUGGER_ADDR, BUGGER_ADDRLEN, + bug_read, NULL, NULL, bug_write, NULL, NULL, NULL); +} diff --git a/src/bugger.h b/src/bugger.h new file mode 100644 index 000000000..1d4dfb841 --- /dev/null +++ b/src/bugger.h @@ -0,0 +1,37 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Implementation of the ISA Bus (de)Bugger expansion card + * sold as a DIY kit in the late 1980's in The Netherlands. + * This card was a assemble-yourself 8bit ISA addon card for + * PC and AT systems that had several tools to aid in low- + * level debugging (mostly for faulty BIOSes, bootloaders + * and system kernels...) + * + * Definitions for the BUGGER card. + * + * Version: @(#)bugger.h 1.0.3 2017/04/07 + * + * Author: Fred N. van Kempen, + * Copyright 1989-2017 Fred N. van Kempen. + */ +#ifndef BUGGER_H +# define BUGGER_H + + +/* I/O port range used. */ +#define BUGGER_ADDR 0x007a +#define BUGGER_ADDRLEN 4 + + +/* Functions. */ +extern void bugger_init(void); +extern void bugger_remove(void); + + +#endif /*BUGGER_H*/ diff --git a/src/buslogic.c b/src/buslogic.c deleted file mode 100644 index b45ea65e3..000000000 --- a/src/buslogic.c +++ /dev/null @@ -1,2643 +0,0 @@ -/* Copyright holders: SA1988 - see COPYING for more details -*/ -/*Buslogic SCSI emulation (including Adaptec 154x ISA software backward compatibility) and the Adaptec 154x itself*/ - -/* Emulated SCSI controllers: - 0 - Adaptec AHA-154xB ISA; - 1 - BusLogic BT-542B ISA; - 2 - BusLogic BT-958 PCI (but BT-542B ISA on non-PCI machines). */ - -#include -#include -#include -#include -#include - -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "mem.h" -#include "rom.h" -#include "dma.h" -#include "pic.h" -#include "pci.h" -#include "timer.h" - -#include "scsi.h" -#include "cdrom.h" - -#include "buslogic.h" - -#define BUSLOGIC_RESET_DURATION_NS UINT64_C(50000000) - -typedef struct __attribute__((packed)) -{ - uint8_t hi; - uint8_t mid; - uint8_t lo; -} addr24; - -#define ADDR_TO_U32(x) (((x).hi << 16) | ((x).mid << 8) | (x).lo & 0xFF) -#define U32_TO_ADDR(a, x) do {(a).hi = (x) >> 16; (a).mid = (x) >> 8; (a).lo = (x) & 0xFF;} while(0) - -// I/O Port interface -// READ Port x+0: STATUS -// WRITE Port x+0: CONTROL -// -// READ Port x+1: DATA -// WRITE Port x+1: COMMAND -// -// READ Port x+2: INTERRUPT STATUS -// WRITE Port x+2: (undefined?) -// -// R/W Port x+3: (undefined) - -// READ STATUS flags -#define STAT_STST 0x80 // self-test in progress -#define STAT_DFAIL 0x40 // internal diagnostic failure -#define STAT_INIT 0x20 // mailbox initialization required -#define STAT_IDLE 0x10 // HBA is idle -#define STAT_CDFULL 0x08 // Command/Data output port is full -#define STAT_DFULL 0x04 // Data input port is full -#define STAT_INVCMD 0x01 // Invalid command - -// READ INTERRUPT STATUS flags -#define INTR_ANY 0x80 // any interrupt -#define INTR_SRCD 0x08 // SCSI reset detected -#define INTR_HACC 0x04 // HA command complete -#define INTR_MBOA 0x02 // MBO empty -#define INTR_MBIF 0x01 // MBI full - -// WRITE CONTROL commands -#define CTRL_HRST 0x80 // Hard reset -#define CTRL_SRST 0x40 // Soft reset -#define CTRL_IRST 0x20 // interrupt reset -#define CTRL_SCRST 0x10 // SCSI bus reset - -// READ/WRITE DATA commands -#define CMD_NOP 0x00 // No operation -#define CMD_MBINIT 0x01 // mailbox initialization -#define CMD_START_SCSI 0x02 // Start SCSI command -#define CMD_INQUIRY 0x04 // Adapter inquiry -#define CMD_EMBOI 0x05 // enable Mailbox Out Interrupt -#define CMD_SELTIMEOUT 0x06 // Set SEL timeout -#define CMD_BUSON_TIME 0x07 // set bus-On time -#define CMD_BUSOFF_TIME 0x08 // set bus-off time -#define CMD_DMASPEED 0x09 // set ISA DMA speed -#define CMD_RETDEVS 0x0A // return installed devices -#define CMD_RETCONF 0x0B // return configuration data -#define CMD_TARGET 0x0C // set HBA to target mode -#define CMD_RETSETUP 0x0D // return setup data -#define CMD_ECHO 0x1F // ECHO command data - -#pragma pack(1) -/** - * Auto SCSI structure which is located - * in host adapter RAM and contains several - * configuration parameters. - */ -typedef struct __attribute__((packed)) AutoSCSIRam -{ - uint8_t aInternalSignature[2]; - uint8_t cbInformation; - uint8_t aHostAdaptertype[6]; - uint8_t uReserved1; - uint8_t fFloppyEnabled : 1; - uint8_t fFloppySecondary : 1; - uint8_t fLevelSensitiveInterrupt : 1; - unsigned char uReserved2 : 2; - unsigned char uSystemRAMAreForBIOS : 3; - unsigned char uDMAChannel : 7; - uint8_t fDMAAutoConfiguration : 1; - unsigned char uIrqChannel : 7; - uint8_t fIrqAutoConfiguration : 1; - uint8_t uDMATransferRate; - uint8_t uSCSIId; - uint8_t fLowByteTerminated : 1; - uint8_t fParityCheckingEnabled : 1; - uint8_t fHighByteTerminated : 1; - uint8_t fNoisyCablingEnvironment : 1; - uint8_t fFastSynchronousNeogtiation : 1; - uint8_t fBusResetEnabled : 1; - uint8_t fReserved3 : 1; - uint8_t fActiveNegotiationEnabled : 1; - uint8_t uBusOnDelay; - uint8_t uBusOffDelay; - uint8_t fHostAdapterBIOSEnabled : 1; - uint8_t fBIOSRedirectionOfInt19 : 1; - uint8_t fExtendedTranslation : 1; - uint8_t fMapRemovableAsFixed : 1; - uint8_t fReserved4 : 1; - uint8_t fBIOSSupportsMoreThan2Drives : 1; - uint8_t fBIOSInterruptMode : 1; - uint8_t fFlopticalSupport : 1; - uint16_t u16DeviceEnabledMask; - uint16_t u16WidePermittedMask; - uint16_t u16FastPermittedMask; - uint16_t u16SynchronousPermittedMask; - uint16_t u16DisconnectPermittedMask; - uint16_t u16SendStartUnitCommandMask; - uint16_t u16IgnoreInBIOSScanMask; - unsigned char uPCIInterruptPin : 2; - unsigned char uHostAdapterIoPortAddress : 2; - uint8_t fStrictRoundRobinMode : 1; - uint8_t fVesaBusSpeedGreaterThan33MHz : 1; - uint8_t fVesaBurstWrite : 1; - uint8_t fVesaBurstRead : 1; - uint16_t u16UltraPermittedMask; - uint32_t uReserved5; - uint8_t uReserved6; - uint8_t uAutoSCSIMaximumLUN; - uint8_t fReserved7 : 1; - uint8_t fSCAMDominant : 1; - uint8_t fSCAMenabled : 1; - uint8_t fSCAMLevel2 : 1; - unsigned char uReserved8 : 4; - uint8_t fInt13Extension : 1; - uint8_t fReserved9 : 1; - uint8_t fCDROMBoot : 1; - unsigned char uReserved10 : 5; - unsigned char uBootTargetId : 4; - unsigned char uBootChannel : 4; - uint8_t fForceBusDeviceScanningOrder : 1; - unsigned char uReserved11 : 7; - uint16_t u16NonTaggedToAlternateLunPermittedMask; - uint16_t u16RenegotiateSyncAfterCheckConditionMask; - uint8_t aReserved12[10]; - uint8_t aManufacturingDiagnostic[2]; - uint16_t u16Checksum; -} AutoSCSIRam; -#pragma pack() - -/** - * The local Ram. - */ -typedef union HostAdapterLocalRam -{ - /** Byte view. */ - uint8_t u8View[256]; - /** Structured view. */ - struct __attribute__((packed)) - { - /** Offset 0 - 63 is for BIOS. */ - uint8_t u8Bios[64]; - /** Auto SCSI structure. */ - AutoSCSIRam autoSCSIData; - } structured; -} HostAdapterLocalRam; - -/** Structure for the INQUIRE_SETUP_INFORMATION reply. */ -typedef struct __attribute__((packed)) ReplyInquireSetupInformationSynchronousValue -{ - uint8_t uOffset : 4; - uint8_t uTransferPeriod : 3; - uint8_t fSynchronous : 1; -}ReplyInquireSetupInformationSynchronousValue; - -typedef struct __attribute__((packed)) ReplyInquireSetupInformation -{ - uint8_t fSynchronousInitiationEnabled : 1; - uint8_t fParityCheckingEnabled : 1; - uint8_t uReserved1 : 6; - uint8_t uBusTransferRate; - uint8_t uPreemptTimeOnBus; - uint8_t uTimeOffBus; - uint8_t cMailbox; - addr24 MailboxAddress; - ReplyInquireSetupInformationSynchronousValue SynchronousValuesId0To7[8]; - uint8_t uDisconnectPermittedId0To7; - uint8_t uSignature; - uint8_t uCharacterD; - uint8_t uHostBusType; - uint8_t uWideTransferPermittedId0To7; - uint8_t uWideTransfersActiveId0To7; - ReplyInquireSetupInformationSynchronousValue SynchronousValuesId8To15[8]; - uint8_t uDisconnectPermittedId8To15; - uint8_t uReserved2; - uint8_t uWideTransferPermittedId8To15; - uint8_t uWideTransfersActiveId8To15; -} ReplyInquireSetupInformation; - -/** Structure for the INQUIRE_EXTENDED_SETUP_INFORMATION. */ -#pragma pack(1) -typedef struct __attribute__((packed)) ReplyInquireExtendedSetupInformation -{ - uint8_t uBusType; - uint8_t uBiosAddress; - uint16_t u16ScatterGatherLimit; - uint8_t cMailbox; - uint32_t uMailboxAddressBase; - uint8_t uReserved1 : 2; - uint8_t fFastEISA : 1; - uint8_t uReserved2 : 3; - uint8_t fLevelSensitiveInterrupt : 1; - uint8_t uReserved3 : 1; - uint8_t aFirmwareRevision[3]; - uint8_t fHostWideSCSI : 1; - uint8_t fHostDifferentialSCSI : 1; - uint8_t fHostSupportsSCAM : 1; - uint8_t fHostUltraSCSI : 1; - uint8_t fHostSmartTermination : 1; - uint8_t uReserved4 : 3; -} ReplyInquireExtendedSetupInformation; -#pragma pack() - -typedef struct __attribute__((packed)) MailboxInit_t -{ - uint8_t Count; - addr24 Address; -} MailboxInit_t; - -#pragma pack(1) -typedef struct __attribute__((packed)) MailboxInitExtended_t -{ - uint8_t Count; - uint32_t Address; -} MailboxInitExtended_t; -#pragma pack() - -/////////////////////////////////////////////////////////////////////////////// -// -// Mailbox Definitions -// -// -/////////////////////////////////////////////////////////////////////////////// - -// -// Mailbox Out -// -// -// MBO Command Values -// - -#define MBO_FREE 0x00 -#define MBO_START 0x01 -#define MBO_ABORT 0x02 - -// -// Mailbox In -// -// -// MBI Status Values -// - -#define MBI_FREE 0x00 -#define MBI_SUCCESS 0x01 -#define MBI_ABORT 0x02 -#define MBI_NOT_FOUND 0x03 -#define MBI_ERROR 0x04 - -typedef struct __attribute__((packed)) Mailbox_t -{ - uint8_t CmdStatus; - addr24 CCBPointer; -} Mailbox_t; - -typedef struct __attribute__((packed)) Mailbox32_t -{ - uint32_t CCBPointer; - union - { - struct - { - uint8_t Reserved[3]; - uint8_t ActionCode; - } out; - struct - { - uint8_t HostStatus; - uint8_t TargetStatus; - uint8_t Reserved; - uint8_t CompletionCode; - } in; - } u; -} Mailbox32_t; - -/////////////////////////////////////////////////////////////////////////////// -// -// CCB - Buslogic SCSI Command Control Block -// -// The CCB is a superset of the CDB (Command Descriptor Block) -// and specifies detailed information about a SCSI command. -// -/////////////////////////////////////////////////////////////////////////////// - -// -// Byte 0 Command Control Block Operation Code -// - -#define SCSI_INITIATOR_COMMAND 0x00 -#define TARGET_MODE_COMMAND 0x01 -#define SCATTER_GATHER_COMMAND 0x02 -#define SCSI_INITIATOR_COMMAND_RES 0x03 -#define SCATTER_GATHER_COMMAND_RES 0x04 -#define BUS_RESET 0x81 - -// -// Byte 1 Address and Direction Control -// - -#define CCB_TARGET_ID_SHIFT 0x06 // CCB Op Code = 00, 02 -#define CCB_INITIATOR_ID_SHIFT 0x06 // CCB Op Code = 01 -#define CCB_DATA_XFER_IN 0x01 -#define CCB_DATA_XFER_OUT 0x02 -#define CCB_LUN_MASK 0x07 // Logical Unit Number - -// -// Byte 2 SCSI_Command_Length - Length of SCSI CDB -// -// Byte 3 Request Sense Allocation Length -// - -#define FOURTEEN_BYTES 0x00 // Request Sense Buffer size -#define NO_AUTO_REQUEST_SENSE 0x01 // No Request Sense Buffer - -// -// Bytes 4, 5 and 6 Data Length // Data transfer byte count -// -// Bytes 7, 8 and 9 Data Pointer // SGD List or Data Buffer -// -// Bytes 10, 11 and 12 Link Pointer // Next CCB in Linked List -// -// Byte 13 Command Link ID // TBD (I don't know yet) -// -// Byte 14 Host Status // Host Adapter status -// - -#define CCB_COMPLETE 0x00 // CCB completed without error -#define CCB_LINKED_COMPLETE 0x0A // Linked command completed -#define CCB_LINKED_COMPLETE_INT 0x0B // Linked complete with interrupt -#define CCB_SELECTION_TIMEOUT 0x11 // Set SCSI selection timed out -#define CCB_DATA_OVER_UNDER_RUN 0x12 -#define CCB_UNEXPECTED_BUS_FREE 0x13 // Target dropped SCSI BSY -#define CCB_PHASE_SEQUENCE_FAIL 0x14 // Target bus phase sequence failure -#define CCB_BAD_MBO_COMMAND 0x15 // MBO command not 0, 1 or 2 -#define CCB_INVALID_OP_CODE 0x16 // CCB invalid operation code -#define CCB_BAD_LINKED_LUN 0x17 // Linked CCB LUN different from first -#define CCB_INVALID_DIRECTION 0x18 // Invalid target direction -#define CCB_DUPLICATE_CCB 0x19 // Duplicate CCB -#define CCB_INVALID_CCB 0x1A // Invalid CCB - bad parameter - -// -// Byte 15 Target Status -// -// See scsi.h files for these statuses. -// - -// -// Bytes 16 and 17 Reserved (must be 0) -// - -// -// Bytes 18 through 18+n-1, where n=size of CDB Command Descriptor Block -// - -typedef struct __attribute__((packed)) CCB32 -{ - uint8_t Opcode; - uint8_t Reserved1:3; - uint8_t ControlByte:2; - uint8_t TagQueued:1; - uint8_t QueueTag:2; - uint8_t CdbLength; - uint8_t RequestSenseLength; - uint32_t DataLength; - uint32_t DataPointer; - uint8_t Reserved2[2]; - uint8_t HostStatus; - uint8_t TargetStatus; - uint8_t Id; - uint8_t Lun:5; - uint8_t LegacyTagEnable:1; - uint8_t LegacyQueueTag:2; - uint8_t Cdb[12]; - uint8_t Reserved3[6]; - uint32_t SensePointer; -} CCB32; - -typedef struct __attribute__((packed)) CCB -{ - uint8_t Opcode; - uint8_t Lun:3; - uint8_t ControlByte:2; - uint8_t Id:3; - uint8_t CdbLength; - uint8_t RequestSenseLength; - addr24 DataLength; - addr24 DataPointer; - addr24 LinkPointer; - uint8_t LinkId; - uint8_t HostStatus; - uint8_t TargetStatus; - uint8_t Reserved[2]; - uint8_t Cdb[12]; -} CCB; - -typedef struct __attribute__((packed)) CCBC -{ - uint8_t Opcode; - uint8_t Pad1:3; - uint8_t ControlByte:2; - uint8_t Pad2:3; - uint8_t CdbLength; - uint8_t RequestSenseLength; - uint8_t Pad3[10]; - uint8_t HostStatus; - uint8_t TargetStatus; - uint8_t Pad4[2]; - uint8_t Cdb[12]; -} CCBC; - -typedef union __attribute__((packed)) CCBU -{ - CCB32 new; - CCB old; - CCBC common; -} CCBU; - -/////////////////////////////////////////////////////////////////////////////// -// -// Scatter/Gather Segment List Definitions -// -/////////////////////////////////////////////////////////////////////////////// - -// -// Adapter limits -// - -#define MAX_SG_DESCRIPTORS (scsi_model ? 32 : 17) - -typedef struct __attribute__((packed)) SGE32 -{ - uint32_t Segment; - uint32_t SegmentPointer; -} SGE32; - -typedef struct __attribute__((packed)) SGE -{ - addr24 Segment; - addr24 SegmentPointer; -} SGE; - -typedef struct __attribute__((packed)) BuslogicRequests_t -{ - CCBU CmdBlock; - uint8_t *RequestSenseBuffer; - uint32_t CCBPointer; - int Is24bit; - uint8_t TargetID; - uint8_t LUN; - uint8_t HostStatus; - uint8_t TargetStatus; - uint8_t MailboxCompletionCode; -} BuslogicRequests_t; - -typedef struct __attribute__((packed)) Buslogic_t -{ - rom_t bios; - int UseLocalRam; - int StrictRoundRobinMode; - int ExtendedLUNCCBFormat; - HostAdapterLocalRam LocalRam; - BuslogicRequests_t BuslogicRequests; - uint8_t Status; - uint8_t Interrupt; - uint8_t Geometry; - uint8_t Control; - uint8_t Command; - uint8_t CmdBuf[53]; - uint8_t CmdParam; - uint8_t CmdParamLeft; - uint8_t DataBuf[64]; - uint8_t DataReply; - uint8_t DataReplyLeft; - uint32_t MailboxCount; - uint32_t MailboxOutAddr; - uint32_t MailboxOutPosCur; - uint32_t MailboxInAddr; - uint32_t MailboxInPosCur; - int Base; - int PCIBase; - int MMIOBase; - int Irq; - int DmaChannel; - int IrqEnabled; - int Mbx24bit; - int MailboxOutInterrupts; - int MbiActive[256]; - int PendingInterrupt; - int Lock; - mem_mapping_t mmio_mapping; -} Buslogic_t; - -int scsi_model = 1; - -int BuslogicResetCallback = 0; -int BuslogicCallback = 0; - -int BuslogicInOperation = 0; - -/** Structure for the INQUIRE_PCI_HOST_ADAPTER_INFORMATION reply. */ -typedef struct __attribute__((packed)) BuslogicPCIInformation_t -{ - uint8_t IsaIOPort; - uint8_t IRQ; - unsigned char LowByteTerminated:1; - unsigned char HighByteTerminated:1; - unsigned char uReserved:2; /* Reserved. */ - unsigned char JP1:1; /* Whatever that means. */ - unsigned char JP2:1; /* Whatever that means. */ - unsigned char JP3:1; /* Whatever that means. */ - /** Whether the provided info is valid. */ - unsigned char InformationIsValid:1; - uint8_t uReserved2; /* Reserved. */ -} BuslogicPCIInformation_t; - -static void BuslogicStartMailbox(Buslogic_t *Buslogic); - -int buslogic_do_log = 0; - -void BuslogicLog(const char *format, ...) -{ -#ifdef ENABLE_BUSLOGIC_LOG - if (buslogic_do_log) - { - va_list ap; - va_start(ap, format); - vprintf(format, ap); - va_end(ap); - fflush(stdout); - } -#endif -} - -static int BuslogicIsPCI() -{ - if (PCI && (scsi_model == 2)) - { - return 1; - } - else - { - return 0; - } -} - -static void BuslogicClearInterrupt(Buslogic_t *Buslogic) -{ - BuslogicLog("Buslogic: Lowering Interrupt 0x%02X\n", Buslogic->Interrupt); - Buslogic->Interrupt = 0; - BuslogicLog("Lowering IRQ %i\n", Buslogic->Irq); - picintc(1 << Buslogic->Irq); - if (Buslogic->PendingInterrupt) - { - Buslogic->Interrupt = Buslogic->PendingInterrupt; - BuslogicLog("Buslogic: Raising Interrupt 0x%02X (Pending)\n", Buslogic->Interrupt); - if (Buslogic->MailboxOutInterrupts || !(Buslogic->Interrupt & INTR_MBOA)) - { - if (Buslogic->IrqEnabled) picint(1 << Buslogic->Irq); - } - Buslogic->PendingInterrupt = 0; - } -} - -static void BuslogicLocalRam(Buslogic_t *Buslogic) -{ - /* - * These values are mostly from what I think is right - * looking at the dmesg output from a Linux guest inside - * a VMware server VM. - * - * So they don't have to be right :) - */ - memset(Buslogic->LocalRam.u8View, 0, sizeof(HostAdapterLocalRam)); - Buslogic->LocalRam.structured.autoSCSIData.fLevelSensitiveInterrupt = 1; - Buslogic->LocalRam.structured.autoSCSIData.fParityCheckingEnabled = 1; - Buslogic->LocalRam.structured.autoSCSIData.fExtendedTranslation = 1; /* Same as in geometry register. */ - Buslogic->LocalRam.structured.autoSCSIData.u16DeviceEnabledMask = UINT16_MAX; /* All enabled. Maybe mask out non present devices? */ - Buslogic->LocalRam.structured.autoSCSIData.u16WidePermittedMask = UINT16_MAX; - Buslogic->LocalRam.structured.autoSCSIData.u16FastPermittedMask = UINT16_MAX; - Buslogic->LocalRam.structured.autoSCSIData.u16SynchronousPermittedMask = UINT16_MAX; - Buslogic->LocalRam.structured.autoSCSIData.u16DisconnectPermittedMask = UINT16_MAX; - Buslogic->LocalRam.structured.autoSCSIData.fStrictRoundRobinMode = Buslogic->StrictRoundRobinMode; - Buslogic->LocalRam.structured.autoSCSIData.u16UltraPermittedMask = UINT16_MAX; - /** @todo calculate checksum? */ -} - -static Buslogic_t *BuslogicResetDevice; - -static void BuslogicReset(Buslogic_t *Buslogic) -{ - BuslogicCallback = 0; - BuslogicResetCallback = 0; - Buslogic->Status = STAT_IDLE | STAT_INIT; - Buslogic->Geometry = 0x80; - Buslogic->Command = 0xFF; - Buslogic->CmdParam = 0; - Buslogic->CmdParamLeft = 0; - Buslogic->IrqEnabled = 1; - Buslogic->StrictRoundRobinMode = 0; - Buslogic->ExtendedLUNCCBFormat = 0; - Buslogic->MailboxOutPosCur = 0; - Buslogic->MailboxInPosCur = 0; - Buslogic->MailboxOutInterrupts = 0; - Buslogic->PendingInterrupt = 0; - Buslogic->Lock = 0; - BuslogicInOperation = 0; - - BuslogicClearInterrupt(Buslogic); - - BuslogicLocalRam(Buslogic); -} - -void BuslogicSoftReset() -{ - if (BuslogicResetDevice != NULL) - { - BuslogicReset(BuslogicResetDevice); - } -} - -static void BuslogicResetControl(Buslogic_t *Buslogic, uint8_t Reset) -{ - BuslogicReset(Buslogic); - if (Reset) - { - Buslogic->Status |= STAT_STST; - Buslogic->Status &= ~STAT_IDLE; - } - BuslogicResetCallback = BUSLOGIC_RESET_DURATION_NS * TIMER_USEC; -} - -static void BuslogicCommandComplete(Buslogic_t *Buslogic) -{ - Buslogic->DataReply = 0; - Buslogic->Status |= STAT_IDLE; - - if (Buslogic->Command != 0x02) - { - Buslogic->Status &= ~STAT_DFULL; - Buslogic->Interrupt = (INTR_ANY | INTR_HACC); - BuslogicLog("Raising IRQ %i\n", Buslogic->Irq); - if (Buslogic->IrqEnabled) picint(1 << Buslogic->Irq); - } - - Buslogic->Command = 0xFF; - Buslogic->CmdParam = 0; -} - -static void BuslogicRaiseInterrupt(Buslogic_t *Buslogic, uint8_t Interrupt) -{ - if (Buslogic->Interrupt & INTR_HACC) - { - BuslogicLog("Pending IRQ\n"); - Buslogic->PendingInterrupt = Interrupt; - } - else - { - Buslogic->Interrupt = Interrupt; - BuslogicLog("Raising IRQ %i\n", Buslogic->Irq); - if (Buslogic->IrqEnabled) picint(1 << Buslogic->Irq); - } -} - -static void BuslogicMailboxInSetup(Buslogic_t *Buslogic, uint32_t CCBPointer, CCBU *CmdBlock, - uint8_t HostStatus, uint8_t TargetStatus, uint8_t MailboxCompletionCode) -{ - BuslogicRequests_t *BuslogicRequests = &Buslogic->BuslogicRequests; - - BuslogicRequests->CCBPointer = CCBPointer; - memcpy(&(BuslogicRequests->CmdBlock), CmdBlock, sizeof(CCB32)); - BuslogicRequests->Is24bit = Buslogic->Mbx24bit; - BuslogicRequests->HostStatus = HostStatus; - BuslogicRequests->TargetStatus = TargetStatus; - BuslogicRequests->MailboxCompletionCode = MailboxCompletionCode; - - BuslogicLog("Mailbox in setup\n"); - - BuslogicInOperation = 2; -} - -static uint32_t BuslogicMailboxInRead(Buslogic_t *Buslogic, uint8_t *CompletionCode) -{ - Mailbox32_t TempMailbox32; - Mailbox_t TempMailboxIn; - - uint32_t Incoming = 0; - - Incoming = Buslogic->MailboxInAddr + (Buslogic->MailboxInPosCur * (Buslogic->Mbx24bit ? sizeof(Mailbox_t) : sizeof(Mailbox32_t))); - - if (Buslogic->Mbx24bit) - { - DMAPageRead(Incoming, &TempMailboxIn, sizeof(Mailbox_t)); - *CompletionCode = TempMailboxIn.CmdStatus; - } - else - { - DMAPageRead(Incoming, &TempMailbox32, sizeof(Mailbox32_t)); - *CompletionCode = TempMailbox32.u.in.CompletionCode; - } - - return Incoming; -} - -static void BuslogicMailboxInAdvance(Buslogic_t *Buslogic) -{ - Buslogic->MailboxInPosCur = (Buslogic->MailboxInPosCur + 1) % Buslogic->MailboxCount; -} - -static void BuslogicMailboxIn(Buslogic_t *Buslogic) -{ - BuslogicRequests_t *BuslogicRequests = &Buslogic->BuslogicRequests; - - uint32_t CCBPointer = BuslogicRequests->CCBPointer; - CCBU *CmdBlock = &(BuslogicRequests->CmdBlock); - uint8_t HostStatus = BuslogicRequests->HostStatus; - uint8_t TargetStatus = BuslogicRequests->TargetStatus; - uint8_t MailboxCompletionCode = BuslogicRequests->MailboxCompletionCode; - - Mailbox32_t Mailbox32; - Mailbox_t MailboxIn; - - Mailbox32_t TempMailbox32; - Mailbox_t TempMailboxIn; - - Mailbox32.CCBPointer = CCBPointer; - Mailbox32.u.in.HostStatus = HostStatus; - Mailbox32.u.in.TargetStatus = TargetStatus; - Mailbox32.u.in.CompletionCode = MailboxCompletionCode; - - uint32_t Incoming = Buslogic->MailboxInAddr + (Buslogic->MailboxInPosCur * (Buslogic->Mbx24bit ? sizeof(Mailbox_t) : sizeof(Mailbox32_t))); - - if (MailboxCompletionCode != MBI_NOT_FOUND) - { - CmdBlock->common.HostStatus = HostStatus; - CmdBlock->common.TargetStatus = TargetStatus; - - //Rewrite the CCB up to the CDB. - BuslogicLog("CCB rewritten to the CDB (pointer %08X, length %i)\n", CCBPointer, offsetof(CCBC, Cdb)); - DMAPageWrite(CCBPointer, CmdBlock, offsetof(CCBC, Cdb)); - } - else - { - BuslogicLog("Mailbox not found!\n"); - } - - BuslogicLog("Host Status 0x%02X, Target Status 0x%02X\n", HostStatus, TargetStatus); - - if (Buslogic->Mbx24bit) - { - MailboxIn.CmdStatus = Mailbox32.u.in.CompletionCode; - U32_TO_ADDR(MailboxIn.CCBPointer, Mailbox32.CCBPointer); - BuslogicLog("Mailbox 24-bit: Status=0x%02X, CCB at 0x%04X\n", MailboxIn.CmdStatus, ADDR_TO_U32(MailboxIn.CCBPointer)); - - DMAPageWrite(Incoming, &MailboxIn, sizeof(Mailbox_t)); - BuslogicLog("%i bytes of 24-bit mailbox written to: %08X\n", sizeof(Mailbox_t), Incoming); - } - else - { - BuslogicLog("Mailbox 32-bit: Status=0x%02X, CCB at 0x%04X\n", Mailbox32.u.in.CompletionCode, Mailbox32.CCBPointer); - - DMAPageWrite(Incoming, &Mailbox32, sizeof(Mailbox32_t)); - BuslogicLog("%i bytes of 32-bit mailbox written to: %08X\n", sizeof(Mailbox32_t), Incoming); - } - - Buslogic->MailboxInPosCur++; - if (Buslogic->MailboxInPosCur >= Buslogic->MailboxCount) - Buslogic->MailboxInPosCur = 0; - - BuslogicRaiseInterrupt(Buslogic, INTR_MBIF | INTR_ANY); - - BuslogicInOperation = 0; -} - -static void BuslogicReadSGEntries(int Is24bit, uint32_t SGList, uint32_t Entries, SGE32 *SG) -{ - if (Is24bit) - { - uint32_t i; - SGE SGE24[MAX_SG_DESCRIPTORS]; - - DMAPageRead(SGList, &SGE24, Entries * sizeof(SGE)); - - for (i=0;iCmdBlock.old.DataPointer); - DataLength = ADDR_TO_U32(BuslogicRequests->CmdBlock.old.DataLength); - } - else - { - DataPointer = BuslogicRequests->CmdBlock.new.DataPointer; - DataLength = BuslogicRequests->CmdBlock.new.DataLength; - } - - BuslogicLog("Data Buffer write: length %d, pointer 0x%04X\n", DataLength, DataPointer); - - if ((BuslogicRequests->CmdBlock.common.ControlByte != 0x03) && DataLength) - { - if (BuslogicRequests->CmdBlock.common.Opcode == SCATTER_GATHER_COMMAND || - BuslogicRequests->CmdBlock.common.Opcode == SCATTER_GATHER_COMMAND_RES) - { - uint32_t ScatterGatherRead; - uint32_t ScatterEntry; - SGE32 ScatterGatherBuffer[MAX_SG_DESCRIPTORS]; - uint32_t ScatterGatherLeft = DataLength / ScatterGatherEntryLength; - uint32_t ScatterGatherAddrCurrent = DataPointer; - uint32_t DataToTransfer = 0; - - do - { - ScatterGatherRead = (ScatterGatherLeft < ELEMENTS(ScatterGatherBuffer)) - ? ScatterGatherLeft : ELEMENTS(ScatterGatherBuffer); - - ScatterGatherLeft -= ScatterGatherRead; - - BuslogicReadSGEntries(Is24bit, ScatterGatherAddrCurrent, ScatterGatherRead, ScatterGatherBuffer); - - for (ScatterEntry = 0; ScatterEntry < ScatterGatherRead; ScatterEntry++) - { - uint32_t Address; - - BuslogicLog("BusLogic S/G Write: ScatterEntry=%u\n", ScatterEntry); - - Address = ScatterGatherBuffer[ScatterEntry].SegmentPointer; - DataToTransfer += ScatterGatherBuffer[ScatterEntry].Segment; - - BuslogicLog("BusLogic S/G Write: Address=%08X DatatoTransfer=%u\n", Address, DataToTransfer); - } - - ScatterGatherAddrCurrent += ScatterGatherRead * ScatterGatherEntryLength; - } while (ScatterGatherLeft > 0); - - BuslogicLog("Data to transfer (S/G) %d\n", DataToTransfer); - - SCSIDevices[BuslogicRequests->TargetID][BuslogicRequests->LUN].InitLength = DataToTransfer; - - //If the control byte is 0x00, it means that the transfer direction is set up by the SCSI command without - //checking its length, so do this procedure for both no read/write commands. - if ((BuslogicRequests->CmdBlock.common.ControlByte == CCB_DATA_XFER_OUT) || (BuslogicRequests->CmdBlock.common.ControlByte == 0x00)) - { - ScatterGatherLeft = DataLength / ScatterGatherEntryLength; - ScatterGatherAddrCurrent = DataPointer; - - do - { - ScatterGatherRead = (ScatterGatherLeft < ELEMENTS(ScatterGatherBuffer)) - ? ScatterGatherLeft : ELEMENTS(ScatterGatherBuffer); - - ScatterGatherLeft -= ScatterGatherRead; - - BuslogicReadSGEntries(Is24bit, ScatterGatherAddrCurrent, ScatterGatherRead, ScatterGatherBuffer); - - for (ScatterEntry = 0; ScatterEntry < ScatterGatherRead; ScatterEntry++) - { - uint32_t Address; - - BuslogicLog("BusLogic S/G Write: ScatterEntry=%u\n", ScatterEntry); - - Address = ScatterGatherBuffer[ScatterEntry].SegmentPointer; - DataToTransfer = ScatterGatherBuffer[ScatterEntry].Segment; - - BuslogicLog("BusLogic S/G Write: Address=%08X DatatoTransfer=%u\n", Address, DataToTransfer); - - DMAPageRead(Address, SCSIDevices[BuslogicRequests->TargetID][BuslogicRequests->LUN].CmdBuffer + sg_buffer_pos, DataToTransfer); - sg_buffer_pos += DataToTransfer; - } - - ScatterGatherAddrCurrent += ScatterGatherRead * (Is24bit ? sizeof(SGE) : sizeof(SGE32)); - } while (ScatterGatherLeft > 0); - } - } - else if (BuslogicRequests->CmdBlock.common.Opcode == SCSI_INITIATOR_COMMAND || - BuslogicRequests->CmdBlock.common.Opcode == SCSI_INITIATOR_COMMAND_RES) - { - uint32_t Address = DataPointer; - SCSIDevices[BuslogicRequests->TargetID][BuslogicRequests->LUN].InitLength = DataLength; - - if (DataLength > 0) - { - DMAPageRead(Address, SCSIDevices[BuslogicRequests->TargetID][BuslogicRequests->LUN].CmdBuffer, SCSIDevices[BuslogicRequests->TargetID][BuslogicRequests->LUN].InitLength); - } - } - } -} - -void BuslogicDataBufferFree(BuslogicRequests_t *BuslogicRequests) -{ - uint32_t DataPointer = 0; - uint32_t DataLength = 0; - - uint32_t sg_buffer_pos = 0; - - uint32_t transfer_length = 0; - - if (BuslogicRequests->Is24bit) - { - DataPointer = ADDR_TO_U32(BuslogicRequests->CmdBlock.old.DataPointer); - DataLength = ADDR_TO_U32(BuslogicRequests->CmdBlock.old.DataLength); - } - else - { - DataPointer = BuslogicRequests->CmdBlock.new.DataPointer; - DataLength = BuslogicRequests->CmdBlock.new.DataLength; - } - - /* if (DataLength > SCSIDevices[BuslogicRequests->TargetID][BuslogicRequests->LUN].InitLength) - { - DataLength = SCSIDevices[BuslogicRequests->TargetID][BuslogicRequests->LUN].InitLength; - } */ - - if ((DataLength != 0) && (BuslogicRequests->CmdBlock.common.Cdb[0] == GPCMD_TEST_UNIT_READY)) - { - BuslogicLog("Data length not 0 with TEST UNIT READY: %i (%i)\n", DataLength, SCSIDevices[BuslogicRequests->TargetID][BuslogicRequests->LUN].InitLength); - } - - if (BuslogicRequests->CmdBlock.common.Cdb[0] == GPCMD_TEST_UNIT_READY) - { - DataLength = 0; - } - - BuslogicLog("Data Buffer read: length %d, pointer 0x%04X\n", DataLength, DataPointer); - - //If the control byte is 0x00, it means that the transfer direction is set up by the SCSI command without - //checking its length, so do this procedure for both read/write commands. - if ((DataLength > 0) && - ((BuslogicRequests->CmdBlock.common.ControlByte == CCB_DATA_XFER_IN) || - (BuslogicRequests->CmdBlock.common.ControlByte == 0x00))) - { - if ((BuslogicRequests->CmdBlock.common.Opcode == SCATTER_GATHER_COMMAND) || - (BuslogicRequests->CmdBlock.common.Opcode == SCATTER_GATHER_COMMAND_RES)) - { - uint32_t ScatterGatherRead; - uint32_t ScatterEntry; - SGE32 ScatterGatherBuffer[MAX_SG_DESCRIPTORS]; - uint32_t ScatterGatherEntrySize = (BuslogicRequests->Is24bit ? sizeof(SGE) : sizeof(SGE32)); - uint32_t ScatterGatherLeft = DataLength / ScatterGatherEntrySize; - // uint32_t ScatterGatherLength = (ScatterGatherLeft * ScatterGatherEntrySize); - uint32_t ScatterGatherAddrCurrent = DataPointer; - - do - { - ScatterGatherRead = (ScatterGatherLeft < ELEMENTS(ScatterGatherBuffer)) - ? ScatterGatherLeft : ELEMENTS(ScatterGatherBuffer); - - ScatterGatherLeft -= ScatterGatherRead; - - BuslogicReadSGEntries(BuslogicRequests->Is24bit, ScatterGatherAddrCurrent, ScatterGatherRead, ScatterGatherBuffer); - - for (ScatterEntry = 0; ScatterEntry < ScatterGatherRead; ScatterEntry++) - { - uint32_t Address; - uint32_t DataToTransfer; - - BuslogicLog("BusLogic S/G: ScatterEntry=%u\n", ScatterEntry); - - Address = ScatterGatherBuffer[ScatterEntry].SegmentPointer; - DataToTransfer = ScatterGatherBuffer[ScatterEntry].Segment; - - BuslogicLog("BusLogic S/G: Writing %i bytes at %08X\n", DataToTransfer, Address); - - DMAPageWrite(Address, SCSIDevices[BuslogicRequests->TargetID][BuslogicRequests->LUN].CmdBuffer + sg_buffer_pos, DataToTransfer); - sg_buffer_pos += DataToTransfer; - } - - ScatterGatherAddrCurrent += (ScatterGatherRead * ScatterGatherEntrySize); - } while (ScatterGatherLeft > 0); - } - else if (BuslogicRequests->CmdBlock.common.Opcode == SCSI_INITIATOR_COMMAND || - BuslogicRequests->CmdBlock.common.Opcode == SCSI_INITIATOR_COMMAND_RES) - { - uint32_t Address = DataPointer; - - BuslogicLog("BusLogic DMA: Writing %i bytes at %08X\n", DataLength, Address); - DMAPageWrite(Address, SCSIDevices[BuslogicRequests->TargetID][BuslogicRequests->LUN].CmdBuffer, DataLength); - } - } - - if ((BuslogicRequests->CmdBlock.common.Opcode == SCSI_INITIATOR_COMMAND_RES) || (BuslogicRequests->CmdBlock.common.Opcode == SCATTER_GATHER_COMMAND_RES)) - { - uint32_t Residual; - - /* Should be 0 when scatter/gather? */ - if (DataLength >= SCSIDevices[BuslogicRequests->TargetID][BuslogicRequests->LUN].InitLength) - { - Residual = DataLength; - Residual -= SCSIDevices[BuslogicRequests->TargetID][BuslogicRequests->LUN].InitLength; - } - else - { - Residual = 0; - } - - if (BuslogicRequests->Is24bit) - { - U32_TO_ADDR(BuslogicRequests->CmdBlock.old.DataLength, Residual); - BuslogicLog("24-bit Residual data length for reading: %d\n", ADDR_TO_U32(BuslogicRequests->CmdBlock.old.DataLength)); - } - else - { - BuslogicRequests->CmdBlock.new.DataLength = Residual; - BuslogicLog("32-bit Residual data length for reading: %d\n", BuslogicRequests->CmdBlock.new.DataLength); - } - } -} - -uint8_t BuslogicRead(uint16_t Port, void *p) -{ - Buslogic_t *Buslogic = (Buslogic_t *)p; - uint8_t Temp; - - switch (Port & 3) - { - case 0: - Temp = Buslogic->Status; -#if 0 - if (Buslogic->Status & STAT_STST) - { - Buslogic->Status &= ~STAT_STST; - Buslogic->Status |= STAT_IDLE; - - if (BuslogicResetCallback <= 0) - { - Temp = Buslogic->Status; - BuslogicResetCallback; - } - } -#endif - break; - - case 1: - if (Buslogic->UseLocalRam) - Temp = Buslogic->LocalRam.u8View[Buslogic->DataReply]; - else - Temp = Buslogic->DataBuf[Buslogic->DataReply]; - if (Buslogic->DataReplyLeft) - { - Buslogic->DataReply++; - Buslogic->DataReplyLeft--; - if (!Buslogic->DataReplyLeft) - { - BuslogicCommandComplete(Buslogic); - } - } - break; - - case 2: - Temp = Buslogic->Interrupt; - break; - - case 3: - Temp = Buslogic->Geometry; - break; - } - - if (Port < 0x1000) - { - BuslogicLog("Buslogic: Read Port 0x%02X, Returned Value %02X\n", Port, Temp); - } - return Temp; -} - -uint16_t BuslogicReadW(uint16_t Port, void *p) -{ - return BuslogicRead(Port, p); -} - -uint32_t BuslogicReadL(uint16_t Port, void *p) -{ - return BuslogicRead(Port, p); -} - -int buslogic_scsi_drive_is_cdrom(uint8_t id, uint8_t lun) -{ - if (lun > 7) - { - return 0; - } - - if (scsi_cdrom_drives[id][lun] >= CDROM_NUM) - { - return 0; - } - else - { - if (cdrom_drives[scsi_cdrom_drives[id][lun]].enabled && cdrom_drives[scsi_cdrom_drives[id][lun]].bus_type && (cdrom_drives[scsi_cdrom_drives[id][lun]].bus_mode & 2)) - { - return 1; - } - else - { - return 0; - } - } -} - -void BuslogicWriteW(uint16_t Port, uint16_t Val, void *p); -void BuslogicWriteL(uint16_t Port, uint32_t Val, void *p); - -void BuslogicWrite(uint16_t Port, uint8_t Val, void *p) -{ - int i = 0; - - uint8_t j = 0; - - uint8_t max_id = scsi_model ? 16 : 8; - - Buslogic_t *Buslogic = (Buslogic_t *)p; - BuslogicRequests_t *BuslogicRequests = &Buslogic->BuslogicRequests; - BuslogicLog("Buslogic: Write Port 0x%02X, Value %02X\n", Port, Val); - - switch (Port & 3) - { - case 0: - if ((Val & CTRL_HRST) || (Val & CTRL_SRST)) - { - uint8_t Reset = !!(Val & CTRL_HRST); - BuslogicResetControl(Buslogic, Reset); - break; - } - - if (Val & CTRL_IRST) - { - BuslogicClearInterrupt(Buslogic); - } - break; - - case 1: - /* Fast path for the mailbox execution command. */ - if ((Val == 0x02) && (Buslogic->Command == 0xFF)) - { - /* If there are no mailboxes configured, don't even try to do anything. */ - if (Buslogic->MailboxCount) - { - if (!BuslogicCallback) - { - BuslogicCallback = 50 * SCSI_TIME; - } - } - return; - } - - if (Buslogic->Command == 0xFF) - { - Buslogic->Command = Val; - Buslogic->CmdParam = 0; - - Buslogic->Status &= ~(STAT_INVCMD | STAT_IDLE); - BuslogicLog("Buslogic: Operation Code 0x%02X\n", Val); - switch (Buslogic->Command) - { - case 0x00: - case 0x04: - case 0x0A: - case 0x0B: - case 0x20: - case 0x23: - case 0x84: - case 0x85: - Buslogic->CmdParamLeft = 0; - break; - - case 0x05: - case 0x07: - case 0x08: - case 0x09: - case 0x0D: - case 0x1F: - case 0x21: - case 0x24: - case 0x25: - Buslogic->CmdParamLeft = 1; - break; - - case 0x8B: - case 0x8D: - case 0x8F: - case 0x96: - Buslogic->CmdParamLeft = scsi_model ? 1 : 0; - break; - - case 0x91: - Buslogic->CmdParamLeft = 2; - break; - - case 0x1C: - case 0x1D: - Buslogic->CmdParamLeft = 3; - break; - - case 0x06: - Buslogic->CmdParamLeft = 4; - break; - - case 0x01: - Buslogic->CmdParamLeft = sizeof(MailboxInit_t); - break; - - case 0x81: - BuslogicLog("Command 0x81 on %s\n", scsi_model ? "BusLogic" : "Adaptec"); - Buslogic->CmdParamLeft = scsi_model ? sizeof(MailboxInitExtended_t) : 0; - break; - - case 0x29: - Buslogic->CmdParamLeft = scsi_model ? 0 : 2; - break; - - case 0x86: //Valid only for PCI - Buslogic->CmdParamLeft = 0; - break; - - case 0x8C: - Buslogic->CmdParamLeft = scsi_model ? 1 : 0; - break; - - case 0x95: //Valid only for PCI - Buslogic->CmdParamLeft = BuslogicIsPCI() ? 1 : 0; - break; - - case 0x28: - Buslogic->CmdParamLeft = 0; - break; - } - } - else - { - Buslogic->CmdBuf[Buslogic->CmdParam] = Val; - Buslogic->CmdParam++; - Buslogic->CmdParamLeft--; - } - - if (!Buslogic->CmdParamLeft) - { - BuslogicLog("Running Operation Code 0x%02X\n", Buslogic->Command); - switch (Buslogic->Command) - { - case 0x00: - Buslogic->DataReplyLeft = 0; - break; - - case 0x01: - { - Buslogic->Mbx24bit = 1; - - MailboxInit_t *MailboxInit = (MailboxInit_t *)Buslogic->CmdBuf; - - Buslogic->MailboxCount = MailboxInit->Count; - Buslogic->MailboxOutAddr = ADDR_TO_U32(MailboxInit->Address); - Buslogic->MailboxInAddr = Buslogic->MailboxOutAddr + (Buslogic->MailboxCount * sizeof(Mailbox_t)); - - BuslogicLog("Buslogic Initialize Mailbox Command\n"); - BuslogicLog("Mailbox Out Address=0x%08X\n", Buslogic->MailboxOutAddr); - BuslogicLog("Mailbox In Address=0x%08X\n", Buslogic->MailboxInAddr); - BuslogicLog("Initialized Mailbox, %d entries at 0x%08X\n", MailboxInit->Count, ADDR_TO_U32(MailboxInit->Address)); - - Buslogic->Status &= ~STAT_INIT; - Buslogic->DataReplyLeft = 0; - } - break; - - case 0x04: - Buslogic->DataBuf[0] = 0x41; - Buslogic->DataBuf[1] = scsi_model ? 0x41 : 0x30; - Buslogic->DataBuf[2] = '5'; - Buslogic->DataBuf[3] = '0'; - Buslogic->DataReplyLeft = 4; - break; - - case 0x05: - if (Buslogic->CmdBuf[0] <= 1) - { - Buslogic->MailboxOutInterrupts = Buslogic->CmdBuf[0]; - BuslogicLog("Mailbox out interrupts: %s\n", Buslogic->MailboxOutInterrupts ? "ON" : "OFF"); - } - else - { - Buslogic->Status |= STAT_INVCMD; - } - Buslogic->DataReplyLeft = 0; - break; - - case 0x06: - Buslogic->DataReplyLeft = 0; - break; - - case 0x07: - Buslogic->DataReplyLeft = 0; - Buslogic->LocalRam.structured.autoSCSIData.uBusOnDelay = Buslogic->CmdBuf[0]; - BuslogicLog("Bus-on time: %d\n", Buslogic->CmdBuf[0]); - break; - - case 0x08: - Buslogic->DataReplyLeft = 0; - Buslogic->LocalRam.structured.autoSCSIData.uBusOffDelay = Buslogic->CmdBuf[0]; - BuslogicLog("Bus-off time: %d\n", Buslogic->CmdBuf[0]); - break; - - case 0x09: - Buslogic->DataReplyLeft = 0; - Buslogic->LocalRam.structured.autoSCSIData.uDMATransferRate = Buslogic->CmdBuf[0]; - BuslogicLog("DMA transfer rate: %02X\n", Buslogic->CmdBuf[0]); - break; - - case 0x0A: - memset(Buslogic->DataBuf, 0, 8); - for (i = 0; i < 7; i++) - { - for (j = 0; j < 8; j++) - { - if (buslogic_scsi_drive_is_cdrom(i, j)) - Buslogic->DataBuf[i] = 1; - } - } - Buslogic->DataBuf[7] = 0; - Buslogic->DataReplyLeft = 8; - break; - - case 0x0B: - Buslogic->DataBuf[0] = (1 << Buslogic->DmaChannel); - Buslogic->DataBuf[1] = (1 << (Buslogic->Irq - 9)); - Buslogic->DataBuf[2] = 7; - Buslogic->DataReplyLeft = 3; - break; - - case 0x0D: - { - Buslogic->DataReplyLeft = Buslogic->CmdBuf[0]; - - ReplyInquireSetupInformation *Reply = (ReplyInquireSetupInformation *)Buslogic->DataBuf; - memset(Reply, 0, sizeof(ReplyInquireSetupInformation)); - - Reply->fSynchronousInitiationEnabled = 1; - Reply->fParityCheckingEnabled = 1; - Reply->cMailbox = Buslogic->MailboxCount; - U32_TO_ADDR(Reply->MailboxAddress, Buslogic->MailboxOutAddr); - - if (scsi_model) - { - Reply->uSignature = 'B'; - /* The 'D' signature prevents Buslogic's OS/2 drivers from getting too - * friendly with Adaptec hardware and upsetting the HBA state. - */ - Reply->uCharacterD = 'D'; /* BusLogic model. */ - Reply->uHostBusType = BuslogicIsPCI() ? 'F' : 'A'; /* ISA bus. */ - } - - BuslogicLog("Return Setup Information: %d\n", Buslogic->CmdBuf[0]); - } - break; - - case 0x23: - if (scsi_model) - { - memset(Buslogic->DataBuf, 0, 8); - for (i = 8; i < max_id; i++) - { - for (i = 0; j < 8; j++) - { - if (buslogic_scsi_drive_is_cdrom(i, j)) - Buslogic->DataBuf[i] = 1; - } - } - Buslogic->DataReplyLeft = 8; - } - else - { - Buslogic->Status |= STAT_INVCMD; - Buslogic->DataReplyLeft = 0; - } - break; - - case 0x1C: - { - uint32_t FIFOBuf; - addr24 Address; - - Buslogic->DataReplyLeft = 0; - Address.hi = Buslogic->CmdBuf[0]; - Address.mid = Buslogic->CmdBuf[1]; - Address.lo = Buslogic->CmdBuf[2]; - FIFOBuf = ADDR_TO_U32(Address); - DMAPageRead(FIFOBuf, &Buslogic->LocalRam.u8View[64], 64); - } - break; - - case 0x1D: - { - uint32_t FIFOBuf; - addr24 Address; - - Buslogic->DataReplyLeft = 0; - Address.hi = Buslogic->CmdBuf[0]; - Address.mid = Buslogic->CmdBuf[1]; - Address.lo = Buslogic->CmdBuf[2]; - FIFOBuf = ADDR_TO_U32(Address); - BuslogicLog("Buslogic FIFO: Writing 64 bytes at %08X\n", FIFOBuf); - DMAPageWrite(FIFOBuf, &Buslogic->LocalRam.u8View[64], 64); - } - break; - - case 0x1F: - Buslogic->DataBuf[0] = Buslogic->CmdBuf[0]; - Buslogic->DataReplyLeft = 1; - break; - - case 0x20: - Buslogic->DataReplyLeft = 0; - if (scsi_model) - { - BuslogicResetControl(Buslogic, 1); - } - else - { - Buslogic->Status |= STAT_INVCMD; - } - break; - - case 0x21: - if (Buslogic->CmdParam == 1) - Buslogic->CmdParamLeft = Buslogic->CmdBuf[0]; - - Buslogic->DataReplyLeft = 0; - break; - - case 0x24: - { - uint16_t TargetsPresentMask = 0; - - for (i = 0; i < max_id; i++) - { - for (j = 0; j < 8; j++) - { - if (SCSIDevices[i][j].LunType == SCSI_CDROM) - TargetsPresentMask |= (1 << i); - } - } - Buslogic->DataBuf[0] = TargetsPresentMask&0x0F; - Buslogic->DataBuf[1] = TargetsPresentMask>>8; - Buslogic->DataReplyLeft = 2; - } - break; - - case 0x25: - if (Buslogic->CmdBuf[0] == 0) - Buslogic->IrqEnabled = 0; - else - Buslogic->IrqEnabled = 1; - BuslogicLog("Lowering IRQ %i\n", Buslogic->Irq); - picintc(1 << Buslogic->Irq); - break; - - case 0x28: - if (!scsi_model) - { - Buslogic->DataBuf[0] = 0x08; - Buslogic->DataBuf[1] = Buslogic->Lock; - Buslogic->DataReplyLeft = 2; - } - else - { - Buslogic->DataReplyLeft = 0; - Buslogic->Status |= STAT_INVCMD; - } - break; - - case 0x29: - if (!scsi_model) - { - if (Buslogic->CmdBuf[1] = Buslogic->Lock) - { - if (Buslogic->CmdBuf[0] & 1) - { - Buslogic->Lock = 1; - } - else - { - Buslogic->Lock = 0; - } - } - Buslogic->DataReplyLeft = 0; - } - else - { - Buslogic->DataReplyLeft = 0; - Buslogic->Status |= STAT_INVCMD; - } - break; - - case 0x81: - { - if (scsi_model) - { - Buslogic->Mbx24bit = 0; - - MailboxInitExtended_t *MailboxInit = (MailboxInitExtended_t *)Buslogic->CmdBuf; - - Buslogic->MailboxCount = MailboxInit->Count; - Buslogic->MailboxOutAddr = MailboxInit->Address; - Buslogic->MailboxInAddr = MailboxInit->Address + (Buslogic->MailboxCount * sizeof(Mailbox32_t)); - - BuslogicLog("Buslogic Extended Initialize Mailbox Command\n"); - BuslogicLog("Mailbox Out Address=0x%08X\n", Buslogic->MailboxOutAddr); - BuslogicLog("Mailbox In Address=0x%08X\n", Buslogic->MailboxInAddr); - BuslogicLog("Initialized Extended Mailbox, %d entries at 0x%08X\n", MailboxInit->Count, MailboxInit->Address); - - Buslogic->Status &= ~STAT_INIT; - Buslogic->DataReplyLeft = 0; - } - else - { - Buslogic->DataReplyLeft = 0; - Buslogic->Status |= STAT_INVCMD; - } - } - break; - - case 0x84: - if (scsi_model) - { - Buslogic->DataBuf[0] = '7'; - Buslogic->DataReplyLeft = 1; - } - else - { - Buslogic->DataReplyLeft = 0; - Buslogic->Status |= STAT_INVCMD; - } - break; - - case 0x85: - if (scsi_model) - { - Buslogic->DataBuf[0] = 'B'; - Buslogic->DataReplyLeft = 1; - } - else - { - Buslogic->DataReplyLeft = 0; - Buslogic->Status |= STAT_INVCMD; - } - break; - - case 0x86: - if (BuslogicIsPCI()) - { - BuslogicPCIInformation_t *Reply = (BuslogicPCIInformation_t *) Buslogic->DataBuf; - memset(Reply, 0, sizeof(BuslogicPCIInformation_t)); - Reply->InformationIsValid = 0; - switch(Buslogic->Base) - { - case 0x330: - Reply->IsaIOPort = 0; - break; - case 0x334: - Reply->IsaIOPort = 1; - break; - case 0x230: - Reply->IsaIOPort = 2; - break; - case 0x234: - Reply->IsaIOPort = 3; - break; - case 0x130: - Reply->IsaIOPort = 4; - break; - case 0x134: - Reply->IsaIOPort = 5; - break; - default: - Reply->IsaIOPort = 0xFF; - break; - } - Reply->IRQ = Buslogic->Irq; - Buslogic->DataReplyLeft = sizeof(BuslogicPCIInformation_t); - } - else - { - Buslogic->DataReplyLeft = 0; - Buslogic->Status |= STAT_INVCMD; - } - break; - - case 0x8B: - { - if (scsi_model) - { - int i; - - /* The reply length is set by the guest and is found in the first byte of the command buffer. */ - Buslogic->DataReplyLeft = Buslogic->CmdBuf[0]; - memset(Buslogic->DataBuf, 0, Buslogic->DataReplyLeft); - char aModelName[] = "542B "; /* Trailing \0 is fine, that's the filler anyway. */ - if (BuslogicIsPCI()) - { - aModelName[0] = '9'; - aModelName[1] = '5'; - aModelName[2] = '8'; - aModelName[3] = 'D'; - } - int cCharsToTransfer = Buslogic->DataReplyLeft <= sizeof(aModelName) - ? Buslogic->DataReplyLeft - : sizeof(aModelName); - - for (i = 0; i < cCharsToTransfer; i++) - Buslogic->DataBuf[i] = aModelName[i]; - } - else - { - Buslogic->DataReplyLeft = 0; - Buslogic->Status |= STAT_INVCMD; - } - } - break; - - case 0x8C: - // if (BuslogicIsPCI()) - if (scsi_model) - { - int i = 0; - Buslogic->DataReplyLeft = Buslogic->CmdBuf[0]; - memset(Buslogic->DataBuf, 0, Buslogic->DataReplyLeft); - } - else - { - Buslogic->DataReplyLeft = 0; - Buslogic->Status |= STAT_INVCMD; - } - break; - - case 0x8D: - { - if (scsi_model) - { - Buslogic->DataReplyLeft = Buslogic->CmdBuf[0]; - ReplyInquireExtendedSetupInformation *Reply = (ReplyInquireExtendedSetupInformation *)Buslogic->DataBuf; - memset(Reply, 0, sizeof(ReplyInquireExtendedSetupInformation)); - - Reply->uBusType = (BuslogicIsPCI()) ? 'E' : 'A'; /* ISA style */ - Reply->uBiosAddress = 0; - Reply->u16ScatterGatherLimit = 8192; - Reply->cMailbox = Buslogic->MailboxCount; - Reply->uMailboxAddressBase = Buslogic->MailboxOutAddr; - if (BuslogicIsPCI()) - { - Reply->fLevelSensitiveInterrupt = 1; - Reply->fHostWideSCSI = 1; - Reply->fHostUltraSCSI = 1; - } - memcpy(Reply->aFirmwareRevision, "07B", sizeof(Reply->aFirmwareRevision)); - BuslogicLog("Return Extended Setup Information: %d\n", Buslogic->CmdBuf[0]); - } - else - { - Buslogic->DataReplyLeft = 0; - Buslogic->Status |= STAT_INVCMD; - } - } - break; - - /* VirtualBox has these two modes implemented in reverse. - According to the BusLogic datasheet: - 0 is the strict round robin mode, which is also the one used by the AHA-154x according to the - Adaptec specification; - 1 is the aggressive round robin mode, which "hunts" for an active outgoing mailbox and then - processes it. */ - case 0x8F: - if (scsi_model) - { - if (Buslogic->CmdBuf[0] == 0) - Buslogic->StrictRoundRobinMode = 1; - else if (Buslogic->CmdBuf[0] == 1) - Buslogic->StrictRoundRobinMode = 0; - - Buslogic->DataReplyLeft = 0; - } - else - { - Buslogic->DataReplyLeft = 0; - Buslogic->Status |= STAT_INVCMD; - } - break; - - case 0x91: - { - uint8_t Offset = Buslogic->CmdBuf[0]; - Buslogic->DataReplyLeft = Buslogic->CmdBuf[1]; - - Buslogic->UseLocalRam = 1; - Buslogic->DataReply = Offset; - } - break; - - case 0x95: - if (BuslogicIsPCI()) - { - if (Buslogic->Base != 0) - { - io_removehandler(Buslogic->Base, 0x0004, BuslogicRead, BuslogicReadW, BuslogicReadL, BuslogicWrite, BuslogicWriteW, BuslogicWriteL, Buslogic); - } - switch(Buslogic->CmdBuf[0]) - { - case 0: - Buslogic->Base = 0x330; - break; - case 1: - Buslogic->Base = 0x334; - break; - case 2: - Buslogic->Base = 0x230; - break; - case 3: - Buslogic->Base = 0x234; - break; - case 4: - Buslogic->Base = 0x130; - break; - case 5: - Buslogic->Base = 0x134; - break; - default: - Buslogic->Base = 0; - break; - } - if (Buslogic->Base != 0) - { - io_sethandler(Buslogic->Base, 0x0004, BuslogicRead, BuslogicReadW, BuslogicReadL, BuslogicWrite, BuslogicWriteW, BuslogicWriteL, Buslogic); - } - Buslogic->DataReplyLeft = 0; - } - else - { - Buslogic->DataReplyLeft = 0; - Buslogic->Status |= STAT_INVCMD; - } - break; - - case 0x96: - if (scsi_model) - { - if (Buslogic->CmdBuf[0] == 0) - Buslogic->ExtendedLUNCCBFormat = 0; - else if (Buslogic->CmdBuf[0] == 1) - Buslogic->ExtendedLUNCCBFormat = 1; - - Buslogic->DataReplyLeft = 0; - } - else - { - Buslogic->DataReplyLeft = 0; - Buslogic->Status |= STAT_INVCMD; - } - break; - - default: - case 0x22: //undocumented - Buslogic->DataReplyLeft = 0; - Buslogic->Status |= STAT_INVCMD; - break; - } - } - - if (Buslogic->DataReplyLeft) - Buslogic->Status |= STAT_DFULL; - else if (!Buslogic->CmdParamLeft) - BuslogicCommandComplete(Buslogic); - break; - - case 2: - if (scsi_model) - Buslogic->Interrupt = Val; //For Buslogic - break; - - case 3: - if (scsi_model) - Buslogic->Geometry = Val; //For Buslogic - break; - } -} - -void BuslogicWriteW(uint16_t Port, uint16_t Val, void *p) -{ - BuslogicWrite(Port, Val & 0xFF, p); -} - -void BuslogicWriteL(uint16_t Port, uint32_t Val, void *p) -{ - BuslogicWrite(Port, Val & 0xFF, p); -} - -static uint8_t BuslogicConvertSenseLength(uint8_t RequestSenseLength) -{ - BuslogicLog("Unconverted Request Sense length %i\n", RequestSenseLength); - - if (RequestSenseLength == 0) - RequestSenseLength = 14; - else if (RequestSenseLength == 1) - RequestSenseLength = 0; - /* else if ((RequestSenseLength > 1) && (RequestSenseLength < 8)) - { - if (!scsi_model) RequestSenseLength = 0; - } */ - - BuslogicLog("Request Sense length %i\n", RequestSenseLength); - - return RequestSenseLength; -} - -static void BuslogicSenseBufferFree(BuslogicRequests_t *BuslogicRequests, int Copy) -{ - uint8_t SenseLength = BuslogicConvertSenseLength(BuslogicRequests->CmdBlock.common.RequestSenseLength); - uint8_t cdrom_id = scsi_cdrom_drives[BuslogicRequests->TargetID][BuslogicRequests->LUN]; - - uint8_t temp_sense[256]; - - if (SenseLength && Copy) - { - uint32_t SenseBufferAddress; - - cdrom_request_sense_for_scsi(cdrom_id, temp_sense, SenseLength); - - /*The sense address, in 32-bit mode, is located in the Sense Pointer of the CCB, but in - 24-bit mode, it is located at the end of the Command Descriptor Block. */ - - if (BuslogicRequests->Is24bit) - { - SenseBufferAddress = BuslogicRequests->CCBPointer; - SenseBufferAddress += BuslogicRequests->CmdBlock.common.CdbLength + offsetof(CCB, Cdb); - } - else - { - SenseBufferAddress = BuslogicRequests->CmdBlock.new.SensePointer; - } - - BuslogicLog("Request Sense address: %02X\n", SenseBufferAddress); - - BuslogicLog("BuslogicSenseBufferFree(): Writing %i bytes at %08X\n", SenseLength, SenseBufferAddress); - DMAPageWrite(SenseBufferAddress, temp_sense, SenseLength); - BuslogicLog("Sense data written to buffer: %02X %02X %02X\n", temp_sense[2], temp_sense[12], temp_sense[13]); - } -} - -static void BuslogicCDROMCommand(Buslogic_t *Buslogic) -{ - BuslogicRequests_t *BuslogicRequests = &Buslogic->BuslogicRequests; - uint8_t Id, Lun; - - uint8_t cdrom_id; - uint8_t cdrom_phase; - - uint32_t temp = 0; - - uint8_t temp_cdb[12]; - uint32_t i; - - Id = BuslogicRequests->TargetID; - Lun = BuslogicRequests->LUN; - - cdrom_id = scsi_cdrom_drives[Id][Lun]; - - BuslogicLog("CD-ROM command being executed on: SCSI ID %i, SCSI LUN %i, CD-ROM %i\n", Id, Lun, cdrom_id); - - BuslogicLog("SCSI Cdb[0]=0x%02X\n", BuslogicRequests->CmdBlock.common.Cdb[0]); - for (i = 1; i < BuslogicRequests->CmdBlock.common.CdbLength; i++) - { - BuslogicLog("SCSI Cdb[%i]=%i\n", i, BuslogicRequests->CmdBlock.common.Cdb[i]); - } - - memset(temp_cdb, 0, cdrom[cdrom_id].cdb_len); - if (BuslogicRequests->CmdBlock.common.CdbLength <= cdrom[cdrom_id].cdb_len) - { - memcpy(temp_cdb, BuslogicRequests->CmdBlock.common.Cdb, BuslogicRequests->CmdBlock.common.CdbLength); - } - else - { - memcpy(temp_cdb, BuslogicRequests->CmdBlock.common.Cdb, cdrom[cdrom_id].cdb_len); - } - - cdrom[cdrom_id].request_length = temp_cdb[1]; /* Since that field in the cdrom struct is never used when the bus type is SCSI, let's use it for this scope. */ - - if (BuslogicRequests->CmdBlock.common.CdbLength != 12) - { - temp_cdb[1] &= 0x1f; /* Make sure the LUN field of the temporary CDB is always 0, otherwise Daemon Tools drives will misehave when a command is passed through to them. */ - } - - //Finally, execute the SCSI command immediately and get the transfer length. - - SCSIPhase = SCSI_PHASE_COMMAND; - cdrom_command(cdrom_id, temp_cdb); - SCSIStatus = cdrom_CDROM_PHASE_to_scsi(cdrom_id); - if (SCSIStatus == SCSI_STATUS_OK) - { - cdrom_phase = cdrom_atapi_phase_to_scsi(cdrom_id); - if (cdrom_phase == 2) - { - /* Command completed - call the phase callback to complete the command. */ - cdrom_phase_callback(cdrom_id); - } - else - { - /* Command first phase complete - call the callback to execute the second phase. */ - cdrom_phase_callback(cdrom_id); - SCSIStatus = cdrom_CDROM_PHASE_to_scsi(cdrom_id); - /* Command second phase complete - call the callback to complete the command. */ - cdrom_phase_callback(cdrom_id); - } - } - else - { - /* Error (Check Condition) - call the phase callback to complete the command. */ - cdrom_phase_callback(cdrom_id); - } - - BuslogicLog("SCSI Status: %s, Sense: %02X, ASC: %02X, ASCQ: %02X\n", (SCSIStatus == SCSI_STATUS_OK) ? "OK" : "CHECK CONDITION", cdrom[cdrom_id].sense[2], cdrom[cdrom_id].sense[12], cdrom[cdrom_id].sense[13]); - - BuslogicDataBufferFree(BuslogicRequests); - - BuslogicSenseBufferFree(BuslogicRequests, (SCSIStatus != SCSI_STATUS_OK)); - - BuslogicLog("Request complete\n"); - - if (SCSIStatus == SCSI_STATUS_OK) - { - BuslogicMailboxInSetup(Buslogic, BuslogicRequests->CCBPointer, &BuslogicRequests->CmdBlock, CCB_COMPLETE, SCSI_STATUS_OK, MBI_SUCCESS); - } - else if (SCSIStatus == SCSI_STATUS_CHECK_CONDITION) - { - BuslogicMailboxInSetup(Buslogic, BuslogicRequests->CCBPointer, &BuslogicRequests->CmdBlock, CCB_COMPLETE, SCSI_STATUS_CHECK_CONDITION, MBI_ERROR); - } -} - -static int BuslogicSCSIRequestSetup(Buslogic_t *Buslogic, uint32_t CCBPointer, Mailbox32_t *Mailbox32) -{ - BuslogicRequests_t *BuslogicRequests = &Buslogic->BuslogicRequests; - uint8_t Id, Lun; - - uint8_t cdrom_id; - uint8_t cdrom_phase; - - uint8_t last_id = scsi_model ? 15 : 7; - - //Fetch data from the Command Control Block. - DMAPageRead(CCBPointer, &BuslogicRequests->CmdBlock, sizeof(CCB32)); - - BuslogicRequests->Is24bit = Buslogic->Mbx24bit; - BuslogicRequests->CCBPointer = CCBPointer; - - BuslogicRequests->TargetID = Buslogic->Mbx24bit ? BuslogicRequests->CmdBlock.old.Id : BuslogicRequests->CmdBlock.new.Id; - BuslogicRequests->LUN = Buslogic->Mbx24bit ? BuslogicRequests->CmdBlock.old.Lun : BuslogicRequests->CmdBlock.new.Lun; - - Id = BuslogicRequests->TargetID; - Lun = BuslogicRequests->LUN; - - if ((Id > last_id) || (Lun > 7)) - { - BuslogicMailboxInSetup(Buslogic, CCBPointer, &BuslogicRequests->CmdBlock, CCB_INVALID_CCB, SCSI_STATUS_OK, MBI_ERROR); - return 1; - } - - BuslogicLog("Scanning SCSI Target ID %i\n", Id); - - cdrom_id = scsi_cdrom_drives[Id][Lun]; - - SCSIStatus = SCSI_STATUS_OK; - - SCSIDevices[Id][Lun].InitLength = 0; - - /* Do this here, so MODE SELECT data will does not get lost in transit. */ - memset(SCSIDevices[Id][Lun].CmdBuffer, 0, 390144); - - BuslogicDataBufferAllocate(BuslogicRequests, BuslogicRequests->Is24bit); - - if (!buslogic_scsi_drive_is_cdrom(Id, Lun)) - { - BuslogicLog("SCSI Target ID %i and LUN %i have no device attached\n", Id, Lun); - - BuslogicDataBufferFree(BuslogicRequests); - - BuslogicSenseBufferFree(BuslogicRequests, 0); - - BuslogicMailboxInSetup(Buslogic, CCBPointer, &BuslogicRequests->CmdBlock, CCB_SELECTION_TIMEOUT, SCSI_STATUS_OK, MBI_ERROR); - } - else - { - BuslogicLog("SCSI Target ID %i and LUN %i detected and working\n", Id, Lun); - - BuslogicLog("Transfer Control %02X\n", BuslogicRequests->CmdBlock.common.ControlByte); - BuslogicLog("CDB Length %i\n", BuslogicRequests->CmdBlock.common.CdbLength); - BuslogicLog("CCB Opcode %x\n", BuslogicRequests->CmdBlock.common.Opcode); - - if (BuslogicRequests->CmdBlock.common.ControlByte > 0x03) - { - BuslogicLog("Invalid control byte: %02X\n", BuslogicRequests->CmdBlock.common.ControlByte); - } - - BuslogicInOperation = 1; - } - - return 1; -} - -static int BuslogicSCSIRequestAbort(Buslogic_t *Buslogic, uint32_t CCBPointer) -{ - BuslogicRequests_t *BuslogicRequests = &Buslogic->BuslogicRequests; - CCBU CmdBlock; - - //Fetch data from the Command Control Block. - DMAPageRead(CCBPointer, &CmdBlock, sizeof(CCB32)); - - //Only SCSI CD-ROMs are supported at the moment, SCSI hard disk support will come soon. - BuslogicMailboxInSetup(Buslogic, CCBPointer, &CmdBlock, 0x26, SCSI_STATUS_OK, MBI_NOT_FOUND); - - return 1; -} - -static uint32_t BuslogicMailboxOut(Buslogic_t *Buslogic, Mailbox32_t *Mailbox32) -{ - Mailbox_t MailboxOut; - uint32_t Outgoing; - - if (Buslogic->Mbx24bit) - { - Outgoing = Buslogic->MailboxOutAddr + (Buslogic->MailboxOutPosCur * sizeof(Mailbox_t)); - - DMAPageRead(Outgoing, &MailboxOut, sizeof(Mailbox_t)); - - Mailbox32->CCBPointer = ADDR_TO_U32(MailboxOut.CCBPointer); - Mailbox32->u.out.ActionCode = MailboxOut.CmdStatus; - } - else - { - Outgoing = Buslogic->MailboxOutAddr + (Buslogic->MailboxOutPosCur * sizeof(Mailbox32_t)); - - DMAPageRead(Outgoing, Mailbox32, sizeof(Mailbox32_t)); - } - - return Outgoing; -} - -static void BuslogicMailboxOutAdvance(Buslogic_t *Buslogic) -{ - Buslogic->MailboxOutPosCur = (Buslogic->MailboxOutPosCur + 1) % Buslogic->MailboxCount; -} - -static int BuslogicProcessMailbox(Buslogic_t *Buslogic) -{ - Mailbox32_t Mailbox32; - Mailbox_t MailboxOut; - uint32_t Outgoing; - - uint8_t CmdStatus = MBO_FREE; - uint32_t CodeOffset = 0; - - int old_irq_enabled = Buslogic->IrqEnabled; - - BuslogicRequests_t *BuslogicRequests = &Buslogic->BuslogicRequests; - - int ret = 0; - - CodeOffset = Buslogic->Mbx24bit ? offsetof(Mailbox_t, CmdStatus) : offsetof(Mailbox32_t, u.out.ActionCode); - - if (!Buslogic->StrictRoundRobinMode) - { - uint8_t MailboxCur = Buslogic->MailboxOutPosCur; - - /* Search for a filled mailbox - stop if we have scanned all mailboxes. */ - do - { - /* Fetch mailbox from guest memory. */ - Outgoing = BuslogicMailboxOut(Buslogic, &Mailbox32); - - /* Check the next mailbox. */ - BuslogicMailboxOutAdvance(Buslogic); - } while ((Mailbox32.u.out.ActionCode == MBO_FREE) && (MailboxCur != Buslogic->MailboxOutPosCur)); - } - else - { - Outgoing = BuslogicMailboxOut(Buslogic, &Mailbox32); - } - - if (Mailbox32.u.out.ActionCode != MBO_FREE) - { - /* We got the mailbox, mark it as free in the guest. */ - BuslogicLog("BuslogicStartMailbox(): Writing %i bytes at %08X\n", sizeof(CmdStatus), Outgoing + CodeOffset); - DMAPageWrite(Outgoing + CodeOffset, &CmdStatus, sizeof(CmdStatus)); - } - - if (Buslogic->MailboxOutInterrupts) - { - BuslogicRaiseInterrupt(Buslogic, INTR_MBOA | INTR_ANY); - } - - /* Check if the mailbox is actually loaded. */ - if (Mailbox32.u.out.ActionCode == MBO_FREE) - { - // BuslogicLog("No loaded mailbox left\n"); - return 0; - } - - if (Mailbox32.u.out.ActionCode == MBO_START) - { - BuslogicLog("Start Mailbox Command\n"); - ret = BuslogicSCSIRequestSetup(Buslogic, Mailbox32.CCBPointer, &Mailbox32); - } - else if (Mailbox32.u.out.ActionCode == MBO_ABORT) - { - BuslogicLog("Abort Mailbox Command\n"); - ret = BuslogicSCSIRequestAbort(Buslogic, Mailbox32.CCBPointer); - } - else - { - BuslogicLog("Invalid action code: %02X\n", Mailbox32.u.out.ActionCode); - ret = 0; - } - - /* Advance to the next mailbox. */ - if (Buslogic->StrictRoundRobinMode) - { - BuslogicMailboxOutAdvance(Buslogic); - } - - return ret; -} - -void BuslogicResetPoll(void *p) -{ - Buslogic_t *Buslogic = (Buslogic_t *)p; - - Buslogic->Status &= ~STAT_STST; - Buslogic->Status |= STAT_IDLE; - - BuslogicResetCallback = 0; -} - -void BuslogicCommandCallback(void *p) -{ - Buslogic_t *Buslogic = (Buslogic_t *)p; - - BuslogicRequests_t *BuslogicRequests = &Buslogic->BuslogicRequests; - - int ret = 0; - int i = 0; - - // BuslogicLog("BusLogic Callback (%08X)!\n", BuslogicCallback); - - if (BuslogicInOperation == 0) - { - // BuslogicLog("BusLogic Callback: Start outgoing mailbox\n"); - if (Buslogic->MailboxCount) - { - ret = BuslogicProcessMailbox(Buslogic); - } - else - { - // fatal("Callback active with mailbox count 0!\n"); - BuslogicCallback += 50 * SCSI_TIME; - return; - } - } - else if (BuslogicInOperation == 1) - { - BuslogicLog("BusLogic Callback: Process request\n"); - BuslogicCDROMCommand(Buslogic); - } - else if (BuslogicInOperation == 2) - { - BuslogicLog("BusLogic Callback: Send incoming mailbox\n"); - BuslogicMailboxIn(Buslogic); - } - else - { - fatal("Invalid BusLogic callback phase: %i\n", BuslogicInOperation); - } - - BuslogicCallback += 50 * SCSI_TIME; -} - -uint8_t mem_read_null(uint32_t addr, void *priv) -{ - return 0; -} - -uint16_t mem_read_nullw(uint32_t addr, void *priv) -{ - return 0; -} - -uint32_t mem_read_nulll(uint32_t addr, void *priv) -{ - return 0; -} - -typedef union -{ - uint32_t addr; - uint8_t addr_regs[4]; -} bar_t; - -uint8_t buslogic_pci_regs[256]; - -bar_t buslogic_pci_bar[3]; - -uint8_t BuslogicPCIRead(int func, int addr, void *p) -{ - Buslogic_t *Buslogic = (Buslogic_t *)p; - - // BuslogicLog("BusLogic PCI read %08X\n", addr); - switch (addr) - { - case 0x00: - return 0x4b; - case 0x01: - return 0x10; - - case 0x02: - return 0x40; - case 0x03: - return 0x10; - - case 0x2C: - return 0x4b; - case 0x2D: - return 0x10; - case 0x2E: - return 0x40; - case 0x2F: - return 0x10; - - case 0x04: - return buslogic_pci_regs[0x04]; /*Respond to IO and memory accesses*/ - case 0x05: - return buslogic_pci_regs[0x05]; - - case 0x07: - return 2; - - case 0x08: - return 1; /*Revision ID*/ - case 0x09: - return 0; /*Programming interface*/ - case 0x0A: - return 0; /*Subclass*/ - case 0x0B: - return 1; /* Class code*/ - - case 0x10: - return (buslogic_pci_bar[0].addr_regs[0] & 0xe0) | 1; /*I/O space*/ - case 0x11: - return buslogic_pci_bar[0].addr_regs[1]; - case 0x12: - return buslogic_pci_bar[0].addr_regs[2]; - case 0x13: - return buslogic_pci_bar[0].addr_regs[3]; - - case 0x14: - return (buslogic_pci_bar[1].addr_regs[0] & 0xe0); /*Memory space*/ - case 0x15: - return buslogic_pci_bar[1].addr_regs[1]; - case 0x16: - return buslogic_pci_bar[1].addr_regs[2]; - case 0x17: - return buslogic_pci_bar[1].addr_regs[3]; - - case 0x30: - return buslogic_pci_bar[2].addr_regs[0] & 0x01; /*BIOS ROM address*/ - case 0x31: - return buslogic_pci_bar[2].addr_regs[1] | 0x18; - case 0x32: - return buslogic_pci_bar[2].addr_regs[2]; - case 0x33: - return buslogic_pci_bar[2].addr_regs[3]; - - case 0x3C: - return Buslogic->Irq; - case 0x3D: - return 1; - } - return 0; -} - -void BuslogicPCIWrite(int func, int addr, uint8_t val, void *p) -{ - Buslogic_t *Buslogic = (Buslogic_t *)p; - - switch (addr) - { - case 0x04: - io_removehandler(Buslogic->PCIBase, 0x0004, BuslogicRead, BuslogicReadW, BuslogicReadL, BuslogicWrite, BuslogicWriteW, BuslogicWriteL, Buslogic); - mem_mapping_disable(&Buslogic->mmio_mapping); - if (val & PCI_COMMAND_IO) - { - if (Buslogic->PCIBase != 0) - { - io_sethandler(Buslogic->PCIBase, 0x0020, BuslogicRead, BuslogicReadW, BuslogicReadL, BuslogicWrite, BuslogicWriteW, BuslogicWriteL, Buslogic); - } - } - if (val & PCI_COMMAND_MEM) - { - if (Buslogic->PCIBase != 0) - { - mem_mapping_set_addr(&Buslogic->mmio_mapping, Buslogic->MMIOBase, 0x20); - } - } - buslogic_pci_regs[addr] = val; - break; - - case 0x10: - val &= 0xe0; - val |= 1; - case 0x11: case 0x12: case 0x13: - /* I/O Base set. */ - /* First, remove the old I/O. */ - io_removehandler(Buslogic->PCIBase, 0x0020, BuslogicRead, BuslogicReadW, BuslogicReadL, BuslogicWrite, BuslogicWriteW, BuslogicWriteL, Buslogic); - /* Then let's set the PCI regs. */ - buslogic_pci_bar[0].addr_regs[addr & 3] = val; - /* Then let's calculate the new I/O base. */ - Buslogic->PCIBase = buslogic_pci_bar[0].addr & 0xffe0; - /* Log the new base. */ - BuslogicLog("BusLogic PCI: New I/O base is %04X\n" , Buslogic->PCIBase); - /* We're done, so get out of the here. */ - if (buslogic_pci_regs[4] & PCI_COMMAND_IO) - { - if (Buslogic->PCIBase != 0) - { - io_sethandler(Buslogic->PCIBase, 0x0020, BuslogicRead, BuslogicReadW, BuslogicReadL, BuslogicWrite, BuslogicWriteW, BuslogicWriteL, Buslogic); - } - } - return; - - case 0x14: - val &= 0xe0; - case 0x15: case 0x16: case 0x17: - /* I/O Base set. */ - /* First, remove the old I/O. */ - mem_mapping_disable(&Buslogic->mmio_mapping); - /* Then let's set the PCI regs. */ - buslogic_pci_bar[1].addr_regs[addr & 3] = val; - /* Then let's calculate the new I/O base. */ - Buslogic->MMIOBase = buslogic_pci_bar[1].addr & 0xffffffe0; - /* Log the new base. */ - BuslogicLog("BusLogic PCI: New MMIO base is %04X\n" , Buslogic->MMIOBase); - /* We're done, so get out of the here. */ - if (buslogic_pci_regs[4] & PCI_COMMAND_MEM) - { - if (Buslogic->PCIBase != 0) - { - mem_mapping_set_addr(&Buslogic->mmio_mapping, Buslogic->MMIOBase, 0x20); - } - } - return; - - /* Commented out until an APIC controller is emulated for the PIIX3, - otherwise the BT-958 will not get an IRQ on boards using the PIIX3. */ -#if 0 - case 0x3C: - buslogic_pci_regs[addr] = val; - if (val != 0xFF) - { - buslogic_log("BusLogic IRQ now: %i\n", val); - Buslogic->Irq = val; - } - return; -#endif - } -} - -void *BuslogicInit() -{ - int i = 0; - - Buslogic_t *Buslogic = malloc(sizeof(Buslogic_t)); - memset(Buslogic, 0, sizeof(Buslogic_t)); - - BuslogicResetDevice = Buslogic; - - scsi_model = device_get_config_int("model"); - Buslogic->Base = device_get_config_int("addr"); - Buslogic->PCIBase = 0; - Buslogic->MMIOBase = 0; - Buslogic->Irq = device_get_config_int("irq"); - Buslogic->DmaChannel = device_get_config_int("dma"); - - if (Buslogic->Base != 0) - { - if (BuslogicIsPCI()) - { - io_sethandler(Buslogic->Base, 0x0004, BuslogicRead, BuslogicReadW, BuslogicReadL, BuslogicWrite, BuslogicWriteW, BuslogicWriteL, Buslogic); - } - else - { - io_sethandler(Buslogic->Base, 0x0004, BuslogicRead, BuslogicReadW, NULL, BuslogicWrite, BuslogicWriteW, NULL, Buslogic); - } - } - - BuslogicLog("Building CD-ROM map...\n"); - build_scsi_cdrom_map(); - - for (i = 0; i < CDROM_NUM; i++) - { - if (buslogic_scsi_drive_is_cdrom(cdrom_drives[i].scsi_device_id, cdrom_drives[i].scsi_device_lun)) - { - SCSIDevices[cdrom_drives[i].scsi_device_id][cdrom_drives[i].scsi_device_lun].LunType == SCSI_CDROM; - } - } - - timer_add(BuslogicResetPoll, &BuslogicResetCallback, &BuslogicResetCallback, Buslogic); - timer_add(BuslogicCommandCallback, &BuslogicCallback, &BuslogicCallback, Buslogic); - - if (BuslogicIsPCI()) - { - pci_add(BuslogicPCIRead, BuslogicPCIWrite, Buslogic); - - buslogic_pci_bar[0].addr_regs[0] = 1; - buslogic_pci_bar[1].addr_regs[0] = 0; - - buslogic_pci_regs[0x04] = 1; - buslogic_pci_regs[0x05] = 0; - - buslogic_pci_regs[0x07] = 2; - - buslogic_pci_bar[2].addr = 0; - - mem_mapping_add(&Buslogic->mmio_mapping, 0xfffd0000, 0x20, mem_read_null, mem_read_nullw, mem_read_nulll, mem_write_null, mem_write_nullw, mem_write_nulll, NULL, MEM_MAPPING_EXTERNAL, Buslogic); - mem_mapping_disable(&Buslogic->mmio_mapping); - } - - BuslogicLog("Buslogic on port 0x%04X\n", Buslogic->Base); - - BuslogicResetControl(Buslogic, CTRL_HRST); - - return Buslogic; -} - -void BuslogicClose(void *p) -{ - Buslogic_t *Buslogic = (Buslogic_t *)p; - free(Buslogic); - BuslogicResetDevice = NULL; -} - -static device_config_t BuslogicConfig[] = -{ - { - .name = "model", - .description = "Model", - .type = CONFIG_BINARY, - .type = CONFIG_SELECTION, - .selection = - { - { - .description = "Adaptec AHA-154XB ISA", - .value = 0 - }, - { - .description = "BusLogic BT-542B ISA", - .value = 1 - }, - { - .description = "BusLogic BT-958 PCI", - .value = 2 - }, - { - .description = "" - } - }, - .default_int = 0 - }, - { - .name = "addr", - .description = "Address", - .type = CONFIG_BINARY, - .type = CONFIG_SELECTION, - .selection = - { - { - .description = "None", - .value = 0 - }, - { - .description = "0x330", - .value = 0x330 - }, - { - .description = "0x334", - .value = 0x334 - }, - { - .description = "0x230", - .value = 0x230 - }, - { - .description = "0x234", - .value = 0x234 - }, - { - .description = "0x130", - .value = 0x130 - }, - { - .description = "0x134", - .value = 0x134 - }, - { - .description = "" - } - }, - .default_int = 0x334 - }, - { - .name = "irq", - .description = "IRQ", - .type = CONFIG_SELECTION, - .selection = - { - { - .description = "IRQ 9", - .value = 9 - }, - { - .description = "IRQ 10", - .value = 10 - }, - { - .description = "IRQ 11", - .value = 11 - }, - { - .description = "IRQ 12", - .value = 12 - }, - { - .description = "IRQ 14", - .value = 14 - }, - { - .description = "IRQ 15", - .value = 15 - }, - { - .description = "" - } - }, - .default_int = 9 - }, - { - .name = "dma", - .description = "DMA channel", - .type = CONFIG_SELECTION, - .selection = - { - { - .description = "DMA 5", - .value = 5 - }, - { - .description = "DMA 6", - .value = 6 - }, - { - .description = "DMA 7", - .value = 7 - }, - { - .description = "" - } - }, - .default_int = 6 - }, - { - .type = -1 - } -}; - -device_t BuslogicDevice = -{ - "Adaptec/Buslogic", - 0, - BuslogicInit, - BuslogicClose, - NULL, - NULL, - NULL, - NULL, - BuslogicConfig -}; diff --git a/src/buslogic.h b/src/buslogic.h index ffb5b4a05..c4b6805f0 100644 --- a/src/buslogic.h +++ b/src/buslogic.h @@ -1 +1,27 @@ -extern device_t BuslogicDevice; \ No newline at end of file +#ifndef BUSLOGIC_H +# define BUSLOGIC_H + + +typedef struct { + uint8_t flags; /* local flags */ + uint8_t bid; /* board ID */ + char fwl, fwh; /* firmware info */ +} aha_info; +#define AHA_GLAG_MEMEN 0x01 /* BIOS Shadow RAM enabled */ + + +extern device_t aha1540b_device; +extern device_t aha1542cf_device; +extern device_t buslogic_device; +extern device_t buslogic_pci_device; + + +extern int buslogic_dev_present(uint8_t id, uint8_t lun); + +extern void aha154x_init(uint16_t, uint32_t, aha_info *); +extern uint8_t aha154x_shram(uint8_t); +extern uint8_t aha154x_eeprom(uint8_t,uint8_t,uint8_t,uint8_t,uint8_t *); +extern uint8_t aha154x_memory(uint8_t); + + +#endif /*BUSLOGIC_H*/ diff --git a/src/cdrom-ioctl.c b/src/cdrom-ioctl.c index ba8d1f9c3..5ab4d09a3 100644 --- a/src/cdrom-ioctl.c +++ b/src/cdrom-ioctl.c @@ -25,16 +25,11 @@ typedef struct cdrom_ioctl_windows_t cdrom_ioctl_windows[CDROM_NUM]; -// #define MSFtoLBA(m,s,f) (((((m*60)+s)*75)+f)-150) -/* The addresses sent from the guest are absolute, ie. a LBA of 0 corresponds to a MSF of 00:00:00. Otherwise, the counter displayed by the guest is wrong: - there is a seeming 2 seconds in which audio plays but counter does not move, while a data track before audio jumps to 2 seconds before the actual start - of the audio while audio still plays. With an absolute conversion, the counter is fine. */ - enum { - CD_STOPPED = 0, - CD_PLAYING, - CD_PAUSED + CD_STOPPED = 0, + CD_PLAYING, + CD_PAUSED }; int cdrom_ioctl_do_log = 0; @@ -58,281 +53,302 @@ void ioctl_audio_callback(uint8_t id, int16_t *output, int len) RAW_READ_INFO in; DWORD count; -// return; -// cdrom_ioctl_log("Audio callback %08X %08X %i %i %i %04X %i\n", ioctl_cd_pos, ioctl_cd_end, ioctl_cd_state, cd_buflen, len, cd_buffer[4], GetTickCount()); - if (cdrom_ioctl[id].cd_state != CD_PLAYING) - { - memset(output, 0, len * 2); - return; - } - while (cdrom_ioctl[id].cd_buflen < len) - { - if (cdrom[id].seek_pos < cdrom_ioctl[id].cd_end) - { - in.DiskOffset.LowPart = (cdrom[id].seek_pos - 150) * 2048; - in.DiskOffset.HighPart = 0; - in.SectorCount = 1; - in.TrackMode = CDDA; - ioctl_open(id, 0); -// cdrom_ioctl_log("Read to %i\n", cd_buflen); - if (!DeviceIoControl(cdrom_ioctl_windows[id].hIOCTL, IOCTL_CDROM_RAW_READ, &in, sizeof(in), &(cdrom_ioctl[id].cd_buffer[cdrom_ioctl[id].cd_buflen]), 2352, &count, NULL)) - { -// cdrom_ioctl_log("DeviceIoControl returned false\n"); - memset(&(cdrom_ioctl[id].cd_buffer[cdrom_ioctl[id].cd_buflen]), 0, (BUF_SIZE - cdrom_ioctl[id].cd_buflen) * 2); - cdrom_ioctl[id].cd_state = CD_STOPPED; - cdrom_ioctl[id].cd_buflen = len; - } - else - { -// cdrom_ioctl_log("DeviceIoControl returned true\n"); - cdrom[id].seek_pos++; - cdrom_ioctl[id].cd_buflen += (2352 / 2); - } - ioctl_close(id); - } - else - { - memset(&(cdrom_ioctl[id].cd_buffer[cdrom_ioctl[id].cd_buflen]), 0, (BUF_SIZE - cdrom_ioctl[id].cd_buflen) * 2); - cdrom_ioctl[id].cd_state = CD_STOPPED; - cdrom_ioctl[id].cd_buflen = len; - } - } - memcpy(output, cdrom_ioctl[id].cd_buffer, len * 2); -// for (c = 0; c < BUF_SIZE - len; c++) -// cd_buffer[c] = cd_buffer[c + cd_buflen]; - memcpy(&cdrom_ioctl[id].cd_buffer[0], &(cdrom_ioctl[id].cd_buffer[len]), (BUF_SIZE - len) * 2); - cdrom_ioctl[id].cd_buflen -= len; -// cdrom_ioctl_log("Done %i\n", GetTickCount()); + if (cdrom_ioctl[id].cd_state != CD_PLAYING) + { + memset(output, 0, len * 2); + return; + } + while (cdrom_ioctl[id].cd_buflen < len) + { + if (cdrom[id].seek_pos < cdrom_ioctl[id].cd_end) + { + in.DiskOffset.LowPart = (cdrom[id].seek_pos - 150) * 2048; + in.DiskOffset.HighPart = 0; + in.SectorCount = 1; + in.TrackMode = CDDA; + ioctl_open(id, 0); + if (!DeviceIoControl(cdrom_ioctl_windows[id].hIOCTL, IOCTL_CDROM_RAW_READ, &in, sizeof(in), &(cdrom_ioctl[id].cd_buffer[cdrom_ioctl[id].cd_buflen]), 2352, &count, NULL)) + { + memset(&(cdrom_ioctl[id].cd_buffer[cdrom_ioctl[id].cd_buflen]), 0, (BUF_SIZE - cdrom_ioctl[id].cd_buflen) * 2); + cdrom_ioctl[id].cd_state = CD_STOPPED; + cdrom_ioctl[id].cd_buflen = len; + } + else + { + cdrom[id].seek_pos++; + cdrom_ioctl[id].cd_buflen += (2352 / 2); + } + ioctl_close(id); + } + else + { + memset(&(cdrom_ioctl[id].cd_buffer[cdrom_ioctl[id].cd_buflen]), 0, (BUF_SIZE - cdrom_ioctl[id].cd_buflen) * 2); + cdrom_ioctl[id].cd_state = CD_STOPPED; + cdrom_ioctl[id].cd_buflen = len; + } + } + memcpy(output, cdrom_ioctl[id].cd_buffer, len * 2); + memcpy(&cdrom_ioctl[id].cd_buffer[0], &(cdrom_ioctl[id].cd_buffer[len]), (BUF_SIZE - len) * 2); + cdrom_ioctl[id].cd_buflen -= len; } void ioctl_audio_stop(uint8_t id) { - cdrom_ioctl[id].cd_state = CD_STOPPED; + cdrom_ioctl[id].cd_state = CD_STOPPED; } static int get_track_nr(uint8_t id, uint32_t pos) { - int c; - int track = 0; - - if (!cdrom_ioctl[id].tocvalid) - return 0; + int c; + int track = 0; - for (c = cdrom_ioctl_windows[id].toc.FirstTrack; c < cdrom_ioctl_windows[id].toc.LastTrack; c++) - { - uint32_t track_address = cdrom_ioctl_windows[id].toc.TrackData[c].Address[3] + - (cdrom_ioctl_windows[id].toc.TrackData[c].Address[2] * 75) + - (cdrom_ioctl_windows[id].toc.TrackData[c].Address[1] * 75 * 60); + if (!cdrom_ioctl[id].tocvalid) + { + return 0; + } - if (track_address <= pos) - track = c; - } - return track; + for (c = cdrom_ioctl_windows[id].toc.FirstTrack; c < cdrom_ioctl_windows[id].toc.LastTrack; c++) + { + uint32_t track_address = cdrom_ioctl_windows[id].toc.TrackData[c].Address[3] + + (cdrom_ioctl_windows[id].toc.TrackData[c].Address[2] * 75) + + (cdrom_ioctl_windows[id].toc.TrackData[c].Address[1] * 75 * 60); + + if (track_address <= pos) + { + track = c; + } + } + return track; } static uint32_t get_track_msf(uint8_t id, uint32_t track_no) { - int c; - int track = 0; - - if (!cdrom_ioctl[id].tocvalid) - return 0; + int c; - for (c = cdrom_ioctl_windows[id].toc.FirstTrack; c < cdrom_ioctl_windows[id].toc.LastTrack; c++) - { - if (c == track_no) - { - return cdrom_ioctl_windows[id].toc.TrackData[c].Address[3] + (cdrom_ioctl_windows[id].toc.TrackData[c].Address[2] << 8) + (cdrom_ioctl_windows[id].toc.TrackData[c].Address[1] << 16); - } - } - return 0xffffffff; + if (!cdrom_ioctl[id].tocvalid) + { + return 0; + } + + for (c = cdrom_ioctl_windows[id].toc.FirstTrack; c < cdrom_ioctl_windows[id].toc.LastTrack; c++) + { + if (c == track_no) + { + return cdrom_ioctl_windows[id].toc.TrackData[c].Address[3] + (cdrom_ioctl_windows[id].toc.TrackData[c].Address[2] << 8) + (cdrom_ioctl_windows[id].toc.TrackData[c].Address[1] << 16); + } + } + return 0xffffffff; } static void ioctl_playaudio(uint8_t id, uint32_t pos, uint32_t len, int ismsf) { - if (!cdrom_drives[id].host_drive) return; - // cdrom_ioctl_log("Play audio - %08X %08X %i\n", pos, len, ismsf); - if (ismsf == 2) + int m = 0, s = 0, f = 0; + uint32_t start_msf = 0, end_msf = 0; + if (!cdrom_drives[id].host_drive) + { + return; + } + if (ismsf == 2) + { + start_msf = get_track_msf(id, pos); + end_msf = get_track_msf(id, len); + if (start_msf == 0xffffffff) { - uint32_t start_msf = get_track_msf(id, pos); - uint32_t end_msf = get_track_msf(id, len); - if (start_msf == 0xffffffff) - { - return; - } - if (end_msf == 0xffffffff) - { - return; - } - int m = (start_msf >> 16) & 0xff; - int s = (start_msf >> 8) & 0xff; - int f = start_msf & 0xff; - pos = MSFtoLBA(m, s, f); - m = (end_msf >> 16) & 0xff; - s = (end_msf >> 8) & 0xff; - f = end_msf & 0xff; - len = MSFtoLBA(m, s, f); + return; } + if (end_msf == 0xffffffff) + { + return; + } + m = (start_msf >> 16) & 0xff; + s = (start_msf >> 8) & 0xff; + f = start_msf & 0xff; + pos = MSFtoLBA(m, s, f); + m = (end_msf >> 16) & 0xff; + s = (end_msf >> 8) & 0xff; + f = end_msf & 0xff; + len = MSFtoLBA(m, s, f); + } else if (ismsf == 1) { - int m = (pos >> 16) & 0xff; - int s = (pos >> 8) & 0xff; - int f = pos & 0xff; + m = (pos >> 16) & 0xff; + s = (pos >> 8) & 0xff; + f = pos & 0xff; - if (pos == 0xffffff) - { - cdrom_ioctl_log("Playing from current position (MSF)\n"); - pos = cdrom[id].seek_pos; - } - else - { - pos = MSFtoLBA(m, s, f); - } + if (pos == 0xffffff) + { + cdrom_ioctl_log("Playing from current position (MSF)\n"); + pos = cdrom[id].seek_pos; + } + else + { + pos = MSFtoLBA(m, s, f); + } - m = (len >> 16) & 0xff; - s = (len >> 8) & 0xff; - f = len & 0xff; - len = MSFtoLBA(m, s, f); - // cdrom_ioctl_log("MSF - pos = %08X len = %08X\n", pos, len); - } - else if (ismsf == 0) + m = (len >> 16) & 0xff; + s = (len >> 8) & 0xff; + f = len & 0xff; + len = MSFtoLBA(m, s, f); + } + else if (ismsf == 0) + { + if (pos == 0xffffffff) { - if (pos == 0xffffffff) - { - cdrom_ioctl_log("Playing from current position\n"); - pos = cdrom[id].seek_pos; - } - len += pos; + cdrom_ioctl_log("Playing from current position\n"); + pos = cdrom[id].seek_pos; } - cdrom[id].seek_pos = pos;// + 150; - cdrom_ioctl[id].cd_end = len;// + 150; - if (cdrom[id].seek_pos < 150) - { - /* Adjust because the host expects a minimum adjusted LBA of 0 which is equivalent to an absolute LBA of 150. */ - cdrom[id].seek_pos = 150; - } - cdrom_ioctl[id].cd_state = CD_PLAYING; - // cdrom_ioctl_log("Audio start %08X %08X %i %i %i\n", ioctl_cd_pos, ioctl_cd_end, ioctl_cd_state, cd_buflen, len); + len += pos; + } + cdrom[id].seek_pos = pos; + cdrom_ioctl[id].cd_end = len; + if (cdrom[id].seek_pos < 150) + { + /* Adjust because the host expects a minimum adjusted LBA of 0 which is equivalent to an absolute LBA of 150. */ + cdrom[id].seek_pos = 150; + } + cdrom_ioctl[id].cd_state = CD_PLAYING; } static void ioctl_pause(uint8_t id) { - if (!cdrom_drives[id].host_drive) return; - if (cdrom_ioctl[id].cd_state == CD_PLAYING) - cdrom_ioctl[id].cd_state = CD_PAUSED; + if (!cdrom_drives[id].host_drive) + { + return; + } + if (cdrom_ioctl[id].cd_state == CD_PLAYING) + { + cdrom_ioctl[id].cd_state = CD_PAUSED; + } } static void ioctl_resume(uint8_t id) { - if (!cdrom_drives[id].host_drive) return; - if (cdrom_ioctl[id].cd_state == CD_PAUSED) - cdrom_ioctl[id].cd_state = CD_PLAYING; + if (!cdrom_drives[id].host_drive) + { + return; + } + if (cdrom_ioctl[id].cd_state == CD_PAUSED) + { + cdrom_ioctl[id].cd_state = CD_PLAYING; + } } static void ioctl_stop(uint8_t id) { - if (!cdrom_drives[id].host_drive) return; - cdrom_ioctl[id].cd_state = CD_STOPPED; + if (!cdrom_drives[id].host_drive) + { + return; + } + cdrom_ioctl[id].cd_state = CD_STOPPED; } static int ioctl_ready(uint8_t id) { - long size; - int temp; - CDROM_TOC ltoc; - // cdrom_ioctl_log("Ready? %i\n",cdrom_drives[id].host_drive); - if (!cdrom_drives[id].host_drive) return 0; - ioctl_open(id, 0); - temp=DeviceIoControl(cdrom_ioctl_windows[id].hIOCTL,IOCTL_CDROM_READ_TOC, NULL,0,<oc,sizeof(ltoc),&size,NULL); - ioctl_close(id); - if (!temp) - return 0; - // cdrom_ioctl_log("ioctl_ready(): Drive opened successfully\n"); - // if ((cdrom_drives[id].host_drive != cdrom_drives[id].prev_host_drive)) cdrom_ioctl_log("Drive has changed\n"); - if ((ltoc.TrackData[ltoc.LastTrack].Address[1] != cdrom_ioctl_windows[id].toc.TrackData[cdrom_ioctl_windows[id].toc.LastTrack].Address[1]) || - (ltoc.TrackData[ltoc.LastTrack].Address[2] != cdrom_ioctl_windows[id].toc.TrackData[cdrom_ioctl_windows[id].toc.LastTrack].Address[2]) || - (ltoc.TrackData[ltoc.LastTrack].Address[3] != cdrom_ioctl_windows[id].toc.TrackData[cdrom_ioctl_windows[id].toc.LastTrack].Address[3]) || - !cdrom_ioctl[id].tocvalid || (cdrom_drives[id].host_drive != cdrom_drives[id].prev_host_drive)) - { - // cdrom_ioctl_log("ioctl_ready(): Disc or drive changed\n"); - // cdrom_ioctl_log("ioctl_ready(): Stopped\n"); - cdrom_ioctl[id].cd_state = CD_STOPPED; - if (cdrom_drives[id].host_drive != cdrom_drives[id].prev_host_drive) - cdrom_drives[id].prev_host_drive = cdrom_drives[id].host_drive; - return 1; - } - // cdrom_ioctl_log("ioctl_ready(): All is good\n"); - return 1; + unsigned long size; + int temp; + CDROM_TOC ltoc; + if (!cdrom_drives[id].host_drive) + { + return 0; + } + ioctl_open(id, 0); + temp = DeviceIoControl(cdrom_ioctl_windows[id].hIOCTL, IOCTL_CDROM_READ_TOC, NULL, 0, <oc, sizeof(ltoc), &size, NULL); + ioctl_close(id); + if (!temp) + { + return 0; + } + if ((ltoc.TrackData[ltoc.LastTrack].Address[1] != cdrom_ioctl_windows[id].toc.TrackData[cdrom_ioctl_windows[id].toc.LastTrack].Address[1]) || + (ltoc.TrackData[ltoc.LastTrack].Address[2] != cdrom_ioctl_windows[id].toc.TrackData[cdrom_ioctl_windows[id].toc.LastTrack].Address[2]) || + (ltoc.TrackData[ltoc.LastTrack].Address[3] != cdrom_ioctl_windows[id].toc.TrackData[cdrom_ioctl_windows[id].toc.LastTrack].Address[3]) || + !cdrom_ioctl[id].tocvalid || (cdrom_drives[id].host_drive != cdrom_drives[id].prev_host_drive)) + { + cdrom_ioctl[id].cd_state = CD_STOPPED; + if (cdrom_drives[id].host_drive != cdrom_drives[id].prev_host_drive) + { + cdrom_drives[id].prev_host_drive = cdrom_drives[id].host_drive; + } + return 1; + } + return 1; } static int ioctl_get_last_block(uint8_t id, unsigned char starttrack, int msf, int maxlen, int single) { - int len=4; - long size; - int c,d; - uint32_t temp; - CDROM_TOC lbtoc; - int lb=0; - if (!cdrom_drives[id].host_drive) return 0; - cdrom_ioctl[id].cd_state = CD_STOPPED; - // cdrom_ioctl_log("ioctl_readtoc(): IOCtl state now CD_STOPPED\n"); - ioctl_open(id, 0); - DeviceIoControl(cdrom_ioctl_windows[id].hIOCTL,IOCTL_CDROM_READ_TOC, NULL,0,&lbtoc,sizeof(lbtoc),&size,NULL); - ioctl_close(id); - cdrom_ioctl[id].tocvalid=1; - for (c=d;c<=lbtoc.LastTrack;c++) - { - uint32_t address; - address = MSFtoLBA(cdrom_ioctl_windows[id].toc.TrackData[c].Address[1],cdrom_ioctl_windows[id].toc.TrackData[c].Address[2],cdrom_ioctl_windows[id].toc.TrackData[c].Address[3]); - if (address > lb) - lb = address; + unsigned long size; + int c, d = 0; + CDROM_TOC lbtoc; + int lb = 0; + if (!cdrom_drives[id].host_drive) + { + return 0; + } + cdrom_ioctl[id].cd_state = CD_STOPPED; + ioctl_open(id, 0); + DeviceIoControl(cdrom_ioctl_windows[id].hIOCTL, IOCTL_CDROM_READ_TOC, NULL, 0, &lbtoc, sizeof(lbtoc), &size, NULL); + ioctl_close(id); + cdrom_ioctl[id].tocvalid=1; + for (c=d; c <= lbtoc.LastTrack; c++) + { + uint32_t address; + address = MSFtoLBA(cdrom_ioctl_windows[id].toc.TrackData[c].Address[1], cdrom_ioctl_windows[id].toc.TrackData[c].Address[2], cdrom_ioctl_windows[id].toc.TrackData[c].Address[3]); + if (address > lb) + { + lb = address; } - return lb; + } + return lb; } static int ioctl_medium_changed(uint8_t id) { - long size; - int temp; - CDROM_TOC ltoc; - if (!cdrom_drives[id].host_drive) return 0; /* This will be handled by the not ready handler instead. */ - ioctl_open(id, 0); - temp=DeviceIoControl(cdrom_ioctl_windows[id].hIOCTL,IOCTL_CDROM_READ_TOC, NULL,0,<oc,sizeof(ltoc),&size,NULL); - ioctl_close(id); - if (!temp) - return 0; /* Drive empty, a not ready handler matter, not disc change. */ - if (!cdrom_ioctl[id].tocvalid || (cdrom_drives[id].host_drive != cdrom_drives[id].prev_host_drive)) - { - cdrom_ioctl[id].cd_state = CD_STOPPED; - cdrom_ioctl_log("Setting TOC...\n"); - cdrom_ioctl_windows[id].toc = ltoc; - cdrom_ioctl[id].tocvalid = 1; - if (cdrom_drives[id].host_drive != cdrom_drives[id].prev_host_drive) - cdrom_drives[id].prev_host_drive = cdrom_drives[id].host_drive; - cdrom_ioctl[id].cdrom_capacity = ioctl_get_last_block(id, 0, 0, 4096, 0); - return 1; - } - else + unsigned long size; + int temp; + CDROM_TOC ltoc; + if (!cdrom_drives[id].host_drive) + { + return 0; /* This will be handled by the not ready handler instead. */ + } + ioctl_open(id, 0); + temp = DeviceIoControl(cdrom_ioctl_windows[id].hIOCTL, IOCTL_CDROM_READ_TOC, NULL, 0, <oc,sizeof(ltoc), &size, NULL); + ioctl_close(id); + if (!temp) + { + return 0; /* Drive empty, a not ready handler matter, not disc change. */ + } + if (!cdrom_ioctl[id].tocvalid || (cdrom_drives[id].host_drive != cdrom_drives[id].prev_host_drive)) + { + cdrom_ioctl[id].cd_state = CD_STOPPED; + cdrom_ioctl_windows[id].toc = ltoc; + cdrom_ioctl[id].tocvalid = 1; + if (cdrom_drives[id].host_drive != cdrom_drives[id].prev_host_drive) { - if ((ltoc.TrackData[ltoc.LastTrack].Address[1] != cdrom_ioctl_windows[id].toc.TrackData[cdrom_ioctl_windows[id].toc.LastTrack].Address[1]) || - (ltoc.TrackData[ltoc.LastTrack].Address[2] != cdrom_ioctl_windows[id].toc.TrackData[cdrom_ioctl_windows[id].toc.LastTrack].Address[2]) || - (ltoc.TrackData[ltoc.LastTrack].Address[3] != cdrom_ioctl_windows[id].toc.TrackData[cdrom_ioctl_windows[id].toc.LastTrack].Address[3])) - { - cdrom_ioctl[id].cd_state = CD_STOPPED; - cdrom_ioctl_log("Setting TOC...\n"); - cdrom_ioctl_windows[id].toc = ltoc; - cdrom_ioctl[id].cdrom_capacity = ioctl_get_last_block(id, 0, 0, 4096, 0); - return 1; /* TOC mismatches. */ - } + cdrom_drives[id].prev_host_drive = cdrom_drives[id].host_drive; } - return 0; /* None of the above, return 0. */ + cdrom_ioctl[id].cdrom_capacity = ioctl_get_last_block(id, 0, 0, 4096, 0); + return 1; + } + else + { + if ((ltoc.TrackData[ltoc.LastTrack].Address[1] != cdrom_ioctl_windows[id].toc.TrackData[cdrom_ioctl_windows[id].toc.LastTrack].Address[1]) || + (ltoc.TrackData[ltoc.LastTrack].Address[2] != cdrom_ioctl_windows[id].toc.TrackData[cdrom_ioctl_windows[id].toc.LastTrack].Address[2]) || + (ltoc.TrackData[ltoc.LastTrack].Address[3] != cdrom_ioctl_windows[id].toc.TrackData[cdrom_ioctl_windows[id].toc.LastTrack].Address[3])) + { + cdrom_ioctl[id].cd_state = CD_STOPPED; + cdrom_ioctl_log("Setting TOC...\n"); + cdrom_ioctl_windows[id].toc = ltoc; + cdrom_ioctl[id].cdrom_capacity = ioctl_get_last_block(id, 0, 0, 4096, 0); + return 1; /* TOC mismatches. */ + } + } + return 0; /* None of the above, return 0. */ } static uint8_t ioctl_getcurrentsubchannel(uint8_t id, uint8_t *b, int msf) { CDROM_SUB_Q_DATA_FORMAT insub; SUB_Q_CHANNEL_DATA sub; - long size; + unsigned long size; int pos=0; if (!cdrom_drives[id].host_drive) return 0; @@ -422,62 +438,72 @@ static uint8_t ioctl_getcurrentsubchannel(uint8_t id, uint8_t *b, int msf) static void ioctl_eject(uint8_t id) { - long size; - if (!cdrom_drives[id].host_drive) return; - cdrom_ioctl[id].cd_state = CD_STOPPED; - ioctl_open(id, 0); - DeviceIoControl(cdrom_ioctl_windows[id].hIOCTL,IOCTL_STORAGE_EJECT_MEDIA,NULL,0,NULL,0,&size,NULL); - ioctl_close(id); + unsigned long size; + if (!cdrom_drives[id].host_drive) + { + return; + } + cdrom_ioctl[id].cd_state = CD_STOPPED; + ioctl_open(id, 0); + DeviceIoControl(cdrom_ioctl_windows[id].hIOCTL,IOCTL_STORAGE_EJECT_MEDIA,NULL,0,NULL,0,&size,NULL); + ioctl_close(id); } static void ioctl_load(uint8_t id) { - long size; - if (!cdrom_drives[id].host_drive) return; - cdrom_ioctl[id].cd_state = CD_STOPPED; - ioctl_open(id, 0); - DeviceIoControl(cdrom_ioctl_windows[id].hIOCTL,IOCTL_STORAGE_LOAD_MEDIA,NULL,0,NULL,0,&size,NULL); - ioctl_close(id); - cdrom_ioctl[id].cdrom_capacity = ioctl_get_last_block(id, 0, 0, 4096, 0); + unsigned long size; + if (!cdrom_drives[id].host_drive) + { + return; + } + cdrom_ioctl[id].cd_state = CD_STOPPED; + ioctl_open(id, 0); + DeviceIoControl(cdrom_ioctl_windows[id].hIOCTL,IOCTL_STORAGE_LOAD_MEDIA,NULL,0,NULL,0,&size,NULL); + ioctl_close(id); + cdrom_ioctl[id].cdrom_capacity = ioctl_get_last_block(id, 0, 0, 4096, 0); } static int is_track_audio(uint8_t id, uint32_t pos) { - int c; - int control = 0; - - if (!cdrom_ioctl[id].tocvalid) - return 0; + int c; + int control = 0; - for (c = 0; c <= cdrom_ioctl_windows[id].toc.LastTrack; c++) - { - uint32_t track_address = MSFtoLBA(cdrom_ioctl_windows[id].toc.TrackData[c].Address[1],cdrom_ioctl_windows[id].toc.TrackData[c].Address[2],cdrom_ioctl_windows[id].toc.TrackData[c].Address[3]); - - if (track_address <= pos) - control = cdrom_ioctl_windows[id].toc.TrackData[c].Control; - } - // cdrom_ioctl_log("Control: %i\n", control); - if ((control & 0xd) == 0) + uint32_t track_address = 0; + + if (!cdrom_ioctl[id].tocvalid) + { + return 0; + } + + for (c = 0; c <= cdrom_ioctl_windows[id].toc.LastTrack; c++) + { + track_address = MSFtoLBA(cdrom_ioctl_windows[id].toc.TrackData[c].Address[1],cdrom_ioctl_windows[id].toc.TrackData[c].Address[2],cdrom_ioctl_windows[id].toc.TrackData[c].Address[3]); + + if (track_address <= pos) { - return 1; - } - else if ((control & 0xd) == 1) - { - return 1; - } - else - { - return 0; + control = cdrom_ioctl_windows[id].toc.TrackData[c].Control; } + } + + if ((control & 0xd) <= 1) + { + return 1; + } + else + { + return 0; + } } static int ioctl_is_track_audio(uint8_t id, uint32_t pos, int ismsf) { + int m = 0, s = 0, f = 0; + if (ismsf) { - int m = (pos >> 16) & 0xff; - int s = (pos >> 8) & 0xff; - int f = pos & 0xff; + m = (pos >> 16) & 0xff; + s = (pos >> 8) & 0xff; + f = pos & 0xff; pos = MSFtoLBA(m, s, f); } else @@ -630,28 +656,24 @@ common_handler: static int SCSICommand(uint8_t id, const UCHAR *cdb, UCHAR *buf, uint32_t *len, int no_length_check) { - HANDLE fh; - DWORD ioctl_bytes; - DWORD out_size; - int ioctl_rv = 0; - int sector_type = 0; - int temp_len = 0; + DWORD ioctl_bytes; + int ioctl_rv = 0; SCSISense.SenseKey = 0; SCSISense.Asc = 0; SCSISense.Ascq = 0; - *len = 0; - memset(&sptd, 0, sizeof(sptd)); - sptd.s.Length = sizeof(SCSI_PASS_THROUGH); - sptd.s.CdbLength = 12; - sptd.s.DataIn = SCSI_IOCTL_DATA_IN; - sptd.s.TimeOutValue = 80 * 60; - sptd.s.DataTransferLength = ioctl_get_block_length(id, cdb, cdrom_ioctl[id].actual_requested_blocks, no_length_check); - sptd.s.SenseInfoOffset = (uintptr_t)&sptd.sense - (uintptr_t)&sptd; - sptd.s.SenseInfoLength = 32; - sptd.s.DataBufferOffset = (uintptr_t)&sptd.data - (uintptr_t)&sptd; - + *len = 0; + memset(&sptd, 0, sizeof(sptd)); + sptd.s.Length = sizeof(SCSI_PASS_THROUGH); + sptd.s.CdbLength = 12; + sptd.s.DataIn = SCSI_IOCTL_DATA_IN; + sptd.s.TimeOutValue = 80 * 60; + sptd.s.DataTransferLength = ioctl_get_block_length(id, cdb, cdrom_ioctl[id].actual_requested_blocks, no_length_check); + sptd.s.SenseInfoOffset = (uintptr_t)&sptd.sense - (uintptr_t)&sptd; + sptd.s.SenseInfoLength = 32; + sptd.s.DataBufferOffset = (uintptr_t)&sptd.data - (uintptr_t)&sptd; + memcpy(sptd.s.Cdb, cdb, 12); ioctl_rv = DeviceIoControl(cdrom_ioctl_windows[id].hIOCTL, IOCTL_SCSI_PASS_THROUGH, &sptd, sizeof(sptd), &sptd, sizeof(sptd), &ioctl_bytes, NULL); @@ -664,25 +686,25 @@ static int SCSICommand(uint8_t id, const UCHAR *cdb, UCHAR *buf, uint32_t *len, cdrom_ioctl_log("Transferred length: %i (command: %02X)\n", sptd.s.DataTransferLength, cdb[0]); cdrom_ioctl_log("Sense length: %i (%02X %02X %02X %02X %02X)\n", sptd.s.SenseInfoLength, sptd.sense[0], sptd.sense[1], sptd.sense[2], sptd.sense[12], sptd.sense[13]); - cdrom_ioctl_log("IOCTL bytes: %i; SCSI status: %i, status: %i, LastError: %08X\n", ioctl_bytes, sptd.s.ScsiStatus, ioctl_rv, GetLastError()); - cdrom_ioctl_log("DATA: %02X %02X %02X %02X %02X %02X\n", sptd.data[0], sptd.data[1], sptd.data[2], sptd.data[3], sptd.data[4], sptd.data[5]); - cdrom_ioctl_log(" %02X %02X %02X %02X %02X %02X\n", sptd.data[6], sptd.data[7], sptd.data[8], sptd.data[9], sptd.data[10], sptd.data[11]); - cdrom_ioctl_log(" %02X %02X %02X %02X %02X %02X\n", sptd.data[12], sptd.data[13], sptd.data[14], sptd.data[15], sptd.data[16], sptd.data[17]); - cdrom_ioctl_log("SENSE: %02X %02X %02X %02X %02X %02X\n", sptd.sense[0], sptd.sense[1], sptd.sense[2], sptd.sense[3], sptd.sense[4], sptd.sense[5]); - cdrom_ioctl_log(" %02X %02X %02X %02X %02X %02X\n", sptd.sense[6], sptd.sense[7], sptd.sense[8], sptd.sense[9], sptd.sense[10], sptd.sense[11]); - cdrom_ioctl_log(" %02X %02X %02X %02X %02X %02X\n", sptd.sense[12], sptd.sense[13], sptd.sense[14], sptd.sense[15], sptd.sense[16], sptd.sense[17]); + cdrom_ioctl_log("IOCTL bytes: %i; SCSI status: %i, status: %i, LastError: %08X\n", ioctl_bytes, sptd.s.ScsiStatus, ioctl_rv, GetLastError()); + cdrom_ioctl_log("DATA: %02X %02X %02X %02X %02X %02X\n", sptd.data[0], sptd.data[1], sptd.data[2], sptd.data[3], sptd.data[4], sptd.data[5]); + cdrom_ioctl_log(" %02X %02X %02X %02X %02X %02X\n", sptd.data[6], sptd.data[7], sptd.data[8], sptd.data[9], sptd.data[10], sptd.data[11]); + cdrom_ioctl_log(" %02X %02X %02X %02X %02X %02X\n", sptd.data[12], sptd.data[13], sptd.data[14], sptd.data[15], sptd.data[16], sptd.data[17]); + cdrom_ioctl_log("SENSE: %02X %02X %02X %02X %02X %02X\n", sptd.sense[0], sptd.sense[1], sptd.sense[2], sptd.sense[3], sptd.sense[4], sptd.sense[5]); + cdrom_ioctl_log(" %02X %02X %02X %02X %02X %02X\n", sptd.sense[6], sptd.sense[7], sptd.sense[8], sptd.sense[9], sptd.sense[10], sptd.sense[11]); + cdrom_ioctl_log(" %02X %02X %02X %02X %02X %02X\n", sptd.sense[12], sptd.sense[13], sptd.sense[14], sptd.sense[15], sptd.sense[16], sptd.sense[17]); *len = sptd.s.DataTransferLength; if (sptd.s.DataTransferLength != 0) { memcpy(buf, sptd.data, sptd.s.DataTransferLength); } - return ioctl_rv; + return ioctl_rv; } static void ioctl_read_capacity(uint8_t id, uint8_t *b) { - int len = 0; + uint32_t len = 0; const UCHAR cdb[] = { 0x25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; UCHAR buf[16]; @@ -701,7 +723,7 @@ static int ioctl_media_type_id(uint8_t id) uint8_t old_sense[3] = { 0, 0, 0 }; UCHAR msbuf[28]; - int len = 0; + uint32_t len = 0; int sense = 0; const UCHAR cdb[] = { 0x5A, 0x00, 0x2A, 0, 0, 0, 0, 0, 28, 0, 0, 0 }; @@ -714,8 +736,6 @@ static int ioctl_media_type_id(uint8_t id) SCSICommand(id, cdb, msbuf, &len, 1); - // pclog("Returned length: %i, media type: %i\n", len, msbuf[2]); - ioctl_close(id); sense = cdrom_sense_key; @@ -743,66 +763,75 @@ static uint32_t msf_to_lba32(int lba) static int ioctl_get_type(uint8_t id, UCHAR *cdb, UCHAR *buf) { - int i = 0; - int ioctl_rv = 0; + int i = 0; + int ioctl_rv = 0; - int len = 0; - - for (i = 2; i <= 5; i++) - { - cdb[1] = i << 2; - ioctl_rv = SCSICommand(id, cdb, buf, &len, 1); /* Bypass length check so we don't risk calling this again and getting stuck in an endless up. */ - if (ioctl_rv) - { - return i; - } - } - return 0; + uint32_t len = 0; + + for (i = 2; i <= 5; i++) + { + cdb[1] = i << 2; + ioctl_rv = SCSICommand(id, cdb, buf, &len, 1); /* Bypass length check so we don't risk calling this again and getting stuck in an endless up. */ + if (ioctl_rv) + { + return i; + } + } + return 0; } static int ioctl_sector_data_type(uint8_t id, int sector, int ismsf) { - int ioctl_rv = 0; - const UCHAR cdb_lba[] = { 0xBE, 0, (sector >> 24), ((sector >> 16) & 0xff), ((sector >> 8) & 0xff), (sector & 0xff), 0, 0, 1, 0x10, 0, 0 }; - const UCHAR cdb_msf[] = { 0xB9, 0, 0, ((sector >> 16) & 0xff), ((sector >> 8) & 0xff), (sector & 0xff), ((sector >> 16) & 0xff), ((sector >> 8) & 0xff), (sector & 0xff), 0x10, 0, 0 }; - UCHAR buf[2352]; + int ioctl_rv = 0; + UCHAR cdb_lba[] = { 0xBE, 0, 0, 0, 0, 0, 0, 0, 1, 0x10, 0, 0 }; + UCHAR cdb_msf[] = { 0xB9, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0 }; + UCHAR buf[2352]; - ioctl_open(id, 0); + cdb_lba[2] = (sector >> 24); + cdb_lba[3] = ((sector >> 16) & 0xff); + cdb_lba[4] = ((sector >> 8) & 0xff); + cdb_lba[5] = (sector & 0xff); - if (ioctl_is_track_audio(id, sector, ismsf)) - { - return 1; - } - - if (ismsf) - { - ioctl_rv = ioctl_get_type(id, cdb_msf, buf); - } - else - { - ioctl_rv = ioctl_get_type(id, cdb_lba, buf); - } + cdb_msf[3] = cdb_msf[6] = ((sector >> 16) & 0xff); + cdb_msf[4] = cdb_msf[7] = ((sector >> 8) & 0xff); + cdb_msf[5] = cdb_msf[8] = (sector & 0xff); - if (ioctl_rv) - { - ioctl_close(id); - return ioctl_rv; - } - - if (ismsf) - { - sector = msf_to_lba32(sector); - if (sector < 150) - { - ioctl_close(id); - return 0; - } - sector -= 150; - ioctl_rv = ioctl_get_type(id, cdb_lba, buf); - } - - ioctl_close(id); - return ioctl_rv; + ioctl_open(id, 0); + + if (ioctl_is_track_audio(id, sector, ismsf)) + { + return 1; + } + + if (ismsf) + { + ioctl_rv = ioctl_get_type(id, cdb_msf, buf); + } + else + { + ioctl_rv = ioctl_get_type(id, cdb_lba, buf); + } + + if (ioctl_rv) + { + ioctl_close(id); + return ioctl_rv; + } + + if (ismsf) + { + sector = msf_to_lba32(sector); + if (sector < 150) + { + ioctl_close(id); + return 0; + } + sector -= 150; + ioctl_rv = ioctl_get_type(id, (UCHAR *) cdb_lba, buf); + } + + ioctl_close(id); + return ioctl_rv; } static int ioctl_get_sector_data_type(uint8_t id, uint8_t b0, uint8_t b1, uint8_t b2, uint8_t b3, int ismsf) @@ -816,7 +845,7 @@ static int ioctl_get_sector_data_type(uint8_t id, uint8_t b0, uint8_t b1, uint8_ static void ioctl_validate_toc(uint8_t id) { - long size; + unsigned long size; if (!cdrom_drives[id].host_drive) { return; @@ -835,7 +864,7 @@ static int ioctl_pass_through(uint8_t id, uint8_t *in_cdb, uint8_t *b, uint32_t { const UCHAR cdb[12]; - int ret; + int ret = 0; int block_length = 0; @@ -845,10 +874,9 @@ static int ioctl_pass_through(uint8_t id, uint8_t *in_cdb, uint8_t *b, uint32_t int blocks_at_once = 0; int buffer_pos = 0; - int temp_requested_blocks = 0; int transferred_blocks = 0; - int temp_len = 0; + uint32_t temp_len = 0; int chunk = 0; if (in_cdb[0] == 0x43) @@ -859,7 +887,7 @@ static int ioctl_pass_through(uint8_t id, uint8_t *in_cdb, uint8_t *b, uint32_t ioctl_open(id, 0); - memcpy(cdb, in_cdb, 12); + memcpy((void *) cdb, in_cdb, 12); temp_block_length = ioctl_get_block_length(id, cdb, cdrom[id].requested_blocks, 0); *len = 0; @@ -873,7 +901,6 @@ static int ioctl_pass_through(uint8_t id, uint8_t *in_cdb, uint8_t *b, uint32_t buffer_pos = 0; temp_pos = cdrom[id].sector_pos; - temp_requested_blocks = cdrom[id].requested_blocks; transferred_blocks = 0; temp_len = 0; @@ -890,7 +917,7 @@ split_block_read_iterate: cdrom_ioctl[id].actual_requested_blocks = blocks_at_once; } cdrom_ioctl_log("CD-ROM %i: ioctl_pass_through(): Transferring %i blocks...\n", id, cdrom_ioctl[id].actual_requested_blocks); - cdrom_update_cdb(cdb, temp_pos, cdrom_ioctl[id].actual_requested_blocks); + cdrom_update_cdb((uint8_t *) cdb, temp_pos, cdrom_ioctl[id].actual_requested_blocks); ret = SCSICommand(id, cdb, buf + buffer_pos, &temp_len, 0); *len += temp_len; transferred_blocks += cdrom_ioctl[id].actual_requested_blocks; @@ -928,21 +955,22 @@ split_block_read_iterate: static uint32_t ioctl_size(uint8_t id) { - uint8_t capacity_buffer[8]; - uint32_t capacity = 0; - ioctl_read_capacity(id, capacity_buffer); - capacity = ((uint32_t) capacity_buffer[0]) << 24; - capacity |= ((uint32_t) capacity_buffer[1]) << 16; - capacity |= ((uint32_t) capacity_buffer[2]) << 8; - capacity |= (uint32_t) capacity_buffer[3]; - return capacity + 1; - // return cdrom_capacity; + uint8_t capacity_buffer[8]; + uint32_t capacity = 0; + ioctl_read_capacity(id, capacity_buffer); + capacity = ((uint32_t) capacity_buffer[0]) << 24; + capacity |= ((uint32_t) capacity_buffer[1]) << 16; + capacity |= ((uint32_t) capacity_buffer[2]) << 8; + capacity |= (uint32_t) capacity_buffer[3]; + return capacity + 1; } static int ioctl_status(uint8_t id) { if (!(ioctl_ready(id)) && (cdrom_drives[id].host_drive <= 0)) - return CD_STATUS_EMPTY; + { + return CD_STATUS_EMPTY; + } switch(cdrom_ioctl[id].cd_state) { @@ -952,14 +980,15 @@ static int ioctl_status(uint8_t id) return CD_STATUS_PAUSED; case CD_STOPPED: return CD_STATUS_STOPPED; + default: + return CD_STATUS_EMPTY; } } void ioctl_reset(uint8_t id) { CDROM_TOC ltoc; - int temp; - long size; + unsigned long size; if (!cdrom_drives[id].host_drive) { @@ -968,7 +997,7 @@ void ioctl_reset(uint8_t id) } ioctl_open(id, 0); - temp = DeviceIoControl(cdrom_ioctl_windows[id].hIOCTL, IOCTL_CDROM_READ_TOC, NULL, 0, <oc, sizeof(ltoc), &size, NULL); + DeviceIoControl(cdrom_ioctl_windows[id].hIOCTL, IOCTL_CDROM_READ_TOC, NULL, 0, <oc, sizeof(ltoc), &size, NULL); ioctl_close(id); cdrom_ioctl_windows[id].toc = ltoc; @@ -977,19 +1006,12 @@ void ioctl_reset(uint8_t id) int ioctl_open(uint8_t id, char d) { - // char s[8]; if (!cdrom_ioctl[id].ioctl_inited) { sprintf(cdrom_ioctl[id].ioctl_path,"\\\\.\\%c:",d); - // cdrom_ioctl_log("Path is %s\n",ioctl_path); cdrom_ioctl[id].tocvalid=0; } - // cdrom_ioctl_log("Opening %s\n",ioctl_path); cdrom_ioctl_windows[id].hIOCTL = CreateFile(cdrom_ioctl[id].ioctl_path, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); - if (!cdrom_ioctl_windows[id].hIOCTL) - { - // fatal("IOCTL"); - } cdrom_drives[id].handler = &ioctl_cdrom; if (!cdrom_ioctl[id].ioctl_inited) { @@ -1018,26 +1040,26 @@ static void ioctl_exit(uint8_t id) static CDROM ioctl_cdrom= { - ioctl_ready, - ioctl_medium_changed, - ioctl_media_type_id, - ioctl_audio_callback, - ioctl_audio_stop, - NULL, - NULL, - NULL, - ioctl_getcurrentsubchannel, - ioctl_pass_through, - ioctl_sector_data_type, - NULL, - ioctl_playaudio, - ioctl_load, - ioctl_eject, - ioctl_pause, - ioctl_resume, - ioctl_size, - ioctl_status, - ioctl_is_track_audio, - ioctl_stop, - ioctl_exit + ioctl_ready, + ioctl_medium_changed, + ioctl_media_type_id, + ioctl_audio_callback, + ioctl_audio_stop, + NULL, + NULL, + NULL, + ioctl_getcurrentsubchannel, + ioctl_pass_through, + ioctl_sector_data_type, + NULL, + ioctl_playaudio, + ioctl_load, + ioctl_eject, + ioctl_pause, + ioctl_resume, + ioctl_size, + ioctl_status, + ioctl_is_track_audio, + ioctl_stop, + ioctl_exit }; diff --git a/src/cdrom-iso.c b/src/cdrom-iso.c index dc10fbf64..7fc01b246 100644 --- a/src/cdrom-iso.c +++ b/src/cdrom-iso.c @@ -8,6 +8,11 @@ #include "ibm.h" #include "cdrom.h" #include "cdrom-iso.h" + +#define __USE_LARGEFILE64 +#define _LARGEFILE_SOURCE +#define _LARGEFILE64_SOURCE + #include static CDROM iso_cdrom; @@ -38,7 +43,7 @@ void iso_audio_callback(uint8_t id, int16_t *output, int len) void iso_audio_stop(uint8_t id) { - // cdrom_iso_log("iso_audio_stop stub\n"); + return; } static int iso_ready(uint8_t id) @@ -93,8 +98,8 @@ static void lba_to_msf(uint8_t *buf, int lba) static uint8_t iso_getcurrentsubchannel(uint8_t id, uint8_t *b, int msf) { - long size; int pos=0; + int32_t temp; if (strlen(cdrom_iso[id].iso_path) == 0) { return 0; @@ -104,7 +109,7 @@ static uint8_t iso_getcurrentsubchannel(uint8_t id, uint8_t *b, int msf) b[pos++]=0; b[pos++]=0; - int32_t temp = cdrom[id].seek_pos; + temp = cdrom[id].seek_pos; if (msf) { memset(&(b[pos]), 0, 8); @@ -130,12 +135,12 @@ static uint8_t iso_getcurrentsubchannel(uint8_t id, uint8_t *b, int msf) static void iso_eject(uint8_t id) { - // cdrom_iso_log("iso_eject stub\n"); + return; } static void iso_load(uint8_t id) { - // cdrom_iso_log("iso_load stub\n"); + return; } static int iso_sector_data_type(uint8_t id, int sector, int ismsf) @@ -145,50 +150,52 @@ static int iso_sector_data_type(uint8_t id, int sector, int ismsf) static void iso_readsector(uint8_t id, uint8_t *b, int sector) { - uint32_t temp; uint64_t file_pos = sector; - if (!cdrom_drives[id].host_drive) return; + if (!cdrom_drives[id].host_drive) + { + return; + } file_pos <<= 11; memset(b, 0, 2856); - cdrom_iso[id].iso_image = fopen(cdrom_iso[id].iso_path, "rb"); - fseeko64(cdrom_iso[id].iso_image, file_pos, SEEK_SET); - fread(b + 16, 2048, 1, cdrom_iso[id].iso_image); - fclose(cdrom_iso[id].iso_image); + cdrom_iso[id].iso_image = fopen(cdrom_iso[id].iso_path, "rb"); + fseeko64(cdrom_iso[id].iso_image, file_pos, SEEK_SET); + fread(b + 16, 2048, 1, cdrom_iso[id].iso_image); + fclose(cdrom_iso[id].iso_image); - /* sync bytes */ - b[0] = 0; - memset(b + 1, 0xff, 10); - b[11] = 0; - b += 12; - lba_to_msf(b, sector); - b[3] = 1; /* mode 1 data */ - b += 4; - b += 2048; - memset(b, 0, 288); + /* sync bytes */ + b[0] = 0; + memset(b + 1, 0xff, 10); + b[11] = 0; + b += 12; + lba_to_msf(b, sector); + b[3] = 1; /* mode 1 data */ + b += 4; + b += 2048; + memset(b, 0, 288); b += 288; - memset(b, 0, 392); + memset(b, 0, 392); } -typedef struct __attribute__((packed)) +typedef struct __attribute__((__packed__)) { uint8_t user_data[2048]; uint8_t ecc[288]; } m1_data_t; -typedef struct __attribute__((packed)) +typedef struct __attribute__((__packed__)) { uint8_t sub_header[8]; uint8_t user_data[2328]; } m2_data_t; -typedef union __attribute__((packed)) +typedef union __attribute__((__packed__)) { m1_data_t m1_data; m2_data_t m2_data; uint8_t raw_data[2352]; } sector_data_t; -typedef struct __attribute__((packed)) +typedef struct __attribute__((__packed__)) { uint8_t sync[12]; uint8_t header[4]; @@ -199,7 +206,7 @@ typedef struct __attribute__((packed)) uint8_t subchannel_rw[96]; } cdrom_sector_t; -typedef union __attribute__((packed)) +typedef union __attribute__((__packed__)) { cdrom_sector_t cdrom_sector; uint8_t buffer[2856]; @@ -211,10 +218,8 @@ int cdrom_sector_size; static int iso_readsector_raw(uint8_t id, uint8_t *buffer, int sector, int ismsf, int cdrom_sector_type, int cdrom_sector_flags, int *len) { - int real_sector_type; uint8_t *b; uint8_t *temp_b; - int is_audio; int real_pos; b = temp_b = buffer; @@ -314,8 +319,6 @@ static int iso_readsector_raw(uint8_t id, uint8_t *buffer, int sector, int ismsf temp_b += 288; } - cdrom_iso_log("CD-ROM sector size: %i (%i, %i) [%04X]\n", cdrom_sector_size, cdrom_sector_type, real_sector_type, cdrom_sector_flags); - if ((cdrom_sector_flags & 0x06) == 0x02) { /* Add error flags. */ @@ -546,7 +549,7 @@ void iso_reset(uint8_t id) int iso_open(uint8_t id, char *fn) { - struct stat st; + struct stat64 st; if (strcmp(fn, cdrom_iso[id].iso_path) != 0) { @@ -557,7 +560,6 @@ int iso_open(uint8_t id, char *fn) if (!cdrom_iso[id].iso_inited || cdrom_iso[id].iso_changed) { sprintf(cdrom_iso[id].iso_path, "%s", fn); - // cdrom_iso_log("Path is %s\n", cdrom_iso[id].iso_path); } cdrom_iso[id].iso_image = fopen(cdrom_iso[id].iso_path, "rb"); cdrom_drives[id].handler = &iso_cdrom; @@ -567,7 +569,7 @@ int iso_open(uint8_t id, char *fn) fclose(cdrom_iso[id].iso_image); } - stat(cdrom_iso[id].iso_path, &st); + stat64(cdrom_iso[id].iso_path, &st); cdrom_iso[id].image_size = st.st_size; return 0; diff --git a/src/cdrom-null.c b/src/cdrom-null.c index 2409df412..9c52cc848 100644 --- a/src/cdrom-null.c +++ b/src/cdrom-null.c @@ -42,11 +42,6 @@ static int null_readsector_raw(uint8_t id, uint8_t *buffer, int sector, int isms return 0; } -static int null_read_track_information(uint8_t id, uint8_t *in_cdb, uint8_t *b) -{ - return 0; -} - static int null_readtoc(uint8_t id, unsigned char *b, unsigned char starttrack, int msf, int maxlen, int single) { return 0; diff --git a/src/cdrom-null.h b/src/cdrom-null.h index 7cc595089..7217760ca 100644 --- a/src/cdrom-null.h +++ b/src/cdrom-null.h @@ -1,14 +1,14 @@ /* Copyright holders: Sarah Walker see COPYING for more details */ -#ifndef CDROM_IOCTL_H -#define CDROM_IOCTL_H +#ifndef CDROM_NULL_H +#define CDROM_NULL_H /* this header file lists the functions provided by various platform specific cdrom-ioctl files */ -extern int cdrom_null_open(uint8_t id, char d); -extern void cdrom_null_reset(uint8_t id); -extern void null_close(uint8_t id); +int cdrom_null_open(uint8_t id, char d); +void cdrom_null_reset(uint8_t id); +void null_close(uint8_t id); -#endif /* ! CDROM_IOCTL_H */ +#endif /* ! CDROM_NULL_H */ diff --git a/src/cdrom.c b/src/cdrom.c index 24a00cbeb..8cf6e3174 100644 --- a/src/cdrom.c +++ b/src/cdrom.c @@ -10,6 +10,7 @@ #include "cdrom.h" #include "ibm.h" #include "ide.h" +#include "piix.h" #include "scsi.h" #include "timer.h" @@ -51,7 +52,12 @@ uint8_t scsi_cdrom_drives[16][8] = { { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } }; +#ifdef __MSC__ +# pragma pack(push,1) +static struct +#else static struct __attribute__((__packed__)) +#endif { uint8_t opcode; uint8_t polled; @@ -61,150 +67,660 @@ static struct __attribute__((__packed__)) uint16_t len; uint8_t control; } *gesn_cdb; +#ifdef __MSC__ +# pragma pack(pop) +#endif +#ifdef __MSC__ +# pragma pack(push,1) +static struct +#else static struct __attribute__((__packed__)) +#endif { uint16_t len; uint8_t notification_class; uint8_t supported_events; } *gesn_event_header; +#ifdef __MSC__ +# pragma pack(pop) +#endif /* Table of all SCSI commands and their flags, needed for the new disc change / not ready handler. */ uint8_t cdrom_command_flags[0x100] = { - [GPCMD_TEST_UNIT_READY] = IMPLEMENTED | CHECK_READY | NONDATA, - [GPCMD_REZERO_UNIT] = IMPLEMENTED | ALLOW_UA | NONDATA | SCSI_ONLY, - [GPCMD_REQUEST_SENSE] = IMPLEMENTED | ALLOW_UA, - [GPCMD_READ_6] = IMPLEMENTED | CHECK_READY, - [GPCMD_SEEK_6] = IMPLEMENTED | CHECK_READY | NONDATA, - [GPCMD_INQUIRY] = IMPLEMENTED | ALLOW_UA, - [GPCMD_VERIFY_6] = IMPLEMENTED | CHECK_READY | NONDATA | SCSI_ONLY, - [GPCMD_MODE_SELECT_6] = IMPLEMENTED, - [GPCMD_MODE_SENSE_6] = IMPLEMENTED, - [GPCMD_START_STOP_UNIT] = IMPLEMENTED | CHECK_READY, - [GPCMD_PREVENT_REMOVAL] = IMPLEMENTED | CHECK_READY, - [GPCMD_READ_CDROM_CAPACITY] = IMPLEMENTED | CHECK_READY, - [GPCMD_READ_10] = IMPLEMENTED | CHECK_READY, - [GPCMD_SEEK_10] = IMPLEMENTED | CHECK_READY | NONDATA, - [GPCMD_VERIFY_10] = IMPLEMENTED | CHECK_READY | NONDATA | SCSI_ONLY, - [GPCMD_READ_SUBCHANNEL] = IMPLEMENTED | CHECK_READY, - [GPCMD_READ_TOC_PMA_ATIP] = IMPLEMENTED | CHECK_READY, /* Read TOC - can get through UNIT_ATTENTION, per VIDE-CDD.SYS - NOTE: The ATAPI reference says otherwise, but I think this is a question of - interpreting things right - the UNIT ATTENTION condition we have here - is a tradition from not ready to ready, by definition the drive - eventually becomes ready, make the condition go away. */ - [GPCMD_READ_HEADER] = IMPLEMENTED | CHECK_READY, - [GPCMD_PLAY_AUDIO_10] = IMPLEMENTED | CHECK_READY, - [GPCMD_GET_CONFIGURATION] = IMPLEMENTED | ALLOW_UA, - [GPCMD_PLAY_AUDIO_MSF] = IMPLEMENTED | CHECK_READY, - [GPCMD_PLAY_AUDIO_TRACK_INDEX] = IMPLEMENTED | CHECK_READY, - [GPCMD_GET_EVENT_STATUS_NOTIFICATION] = IMPLEMENTED | ALLOW_UA, - [GPCMD_PAUSE_RESUME] = IMPLEMENTED | CHECK_READY, - [GPCMD_STOP_PLAY_SCAN] = IMPLEMENTED | CHECK_READY, - [GPCMD_READ_DISC_INFORMATION] = IMPLEMENTED | CHECK_READY, - [GPCMD_READ_TRACK_INFORMATION] = IMPLEMENTED | CHECK_READY, - [GPCMD_MODE_SELECT_10] = IMPLEMENTED, - [GPCMD_MODE_SENSE_10] = IMPLEMENTED, - [GPCMD_PLAY_AUDIO_12] = IMPLEMENTED | CHECK_READY, - [GPCMD_READ_12] = IMPLEMENTED | CHECK_READY, - [GPCMD_READ_DVD_STRUCTURE] = IMPLEMENTED | CHECK_READY, - [GPCMD_VERIFY_12] = IMPLEMENTED | CHECK_READY | NONDATA | SCSI_ONLY, - [GPCMD_PLAY_CD_OLD] = IMPLEMENTED | CHECK_READY | ATAPI_ONLY, - [GPCMD_READ_CD_OLD] = IMPLEMENTED | CHECK_READY | ATAPI_ONLY, - [GPCMD_READ_CD_MSF] = IMPLEMENTED | CHECK_READY, - [GPCMD_SCAN] = IMPLEMENTED | CHECK_READY, - [GPCMD_SET_SPEED] = IMPLEMENTED, - [GPCMD_PLAY_CD] = IMPLEMENTED | CHECK_READY, - [GPCMD_MECHANISM_STATUS] = IMPLEMENTED, - [GPCMD_READ_CD] = IMPLEMENTED | CHECK_READY, - [GPCMD_SEND_DVD_STRUCTURE] = IMPLEMENTED | CHECK_READY, - [GPCMD_PAUSE_RESUME_ALT] = IMPLEMENTED | CHECK_READY | SCSI_ONLY, - [GPCMD_SCAN_ALT] = IMPLEMENTED | CHECK_READY | SCSI_ONLY, - [GPCMD_SET_SPEED_ALT] = IMPLEMENTED | SCSI_ONLY + IMPLEMENTED | CHECK_READY | NONDATA, + IMPLEMENTED | ALLOW_UA | NONDATA | SCSI_ONLY, + 0, + IMPLEMENTED | ALLOW_UA, + 0, 0, 0, 0, + IMPLEMENTED | CHECK_READY, + 0, 0, + IMPLEMENTED | CHECK_READY | NONDATA, + 0, 0, 0, 0, 0, 0, + IMPLEMENTED | ALLOW_UA, + IMPLEMENTED | CHECK_READY | NONDATA | SCSI_ONLY, + 0, + IMPLEMENTED, + 0, 0, 0, 0, + IMPLEMENTED, + IMPLEMENTED | CHECK_READY, + 0, 0, + IMPLEMENTED | CHECK_READY, + 0, 0, 0, 0, 0, 0, + IMPLEMENTED | CHECK_READY, + 0, 0, + IMPLEMENTED | CHECK_READY, + 0, 0, + IMPLEMENTED | CHECK_READY | NONDATA, + 0, 0, 0, + IMPLEMENTED | CHECK_READY | NONDATA | SCSI_ONLY, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, + IMPLEMENTED | CHECK_READY, + IMPLEMENTED | CHECK_READY, /* Read TOC - can get through UNIT_ATTENTION, per VIDE-CDD.SYS + NOTE: The ATAPI reference says otherwise, but I think this is a question of + interpreting things right - the UNIT ATTENTION condition we have here + is a tradition from not ready to ready, by definition the drive + eventually becomes ready, make the condition go away. */ + IMPLEMENTED | CHECK_READY, + IMPLEMENTED | CHECK_READY, + IMPLEMENTED | ALLOW_UA, + IMPLEMENTED | CHECK_READY, + IMPLEMENTED | CHECK_READY, + 0, + IMPLEMENTED | ALLOW_UA, + IMPLEMENTED | CHECK_READY, + 0, 0, + IMPLEMENTED | CHECK_READY, + 0, 0, + IMPLEMENTED | CHECK_READY, + IMPLEMENTED | CHECK_READY, + 0, 0, + IMPLEMENTED, + 0, 0, 0, 0, + IMPLEMENTED, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + IMPLEMENTED | CHECK_READY, + 0, 0, + IMPLEMENTED | CHECK_READY, + 0, 0, 0, 0, + IMPLEMENTED | CHECK_READY, + 0, + IMPLEMENTED | CHECK_READY | NONDATA | SCSI_ONLY, + 0, 0, 0, 0, + IMPLEMENTED | CHECK_READY | ATAPI_ONLY, + 0, 0, 0, + IMPLEMENTED | CHECK_READY | ATAPI_ONLY, + IMPLEMENTED | CHECK_READY, + IMPLEMENTED | CHECK_READY, + IMPLEMENTED, + IMPLEMENTED | CHECK_READY, + IMPLEMENTED, + IMPLEMENTED | CHECK_READY, + IMPLEMENTED | CHECK_READY, + 0, 0, + IMPLEMENTED | CHECK_READY | SCSI_ONLY, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + IMPLEMENTED | CHECK_READY | SCSI_ONLY, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + IMPLEMENTED | SCSI_ONLY, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; uint8_t cdrom_mode_sense_page_flags[CDROM_NUM][0x40] = { - { [GPMODE_R_W_ERROR_PAGE] = IMPLEMENTED, - [GPMODE_CDROM_PAGE] = IMPLEMENTED, - [GPMODE_CDROM_AUDIO_PAGE] = IMPLEMENTED, - [GPMODE_CAPABILITIES_PAGE] = IMPLEMENTED, - [GPMODE_ALL_PAGES] = IMPLEMENTED }, - { [GPMODE_R_W_ERROR_PAGE] = IMPLEMENTED, - [GPMODE_CDROM_PAGE] = IMPLEMENTED, - [GPMODE_CDROM_AUDIO_PAGE] = IMPLEMENTED, - [GPMODE_CAPABILITIES_PAGE] = IMPLEMENTED, - [GPMODE_ALL_PAGES] = IMPLEMENTED }, - { [GPMODE_R_W_ERROR_PAGE] = IMPLEMENTED, - [GPMODE_CDROM_PAGE] = IMPLEMENTED, - [GPMODE_CDROM_AUDIO_PAGE] = IMPLEMENTED, - [GPMODE_CAPABILITIES_PAGE] = IMPLEMENTED, - [GPMODE_ALL_PAGES] = IMPLEMENTED }, - { [GPMODE_R_W_ERROR_PAGE] = IMPLEMENTED, - [GPMODE_CDROM_PAGE] = IMPLEMENTED, - [GPMODE_CDROM_AUDIO_PAGE] = IMPLEMENTED, - [GPMODE_CAPABILITIES_PAGE] = IMPLEMENTED, - [GPMODE_ALL_PAGES] = IMPLEMENTED } + { 0, IMPLEMENTED, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, IMPLEMENTED, IMPLEMENTED, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, IMPLEMENTED, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, IMPLEMENTED }, + { 0, IMPLEMENTED, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, IMPLEMENTED, IMPLEMENTED, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, IMPLEMENTED, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, IMPLEMENTED }, + { 0, IMPLEMENTED, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, IMPLEMENTED, IMPLEMENTED, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, IMPLEMENTED, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, IMPLEMENTED }, + { 0, IMPLEMENTED, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, IMPLEMENTED, IMPLEMENTED, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, IMPLEMENTED, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, IMPLEMENTED } }; const uint8_t cdrom_mode_sense_pages_default[CDROM_NUM][0x40][0x40] = { - { [GPMODE_R_W_ERROR_PAGE] = { GPMODE_R_W_ERROR_PAGE, 6, 0, 5, 0, 0, 0, 0 }, - [GPMODE_CDROM_PAGE] = { GPMODE_CDROM_PAGE, 6, 0, 1, 0, 60, 0, 75 }, - [GPMODE_CDROM_AUDIO_PAGE] = { 0x8E, 0xE, 4, 0, 0, 0, 0, 75, 1, 0xFF, 2, 0xFF, 0, 0, 0, 0 }, - [GPMODE_CAPABILITIES_PAGE] = { GPMODE_CAPABILITIES_PAGE, 0x12, 0, 0, 1, 0, 0, 0, 0x02, 0xC2, 0, 2, 0, 0, 0x02, 0xC2, 0, 0, 0, 0 } }, - { [GPMODE_R_W_ERROR_PAGE] = { GPMODE_R_W_ERROR_PAGE, 6, 0, 5, 0, 0, 0, 0 }, - [GPMODE_CDROM_PAGE] = { GPMODE_CDROM_PAGE, 6, 0, 1, 0, 60, 0, 75 }, - [GPMODE_CDROM_AUDIO_PAGE] = { 0x8E, 0xE, 4, 0, 0, 0, 0, 75, 1, 0xFF, 2, 0xFF, 0, 0, 0, 0 }, - [GPMODE_CAPABILITIES_PAGE] = { GPMODE_CAPABILITIES_PAGE, 0x12, 0, 0, 1, 0, 0, 0, 0x02, 0xC2, 0, 2, 0, 0, 0x02, 0xC2, 0, 0, 0, 0 } }, - { [GPMODE_R_W_ERROR_PAGE] = { GPMODE_R_W_ERROR_PAGE, 6, 0, 5, 0, 0, 0, 0 }, - [GPMODE_CDROM_PAGE] = { GPMODE_CDROM_PAGE, 6, 0, 1, 0, 60, 0, 75 }, - [GPMODE_CDROM_AUDIO_PAGE] = { 0x8E, 0xE, 4, 0, 0, 0, 0, 75, 1, 0xFF, 2, 0xFF, 0, 0, 0, 0 }, - [GPMODE_CAPABILITIES_PAGE] = { GPMODE_CAPABILITIES_PAGE, 0x12, 0, 0, 1, 0, 0, 0, 0x02, 0xC2, 0, 2, 0, 0, 0x02, 0xC2, 0, 0, 0, 0 } }, - { [GPMODE_R_W_ERROR_PAGE] = { GPMODE_R_W_ERROR_PAGE, 6, 0, 5, 0, 0, 0, 0 }, - [GPMODE_CDROM_PAGE] = { GPMODE_CDROM_PAGE, 6, 0, 1, 0, 60, 0, 75 }, - [GPMODE_CDROM_AUDIO_PAGE] = { 0x8E, 0xE, 4, 0, 0, 0, 0, 75, 1, 0xFF, 2, 0xFF, 0, 0, 0, 0 }, - [GPMODE_CAPABILITIES_PAGE] = { GPMODE_CAPABILITIES_PAGE, 0x12, 0, 0, 1, 0, 0, 0, 0x02, 0xC2, 0, 2, 0, 0, 0x02, 0xC2, 0, 0, 0, 0 } } + { { 0, 0 }, + { GPMODE_R_W_ERROR_PAGE, 6, 0, 5, 0, 0, 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { GPMODE_CDROM_PAGE, 6, 0, 1, 0, 60, 0, 75 }, + { 0x8E, 0xE, 4, 0, 0, 0, 0, 75, 1, 0xFF, 2, 0xFF, 0, 0, 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { GPMODE_CAPABILITIES_PAGE, 0x12, 0, 0, 1, 0, 0, 0, 0x02, 0xC2, 0, 2, 0, 0, 0x02, 0xC2, 0, 0, 0, 0 } }, + { { 0, 0 }, + { GPMODE_R_W_ERROR_PAGE, 6, 0, 5, 0, 0, 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { GPMODE_CDROM_PAGE, 6, 0, 1, 0, 60, 0, 75 }, + { 0x8E, 0xE, 4, 0, 0, 0, 0, 75, 1, 0xFF, 2, 0xFF, 0, 0, 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { GPMODE_CAPABILITIES_PAGE, 0x12, 0, 0, 1, 0, 0, 0, 0x02, 0xC2, 0, 2, 0, 0, 0x02, 0xC2, 0, 0, 0, 0 } }, + { { 0, 0 }, + { GPMODE_R_W_ERROR_PAGE, 6, 0, 5, 0, 0, 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { GPMODE_CDROM_PAGE, 6, 0, 1, 0, 60, 0, 75 }, + { 0x8E, 0xE, 4, 0, 0, 0, 0, 75, 1, 0xFF, 2, 0xFF, 0, 0, 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { GPMODE_CAPABILITIES_PAGE, 0x12, 0, 0, 1, 0, 0, 0, 0x02, 0xC2, 0, 2, 0, 0, 0x02, 0xC2, 0, 0, 0, 0 } }, + { { 0, 0 }, + { GPMODE_R_W_ERROR_PAGE, 6, 0, 5, 0, 0, 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { GPMODE_CDROM_PAGE, 6, 0, 1, 0, 60, 0, 75 }, + { 0x8E, 0xE, 4, 0, 0, 0, 0, 75, 1, 0xFF, 2, 0xFF, 0, 0, 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { GPMODE_CAPABILITIES_PAGE, 0x12, 0, 0, 1, 0, 0, 0, 0x02, 0xC2, 0, 2, 0, 0, 0x02, 0xC2, 0, 0, 0, 0 } } }; uint8_t cdrom_mode_sense_pages_changeable[CDROM_NUM][0x40][0x40] = { - { [GPMODE_R_W_ERROR_PAGE] = { GPMODE_R_W_ERROR_PAGE, 6, 0, 0, 0, 0, 0, 0 }, - [GPMODE_CDROM_PAGE] = { GPMODE_CDROM_PAGE, 6, 0, 0, 0, 0, 0, 0 }, - [GPMODE_CDROM_AUDIO_PAGE] = { 0x8E, 0xE, 4, 0xFF, 0, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0, 0, 0 }, - [GPMODE_CAPABILITIES_PAGE] = { GPMODE_CAPABILITIES_PAGE, 0x12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { [GPMODE_R_W_ERROR_PAGE] = { GPMODE_R_W_ERROR_PAGE, 6, 0, 0, 0, 0, 0, 0 }, - [GPMODE_CDROM_PAGE] = { GPMODE_CDROM_PAGE, 6, 0, 0, 0, 0, 0, 0 }, - [GPMODE_CDROM_AUDIO_PAGE] = { 0x8E, 0xE, 4, 0xFF, 0, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0, 0, 0 }, - [GPMODE_CAPABILITIES_PAGE] = { GPMODE_CAPABILITIES_PAGE, 0x12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { [GPMODE_R_W_ERROR_PAGE] = { GPMODE_R_W_ERROR_PAGE, 6, 0, 0, 0, 0, 0, 0 }, - [GPMODE_CDROM_PAGE] = { GPMODE_CDROM_PAGE, 6, 0, 0, 0, 0, 0, 0 }, - [GPMODE_CDROM_AUDIO_PAGE] = { 0x8E, 0xE, 4, 0xFF, 0, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0, 0, 0 }, - [GPMODE_CAPABILITIES_PAGE] = { GPMODE_CAPABILITIES_PAGE, 0x12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { [GPMODE_R_W_ERROR_PAGE] = { GPMODE_R_W_ERROR_PAGE, 6, 0, 0, 0, 0, 0, 0 }, - [GPMODE_CDROM_PAGE] = { GPMODE_CDROM_PAGE, 6, 0, 0, 0, 0, 0, 0 }, - [GPMODE_CDROM_AUDIO_PAGE] = { 0x8E, 0xE, 4, 0xFF, 0, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0, 0, 0 }, - [GPMODE_CAPABILITIES_PAGE] = { GPMODE_CAPABILITIES_PAGE, 0x12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } + { { 0, 0 }, + { GPMODE_R_W_ERROR_PAGE, 6, 0, 5, 0, 0, 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { GPMODE_CDROM_PAGE, 6, 0, 1, 0, 60, 0, 75 }, + { 0x8E, 0xE, 4, 0, 0, 0, 0, 75, 1, 0xFF, 2, 0xFF, 0, 0, 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { GPMODE_CAPABILITIES_PAGE, 0x12, 0, 0, 1, 0, 0, 0, 0x02, 0xC2, 0, 2, 0, 0, 0x02, 0xC2, 0, 0, 0, 0 } }, + { { 0, 0 }, + { GPMODE_R_W_ERROR_PAGE, 6, 0, 5, 0, 0, 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { GPMODE_CDROM_PAGE, 6, 0, 1, 0, 60, 0, 75 }, + { 0x8E, 0xE, 4, 0, 0, 0, 0, 75, 1, 0xFF, 2, 0xFF, 0, 0, 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { GPMODE_CAPABILITIES_PAGE, 0x12, 0, 0, 1, 0, 0, 0, 0x02, 0xC2, 0, 2, 0, 0, 0x02, 0xC2, 0, 0, 0, 0 } }, + { { 0, 0 }, + { GPMODE_R_W_ERROR_PAGE, 6, 0, 5, 0, 0, 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { GPMODE_CDROM_PAGE, 6, 0, 1, 0, 60, 0, 75 }, + { 0x8E, 0xE, 4, 0, 0, 0, 0, 75, 1, 0xFF, 2, 0xFF, 0, 0, 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { GPMODE_CAPABILITIES_PAGE, 0x12, 0, 0, 1, 0, 0, 0, 0x02, 0xC2, 0, 2, 0, 0, 0x02, 0xC2, 0, 0, 0, 0 } }, + { { 0, 0 }, + { GPMODE_R_W_ERROR_PAGE, 6, 0, 5, 0, 0, 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { GPMODE_CDROM_PAGE, 6, 0, 1, 0, 60, 0, 75 }, + { 0x8E, 0xE, 4, 0, 0, 0, 0, 75, 1, 0xFF, 2, 0xFF, 0, 0, 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { GPMODE_CAPABILITIES_PAGE, 0x12, 0, 0, 1, 0, 0, 0, 0x02, 0xC2, 0, 2, 0, 0, 0x02, 0xC2, 0, 0, 0, 0 } } }; uint8_t cdrom_mode_sense_pages_saved[CDROM_NUM][0x40][0x40] = { - { [GPMODE_R_W_ERROR_PAGE] = { GPMODE_R_W_ERROR_PAGE, 6, 0, 5, 0, 0, 0, 0 }, - [GPMODE_CDROM_PAGE] = { GPMODE_CDROM_PAGE, 6, 0, 1, 0, 60, 0, 75 }, - [GPMODE_CDROM_AUDIO_PAGE] = { 0x8E, 0xE, 4, 0, 0, 0, 0, 75, 1, 0xFF, 2, 0xFF, 0, 0, 0, 0 }, - [GPMODE_CAPABILITIES_PAGE] = { GPMODE_CAPABILITIES_PAGE, 0x12, 0, 0, 1, 0, 0, 0, 0x02, 0xC2, 0, 2, 0, 0, 0x02, 0xC2, 0, 0, 0, 0 } }, - { [GPMODE_R_W_ERROR_PAGE] = { GPMODE_R_W_ERROR_PAGE, 6, 0, 5, 0, 0, 0, 0 }, - [GPMODE_CDROM_PAGE] = { GPMODE_CDROM_PAGE, 6, 0, 1, 0, 60, 0, 75 }, - [GPMODE_CDROM_AUDIO_PAGE] = { 0x8E, 0xE, 4, 0, 0, 0, 0, 75, 1, 0xFF, 2, 0xFF, 0, 0, 0, 0 }, - [GPMODE_CAPABILITIES_PAGE] = { GPMODE_CAPABILITIES_PAGE, 0x12, 0, 0, 1, 0, 0, 0, 0x02, 0xC2, 0, 2, 0, 0, 0x02, 0xC2, 0, 0, 0, 0 } }, - { [GPMODE_R_W_ERROR_PAGE] = { GPMODE_R_W_ERROR_PAGE, 6, 0, 5, 0, 0, 0, 0 }, - [GPMODE_CDROM_PAGE] = { GPMODE_CDROM_PAGE, 6, 0, 1, 0, 60, 0, 75 }, - [GPMODE_CDROM_AUDIO_PAGE] = { 0x8E, 0xE, 4, 0, 0, 0, 0, 75, 1, 0xFF, 2, 0xFF, 0, 0, 0, 0 }, - [GPMODE_CAPABILITIES_PAGE] = { GPMODE_CAPABILITIES_PAGE, 0x12, 0, 0, 1, 0, 0, 0, 0x02, 0xC2, 0, 2, 0, 0, 0x02, 0xC2, 0, 0, 0, 0 } }, - { [GPMODE_R_W_ERROR_PAGE] = { GPMODE_R_W_ERROR_PAGE, 6, 0, 5, 0, 0, 0, 0 }, - [GPMODE_CDROM_PAGE] = { GPMODE_CDROM_PAGE, 6, 0, 1, 0, 60, 0, 75 }, - [GPMODE_CDROM_AUDIO_PAGE] = { 0x8E, 0xE, 4, 0, 0, 0, 0, 75, 1, 0xFF, 2, 0xFF, 0, 0, 0, 0 }, - [GPMODE_CAPABILITIES_PAGE] = { GPMODE_CAPABILITIES_PAGE, 0x12, 0, 0, 1, 0, 0, 0, 0x02, 0xC2, 0, 2, 0, 0, 0x02, 0xC2, 0, 0, 0, 0 } } + { { 0, 0 }, + { GPMODE_R_W_ERROR_PAGE, 6, 0, 5, 0, 0, 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { GPMODE_CDROM_PAGE, 6, 0, 1, 0, 60, 0, 75 }, + { 0x8E, 0xE, 4, 0, 0, 0, 0, 75, 1, 0xFF, 2, 0xFF, 0, 0, 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { GPMODE_CAPABILITIES_PAGE, 0x12, 0, 0, 1, 0, 0, 0, 0x02, 0xC2, 0, 2, 0, 0, 0x02, 0xC2, 0, 0, 0, 0 } }, + { { 0, 0 }, + { GPMODE_R_W_ERROR_PAGE, 6, 0, 5, 0, 0, 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { GPMODE_CDROM_PAGE, 6, 0, 1, 0, 60, 0, 75 }, + { 0x8E, 0xE, 4, 0, 0, 0, 0, 75, 1, 0xFF, 2, 0xFF, 0, 0, 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { GPMODE_CAPABILITIES_PAGE, 0x12, 0, 0, 1, 0, 0, 0, 0x02, 0xC2, 0, 2, 0, 0, 0x02, 0xC2, 0, 0, 0, 0 } }, + { { 0, 0 }, + { GPMODE_R_W_ERROR_PAGE, 6, 0, 5, 0, 0, 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { GPMODE_CDROM_PAGE, 6, 0, 1, 0, 60, 0, 75 }, + { 0x8E, 0xE, 4, 0, 0, 0, 0, 75, 1, 0xFF, 2, 0xFF, 0, 0, 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { GPMODE_CAPABILITIES_PAGE, 0x12, 0, 0, 1, 0, 0, 0, 0x02, 0xC2, 0, 2, 0, 0, 0x02, 0xC2, 0, 0, 0, 0 } }, + { { 0, 0 }, + { GPMODE_R_W_ERROR_PAGE, 6, 0, 5, 0, 0, 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { GPMODE_CDROM_PAGE, 6, 0, 1, 0, 60, 0, 75 }, + { 0x8E, 0xE, 4, 0, 0, 0, 0, 75, 1, 0xFF, 2, 0xFF, 0, 0, 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { GPMODE_CAPABILITIES_PAGE, 0x12, 0, 0, 1, 0, 0, 0, 0x02, 0xC2, 0, 2, 0, 0, 0x02, 0xC2, 0, 0, 0, 0 } } }; int cdrom_do_log = 0; @@ -379,6 +895,8 @@ int cdrom_current_mode(int id) { return (cdrom[id].features & 1) ? 2 : 1; } + + return 0; } /* Translates ATAPI status (ERR_STAT flag) to SCSI status. */ @@ -423,6 +941,8 @@ int cdrom_atapi_phase_to_scsi(uint8_t id) return 4; } } + + return 0; } int cdrom_lba_to_msf_accurate(int lba) @@ -469,6 +989,8 @@ void cdrom_mode_sense_load(uint8_t id) case 3: f = fopen(nvr_concat("cdrom_4_mode_sense.bin"), "rb"); break; + default: + return; } if (!f) { @@ -495,6 +1017,8 @@ void cdrom_mode_sense_save(uint8_t id) case 3: f = fopen(nvr_concat("cdrom_4_mode_sense.bin"), "wb"); break; + default: + return; } if (!f) { @@ -738,9 +1262,9 @@ int cdrom_mode_select_write(uint8_t id, uint8_t val) uint8_t cdrom_read_capacity_cdb[12] = {0x25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -static int cdrom_pass_through(uint8_t id, int *len, uint8_t *cdb, uint8_t *buffer); +static int cdrom_pass_through(uint8_t id, uint32_t *len, uint8_t *cdb, uint8_t *buffer); -int cdrom_read_capacity(uint8_t id, uint8_t *cdb, uint8_t *buffer, int *len) +int cdrom_read_capacity(uint8_t id, uint8_t *cdb, uint8_t *buffer, uint32_t *len) { int ret = 0; int size = 0; @@ -787,6 +1311,8 @@ uint8_t cdrom_mode_sense_read(uint8_t id, uint8_t page_control, uint8_t page, ui return cdrom_mode_sense_pages_default[id][page][pos]; break; } + + return 0; } uint32_t cdrom_mode_sense(uint8_t id, uint8_t *buf, uint32_t pos, uint8_t type, uint8_t block_descriptor_len) @@ -800,8 +1326,6 @@ uint32_t cdrom_mode_sense(uint8_t id, uint8_t *buf, uint32_t pos, uint8_t type, type &= 0x3f; - int len = 0; - if (block_descriptor_len) { buf[pos++] = 1; /* Density code. */ @@ -1129,14 +1653,27 @@ static void cdrom_data_phase_error(uint8_t id) cdrom_cmd_error(id); } -static int cdrom_pass_through(uint8_t id, int *len, uint8_t *cdb, uint8_t *buffer) +static int cdrom_pass_through(uint8_t id, uint32_t *len, uint8_t *cdb, uint8_t *buffer) { int ret = 0; - // uint8_t *cdbufferb = (uint8_t *) cdrom[id].buffer; + uint8_t temp_cdb[16]; - // ret = cdrom_drives[id].handler->pass_through(id, cdrom[id].current_cdb, cdbufferb + cdrom[id].data_pos, len); - ret = cdrom_drives[id].handler->pass_through(id, cdb, buffer, len); - // cdrom_log("CD-ROM %i: Data from pass through: %02X %02X %02X %02X %02X %02X %02X %02X\n", id, cdbufferb[cdrom[id].data_pos + 0], cdbufferb[cdrom[id].data_pos + 1], cdbufferb[cdrom[id].data_pos + 2], cdbufferb[cdrom[id].data_pos + 3], cdbufferb[cdrom[id].data_pos + 4], cdbufferb[cdrom[id].data_pos + 5], cdbufferb[cdrom[id].data_pos + 6], cdbufferb[cdrom[id].data_pos + 7]); + memset(temp_cdb, 0, 16); + + if (cdb[0] == 8) + { + temp_cdb[0] = 0x28; + temp_cdb[8] = cdb[4]; + temp_cdb[3] = cdb[1]; + temp_cdb[4] = cdb[2]; + temp_cdb[5] = cdb[3]; + } + else + { + memcpy(temp_cdb, cdb, 16); + } + + ret = cdrom_drives[id].handler->pass_through(id, temp_cdb, buffer, len); cdrom_log("CD-ROM %i: Data from pass through: %02X %02X %02X %02X %02X %02X %02X %02X\n", id, buffer[0], buffer[1], buffer[2], buffer[3], buffer[4], buffer[5], buffer[6], buffer[7]); cdrom_log("CD-ROM %i: Returned value: %i\n", id, ret); @@ -1165,7 +1702,7 @@ static int cdrom_pass_through(uint8_t id, int *len, uint8_t *cdb, uint8_t *buffe } } -int cdrom_update_cdb(uint8_t *cdb, int lba_pos, int number_of_blocks) +void cdrom_update_cdb(uint8_t *cdb, int lba_pos, int number_of_blocks) { int temp = 0; @@ -1221,7 +1758,7 @@ int cdrom_update_cdb(uint8_t *cdb, int lba_pos, int number_of_blocks) } } -int cdrom_read_data(uint8_t id, int msf, int type, int flags, int *len) +int cdrom_read_data(uint8_t id, int msf, int type, int flags, uint32_t *len) { uint8_t *cdbufferb = (uint8_t *) cdrom[id].buffer; @@ -1247,7 +1784,7 @@ int cdrom_read_data(uint8_t id, int msf, int type, int flags, int *len) if (cdrom[id].sector_pos > (cdsize - 1)) { - // cdrom_log("CD-ROM %i: Trying to read beyond the end of disc\n", id); + /* cdrom_log("CD-ROM %i: Trying to read beyond the end of disc\n", id); */ cdrom_lba_out_of_range(id); return 0; } @@ -1258,7 +1795,7 @@ int cdrom_read_data(uint8_t id, int msf, int type, int flags, int *len) { if (cdrom[id].sector_pos > (cdrom_drives[id].handler->size(id) - 1)) { - // cdrom_log("CD-ROM %i: Trying to read beyond the end of disc\n", id); + /* cdrom_log("CD-ROM %i: Trying to read beyond the end of disc\n", id); */ cdrom_lba_out_of_range(id); return 0; } @@ -1290,9 +1827,8 @@ int cdrom_read_data(uint8_t id, int msf, int type, int flags, int *len) return 1; } -int cdrom_read_blocks(uint8_t id, int *len, int first_batch) +int cdrom_read_blocks(uint8_t id, uint32_t *len, int first_batch) { - int i = 0; int ret = 0; int msf = 0; @@ -1385,7 +1921,7 @@ static int cdrom_read_dvd_structure(uint8_t id, int format, const uint8_t *packe total_sectors >>= 2; if (total_sectors == 0) { - // return -ASC_MEDIUM_NOT_PRESENT; + /* return -ASC_MEDIUM_NOT_PRESENT; */ cdrom_not_ready(id); return 0; } @@ -1567,7 +2103,7 @@ int cdrom_pre_execution_check(uint8_t id, uint8_t *cdb) if (cdrom_drives[id].handler->medium_changed(id)) { - // cdrom_log("CD-ROM %i: Medium has changed...\n", id); + /* cdrom_log("CD-ROM %i: Medium has changed...\n", id); */ cdrom_insert(id); } @@ -1588,7 +2124,7 @@ int cdrom_pre_execution_check(uint8_t id, uint8_t *cdb) /* Only increment the unit attention phase if the command can not pass through it. */ if (!(cdrom_command_flags[cdb[0]] & ALLOW_UA)) { - // cdrom_log("CD-ROM %i: Unit attention now 2\n", id); + /* cdrom_log("CD-ROM %i: Unit attention now 2\n", id); */ cdrom[id].unit_attention = 2; cdrom_log("CD-ROM %i: UNIT ATTENTION: Command %02X not allowed to pass through\n", id, cdb[0]); cdrom_unit_attention(id); @@ -1599,7 +2135,7 @@ int cdrom_pre_execution_check(uint8_t id, uint8_t *cdb) { if (cdb[0] != GPCMD_REQUEST_SENSE) { - // cdrom_log("CD-ROM %i: Unit attention now 0\n", id); + /* cdrom_log("CD-ROM %i: Unit attention now 0\n", id); */ cdrom[id].unit_attention = 0; } } @@ -1636,7 +2172,7 @@ void cdrom_clear_callback(uint8_t channel) static void cdrom_seek(uint8_t id, uint32_t pos) { - // cdrom_log("CD-ROM %i: Seek %08X\n", id, pos); + /* cdrom_log("CD-ROM %i: Seek %08X\n", id, pos); */ cdrom[id].seek_pos = pos; if (cdrom_drives[id].handler->stop) { @@ -1710,7 +2246,7 @@ void cdrom_request_sense(uint8_t id, uint8_t *buffer, uint8_t alloc_length) } } - // cdrom_log("CD-ROM %i: Reporting sense: %02X %02X %02X\n", id, cdbufferb[2], cdbufferb[12], cdbufferb[13]); + /* cdrom_log("CD-ROM %i: Reporting sense: %02X %02X %02X\n", id, cdbufferb[2], cdbufferb[12], cdbufferb[13]); */ if (buffer[2] == SENSE_UNIT_ATTENTION) { @@ -1729,7 +2265,7 @@ void cdrom_request_sense_for_scsi(uint8_t id, uint8_t *buffer, uint8_t alloc_len if (cdrom_drives[id].handler->medium_changed(id)) { - // cdrom_log("CD-ROM %i: Medium has changed...\n", id); + /* cdrom_log("CD-ROM %i: Medium has changed...\n", id); */ cdrom_insert(id); } @@ -1751,34 +2287,28 @@ void cdrom_request_sense_for_scsi(uint8_t id, uint8_t *buffer, uint8_t alloc_len void cdrom_command(uint8_t id, uint8_t *cdb) { uint8_t *cdbufferb = (uint8_t *) cdrom[id].buffer; - uint8_t rcdmode = 0; - int c; - int len; + uint32_t len; int msf; int pos=0; - unsigned char temp; - uint32_t size; - uint8_t page_code; int max_len; int used_len; unsigned idx = 0; unsigned size_idx; unsigned preamble_len; int toc_format; - int temp_command; - int alloc_length; - int completed; + uint32_t alloc_length; uint8_t index = 0; int block_desc = 0; - int media; - int format; + int format = 0; int ret; int real_pos; int track = 0; - int ready = 0; - uint8_t device_identify[8] = { '8', '6', 'B', '_', 'C', 'D', '0', 0 }; - uint8_t device_identify_ex[14] = { '8', '6', 'B', '_', 'C', 'D', '0', ' ', 'v', '1', '.', '0', '0', 0 }; + char device_identify[8] = { '8', '6', 'B', '_', 'C', 'D', '0', 0 }; + char device_identify_ex[14] = { '8', '6', 'B', '_', 'C', 'D', '0', ' ', 'v', '1', '.', '0', '0', 0 }; +#if 0 + int CdbLength; +#endif if (cdrom_drives[id].bus_type) { cdrom[id].status &= ~ERR_STAT; @@ -1802,18 +2332,19 @@ void cdrom_command(uint8_t id, uint8_t *cdb) memcpy(cdrom[id].current_cdb, cdb, cdrom[id].cdb_len); + cdrom[id].cd_status = cdrom_drives[id].handler->status(id); + if (cdb[0] != 0) { cdrom_log("CD-ROM %i: Command 0x%02X, Sense Key %02X, Asc %02X, Ascq %02X, %i, Unit attention: %i\n", id, cdb[0], cdrom_sense_key, cdrom_asc, cdrom_ascq, ins, cdrom[id].unit_attention); cdrom_log("CD-ROM %i: Request length: %04X\n", id, cdrom[id].request_length); -// #if 0 - int CdbLength; +#if 0 for (CdbLength = 1; CdbLength < cdrom[id].cdb_len; CdbLength++) { cdrom_log("CD-ROM %i: CDB[%d] = 0x%02X\n", id, CdbLength, cdb[CdbLength]); } -// #endif +#endif } msf = cdb[1] & 2; @@ -1825,11 +2356,6 @@ void cdrom_command(uint8_t id, uint8_t *cdb) return; } - if (cdb[0] != GPCMD_REQUEST_SENSE) - { - completed = cdrom_playing_completed(id); - } - switch (cdb[0]) { case GPCMD_TEST_UNIT_READY: @@ -1919,7 +2445,7 @@ void cdrom_command(uint8_t id, uint8_t *cdb) } cdrom_data_command_finish(id, len, len, len, 0); - // cdrom_log("CD-ROM %i: READ_TOC_PMA_ATIP format %02X, length %i (%i)\n", id, toc_format, ide->cylinder, cdbufferb[1]); + /* cdrom_log("CD-ROM %i: READ_TOC_PMA_ATIP format %02X, length %i (%i)\n", id, toc_format, ide->cylinder, cdbufferb[1]); */ return; case GPCMD_READ_CD_OLD: @@ -1948,7 +2474,7 @@ void cdrom_command(uint8_t id, uint8_t *cdb) msf = 0; break; case GPCMD_READ_CD_MSF: - // cdrom_log("CD-ROM %i: Read CD MSF: Start MSF %02X%02X%02X End MSF %02X%02X%02X Flags %02X\n", id, cdb[3], cdb[4], cdb[5], cdb[6], cdb[7], cdb[8], cdb[9]); + /* cdrom_log("CD-ROM %i: Read CD MSF: Start MSF %02X%02X%02X End MSF %02X%02X%02X Flags %02X\n", id, cdb[3], cdb[4], cdb[5], cdb[6], cdb[7], cdb[8], cdb[9]); */ cdrom[id].sector_len = MSFtoLBA(cdb[6], cdb[7], cdb[8]); cdrom[id].sector_pos = MSFtoLBA(cdb[3], cdb[4], cdb[5]); @@ -1958,7 +2484,7 @@ void cdrom_command(uint8_t id, uint8_t *cdb) break; case GPCMD_READ_CD_OLD: case GPCMD_READ_CD: - // cdrom_log("CD-ROM %i: Read CD: Start LBA %02X%02X%02X%02X Length %02X%02X%02X Flags %02X\n", id, cdb[2], cdb[3], cdb[4], cdb[5], cdb[6], cdb[7], cdb[8], cdb[9]); + /* cdrom_log("CD-ROM %i: Read CD: Start LBA %02X%02X%02X%02X Length %02X%02X%02X Flags %02X\n", id, cdb[2], cdb[3], cdb[4], cdb[5], cdb[6], cdb[7], cdb[8], cdb[9]); */ cdrom[id].sector_len = (cdb[6] << 16) | (cdb[7] << 8) | cdb[8]; cdrom[id].sector_pos = (cdb[2] << 24) | (cdb[3] << 16) | (cdb[4] << 8) | cdb[5]; @@ -1968,14 +2494,14 @@ void cdrom_command(uint8_t id, uint8_t *cdb) if (!cdrom[id].sector_len) { - // cdrom_log("CD-ROM %i: All done - callback set\n", id); + /* cdrom_log("CD-ROM %i: All done - callback set\n", id); */ cdrom[id].packet_status = CDROM_PHASE_COMPLETE; cdrom[id].callback = 20 * CDROM_TIME; break; } max_len = cdrom[id].sector_len; - // if (cdrom_drives[id].bus_type) + /* if (cdrom_drives[id].bus_type) */ if (cdrom_current_mode(id) == 2) { cdrom[id].requested_blocks = max_len; @@ -2003,7 +2529,11 @@ void cdrom_command(uint8_t id, uint8_t *cdb) cdrom[id].all_blocks_total = cdrom[id].block_total; if (cdrom[id].packet_status != CDROM_PHASE_COMPLETE) { - readflash=1; + update_status_bar_icon(0x10 | id, 1); + } + else + { + update_status_bar_icon(0x10 | id, 0); } return; @@ -2132,7 +2662,6 @@ void cdrom_command(uint8_t id, uint8_t *cdb) return; case GPCMD_GET_CONFIGURATION: - temp_command = cdb[0]; /* XXX: could result in alignment problems in some architectures */ len = (cdb[7] << 8) | cdb[8]; alloc_length = len; @@ -2398,7 +2927,6 @@ void cdrom_command(uint8_t id, uint8_t *cdb) { return; } - cdrom_log("CD-ROM %i: Audio status: %i\n", id, temp); switch(cdrom[id].cd_status) { case CD_STATUS_PLAYING: @@ -2435,7 +2963,7 @@ void cdrom_command(uint8_t id, uint8_t *cdb) { if (cdb[3] > 3) { - // cdrom_log("CD-ROM %i: Read subchannel check condition %02X\n", id, cdb[3]); + /* cdrom_log("CD-ROM %i: Read subchannel check condition %02X\n", id, cdb[3]); */ cdrom_invalid_field(id); return; } @@ -2453,7 +2981,7 @@ void cdrom_command(uint8_t id, uint8_t *cdb) break; } - memset(cdbufferb, 24, 0); + memset(cdbufferb, 0, 24); pos = 0; cdbufferb[pos++] = 0; cdbufferb[pos++] = 0; /*Audio status*/ @@ -2523,7 +3051,22 @@ void cdrom_command(uint8_t id, uint8_t *cdb) switch (cdb[7]) { - case 0x00 ... 0x7f: + case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: + case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: case 0x0f: + case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17: + case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c: case 0x1d: case 0x1e: case 0x1f: + case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27: + case 0x28: case 0x29: case 0x2a: case 0x2b: case 0x2c: case 0x2d: case 0x2e: case 0x2f: + case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37: + case 0x38: case 0x39: case 0x3a: case 0x3b: case 0x3c: case 0x3d: case 0x3e: case 0x3f: + case 0x40: case 0x41: case 0x42: case 0x43: case 0x44: case 0x45: case 0x46: case 0x47: + case 0x48: case 0x49: case 0x4a: case 0x4b: case 0x4c: case 0x4d: case 0x4e: case 0x4f: + case 0x50: case 0x51: case 0x52: case 0x53: case 0x54: case 0x55: case 0x56: case 0x57: + case 0x58: case 0x59: case 0x5a: case 0x5b: case 0x5c: case 0x5d: case 0x5e: case 0x5f: + case 0x60: case 0x61: case 0x62: case 0x63: case 0x64: case 0x65: case 0x66: case 0x67: + case 0x68: case 0x69: case 0x6a: case 0x6b: case 0x6c: case 0x6d: case 0x6e: case 0x6f: + case 0x70: case 0x71: case 0x72: case 0x73: case 0x74: case 0x75: case 0x76: case 0x77: + case 0x78: case 0x79: case 0x7a: case 0x7b: case 0x7c: case 0x7d: case 0x7e: case 0x7f: case 0xff: if (cdb[1] == 0) { @@ -2649,7 +3192,8 @@ void cdrom_command(uint8_t id, uint8_t *cdb) memset(cdbufferb, 0, 8); cdbufferb[0] = 5; /*CD-ROM*/ cdbufferb[1] = 0x80; /*Removable*/ - cdbufferb[3] = 0x21; + cdbufferb[2] = cdrom_drives[id].bus_type ? 0x02 : 0x00; /*SCSI-2 compliant*/ + cdbufferb[3] = cdrom_drives[id].bus_type ? 0x02 : 0x21; cdbufferb[4] = 31; ide_padstr8(cdbufferb + 8, 8, "86Box"); /* Vendor */ @@ -2740,13 +3284,13 @@ atapi_out: break; } - // cdrom_log("CD-ROM %i: Phase: %02X, request length: %i\n", cdrom[id].phase, cdrom[id].request_length); + /* cdrom_log("CD-ROM %i: Phase: %02X, request length: %i\n", cdrom[id].phase, cdrom[id].request_length); */ } /* This is for block reads. */ int cdrom_block_check(uint8_t id) { - int alloc_length = 0; + uint32_t alloc_length = 0; int ret = 0; /* If this is a media access command, and we hit the end of the block but not the entire length, @@ -2801,7 +3345,6 @@ int cdrom_block_check(uint8_t id) /* This is the general ATAPI callback. */ void cdrom_callback(uint8_t id) /* Callback for non-Read CD commands */ { - int ret = 0; int old_pos = 0; if (!cdrom_drives[id].bus_type) @@ -2840,6 +3383,8 @@ int cdrom_mode_select_return(uint8_t id, int ret) { case 0: /* Invalid field in parameter list. */ + case -6: + /* Attempted to write to a non-existent CD-ROM drive (should never occur, but you never know). */ cdrom_invalid_field_pl(id); return -2; case 1: @@ -2860,10 +3405,12 @@ int cdrom_mode_select_return(uint8_t id, int ret) /* Unknown phase. */ cdrom_illegal_opcode(id); return -2; - case -6: + case -5: /* Command terminated successfully. */ - cdrom_command_complete(id); + /* cdrom_command_complete(id); */ return -1; + default: + return -15; } } @@ -2895,6 +3442,8 @@ int cdrom_read_from_ide_dma(uint8_t channel) return 1; } } + + return 0; } int cdrom_read_from_scsi_dma(uint8_t scsi_id, uint8_t scsi_lun) @@ -2963,6 +3512,8 @@ int cdrom_read_from_dma(uint8_t id) return 0; } } + + return 0; } int cdrom_write_to_ide_dma(uint8_t channel) @@ -2990,7 +3541,7 @@ int cdrom_write_to_ide_dma(uint8_t channel) { while(transfer_length > 0) { - // pclog("CD-ROM %i: ATAPI DMA on position: %08X...\n", id, cdbufferb + cdbufferb_pos); + /* pclog("CD-ROM %i: ATAPI DMA on position: %08X...\n", id, cdbufferb + cdbufferb_pos); */ bus_master_len = piix_bus_master_get_count(channel >> 1); ret = piix_bus_master_dma_read_ex(channel >> 1, cdbufferb + cdbufferb_pos); if (ret != 0) @@ -3003,17 +3554,19 @@ int cdrom_write_to_ide_dma(uint8_t channel) if (ret > 0) { - // pclog("CD-ROM %i: ATAPI DMA error\n", id); + /* pclog("CD-ROM %i: ATAPI DMA error\n", id); */ cdrom_data_phase_error(id); cdrom_phase_callback(id); return 0; } else { - // pclog("CD-ROM %i: ATAPI DMA successful\n", id); + /* pclog("CD-ROM %i: ATAPI DMA successful\n", id); */ return 1; } } + + return 0; } int cdrom_write_to_scsi_dma(uint8_t scsi_id, uint8_t scsi_lun) @@ -3087,6 +3640,7 @@ void cdrom_phase_callback(uint8_t id) cdrom[id].status = READY_STAT; cdrom[id].phase = 3; cdrom[id].packet_status = 0xFF; + update_status_bar_icon(0x10 | id, 0); cdrom_irq_raise(id); return; case CDROM_PHASE_DATA_OUT: @@ -3101,6 +3655,7 @@ void cdrom_phase_callback(uint8_t id) cdrom[id].packet_status = CDROM_PHASE_COMPLETE; cdrom[id].status = READY_STAT; cdrom[id].phase = 3; + update_status_bar_icon(0x10 | id, 0); cdrom_irq_raise(id); return; case CDROM_PHASE_DATA_IN: @@ -3115,6 +3670,7 @@ void cdrom_phase_callback(uint8_t id) cdrom[id].packet_status = CDROM_PHASE_COMPLETE; cdrom[id].status = READY_STAT; cdrom[id].phase = 3; + update_status_bar_icon(0x10 | id, 0); cdrom_irq_raise(id); return; case CDROM_PHASE_ERROR: diff --git a/src/cdrom.h b/src/cdrom.h index 2902fd39d..eb5e4066e 100644 --- a/src/cdrom.h +++ b/src/cdrom.h @@ -46,7 +46,12 @@ typedef struct CDROM void (*exit)(uint8_t id); } CDROM; +#ifdef __MSC__ +# pragma pack(push,1) +typedef struct +#else typedef struct __attribute__((__packed__)) +#endif { uint8_t previous_command; int toctimes; @@ -115,10 +120,18 @@ typedef struct __attribute__((__packed__)) int init_length; } cdrom_t; +#ifdef __MSC__ +# pragma pack(pop) +#endif extern cdrom_t cdrom[CDROM_NUM]; +#ifdef __MSC__ +# pragma pack(push,1) +typedef struct +#else typedef struct __attribute__((__packed__)) +#endif { int enabled; @@ -141,6 +154,9 @@ typedef struct __attribute__((__packed__)) uint8_t sound_on; uint8_t atapi_dma; } cdrom_drive_t; +#ifdef __MSC__ +# pragma pack(pop) +#endif extern cdrom_drive_t cdrom_drives[CDROM_NUM]; @@ -199,6 +215,8 @@ int cdrom_lba_to_msf_accurate(int lba); void cdrom_reset(uint8_t id); void cdrom_set_signature(int id); void cdrom_request_sense_for_scsi(uint8_t id, uint8_t *buffer, uint8_t alloc_length); +void cdrom_update_cdb(uint8_t *cdb, int lba_pos, int number_of_blocks); +void cdrom_insert(uint8_t id); #define cdrom_sense_error cdrom[id].sense[0] #define cdrom_sense_key cdrom[id].sense[2] diff --git a/src/codegen.h b/src/codegen.h index ed5ce3a5f..ad0b3f63a 100644 --- a/src/codegen.h +++ b/src/codegen.h @@ -69,7 +69,7 @@ typedef struct codeblock_t /*Code block is always entered with the same FPU top-of-stack*/ #define CODEBLOCK_STATIC_TOP 2 -static inline codeblock_t *codeblock_tree_find(uint32_t phys, uint32_t _cs) +static __inline codeblock_t *codeblock_tree_find(uint32_t phys, uint32_t _cs) { codeblock_t *block = pages[phys >> 12].head; uint64_t a = _cs | ((uint64_t)phys << 32); @@ -87,7 +87,7 @@ static inline codeblock_t *codeblock_tree_find(uint32_t phys, uint32_t _cs) return block; } -static inline void codeblock_tree_add(codeblock_t *new_block) +static __inline void codeblock_tree_add(codeblock_t *new_block) { codeblock_t *block = pages[new_block->phys >> 12].head; uint64_t a = new_block->_cs | ((uint64_t)new_block->phys << 32); @@ -121,7 +121,7 @@ static inline void codeblock_tree_add(codeblock_t *new_block) } } -static inline void codeblock_tree_delete(codeblock_t *block) +static __inline void codeblock_tree_delete(codeblock_t *block) { codeblock_t *parent = block->parent; @@ -297,7 +297,7 @@ extern int block_pos; #define CPU_BLOCK_END() cpu_block_end = 1 -static inline void addbyte(uint8_t val) +static __inline void addbyte(uint8_t val) { codeblock[block_current].data[block_pos++] = val; if (block_pos >= BLOCK_MAX) @@ -306,7 +306,7 @@ static inline void addbyte(uint8_t val) } } -static inline void addword(uint16_t val) +static __inline void addword(uint16_t val) { *(uint16_t *)&codeblock[block_current].data[block_pos] = val; block_pos += 2; @@ -316,7 +316,7 @@ static inline void addword(uint16_t val) } } -static inline void addlong(uint32_t val) +static __inline void addlong(uint32_t val) { *(uint32_t *)&codeblock[block_current].data[block_pos] = val; block_pos += 4; @@ -326,7 +326,7 @@ static inline void addlong(uint32_t val) } } -static inline void addquad(uint64_t val) +static __inline void addquad(uint64_t val) { *(uint64_t *)&codeblock[block_current].data[block_pos] = val; block_pos += 8; diff --git a/src/codegen_ops_arith.h b/src/codegen_ops_arith.h index b732f9f9f..fc67be9f1 100644 --- a/src/codegen_ops_arith.h +++ b/src/codegen_ops_arith.h @@ -2,7 +2,7 @@ static uint32_t ropINC_rw(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uin { int host_reg; - CALL_FUNC(flags_rebuild_c); + CALL_FUNC((void *) flags_rebuild_c); host_reg = LOAD_REG_W(opcode & 7); @@ -21,7 +21,7 @@ static uint32_t ropINC_rl(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uin { int host_reg; - CALL_FUNC(flags_rebuild_c); + CALL_FUNC((void *) flags_rebuild_c); host_reg = LOAD_REG_L(opcode & 7); @@ -40,7 +40,7 @@ static uint32_t ropDEC_rw(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uin { int host_reg; - CALL_FUNC(flags_rebuild_c); + CALL_FUNC((void *) flags_rebuild_c); host_reg = LOAD_REG_W(opcode & 7); @@ -59,7 +59,7 @@ static uint32_t ropDEC_rl(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uin { int host_reg; - CALL_FUNC(flags_rebuild_c); + CALL_FUNC((void *) flags_rebuild_c); host_reg = LOAD_REG_L(opcode & 7); diff --git a/src/codegen_ops_fpu.h b/src/codegen_ops_fpu.h index 4fafa33ce..7c414c3b5 100644 --- a/src/codegen_ops_fpu.h +++ b/src/codegen_ops_fpu.h @@ -200,30 +200,30 @@ static uint32_t ropF ## name ## size(uint8_t opcode, uint32_t fetchdat, uint32_t return op_pc + 1; \ } -ropFarith(ADD, s, MEM_LOAD_ADDR_EA_L, FP_OP_S); -ropFarith(DIV, s, MEM_LOAD_ADDR_EA_L, FP_OP_S); -ropFarith(DIVR, s, MEM_LOAD_ADDR_EA_L, FP_OP_S); -ropFarith(MUL, s, MEM_LOAD_ADDR_EA_L, FP_OP_S); -ropFarith(SUB, s, MEM_LOAD_ADDR_EA_L, FP_OP_S); -ropFarith(SUBR, s, MEM_LOAD_ADDR_EA_L, FP_OP_S); -ropFarith(ADD, d, MEM_LOAD_ADDR_EA_Q, FP_OP_D); -ropFarith(DIV, d, MEM_LOAD_ADDR_EA_Q, FP_OP_D); -ropFarith(DIVR, d, MEM_LOAD_ADDR_EA_Q, FP_OP_D); -ropFarith(MUL, d, MEM_LOAD_ADDR_EA_Q, FP_OP_D); -ropFarith(SUB, d, MEM_LOAD_ADDR_EA_Q, FP_OP_D); -ropFarith(SUBR, d, MEM_LOAD_ADDR_EA_Q, FP_OP_D); -ropFarith(ADD, iw, MEM_LOAD_ADDR_EA_W, FP_OP_IW); -ropFarith(DIV, iw, MEM_LOAD_ADDR_EA_W, FP_OP_IW); -ropFarith(DIVR, iw, MEM_LOAD_ADDR_EA_W, FP_OP_IW); -ropFarith(MUL, iw, MEM_LOAD_ADDR_EA_W, FP_OP_IW); -ropFarith(SUB, iw, MEM_LOAD_ADDR_EA_W, FP_OP_IW); -ropFarith(SUBR, iw, MEM_LOAD_ADDR_EA_W, FP_OP_IW); -ropFarith(ADD, il, MEM_LOAD_ADDR_EA_L, FP_OP_IL); -ropFarith(DIV, il, MEM_LOAD_ADDR_EA_L, FP_OP_IL); -ropFarith(DIVR, il, MEM_LOAD_ADDR_EA_L, FP_OP_IL); -ropFarith(MUL, il, MEM_LOAD_ADDR_EA_L, FP_OP_IL); -ropFarith(SUB, il, MEM_LOAD_ADDR_EA_L, FP_OP_IL); -ropFarith(SUBR, il, MEM_LOAD_ADDR_EA_L, FP_OP_IL); +ropFarith(ADD, s, MEM_LOAD_ADDR_EA_L, FP_OP_S) +ropFarith(DIV, s, MEM_LOAD_ADDR_EA_L, FP_OP_S) +ropFarith(DIVR, s, MEM_LOAD_ADDR_EA_L, FP_OP_S) +ropFarith(MUL, s, MEM_LOAD_ADDR_EA_L, FP_OP_S) +ropFarith(SUB, s, MEM_LOAD_ADDR_EA_L, FP_OP_S) +ropFarith(SUBR, s, MEM_LOAD_ADDR_EA_L, FP_OP_S) +ropFarith(ADD, d, MEM_LOAD_ADDR_EA_Q, FP_OP_D) +ropFarith(DIV, d, MEM_LOAD_ADDR_EA_Q, FP_OP_D) +ropFarith(DIVR, d, MEM_LOAD_ADDR_EA_Q, FP_OP_D) +ropFarith(MUL, d, MEM_LOAD_ADDR_EA_Q, FP_OP_D) +ropFarith(SUB, d, MEM_LOAD_ADDR_EA_Q, FP_OP_D) +ropFarith(SUBR, d, MEM_LOAD_ADDR_EA_Q, FP_OP_D) +ropFarith(ADD, iw, MEM_LOAD_ADDR_EA_W, FP_OP_IW) +ropFarith(DIV, iw, MEM_LOAD_ADDR_EA_W, FP_OP_IW) +ropFarith(DIVR, iw, MEM_LOAD_ADDR_EA_W, FP_OP_IW) +ropFarith(MUL, iw, MEM_LOAD_ADDR_EA_W, FP_OP_IW) +ropFarith(SUB, iw, MEM_LOAD_ADDR_EA_W, FP_OP_IW) +ropFarith(SUBR, iw, MEM_LOAD_ADDR_EA_W, FP_OP_IW) +ropFarith(ADD, il, MEM_LOAD_ADDR_EA_L, FP_OP_IL) +ropFarith(DIV, il, MEM_LOAD_ADDR_EA_L, FP_OP_IL) +ropFarith(DIVR, il, MEM_LOAD_ADDR_EA_L, FP_OP_IL) +ropFarith(MUL, il, MEM_LOAD_ADDR_EA_L, FP_OP_IL) +ropFarith(SUB, il, MEM_LOAD_ADDR_EA_L, FP_OP_IL) +ropFarith(SUBR, il, MEM_LOAD_ADDR_EA_L, FP_OP_IL) #define ropFcompare(name, size, load, op) \ static uint32_t ropF ## name ## size(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \ @@ -252,10 +252,10 @@ static uint32_t ropF ## name ## P ## size(uint8_t opcode, uint32_t fetchdat, uin return new_pc; \ } -ropFcompare(COM, s, MEM_LOAD_ADDR_EA_L, FP_COMPARE_S); -ropFcompare(COM, d, MEM_LOAD_ADDR_EA_Q, FP_COMPARE_D); -ropFcompare(COM, iw, MEM_LOAD_ADDR_EA_W, FP_COMPARE_IW); -ropFcompare(COM, il, MEM_LOAD_ADDR_EA_L, FP_COMPARE_IL); +ropFcompare(COM, s, MEM_LOAD_ADDR_EA_L, FP_COMPARE_S) +ropFcompare(COM, d, MEM_LOAD_ADDR_EA_Q, FP_COMPARE_D) +ropFcompare(COM, iw, MEM_LOAD_ADDR_EA_W, FP_COMPARE_IW) +ropFcompare(COM, il, MEM_LOAD_ADDR_EA_L, FP_COMPARE_IL) /*static uint32_t ropFADDs(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) { @@ -491,7 +491,7 @@ static uint32_t ropFSTSW_AX(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, u int host_reg; FP_ENTER(); - host_reg = LOAD_VAR_W(&cpu_state.npxs); + host_reg = LOAD_VAR_W((uintptr_t) &cpu_state.npxs); STORE_REG_TARGET_W_RELEASE(host_reg, REG_AX); return op_pc; @@ -631,8 +631,8 @@ static uint32_t ropFCHS(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint3 opFLDimm(1, 1.0) opFLDimm(L2T, 3.3219280948873623) -opFLDimm(L2E, 1.4426950408889634); -opFLDimm(PI, 3.141592653589793); -opFLDimm(EG2, 0.3010299956639812); -opFLDimm(LN2, 0.693147180559945); +opFLDimm(L2E, 1.4426950408889634) +opFLDimm(PI, 3.141592653589793) +opFLDimm(EG2, 0.3010299956639812) +opFLDimm(LN2, 0.693147180559945) opFLDimm(Z, 0.0) diff --git a/src/codegen_ops_jump.h b/src/codegen_ops_jump.h index 8dba96c7c..440f867ef 100644 --- a/src/codegen_ops_jump.h +++ b/src/codegen_ops_jump.h @@ -75,16 +75,16 @@ static uint32_t ropLOOP(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint3 return op_pc+1; } -static int BRANCH_COND_B(int pc_offset, uint32_t op_pc, uint32_t offset, int not) +static void BRANCH_COND_B(int pc_offset, uint32_t op_pc, uint32_t offset, int not) { - CALL_FUNC(CF_SET); + CALL_FUNC((void *) CF_SET); if (not) TEST_ZERO_JUMP_L(0, op_pc+pc_offset+offset, timing_bt); else TEST_NONZERO_JUMP_L(0, op_pc+pc_offset+offset, timing_bt); } -static int BRANCH_COND_E(int pc_offset, uint32_t op_pc, uint32_t offset, int not) +static void BRANCH_COND_E(int pc_offset, uint32_t op_pc, uint32_t offset, int not) { int host_reg; @@ -122,7 +122,7 @@ static int BRANCH_COND_E(int pc_offset, uint32_t op_pc, uint32_t offset, int not break; case FLAGS_UNKNOWN: - CALL_FUNC(ZF_SET); + CALL_FUNC((void *) ZF_SET); if (not) TEST_ZERO_JUMP_L(0, op_pc+pc_offset+offset, timing_bt); else @@ -131,25 +131,25 @@ static int BRANCH_COND_E(int pc_offset, uint32_t op_pc, uint32_t offset, int not } } -static int BRANCH_COND_O(int pc_offset, uint32_t op_pc, uint32_t offset, int not) +static void BRANCH_COND_O(int pc_offset, uint32_t op_pc, uint32_t offset, int not) { - CALL_FUNC(VF_SET); + CALL_FUNC((void *) VF_SET); if (not) TEST_ZERO_JUMP_L(0, op_pc+pc_offset+offset, timing_bt); else TEST_NONZERO_JUMP_L(0, op_pc+pc_offset+offset, timing_bt); } -static int BRANCH_COND_P(int pc_offset, uint32_t op_pc, uint32_t offset, int not) +static void BRANCH_COND_P(int pc_offset, uint32_t op_pc, uint32_t offset, int not) { - CALL_FUNC(PF_SET); + CALL_FUNC((void *) PF_SET); if (not) TEST_ZERO_JUMP_L(0, op_pc+pc_offset+offset, timing_bt); else TEST_NONZERO_JUMP_L(0, op_pc+pc_offset+offset, timing_bt); } -static int BRANCH_COND_S(int pc_offset, uint32_t op_pc, uint32_t offset, int not) +static void BRANCH_COND_S(int pc_offset, uint32_t op_pc, uint32_t offset, int not) { int host_reg; @@ -204,7 +204,7 @@ static int BRANCH_COND_S(int pc_offset, uint32_t op_pc, uint32_t offset, int not break; case FLAGS_UNKNOWN: - CALL_FUNC(NF_SET); + CALL_FUNC((void *) NF_SET); if (not) TEST_ZERO_JUMP_L(0, op_pc+pc_offset+offset, timing_bt); else diff --git a/src/codegen_ops_misc.h b/src/codegen_ops_misc.h index 9d9ee7507..63ee0d6bd 100644 --- a/src/codegen_ops_misc.h +++ b/src/codegen_ops_misc.h @@ -33,7 +33,7 @@ static uint32_t ropFE(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_ if ((fetchdat & 0x30) != 0x00) return 0; - CALL_FUNC(flags_rebuild_c); + CALL_FUNC((void *) flags_rebuild_c); if ((fetchdat & 0xc0) == 0xc0) host_reg = LOAD_REG_B(fetchdat & 7); @@ -86,7 +86,7 @@ static uint32_t ropFF_16(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint return 0; if ((fetchdat & 0x30) == 0x00) - CALL_FUNC(flags_rebuild_c); + CALL_FUNC((void *) flags_rebuild_c); if ((fetchdat & 0xc0) == 0xc0) host_reg = LOAD_REG_W(fetchdat & 7); @@ -167,6 +167,9 @@ static uint32_t ropFF_16(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint MEM_STORE_ADDR_EA_W(&_ss, host_reg); SP_MODIFY(-2); return op_pc + 1; + + default: + return -1; } } static uint32_t ropFF_32(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) @@ -178,7 +181,7 @@ static uint32_t ropFF_32(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint return 0; if ((fetchdat & 0x30) == 0x00) - CALL_FUNC(flags_rebuild_c); + CALL_FUNC((void *) flags_rebuild_c); if ((fetchdat & 0xc0) == 0xc0) host_reg = LOAD_REG_L(fetchdat & 7); @@ -259,5 +262,8 @@ static uint32_t ropFF_32(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint MEM_STORE_ADDR_EA_L(&_ss, host_reg); SP_MODIFY(-4); return op_pc + 1; + + default: + return -1; } } diff --git a/src/codegen_ops_mmx.h b/src/codegen_ops_mmx.h index 14730cb93..1c425daa2 100644 --- a/src/codegen_ops_mmx.h +++ b/src/codegen_ops_mmx.h @@ -154,22 +154,22 @@ MMX_OP(ropPSUBSW, MMX_SUBSW) MMX_OP(ropPSUBUSB, MMX_SUBUSB) MMX_OP(ropPSUBUSW, MMX_SUBUSW) -MMX_OP(ropPUNPCKLBW, MMX_PUNPCKLBW); -MMX_OP(ropPUNPCKLWD, MMX_PUNPCKLWD); -MMX_OP(ropPUNPCKLDQ, MMX_PUNPCKLDQ); -MMX_OP(ropPACKSSWB, MMX_PACKSSWB); -MMX_OP(ropPCMPGTB, MMX_PCMPGTB); -MMX_OP(ropPCMPGTW, MMX_PCMPGTW); -MMX_OP(ropPCMPGTD, MMX_PCMPGTD); -MMX_OP(ropPACKUSWB, MMX_PACKUSWB); -MMX_OP(ropPUNPCKHBW, MMX_PUNPCKHBW); -MMX_OP(ropPUNPCKHWD, MMX_PUNPCKHWD); -MMX_OP(ropPUNPCKHDQ, MMX_PUNPCKHDQ); -MMX_OP(ropPACKSSDW, MMX_PACKSSDW); +MMX_OP(ropPUNPCKLBW, MMX_PUNPCKLBW) +MMX_OP(ropPUNPCKLWD, MMX_PUNPCKLWD) +MMX_OP(ropPUNPCKLDQ, MMX_PUNPCKLDQ) +MMX_OP(ropPACKSSWB, MMX_PACKSSWB) +MMX_OP(ropPCMPGTB, MMX_PCMPGTB) +MMX_OP(ropPCMPGTW, MMX_PCMPGTW) +MMX_OP(ropPCMPGTD, MMX_PCMPGTD) +MMX_OP(ropPACKUSWB, MMX_PACKUSWB) +MMX_OP(ropPUNPCKHBW, MMX_PUNPCKHBW) +MMX_OP(ropPUNPCKHWD, MMX_PUNPCKHWD) +MMX_OP(ropPUNPCKHDQ, MMX_PUNPCKHDQ) +MMX_OP(ropPACKSSDW, MMX_PACKSSDW) -MMX_OP(ropPCMPEQB, MMX_PCMPEQB); -MMX_OP(ropPCMPEQW, MMX_PCMPEQW); -MMX_OP(ropPCMPEQD, MMX_PCMPEQD); +MMX_OP(ropPCMPEQB, MMX_PCMPEQB) +MMX_OP(ropPCMPEQW, MMX_PCMPEQW) +MMX_OP(ropPCMPEQD, MMX_PCMPEQD) MMX_OP(ropPSRLW, MMX_PSRLW) MMX_OP(ropPSRLD, MMX_PSRLD) @@ -180,9 +180,9 @@ MMX_OP(ropPSLLW, MMX_PSLLW) MMX_OP(ropPSLLD, MMX_PSLLD) MMX_OP(ropPSLLQ, MMX_PSLLQ) -MMX_OP(ropPMULLW, MMX_PMULLW); -MMX_OP(ropPMULHW, MMX_PMULHW); -MMX_OP(ropPMADDWD, MMX_PMADDWD); +MMX_OP(ropPMULLW, MMX_PMULLW) +MMX_OP(ropPMULHW, MMX_PMULHW) +MMX_OP(ropPMADDWD, MMX_PMADDWD) static uint32_t ropPSxxW_imm(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) { diff --git a/src/codegen_ops_mov.h b/src/codegen_ops_mov.h index bfee56a29..4679c03f4 100644 --- a/src/codegen_ops_mov.h +++ b/src/codegen_ops_mov.h @@ -512,22 +512,22 @@ static uint32_t ropMOV_w_seg(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, switch (fetchdat & 0x38) { case 0x00: /*ES*/ - host_reg = LOAD_VAR_WL(&ES); + host_reg = LOAD_VAR_WL((uintptr_t) &ES); break; case 0x08: /*CS*/ - host_reg = LOAD_VAR_WL(&CS); + host_reg = LOAD_VAR_WL((uintptr_t) &CS); break; case 0x18: /*DS*/ - host_reg = LOAD_VAR_WL(&DS); + host_reg = LOAD_VAR_WL((uintptr_t) &DS); break; case 0x10: /*SS*/ - host_reg = LOAD_VAR_WL(&SS); + host_reg = LOAD_VAR_WL((uintptr_t) &SS); break; case 0x20: /*FS*/ - host_reg = LOAD_VAR_WL(&FS); + host_reg = LOAD_VAR_WL((uintptr_t) &FS); break; case 0x28: /*GS*/ - host_reg = LOAD_VAR_WL(&GS); + host_reg = LOAD_VAR_WL((uintptr_t) &GS); break; default: return 0; diff --git a/src/codegen_ops_stack.h b/src/codegen_ops_stack.h index 082d8a4e3..9aadbaa4e 100644 --- a/src/codegen_ops_stack.h +++ b/src/codegen_ops_stack.h @@ -85,7 +85,7 @@ static uint32_t ropPUSH_imm_b32(uint8_t opcode, uint32_t fetchdat, uint32_t op_3 static uint32_t ropPOP_16(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) { - int host_reg; + /* int host_reg; */ STORE_IMM_ADDR_L((uintptr_t)&cpu_state.oldpc, op_old_pc); LOAD_STACK_TO_EA(0); @@ -97,7 +97,7 @@ static uint32_t ropPOP_16(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uin } static uint32_t ropPOP_32(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) { - int host_reg; + /* int host_reg; */ STORE_IMM_ADDR_L((uintptr_t)&cpu_state.oldpc, op_old_pc); LOAD_STACK_TO_EA(0); @@ -110,7 +110,7 @@ static uint32_t ropPOP_32(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uin static uint32_t ropRET_16(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) { - int host_reg; + /* int host_reg; */ STORE_IMM_ADDR_L((uintptr_t)&cpu_state.oldpc, op_old_pc); LOAD_STACK_TO_EA(0); @@ -122,7 +122,7 @@ static uint32_t ropRET_16(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uin } static uint32_t ropRET_32(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) { - int host_reg; + /* int host_reg; */ STORE_IMM_ADDR_L((uintptr_t)&cpu_state.oldpc, op_old_pc); LOAD_STACK_TO_EA(0); @@ -136,7 +136,7 @@ static uint32_t ropRET_32(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uin static uint32_t ropRET_imm_16(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) { uint16_t offset = fetchdat & 0xffff; - int host_reg; + /* int host_reg; */ STORE_IMM_ADDR_L((uintptr_t)&cpu_state.oldpc, op_old_pc); LOAD_STACK_TO_EA(0); @@ -149,7 +149,7 @@ static uint32_t ropRET_imm_16(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, static uint32_t ropRET_imm_32(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) { uint16_t offset = fetchdat & 0xffff; - int host_reg; + /* int host_reg; */ STORE_IMM_ADDR_L((uintptr_t)&cpu_state.oldpc, op_old_pc); LOAD_STACK_TO_EA(0); @@ -254,8 +254,6 @@ ROP_PUSH_SEG(SS) #define ROP_POP_SEG(seg, rseg) \ static uint32_t ropPOP_ ## seg ## _16(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \ { \ - int host_reg; \ - \ STORE_IMM_ADDR_L((uintptr_t)&cpu_state.oldpc, op_old_pc); \ LOAD_STACK_TO_EA(0); \ MEM_LOAD_ADDR_EA_W(&_ss); \ @@ -266,8 +264,6 @@ static uint32_t ropPOP_ ## seg ## _16(uint8_t opcode, uint32_t fetchdat, uint32_ } \ static uint32_t ropPOP_ ## seg ## _32(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \ { \ - int host_reg; \ - \ STORE_IMM_ADDR_L((uintptr_t)&cpu_state.oldpc, op_old_pc); \ LOAD_STACK_TO_EA(0); \ MEM_LOAD_ADDR_EA_W(&_ss); \ diff --git a/src/codegen_ops_x86.h b/src/codegen_ops_x86.h index 30c013856..c8c18a28c 100644 --- a/src/codegen_ops_x86.h +++ b/src/codegen_ops_x86.h @@ -8,7 +8,7 @@ #define HOST_REG_END 4 #define HOST_REG_XMM_START 0 #define HOST_REG_XMM_END 7 -static inline int find_host_reg() +static __inline int find_host_reg() { int c; for (c = HOST_REG_START; c < HOST_REG_END; c++) @@ -21,7 +21,7 @@ static inline int find_host_reg() fatal("Out of host regs!\n"); return c; } -static inline int find_host_xmm_reg() +static __inline int find_host_xmm_reg() { int c; for (c = HOST_REG_XMM_START; c < HOST_REG_XMM_END; c++) @@ -942,7 +942,7 @@ static x86seg *FETCH_EA_16(x86seg *op_ea_seg, uint32_t fetchdat, int op_ssegs, u break; case 2: addbyte(0xb8); /*MOVL EAX, imm16*/ - addlong((fetchdat >> 8) & 0xffff);// pc++; + addlong((fetchdat >> 8) & 0xffff); addbyte(0x03); /*ADDL EAX, *mod1add[0][rm]*/ addbyte(0x05); addlong((uint32_t)mod1add[0][rm]); @@ -983,7 +983,7 @@ static x86seg *FETCH_EA_32(x86seg *op_ea_seg, uint32_t fetchdat, int op_ssegs, u { new_eaaddr = fastreadl(cs + (*op_pc) + 1); addbyte(0xb8); /*MOVL EAX, imm32*/ - addlong(new_eaaddr);// pc++; + addlong(new_eaaddr); (*op_pc) += 4; } else @@ -3600,29 +3600,29 @@ MMX_x86_OP(SUBSW, 0xe9) MMX_x86_OP(SUBUSB, 0xd8) MMX_x86_OP(SUBUSW, 0xd9) -MMX_x86_OP(PUNPCKLBW, 0x60); -MMX_x86_OP(PUNPCKLWD, 0x61); -MMX_x86_OP(PUNPCKLDQ, 0x62); -MMX_x86_OP(PCMPGTB, 0x64); -MMX_x86_OP(PCMPGTW, 0x65); -MMX_x86_OP(PCMPGTD, 0x66); +MMX_x86_OP(PUNPCKLBW, 0x60) +MMX_x86_OP(PUNPCKLWD, 0x61) +MMX_x86_OP(PUNPCKLDQ, 0x62) +MMX_x86_OP(PCMPGTB, 0x64) +MMX_x86_OP(PCMPGTW, 0x65) +MMX_x86_OP(PCMPGTD, 0x66) -MMX_x86_OP(PCMPEQB, 0x74); -MMX_x86_OP(PCMPEQW, 0x75); -MMX_x86_OP(PCMPEQD, 0x76); +MMX_x86_OP(PCMPEQB, 0x74) +MMX_x86_OP(PCMPEQW, 0x75) +MMX_x86_OP(PCMPEQD, 0x76) -MMX_x86_OP(PSRLW, 0xd1); -MMX_x86_OP(PSRLD, 0xd2); -MMX_x86_OP(PSRLQ, 0xd3); -MMX_x86_OP(PSRAW, 0xe1); -MMX_x86_OP(PSRAD, 0xe2); -MMX_x86_OP(PSLLW, 0xf1); -MMX_x86_OP(PSLLD, 0xf2); -MMX_x86_OP(PSLLQ, 0xf3); +MMX_x86_OP(PSRLW, 0xd1) +MMX_x86_OP(PSRLD, 0xd2) +MMX_x86_OP(PSRLQ, 0xd3) +MMX_x86_OP(PSRAW, 0xe1) +MMX_x86_OP(PSRAD, 0xe2) +MMX_x86_OP(PSLLW, 0xf1) +MMX_x86_OP(PSLLD, 0xf2) +MMX_x86_OP(PSLLQ, 0xf3) -MMX_x86_OP(PMULLW, 0xd5); -MMX_x86_OP(PMULHW, 0xe5); -MMX_x86_OP(PMADDWD, 0xf5); +MMX_x86_OP(PMULLW, 0xd5) +MMX_x86_OP(PMULHW, 0xe5) +MMX_x86_OP(PMADDWD, 0xf5) static void MMX_PACKSSWB(int dst_reg, int src_reg) { diff --git a/src/codegen_ops_xchg.h b/src/codegen_ops_xchg.h index 9a72c9a5a..597d26e1b 100644 --- a/src/codegen_ops_xchg.h +++ b/src/codegen_ops_xchg.h @@ -44,9 +44,9 @@ OP_XCHG_EAX_(EBP) static uint32_t ropXCHG_b(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) { -// #ifdef __amd64__ - // return 0; -// #else +/* #ifdef __amd64__ + return 0; +#else */ int src_reg, dst_reg, temp_reg; if ((fetchdat & 0xc0) != 0xc0) @@ -59,7 +59,7 @@ static uint32_t ropXCHG_b(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uin STORE_REG_TARGET_B_RELEASE(temp_reg, fetchdat & 7); return op_pc + 1; -// #endif +/* #endif */ } static uint32_t ropXCHG_w(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) { diff --git a/src/codegen_timing_486.c b/src/codegen_timing_486.c index 0cd8c25b7..19b958931 100644 --- a/src/codegen_timing_486.c +++ b/src/codegen_timing_486.c @@ -251,7 +251,7 @@ static int *opcode_timings_8x[8] = static int timing_count; static uint8_t last_prefix; -static inline int COUNT(int *c, int op_32) +static __inline int COUNT(int *c, int op_32) { if ((uintptr_t)c <= 10000) return (int)c; diff --git a/src/codegen_timing_686.c b/src/codegen_timing_686.c index 5b2b5eda5..c4b4cc456 100644 --- a/src/codegen_timing_686.c +++ b/src/codegen_timing_686.c @@ -819,7 +819,7 @@ static uint32_t opcode_timings_8x[8] = static int decode_delay; static uint8_t last_prefix; -static inline int COUNT(uint32_t c, int op_32) +static __inline int COUNT(uint32_t c, int op_32) { if (c & CYCLES_HAS_MULTI) { @@ -863,48 +863,39 @@ void codegen_timing_686_opcode(uint8_t opcode, uint32_t fetchdat, int op_32) { case 0x0f: timings = mod3 ? opcode_timings_0f_mod3 : opcode_timings_0f; -// pclog("timings 0f\n"); break; case 0xd8: timings = mod3 ? opcode_timings_d8_mod3 : opcode_timings_d8; opcode = (opcode >> 3) & 7; -// pclog("timings d8\n"); break; case 0xd9: timings = mod3 ? opcode_timings_d9_mod3 : opcode_timings_d9; opcode = mod3 ? opcode & 0x3f : (opcode >> 3) & 7; -// pclog("timings d9\n"); break; case 0xda: timings = mod3 ? opcode_timings_da_mod3 : opcode_timings_da; opcode = (opcode >> 3) & 7; -// pclog("timings da\n"); break; case 0xdb: timings = mod3 ? opcode_timings_db_mod3 : opcode_timings_db; opcode = mod3 ? opcode & 0x3f : (opcode >> 3) & 7; -// pclog("timings db\n"); break; case 0xdc: timings = mod3 ? opcode_timings_dc_mod3 : opcode_timings_dc; opcode = (opcode >> 3) & 7; -// pclog("timings dc\n"); break; case 0xdd: timings = mod3 ? opcode_timings_dd_mod3 : opcode_timings_dd; opcode = (opcode >> 3) & 7; -// pclog("timings dd\n"); break; case 0xde: timings = mod3 ? opcode_timings_de_mod3 : opcode_timings_de; opcode = (opcode >> 3) & 7; -// pclog("timings de\n"); break; case 0xdf: timings = mod3 ? opcode_timings_df_mod3 : opcode_timings_df; opcode = (opcode >> 3) & 7; -// pclog("timings df\n"); break; default: @@ -914,7 +905,6 @@ void codegen_timing_686_opcode(uint8_t opcode, uint32_t fetchdat, int op_32) timings = mod3 ? opcode_timings_mod3 : opcode_timings_8x; if (!mod3) opcode = (fetchdat >> 3) & 7; -// pclog("timings 80 %p %p %p\n", (void *)timings, (void *)opcode_timings_mod3, (void *)opcode_timings_8x); break; case 0xc0: case 0xc1: @@ -935,22 +925,18 @@ void codegen_timing_686_opcode(uint8_t opcode, uint32_t fetchdat, int op_32) case 0xf6: timings = mod3 ? opcode_timings_f6_mod3 : opcode_timings_f6; opcode = (fetchdat >> 3) & 7; -// pclog("timings f6\n"); break; case 0xf7: timings = mod3 ? opcode_timings_f7_mod3 : opcode_timings_f7; opcode = (fetchdat >> 3) & 7; -// pclog("timings f7\n"); break; case 0xff: timings = mod3 ? opcode_timings_ff_mod3 : opcode_timings_ff; opcode = (fetchdat >> 3) & 7; -// pclog("timings ff\n"); break; default: timings = mod3 ? opcode_timings_mod3 : opcode_timings; -// pclog("timings normal\n"); break; } } @@ -970,7 +956,6 @@ void codegen_timing_686_opcode(uint8_t opcode, uint32_t fetchdat, int op_32) codegen_block_cycles += COUNT(prev_timings[prev_opcode], prev_op_32) + decode_delay; decode_delay = (-COUNT(prev_timings[prev_opcode], prev_op_32)) + 1; prev_full = 0; -// pclog("Not pairable %i\n", COUNT(prev_timings[prev_opcode], prev_op_32) + decode_delay); } else if (((timings[opcode] & PAIR_MASK) == PAIR_X || (timings[opcode] & PAIR_MASK) == PAIR_X_BRANCH) && (prev_timings[opcode] & PAIR_MASK) == PAIR_X) @@ -980,7 +965,6 @@ void codegen_timing_686_opcode(uint8_t opcode, uint32_t fetchdat, int op_32) codegen_block_cycles += COUNT(prev_timings[prev_opcode], prev_op_32) + decode_delay; decode_delay = (-COUNT(prev_timings[prev_opcode], prev_op_32)) + 1; prev_full = 0; -// pclog("Not pairable %i\n", COUNT(prev_timings[prev_opcode], prev_op_32) + decode_delay); } else if (prev_regmask & regmask) { @@ -989,7 +973,6 @@ void codegen_timing_686_opcode(uint8_t opcode, uint32_t fetchdat, int op_32) codegen_block_cycles += COUNT(prev_timings[prev_opcode], prev_op_32) + decode_delay; decode_delay = (-COUNT(prev_timings[prev_opcode], prev_op_32)) + 1; prev_full = 0; -// pclog("Not pairable %i\n", COUNT(prev_timings[prev_opcode], prev_op_32) + decode_delay); } else { @@ -1003,7 +986,6 @@ void codegen_timing_686_opcode(uint8_t opcode, uint32_t fetchdat, int op_32) decode_delay = (-t_pair) + 1; prev_full = 0; -// pclog("Pairable %i %i %i %02x %02x\n", t_pair, t1, t2, opcode, prev_opcode); return; } } @@ -1016,12 +998,10 @@ void codegen_timing_686_opcode(uint8_t opcode, uint32_t fetchdat, int op_32) /*Instruction not pairable*/ codegen_block_cycles += COUNT(timings[opcode], op_32) + decode_delay; decode_delay = (-COUNT(timings[opcode], op_32)) + 1; -// pclog("Not pairable %i\n", COUNT(timings[opcode], op_32) + decode_delay); } else { /*Instruction might pair with next*/ -// pclog("Might pair - %02x %02x %08x %08x %08x %p %p %p\n", last_prefix, opcode, timings[opcode], timings[opcode] & PAIR_MASK, PAIR_X_BRANCH, timings, opcode_timings_0f, opcode_timings_0f_mod3); prev_full = 1; prev_opcode = opcode; prev_timings = timings; diff --git a/src/codegen_timing_pentium.c b/src/codegen_timing_pentium.c index 31d4cafe7..6d678915e 100644 --- a/src/codegen_timing_pentium.c +++ b/src/codegen_timing_pentium.c @@ -819,7 +819,7 @@ static uint32_t opcode_timings_8x[8] = static int decode_delay; static uint8_t last_prefix; -static inline int COUNT(uint32_t c, int op_32) +static __inline int COUNT(uint32_t c, int op_32) { if (c & CYCLES_HAS_MULTI) { @@ -855,7 +855,6 @@ void codegen_timing_pentium_block_start() void codegen_timing_pentium_start() { -// decode_delay = 0; last_prefix = 0; } @@ -896,48 +895,39 @@ void codegen_timing_pentium_opcode(uint8_t opcode, uint32_t fetchdat, int op_32) { case 0x0f: timings = mod3 ? opcode_timings_0f_mod3 : opcode_timings_0f; -// pclog("timings 0f\n"); break; case 0xd8: timings = mod3 ? opcode_timings_d8_mod3 : opcode_timings_d8; opcode = (opcode >> 3) & 7; -// pclog("timings d8\n"); break; case 0xd9: timings = mod3 ? opcode_timings_d9_mod3 : opcode_timings_d9; opcode = mod3 ? opcode & 0x3f : (opcode >> 3) & 7; -// pclog("timings d9\n"); break; case 0xda: timings = mod3 ? opcode_timings_da_mod3 : opcode_timings_da; opcode = (opcode >> 3) & 7; -// pclog("timings da\n"); break; case 0xdb: timings = mod3 ? opcode_timings_db_mod3 : opcode_timings_db; opcode = mod3 ? opcode & 0x3f : (opcode >> 3) & 7; -// pclog("timings db\n"); break; case 0xdc: timings = mod3 ? opcode_timings_dc_mod3 : opcode_timings_dc; opcode = (opcode >> 3) & 7; -// pclog("timings dc\n"); break; case 0xdd: timings = mod3 ? opcode_timings_dd_mod3 : opcode_timings_dd; opcode = (opcode >> 3) & 7; -// pclog("timings dd\n"); break; case 0xde: timings = mod3 ? opcode_timings_de_mod3 : opcode_timings_de; opcode = (opcode >> 3) & 7; -// pclog("timings de\n"); break; case 0xdf: timings = mod3 ? opcode_timings_df_mod3 : opcode_timings_df; opcode = (opcode >> 3) & 7; -// pclog("timings df\n"); break; default: @@ -947,34 +937,28 @@ void codegen_timing_pentium_opcode(uint8_t opcode, uint32_t fetchdat, int op_32) timings = mod3 ? opcode_timings_mod3 : opcode_timings_8x; if (!mod3) opcode = (fetchdat >> 3) & 7; -// pclog("timings 80 %p %p %p\n", (void *)timings, (void *)opcode_timings_mod3, (void *)opcode_timings_8x); break; case 0xc0: case 0xc1: case 0xd0: case 0xd1: case 0xd2: case 0xd3: timings = mod3 ? opcode_timings_shift_mod3 : opcode_timings_shift; opcode = (fetchdat >> 3) & 7; -// pclog("timings c0\n"); break; case 0xf6: timings = mod3 ? opcode_timings_f6_mod3 : opcode_timings_f6; opcode = (fetchdat >> 3) & 7; -// pclog("timings f6\n"); break; case 0xf7: timings = mod3 ? opcode_timings_f7_mod3 : opcode_timings_f7; opcode = (fetchdat >> 3) & 7; -// pclog("timings f7\n"); break; case 0xff: timings = mod3 ? opcode_timings_ff_mod3 : opcode_timings_ff; opcode = (fetchdat >> 3) & 7; -// pclog("timings ff\n"); break; default: timings = mod3 ? opcode_timings_mod3 : opcode_timings; -// pclog("timings normal\n"); break; } } @@ -1007,7 +991,6 @@ void codegen_timing_pentium_opcode(uint8_t opcode, uint32_t fetchdat, int op_32) if (t_pair < 1) fatal("Illegal pair timings : t1=%i t2=%i u_opcode=%02x v_opcode=%02x\n", t1, t2, u_pipe_opcode, opcode); -// pclog("Paired timings : t_pair=%i t1=%i t2=%i u_opcode=%02x v_opcode=%02x %08x:%08x\n", t_pair, t1, t2, u_pipe_opcode, opcode, cs, pc); codegen_block_cycles += t_pair; decode_delay = (-t_pair) + 1; @@ -1021,7 +1004,6 @@ nopair: codegen_block_cycles += COUNT(u_pipe_timings[u_pipe_opcode], u_pipe_op_32) + decode_delay; decode_delay = (-COUNT(u_pipe_timings[u_pipe_opcode], u_pipe_op_32)) + 1; u_pipe_full = 0; -// pclog("Evicited U-pipe timings : t1=%i u_opcode=%02x decode_delay=%i %08x:%08x\n", COUNT(u_pipe_timings[u_pipe_opcode], u_pipe_op_32), u_pipe_opcode, decode_delay, cs, pc); } if ((timings[opcode] & PAIR_U) && !decode_delay) @@ -1038,7 +1020,6 @@ nopair: codegen_block_cycles += COUNT(timings[opcode], op_32) + decode_delay; decode_delay = (-COUNT(timings[opcode], op_32)) + 1; -// pclog("Non-pairable timings : %08x t1=%i opcode=%02x mod3=%i decode_delay=%i %08x:%08x %08x %p %p\n", timings[opcode], COUNT(timings[opcode], op_32), opcode, mod3, decode_delay, cs, pc, opcode_timings[0x04], (void *)timings, (void *)opcode_timings); } void codegen_timing_pentium_block_end() diff --git a/src/codegen_timing_winchip.c b/src/codegen_timing_winchip.c index 342fbb0b6..5d1a26bf3 100644 --- a/src/codegen_timing_winchip.c +++ b/src/codegen_timing_winchip.c @@ -251,7 +251,7 @@ static int *opcode_timings_8x[8] = static int timing_count; static uint8_t last_prefix; -static inline int COUNT(int *c, int op_32) +static __inline int COUNT(int *c, int op_32) { if ((uintptr_t)c <= 10000) return (int)c; diff --git a/src/codegen_x86.c b/src/codegen_x86.c index 65eddfabd..e7971c383 100644 --- a/src/codegen_x86.c +++ b/src/codegen_x86.c @@ -80,7 +80,7 @@ uint32_t mem_check_write_l; static uint32_t gen_MEM_LOAD_ADDR_EA_B() { - uint32_t addr = &codeblock[block_current].data[block_pos]; + uint32_t addr = (uint32_t)&codeblock[block_current].data[block_pos]; addbyte(0x89); /*MOV ESI, EDX*/ addbyte(0xd6); @@ -130,7 +130,7 @@ static uint32_t gen_MEM_LOAD_ADDR_EA_B() static uint32_t gen_MEM_LOAD_ADDR_EA_W() { - uint32_t addr = &codeblock[block_current].data[block_pos]; + uint32_t addr = (uint32_t)&codeblock[block_current].data[block_pos]; addbyte(0x89); /*MOV ESI, EDX*/ addbyte(0xd6); @@ -187,7 +187,7 @@ static uint32_t gen_MEM_LOAD_ADDR_EA_W() static uint32_t gen_MEM_LOAD_ADDR_EA_L() { - uint32_t addr = &codeblock[block_current].data[block_pos]; + uint32_t addr = (uint32_t)&codeblock[block_current].data[block_pos]; addbyte(0x89); /*MOV ESI, EDX*/ addbyte(0xd6); @@ -240,7 +240,7 @@ static uint32_t gen_MEM_LOAD_ADDR_EA_L() static uint32_t gen_MEM_LOAD_ADDR_EA_Q() { - uint32_t addr = &codeblock[block_current].data[block_pos]; + uint32_t addr = (uint32_t)&codeblock[block_current].data[block_pos]; addbyte(0x89); /*MOV ESI, EDX*/ addbyte(0xd6); @@ -297,7 +297,7 @@ static uint32_t gen_MEM_LOAD_ADDR_EA_Q() static uint32_t gen_MEM_STORE_ADDR_EA_B() { - uint32_t addr = &codeblock[block_current].data[block_pos]; + uint32_t addr = (uint32_t)&codeblock[block_current].data[block_pos]; /*dat = ECX, seg = ESI, addr = EAX*/ addbyte(0x89); /*MOV EBX, ESI*/ @@ -345,7 +345,7 @@ static uint32_t gen_MEM_STORE_ADDR_EA_B() static uint32_t gen_MEM_STORE_ADDR_EA_W() { - uint32_t addr = &codeblock[block_current].data[block_pos]; + uint32_t addr = (uint32_t)&codeblock[block_current].data[block_pos]; /*dat = ECX, seg = ESI, addr = EAX*/ addbyte(0x89); /*MOV EBX, ESI*/ @@ -401,7 +401,7 @@ static uint32_t gen_MEM_STORE_ADDR_EA_W() static uint32_t gen_MEM_STORE_ADDR_EA_L() { - uint32_t addr = &codeblock[block_current].data[block_pos]; + uint32_t addr = (uint32_t)&codeblock[block_current].data[block_pos]; /*dat = ECX, seg = ESI, addr = EAX*/ addbyte(0x89); /*MOV EBX, ESI*/ @@ -456,7 +456,7 @@ static uint32_t gen_MEM_STORE_ADDR_EA_L() static uint32_t gen_MEM_STORE_ADDR_EA_Q() { - uint32_t addr = &codeblock[block_current].data[block_pos]; + uint32_t addr = (uint32_t)&codeblock[block_current].data[block_pos]; /*dat = EBX/ECX, seg = ESI, addr = EAX*/ addbyte(0x89); /*MOV EDX, ESI*/ @@ -517,7 +517,7 @@ static uint32_t gen_MEM_STORE_ADDR_EA_Q() static char gen_MEM_LOAD_ADDR_EA_B_NO_ABRT_err[] = "gen_MEM_LOAD_ADDR_EA_B_NO_ABRT aborted\n"; static uint32_t gen_MEM_LOAD_ADDR_EA_B_NO_ABRT() { - uint32_t addr = &codeblock[block_current].data[block_pos]; + uint32_t addr = (uint32_t)&codeblock[block_current].data[block_pos]; addbyte(0x89); /*MOV ESI, EDX*/ addbyte(0xd6); @@ -568,7 +568,7 @@ static uint32_t gen_MEM_LOAD_ADDR_EA_B_NO_ABRT() addbyte(0xc7); /*MOV [ESP], gen_MEM_LOAD_ADDR_EA_B_NO_ABRT_err*/ addbyte(0x04); addbyte(0x24); - addlong(gen_MEM_LOAD_ADDR_EA_B_NO_ABRT_err); + addlong((uint32_t)gen_MEM_LOAD_ADDR_EA_B_NO_ABRT_err); addbyte(0xe8); /*CALL fatal*/ addlong((uint32_t)fatal - (uint32_t)(&codeblock[block_current].data[block_pos + 4])); /*Should not return!*/ @@ -579,7 +579,7 @@ static uint32_t gen_MEM_LOAD_ADDR_EA_B_NO_ABRT() static char gen_MEM_LOAD_ADDR_EA_W_NO_ABRT_err[] = "gen_MEM_LOAD_ADDR_EA_W_NO_ABRT aborted\n"; static uint32_t gen_MEM_LOAD_ADDR_EA_W_NO_ABRT() { - uint32_t addr = &codeblock[block_current].data[block_pos]; + uint32_t addr = (uint32_t)&codeblock[block_current].data[block_pos]; addbyte(0x89); /*MOV ESI, EDX*/ addbyte(0xd6); @@ -637,7 +637,7 @@ static uint32_t gen_MEM_LOAD_ADDR_EA_W_NO_ABRT() addbyte(0xc7); /*MOV [ESP], gen_MEM_LOAD_ADDR_EA_W_NO_ABRT_err*/ addbyte(0x04); addbyte(0x24); - addlong(gen_MEM_LOAD_ADDR_EA_W_NO_ABRT_err); + addlong((uint32_t)gen_MEM_LOAD_ADDR_EA_W_NO_ABRT_err); addbyte(0xe8); /*CALL fatal*/ addlong((uint32_t)fatal - (uint32_t)(&codeblock[block_current].data[block_pos + 4])); /*Should not return!*/ @@ -648,7 +648,7 @@ static uint32_t gen_MEM_LOAD_ADDR_EA_W_NO_ABRT() static char gen_MEM_LOAD_ADDR_EA_L_NO_ABRT_err[] = "gen_MEM_LOAD_ADDR_EA_L_NO_ABRT aborted\n"; static uint32_t gen_MEM_LOAD_ADDR_EA_L_NO_ABRT() { - uint32_t addr = &codeblock[block_current].data[block_pos]; + uint32_t addr = (uint32_t)&codeblock[block_current].data[block_pos]; addbyte(0x89); /*MOV ESI, EDX*/ addbyte(0xd6); @@ -705,7 +705,7 @@ static uint32_t gen_MEM_LOAD_ADDR_EA_L_NO_ABRT() addbyte(0xc7); /*MOV [ESP], gen_MEM_LOAD_ADDR_EA_L_NO_ABRT_err*/ addbyte(0x04); addbyte(0x24); - addlong(gen_MEM_LOAD_ADDR_EA_L_NO_ABRT_err); + addlong((uint32_t)gen_MEM_LOAD_ADDR_EA_L_NO_ABRT_err); addbyte(0xe8); /*CALL fatal*/ addlong((uint32_t)fatal - (uint32_t)(&codeblock[block_current].data[block_pos + 4])); /*Should not return!*/ @@ -716,7 +716,7 @@ static uint32_t gen_MEM_LOAD_ADDR_EA_L_NO_ABRT() static char gen_MEM_STORE_ADDR_EA_B_NO_ABRT_err[] = "gen_MEM_STORE_ADDR_EA_B_NO_ABRT aborted\n"; static uint32_t gen_MEM_STORE_ADDR_EA_B_NO_ABRT() { - uint32_t addr = &codeblock[block_current].data[block_pos]; + uint32_t addr = (uint32_t)&codeblock[block_current].data[block_pos]; /*dat = ECX, seg = ESI, addr = EAX*/ addbyte(0x89); /*MOV EBX, ESI*/ @@ -763,7 +763,7 @@ static uint32_t gen_MEM_STORE_ADDR_EA_B_NO_ABRT() addbyte(0xc7); /*MOV [ESP], gen_MEM_STORE_ADDR_EA_B_NO_ABRT_err*/ addbyte(0x04); addbyte(0x24); - addlong(gen_MEM_STORE_ADDR_EA_B_NO_ABRT_err); + addlong((uint32_t)gen_MEM_STORE_ADDR_EA_B_NO_ABRT_err); addbyte(0xe8); /*CALL fatal*/ addlong((uint32_t)fatal - (uint32_t)(&codeblock[block_current].data[block_pos + 4])); /*Should not return!*/ @@ -774,7 +774,7 @@ static uint32_t gen_MEM_STORE_ADDR_EA_B_NO_ABRT() static char gen_MEM_STORE_ADDR_EA_W_NO_ABRT_err[] = "gen_MEM_STORE_ADDR_EA_W_NO_ABRT aborted\n"; static uint32_t gen_MEM_STORE_ADDR_EA_W_NO_ABRT() { - uint32_t addr = &codeblock[block_current].data[block_pos]; + uint32_t addr = (uint32_t)&codeblock[block_current].data[block_pos]; /*dat = ECX, seg = ESI, addr = EAX*/ addbyte(0x89); /*MOV EBX, ESI*/ @@ -829,7 +829,7 @@ static uint32_t gen_MEM_STORE_ADDR_EA_W_NO_ABRT() addbyte(0xc7); /*MOV [ESP], gen_MEM_STORE_ADDR_EA_W_NO_ABRT_err*/ addbyte(0x04); addbyte(0x24); - addlong(gen_MEM_STORE_ADDR_EA_W_NO_ABRT_err); + addlong((uint32_t)gen_MEM_STORE_ADDR_EA_W_NO_ABRT_err); addbyte(0xe8); /*CALL fatal*/ addlong((uint32_t)fatal - (uint32_t)(&codeblock[block_current].data[block_pos + 4])); /*Should not return!*/ @@ -840,7 +840,7 @@ static uint32_t gen_MEM_STORE_ADDR_EA_W_NO_ABRT() static char gen_MEM_STORE_ADDR_EA_L_NO_ABRT_err[] = "gen_MEM_STORE_ADDR_EA_L_NO_ABRT aborted\n"; static uint32_t gen_MEM_STORE_ADDR_EA_L_NO_ABRT() { - uint32_t addr = &codeblock[block_current].data[block_pos]; + uint32_t addr = (uint32_t)&codeblock[block_current].data[block_pos]; /*dat = ECX, seg = ESI, addr = EAX*/ addbyte(0x89); /*MOV EBX, ESI*/ @@ -894,7 +894,7 @@ static uint32_t gen_MEM_STORE_ADDR_EA_L_NO_ABRT() addbyte(0xc7); /*MOV [ESP], gen_MEM_STORE_ADDR_EA_W_NO_ABRT_err*/ addbyte(0x04); addbyte(0x24); - addlong(gen_MEM_STORE_ADDR_EA_W_NO_ABRT_err); + addlong((uint32_t)gen_MEM_STORE_ADDR_EA_W_NO_ABRT_err); addbyte(0xe8); /*CALL fatal*/ addlong((uint32_t)fatal - (uint32_t)(&codeblock[block_current].data[block_pos + 4])); /*Should not return!*/ @@ -904,7 +904,7 @@ static uint32_t gen_MEM_STORE_ADDR_EA_L_NO_ABRT() static uint32_t gen_MEM_CHECK_WRITE() { - uint32_t addr = &codeblock[block_current].data[block_pos]; + uint32_t addr = (uint32_t)&codeblock[block_current].data[block_pos]; /*seg = ESI, addr = EAX*/ @@ -966,7 +966,7 @@ static uint32_t gen_MEM_CHECK_WRITE() static uint32_t gen_MEM_CHECK_WRITE_W() { - uint32_t addr = &codeblock[block_current].data[block_pos]; + uint32_t addr = (uint32_t)&codeblock[block_current].data[block_pos]; /*seg = ESI, addr = EAX*/ @@ -1048,7 +1048,7 @@ static uint32_t gen_MEM_CHECK_WRITE_W() static uint32_t gen_MEM_CHECK_WRITE_L() { - uint32_t addr = &codeblock[block_current].data[block_pos]; + uint32_t addr = (uint32_t)&codeblock[block_current].data[block_pos]; /*seg = ESI, addr = EAX*/ @@ -1157,11 +1157,11 @@ void codegen_init() exit(-1); } #endif -// pclog("Codegen is %p\n", (void *)pages[0xfab12 >> 12].block); + /* pclog("Codegen is %p\n", (void *)pages[0xfab12 >> 12].block); */ block_current = BLOCK_SIZE; block_pos = 0; - mem_abrt_rout = &codeblock[block_current].data[block_pos]; + mem_abrt_rout = (uint32_t)&codeblock[block_current].data[block_pos]; addbyte(0x83); /*ADDL $16+4,%esp*/ addbyte(0xC4); addbyte(0x10+4); @@ -1205,10 +1205,16 @@ void codegen_init() block_pos = (block_pos + 15) & ~15; mem_check_write_l = gen_MEM_CHECK_WRITE_L(); - asm( +#ifdef __MSC__ + __asm { + fstcw cpu_state.old_npxc + } +#else + __asm( "fstcw %0\n" : "=m" (cpu_state.old_npxc) ); +#endif } void codegen_reset() @@ -1313,7 +1319,7 @@ static void remove_from_block_list(codeblock_t *block, uint32_t pc) } else { -// pclog(" pages.block_2=%p 3 %p %p\n", (void *)block->next_2, (void *)block, (void *)pages[block->phys_2 >> 12].block_2); + /* pclog(" pages.block_2=%p 3 %p %p\n", (void *)block->next_2, (void *)block, (void *)pages[block->phys_2 >> 12].block_2); */ pages[block->phys_2 >> 12].block_2 = block->next_2; if (block->next_2) block->next_2->prev_2 = NULL; @@ -1380,11 +1386,11 @@ void codegen_block_init(uint32_t phys_addr) block_current = (block_current + 1) & BLOCK_MASK; block = &codeblock[block_current]; -// if (block->pc == 0xb00b4ff5) -// pclog("Init target block\n"); + /* if (block->pc == 0xb00b4ff5) + pclog("Init target block\n"); */ if (block->pc != 0) { -// pclog("Reuse block : was %08x now %08x\n", block->pc, cs+pc); + /* pclog("Reuse block : was %08x now %08x\n", block->pc, cs+pc); */ delete_block(block); cpu_recomp_reuse++; } @@ -1457,7 +1463,7 @@ void codegen_block_start_recompile(codeblock_t *block) addbyte(0xBD); /*MOVL EBP, &cpu_state*/ addlong(((uintptr_t)&cpu_state) + 128); -// pclog("New block %i for %08X %03x\n", block_current, cs+pc, block_num); + /* pclog("New block %i for %08X %03x\n", block_current, cs+pc, block_num); */ last_op32 = -1; last_ea_seg = NULL; @@ -1511,11 +1517,11 @@ void codegen_block_generate_end_mask() start_pc >>= PAGE_MASK_SHIFT; end_pc >>= PAGE_MASK_SHIFT; -// pclog("block_end: %08x %08x\n", start_pc, end_pc); + /* pclog("block_end: %08x %08x\n", start_pc, end_pc); */ for (; start_pc <= end_pc; start_pc++) { block->page_mask |= ((uint64_t)1 << start_pc); -// pclog(" %08x %llx\n", start_pc, block->page_mask); + /* pclog(" %08x %llx\n", start_pc, block->page_mask); */ } pages[block->phys >> 12].code_present_mask |= block->page_mask; @@ -1528,7 +1534,7 @@ void codegen_block_generate_end_mask() block->phys_2 = get_phys_noabrt(block->endpc); if (block->phys_2 != -1) { -// pclog("start block - %08x %08x %p %p %p %08x\n", block->pc, block->endpc, (void *)block, (void *)block->next_2, (void *)pages[block->phys_2 >> 12].block_2, block->phys_2); + /* pclog("start block - %08x %08x %p %p %p %08x\n", block->pc, block->endpc, (void *)block, (void *)block->next_2, (void *)pages[block->phys_2 >> 12].block_2, block->phys_2); */ start_pc = 0; end_pc = (block->endpc & 0xfff) >> PAGE_MASK_SHIFT; @@ -1537,19 +1543,19 @@ void codegen_block_generate_end_mask() if (!pages[block->phys_2 >> 12].block_2) mem_flush_write_page(block->phys_2, block->endpc); -// pclog("New block - %08x %08x %p %p phys %08x %08x %016llx\n", block->pc, block->endpc, (void *)block, (void *)block->next_2, block->phys, block->phys_2, block->page_mask2); + /* pclog("New block - %08x %08x %p %p phys %08x %08x %016llx\n", block->pc, block->endpc, (void *)block, (void *)block->next_2, block->phys, block->phys_2, block->page_mask2); */ if (!block->page_mask2) fatal("!page_mask2\n"); if (block->next_2) { -// pclog(" next_2->pc=%08x\n", block->next_2->pc); + /* pclog(" next_2->pc=%08x\n", block->next_2->pc); */ if (!block->next_2->pc) fatal("block->next_2->pc=0 %p\n", (void *)block->next_2); } } } -// pclog("block_end: %08x %08x %016llx\n", block->pc, block->endpc, block->page_mask); + /* pclog("block_end: %08x %08x %016llx\n", block->pc, block->endpc, block->page_mask); */ recomp_page = -1; } @@ -1605,7 +1611,7 @@ void codegen_block_end_recompile(codeblock_t *block) block->next_2 = block->prev_2 = NULL; codegen_block_generate_end_mask(); add_to_block_list(block); -// pclog("End block %i\n", block_num); + /* pclog("End block %i\n", block_num); */ if (!(block->flags & CODEBLOCK_HAS_FPU)) block->flags &= ~CODEBLOCK_STATIC_TOP; @@ -1715,7 +1721,7 @@ static x86seg *codegen_generate_ea_16_long(x86seg *op_ea_seg, uint32_t fetchdat, break; case 1: addbyte(0xb8); /*MOVL ,%eax*/ - addlong((uint32_t)(int8_t)(rmdat >> 8));// pc++; + addlong((uint32_t)(int8_t)(rmdat >> 8)); /* pc++; */ addbyte(0x03); /*ADDL *mod1add[0][cpu_rm], %eax*/ addbyte(0x05); addlong((uint32_t)mod1add[0][cpu_rm]); @@ -1726,7 +1732,7 @@ static x86seg *codegen_generate_ea_16_long(x86seg *op_ea_seg, uint32_t fetchdat, break; case 2: addbyte(0xb8); /*MOVL ,%eax*/ - addlong((fetchdat >> 8) & 0xffff);// pc++; + addlong((fetchdat >> 8) & 0xffff); /* pc++; */ addbyte(0x03); /*ADDL *mod1add[0][cpu_rm], %eax*/ addbyte(0x05); addlong((uint32_t)mod1add[0][cpu_rm]); @@ -1763,7 +1769,7 @@ static x86seg *codegen_generate_ea_32_long(x86seg *op_ea_seg, uint32_t fetchdat, { new_eaaddr = fastreadl(cs + (*op_pc) + 1); addbyte(0xb8); /*MOVL ,%eax*/ - addlong(new_eaaddr);// pc++; + addlong(new_eaaddr); /* pc++; */ (*op_pc) += 4; } else @@ -1843,8 +1849,10 @@ static x86seg *codegen_generate_ea_32_long(x86seg *op_ea_seg, uint32_t fetchdat, addbyte(0x8b); /*MOVL regs[sib&7].l, %eax*/ addbyte(0x45); addbyte(cpu_state_offset(regs[cpu_rm].l)); -// addbyte(0xa1); /*MOVL regs[cpu_rm].l, %eax*/ -// addlong((uint32_t)&cpu_state.regs[cpu_rm].l); +#if 0 + addbyte(0xa1); /*MOVL regs[cpu_rm].l, %eax*/ + addlong((uint32_t)&cpu_state.regs[cpu_rm].l); +#endif cpu_state.eaaddr = cpu_state.regs[cpu_rm].l; if (cpu_mod) { @@ -2086,8 +2094,10 @@ generate_call: } op = op_table[((opcode >> opcode_shift) | op_32) & opcode_mask]; -// if (output) -// pclog("Generate call at %08X %02X %08X %02X %08X %08X %08X %08X %08X %02X %02X %02X %02X\n", &codeblock[block_current][block_pos], opcode, new_pc, ram[old_pc], EAX, EBX, ECX, EDX, ESI, ram[0x7bd2+6],ram[0x7bd2+7],ram[0x7bd2+8],ram[0x7bd2+9]); +#if 0 + if (output) + pclog("Generate call at %08X %02X %08X %02X %08X %08X %08X %08X %08X %02X %02X %02X %02X\n", &codeblock[block_current][block_pos], opcode, new_pc, ram[old_pc], EAX, EBX, ECX, EDX, ESI, ram[0x7bd2+6],ram[0x7bd2+7],ram[0x7bd2+8],ram[0x7bd2+9]); +#endif if (op_ssegs != last_ssegs) { last_ssegs = op_ssegs; @@ -2169,8 +2179,10 @@ generate_call: addbyte(0x0F); addbyte(0x85); /*JNZ 0*/ addlong((uint32_t)&block->data[BLOCK_EXIT_OFFSET] - (uint32_t)(&block->data[block_pos + 4])); -// addbyte(0xE8); /*CALL*/ -// addlong(((uint8_t *)codegen_debug - (uint8_t *)(&block->data[block_pos + 4]))); +#if 0 + addbyte(0xE8); /*CALL*/ + addlong(((uint8_t *)codegen_debug - (uint8_t *)(&block->data[block_pos + 4]))); +#endif codegen_endpc = (cs + cpu_state.pc) + 8; } diff --git a/src/config.c b/src/config.c index 234254fe5..1e22f6415 100644 --- a/src/config.c +++ b/src/config.c @@ -5,6 +5,7 @@ #include #include #include "config.h" +#include "ibm.h" char config_file_default[256]; @@ -148,9 +149,7 @@ void config_load(char *fn) strncpy(new_section->name, name, 256); list_add(&new_section->list, &config_head); - current_section = new_section; - -// pclog("New section : %s %p\n", name, (void *)current_section); + current_section = new_section; } else { @@ -182,8 +181,6 @@ void config_load(char *fn) strncpy(new_entry->name, name, 256); strncpy(new_entry->data, &buffer[data_pos], 256); list_add(&new_entry->list, ¤t_section->entry_head); - -// pclog("New data under section [%s] : %s = %s\n", current_section->name, new_entry->name, new_entry->data); } } diff --git a/src/cpu.c b/src/cpu.c index 085f4e1b7..d2e1b26f7 100644 --- a/src/cpu.c +++ b/src/cpu.c @@ -166,11 +166,13 @@ CPU cpus_8088[] = { /*8088 standard*/ {"8088/4.77", CPU_8088, 0, 4772728, 1, 0, 0, 0, 0, 0, 0,0,0,0}, - {"8088/7.16", CPU_8088, 1, 14318184/2, 1, 0, 0, 0, 0, 0, 0,0,0,0}, {"8088/8", CPU_8088, 1, 8000000, 1, 0, 0, 0, 0, 0, 0,0,0,0}, +#if 0 + {"8088/7.16", CPU_8088, 1, 14318184/2, 1, 0, 0, 0, 0, 0, 0,0,0,0}, {"8088/10", CPU_8088, 2, 10000000, 1, 0, 0, 0, 0, 0, 0,0,0,0}, {"8088/12", CPU_8088, 3, 12000000, 1, 0, 0, 0, 0, 0, 0,0,0,0}, {"8088/16", CPU_8088, 4, 16000000, 1, 0, 0, 0, 0, 0, 0,0,0,0}, +#endif {"", -1, 0, 0, 0, 0, 0,0,0,0} }; @@ -325,6 +327,7 @@ CPU cpus_i486[] = {"i486SX/25", CPU_i486SX, 2, 25000000, 1, 25000000, 0x42a, 0, 0, CPU_SUPPORTS_DYNAREC, 4,4,3,3}, {"i486SX/33", CPU_i486SX, 3, 33333333, 1, 33333333, 0x42a, 0, 0, CPU_SUPPORTS_DYNAREC, 6,6,3,3}, {"i486SX2/50", CPU_i486SX, 5, 50000000, 2, 25000000, 0x45b, 0, 0, CPU_SUPPORTS_DYNAREC, 8,8,6,6}, + {"i486SX2/66 (Q0569)", CPU_i486SX, 6, 66666666, 2, 33333333, 0x45b, 0, 0, CPU_SUPPORTS_DYNAREC, 8,8,6,6}, {"i486DX/25", CPU_i486DX, 2, 25000000, 1, 25000000, 0x404, 0, 0, CPU_SUPPORTS_DYNAREC, 4,4,3,3}, {"i486DX/33", CPU_i486DX, 3, 33333333, 1, 33333333, 0x404, 0, 0, CPU_SUPPORTS_DYNAREC, 6,6,3,3}, {"i486DX/50", CPU_i486DX, 5, 50000000, 1, 25000000, 0x404, 0, 0, CPU_SUPPORTS_DYNAREC, 8,8,4,4}, @@ -1862,8 +1865,6 @@ void cpu_CPUID() EAX = CPUID; EBX = ECX = 0; EDX = CPUID_FPU | CPUID_TSC | CPUID_MSR | CPUID_CMPXCHG8B | CPUID_MMX | CPUID_SEP | CPUID_CMOV; - // EDX = CPUID_FPU | CPUID_TSC | CPUID_MSR | CPUID_CMPXCHG8B | CPUID_MMX | CPUID_CMOV; - // EDX = 0x0183FBFF; } else if (EAX == 2) { @@ -1888,8 +1889,6 @@ void cpu_CPUID() EAX = CPUID; EBX = ECX = 0; EDX = CPUID_FPU | CPUID_TSC | CPUID_MSR | CPUID_CMPXCHG8B | CPUID_MMX | CPUID_SEP | CPUID_FXSR | CPUID_CMOV; - // EDX = CPUID_FPU | CPUID_TSC | CPUID_MSR | CPUID_CMPXCHG8B | CPUID_MMX | CPUID_FXSR | CPUID_CMOV; - // EDX = 0x0183FBFF; } else if (EAX == 2) { @@ -1997,10 +1996,8 @@ void cpu_RDMSR() break; case CPU_PENTIUMPRO: - // case CPU_PENTIUM2: case CPU_PENTIUM2D: EAX = EDX = 0; - // pclog("RDMSR, ECX=%08X\n", ECX); switch (ECX) { case 0x10: @@ -2024,11 +2021,11 @@ void cpu_RDMSR() EAX = ecx79_msr & 0xffffffff; EDX = ecx79_msr >> 32; break; - case 0x88 ... 0x8B: + case 0x88: case 0x89: case 0x8A: case 0x8B: EAX = ecx8x_msr[ECX - 0x88] & 0xffffffff; EDX = ecx8x_msr[ECX - 0x88] >> 32; break; - case 0xC1 ... 0xC8: + case 0xC1: case 0xC2: case 0xC3: case 0xC4: case 0xC5: case 0xC6: case 0xC7: case 0xC8: EAX = msr_ia32_pmc[ECX - 0xC1] & 0xffffffff; EDX = msr_ia32_pmc[ECX - 0xC1] >> 32; break; @@ -2040,7 +2037,7 @@ void cpu_RDMSR() EAX = ecx116_msr & 0xffffffff; EDX = ecx116_msr >> 32; break; - case 0x118 ... 0x11B: + case 0x118: case 0x119: case 0x11A: case 0x11B: EAX = ecx11x_msr[ECX - 0x118] & 0xffffffff; EDX = ecx11x_msr[ECX - 0x118] >> 32; break; @@ -2073,7 +2070,8 @@ void cpu_RDMSR() EAX = ecx1e0_msr & 0xffffffff; EDX = ecx1e0_msr >> 32; break; - case 0x200 ... 0x20F: + case 0x200: case 0x201: case 0x202: case 0x203: case 0x204: case 0x205: case 0x206: case 0x207: + case 0x208: case 0x209: case 0x20A: case 0x20B: case 0x20C: case 0x20D: case 0x20E: case 0x20F: if (ECX & 1) { EAX = mtrr_physmask_msr[(ECX - 0x200) >> 1] & 0xffffffff; @@ -2097,8 +2095,7 @@ void cpu_RDMSR() EAX = mtrr_fix16k_a000_msr & 0xffffffff; EDX = mtrr_fix16k_a000_msr >> 32; break; - case 0x268 ... 0x26F: - // ((ECX - 0x268) * 0x8000) + case 0x268: case 0x269: case 0x26A: case 0x26B: case 0x26C: case 0x26D: case 0x26E: case 0x26F: EAX = mtrr_fix4k_msr[ECX - 0x268] & 0xffffffff; EDX = mtrr_fix4k_msr[ECX - 0x268] >> 32; break; @@ -2206,9 +2203,7 @@ void cpu_WRMSR() break; case CPU_PENTIUMPRO: - // case CPU_PENTIUM2: case CPU_PENTIUM2D: - // pclog("WRMSR, ECX=%08X\n", ECX); switch (ECX) { case 0x10: @@ -2224,10 +2219,10 @@ void cpu_WRMSR() case 0x79: ecx79_msr = EAX | ((uint64_t)EDX << 32); break; - case 0x88 ... 0x8B: + case 0x88: case 0x89: case 0x8A: case 0x8B: ecx8x_msr[ECX - 0x88] = EAX | ((uint64_t)EDX << 32); break; - case 0xC1 ... 0xC8: + case 0xC1: case 0xC2: case 0xC3: case 0xC4: case 0xC5: case 0xC6: case 0xC7: case 0xC8: msr_ia32_pmc[ECX - 0xC1] = EAX | ((uint64_t)EDX << 32); break; case 0xFE: @@ -2236,7 +2231,7 @@ void cpu_WRMSR() case 0x116: ecx116_msr = EAX | ((uint64_t)EDX << 32); break; - case 0x118 ... 0x011B: + case 0x118: case 0x119: case 0x11A: case 0x11B: ecx11x_msr[ECX - 0x118] = EAX | ((uint64_t)EDX << 32); break; case 0x11E: @@ -2244,17 +2239,14 @@ void cpu_WRMSR() break; case 0x174: if (models[model].cpu[cpu_manufacturer].cpus[cpu].cpu_type == CPU_PENTIUMPRO) goto i686_invalid_wrmsr; - // pclog("WRMSR SYSENTER_CS: old=%04X, new=%04X\n", cs_msr, (uint16_t) (EAX & 0xFFFF)); cs_msr = EAX & 0xFFFF; break; case 0x175: if (models[model].cpu[cpu_manufacturer].cpus[cpu].cpu_type == CPU_PENTIUMPRO) goto i686_invalid_wrmsr; - // pclog("WRMSR SYSENTER_ESP: old=%08X, new=%08X\n", esp_msr, EAX); esp_msr = EAX; break; case 0x176: if (models[model].cpu[cpu_manufacturer].cpus[cpu].cpu_type == CPU_PENTIUMPRO) goto i686_invalid_wrmsr; - // pclog("WRMSR SYSENTER_EIP: old=%08X, new=%08X\n", eip_msr, EAX); eip_msr = EAX; break; case 0x186: @@ -2266,7 +2258,8 @@ void cpu_WRMSR() case 0x1E0: ecx1e0_msr = EAX | ((uint64_t)EDX << 32); break; - case 0x200 ... 0x20F: + case 0x200: case 0x201: case 0x202: case 0x203: case 0x204: case 0x205: case 0x206: case 0x207: + case 0x208: case 0x209: case 0x20A: case 0x20B: case 0x20C: case 0x20D: case 0x20E: case 0x20F: if (ECX & 1) mtrr_physmask_msr[(ECX - 0x200) >> 1] = EAX | ((uint64_t)EDX << 32); else @@ -2281,8 +2274,7 @@ void cpu_WRMSR() case 0x259: mtrr_fix16k_a000_msr = EAX | ((uint64_t)EDX << 32); break; - case 0x268 ... 0x26F: - // ((ECX - 0x268) * 0x8000) + case 0x268: case 0x269: case 0x26A: case 0x26B: case 0x26C: case 0x26D: case 0x26E: case 0x26F: mtrr_fix4k_msr[ECX - 0x268] = EAX | ((uint64_t)EDX << 32); break; case 0x277: diff --git a/src/cpu.h b/src/cpu.h index 1159caefc..cbf7b7516 100644 --- a/src/cpu.h +++ b/src/cpu.h @@ -133,7 +133,6 @@ extern uint64_t cpu_CR4_mask; #define CPU_SUPPORTS_DYNAREC 1 #define CPU_REQUIRES_DYNAREC 2 -// #define CPU_REQUIRES_DYNAREC 0 extern int cpu_cycles_read, cpu_cycles_read_l, cpu_cycles_write, cpu_cycles_write_l; extern int cpu_prefetch_cycles, cpu_prefetch_width; @@ -161,5 +160,6 @@ extern int isa_cycles; #define ISA_CYCLES(x) ((x * isa_cycles) >> ISA_CYCLES_SHIFT) void cpu_update_waitstates(); +void cpu_set(); #endif diff --git a/src/dac.c b/src/dac.c index 5a784d04c..7aecf02f5 100644 --- a/src/dac.c +++ b/src/dac.c @@ -2,6 +2,7 @@ see COPYING for more details */ #include "ibm.h" +#include "dac.h" uint8_t dac,dac2; uint8_t dacctrl; @@ -18,10 +19,8 @@ void writedac(uint16_t addr, uint8_t val) void writedacctrl(uint16_t addr, uint8_t val) { -// printf("Write DAC ctrl %02X %i\n",val,lptfifo); if (dacctrl&8 && !(val&8) && (lptfifo!=16)) { -// dac=dac2; dssbuffer[dssend++]=dac2; dssend&=15; lptfifo++; diff --git a/src/dac.h b/src/dac.h new file mode 100644 index 000000000..4a10e6c2f --- /dev/null +++ b/src/dac.h @@ -0,0 +1,2 @@ +void writedac(uint16_t addr, uint8_t val); +void writedacctrl(uint16_t addr, uint8_t val); diff --git a/src/device.c b/src/device.c index 44f6cb5e9..39a4c0c32 100644 --- a/src/device.c +++ b/src/device.c @@ -112,6 +112,8 @@ char *device_add_status_info(char *s, int max_len) devices[c]->add_status_info(s, max_len, device_priv[c]); } } + + return NULL; } int device_get_config_int(char *s) diff --git a/src/device.h b/src/device.h index 6ac7628d7..fb509ce7f 100644 --- a/src/device.h +++ b/src/device.h @@ -47,7 +47,10 @@ char *device_get_config_string(char *name); enum { DEVICE_NOT_WORKING = 1, /*Device does not currently work correctly and will be disabled in a release build*/ - DEVICE_AT = 2 /*Device requires an AT-compatible system*/ + DEVICE_AT = 2, /*Device requires an AT-compatible system*/ + DEVICE_PS2 = 4, /*Device requires a PS/1 or PS/2 system*/ + DEVICE_MCA = 0x20, /*Device requires the MCA bus*/ + DEVICE_PCI = 0x40 /*Device requires the PCI bus*/ }; int model_get_config_int(char *s); diff --git a/src/disc.c b/src/disc.c index e5d202775..70141de15 100644 --- a/src/disc.c +++ b/src/disc.c @@ -102,13 +102,9 @@ void disc_load(int drive, char *fn) int c = 0, size; char *p; FILE *f; -// pclog("disc_load %i %s\n", drive, fn); -// setejecttext(drive, ""); if (!fn) return; p = get_extension(fn); if (!p) return; -// setejecttext(drive, fn); - // pclog("Loading :%i %s %s\n", drive, fn,p); f = fopen(fn, "rb"); if (!f) return; fseek(f, -1, SEEK_END); @@ -118,12 +114,10 @@ void disc_load(int drive, char *fn) { if (!strcasecmp(p, loaders[c].ext) && (size == loaders[c].size || loaders[c].size == -1)) { - // pclog("Loading as %s (UI write protected = %s)\n", p, ui_writeprot[drive] ? "yes" : "no"); driveloaders[drive] = c; loaders[c].load(drive, fn); drive_empty[drive] = 0; strcpy(discfns[drive], fn); - // fdd_set_head(real_drive(drive), 0); fdd_forced_seek(real_drive(drive), 0); disc_changed[drive] = 1; return; @@ -138,7 +132,6 @@ void disc_load(int drive, char *fn) void disc_close(int drive) { -// pclog("disc_close %i\n", drive); if (loaders[driveloaders[drive]].close) loaders[driveloaders[drive]].close(drive); drive_empty[drive] = 1; fdd_set_head(real_drive(drive), 0); @@ -210,8 +203,7 @@ void disc_poll(int drive) { if (drive >= FDD_NUM) { - disc_poll_time[drive] += (int) (((romset == ROM_MRTHOR) ? 8.0 : 32.0) * TIMER_USEC); - return; + fatal("Attempting to poll floppy drive %i that is not supposed to be there\n", drive); } disc_poll_time[drive] += (int) disc_real_period(drive); @@ -249,7 +241,7 @@ void disc_poll_3() int disc_get_bitcell_period(int rate) { - int bit_rate; + int bit_rate = 250; switch (rate) { @@ -312,7 +304,6 @@ void disc_reset() void disc_init() { -// pclog("disc_init %p\n", drives); drives[0].poll = drives[1].poll = drives[2].poll = drives[3].poll = 0; drives[0].seek = drives[1].seek = drives[2].seek = drives[3].seek = 0; drives[0].readsector = drives[1].readsector = drives[2].readsector = drives[3].readsector = 0; @@ -322,13 +313,8 @@ void disc_init() int oldtrack[FDD_NUM] = {0, 0, 0, 0}; void disc_seek(int drive, int track) { -// pclog("disc_seek: drive=%i track=%i\n", drive, track); if (drives[drive].seek) drives[drive].seek(drive, track); -// if (track != oldtrack[drive]) -// fdc_discchange_clear(drive); -// ddnoise_seek(track - oldtrack[drive]); -// oldtrack[drive] = track; } void disc_readsector(int drive, int sector, int track, int side, int density, int sector_size) diff --git a/src/disc.h b/src/disc.h index bb6491ea4..32bb601a0 100644 --- a/src/disc.h +++ b/src/disc.h @@ -64,7 +64,6 @@ extern int swwp; extern int disable_write; extern int defaultwriteprot; -//extern char discfns[4][260]; extern int writeprot[FDD_NUM], fwriteprot[FDD_NUM]; extern int disc_track[FDD_NUM]; @@ -147,7 +146,7 @@ void d86f_reset_index_hole_pos(int drive, int side); uint16_t d86f_prepare_pretrack(int drive, int side, int iso); uint16_t d86f_prepare_sector(int drive, int side, int prev_pos, uint8_t *id_buf, uint8_t *data_buf, int data_len, int gap2, int gap3, int deleted, int bad_crc); -int gap3_sizes[5][8][256]; +int gap3_sizes[5][8][48]; void null_writeback(int drive); void null_write_data(int drive, int side, uint16_t pos, uint8_t data); diff --git a/src/disc_86f.c b/src/disc_86f.c index af9d5d58c..c1567a1d5 100644 --- a/src/disc_86f.c +++ b/src/disc_86f.c @@ -5,8 +5,6 @@ #include #include -// #include "crcspeed/crc64speed.h" -// #include "zlib.h" #include "lzf/lzf.h" #include "config.h" @@ -22,7 +20,7 @@ #define CHUNK 16384 -uint64_t poly = 0x42F0E1EBA9EA3693; /* ECMA normal */ +uint64_t poly = 0x42F0E1EBA9EA3693ll; /* ECMA normal */ uint64_t table[256]; @@ -86,25 +84,45 @@ enum /* 1 11 01 ??? */ STATE_0D_SPIN_TO_INDEX = 0xE8, /* FORMAT TRACK */ - STATE_0D_FORMAT_TRACK + STATE_0D_FORMAT_TRACK, + + /* 1 11 11 ??? */ + STATE_0D_NOP_SPIN_TO_INDEX = 0xF8, /* FORMAT TRACK */ + STATE_0D_NOP_FORMAT_TRACK }; static uint16_t CRCTable[256]; -typedef struct __attribute__((packed)) +#ifdef __MSC__ +# pragma pack(push,1) +typedef struct +#else +typedef struct __attribute__((__packed__)) +#endif { uint8_t buffer[10]; uint32_t pos; uint32_t len; } sliding_buffer_t; +#ifdef __MSC__ +# pragma pack(pop) +#endif -typedef struct __attribute__((packed)) +#ifdef __MSC__ +# pragma pack(push,1) +typedef struct +#else +typedef struct __attribute__((__packed__)) +#endif { uint32_t sync_marks; uint32_t bits_obtained; uint32_t bytes_obtained; uint32_t sync_pos; } find_t; +#ifdef __MSC__ +# pragma pack(pop) +#endif uint8_t encoded_fm[64] = { 0xAA, 0xAB, 0xAE, 0xAF, 0xBA, 0xBB, 0xBE, 0xBF, 0xEA, 0xEB, 0xEE, 0xEF, 0xFA, 0xFB, 0xFE, 0xFF, 0xAA, 0xAB, 0xAE, 0xAF, 0xBA, 0xBB, 0xBE, 0xBF, 0xEA, 0xEB, 0xEE, 0xEF, 0xFA, 0xFB, 0xFE, 0xFF, @@ -135,14 +153,22 @@ enum FMT_SECTOR_GAP3, FMT_POSTTRK_CHECK, - FMT_POSTTRK_GAP4, + FMT_POSTTRK_GAP4 }; -typedef struct __attribute__((packed)) +#ifdef __MSC__ +# pragma pack(push,1) +typedef struct +#else +typedef struct __attribute__((__packed__)) +#endif { unsigned nibble0 :4; unsigned nibble1 :4; } split_byte_t; +#ifdef __MSC__ +# pragma pack(pop) +#endif typedef union { uint8_t byte; @@ -160,7 +186,12 @@ typedef union { Bits 10, 9 Zone type (3 = Commodore 64 zoned, 2 = Apple zoned, 1 = Pre-Apple zoned #2, 0 = Pre-Apple zoned #1) Bit 11 Data and surface bits are stored in reverse byte endianness */ -static struct __attribute__((packed)) +#ifdef __MSC__ +# pragma pack(push,1) +struct +#else +struct __attribute__((__packed__)) +#endif { FILE *f; uint16_t version; @@ -198,11 +229,14 @@ static struct __attribute__((packed)) uint32_t error_condition; int is_compressed; int id_found; - uint8_t original_file_name[2048]; + char original_file_name[2048]; uint8_t *filebuf; uint8_t *outbuf; uint32_t dma_over; } d86f[FDD_NUM]; +#ifdef __MSC__ +# pragma pack(pop) +#endif int d86f_do_log = 0; @@ -475,7 +509,6 @@ int d86f_get_array_size(int drive, int side) int array_size = 0; int rm = 0; int hole = 0; - int extra_bytes = 0; rm = d86f_get_rpm_mode(drive); hole = (d86f_handler[drive].disk_flags(drive) & 6) >> 1; switch (hole) @@ -833,7 +866,7 @@ void d86f_get_bit(int drive, int side) uint32_t track_word; uint32_t track_bit; uint16_t encoded_data; - uint16_t surface_data; + uint16_t surface_data = 0; uint16_t current_bit; uint16_t surface_bit; @@ -905,7 +938,7 @@ void d86f_put_bit(int drive, int side, int bit) uint32_t track_word; uint32_t track_bit; uint16_t encoded_data; - uint16_t surface_data; + uint16_t surface_data = 0; uint16_t current_bit; uint16_t surface_bit; @@ -1124,7 +1157,6 @@ void d86f_find_address_mark_mfm(int drive, int side, find_t *find, uint16_t req_ { find->sync_marks++; find->sync_pos = d86f[drive].track_pos; - // d86f_log("Sync marks: %i\n", find->sync_marks); return; } @@ -1137,7 +1169,6 @@ void d86f_find_address_mark_mfm(int drive, int side, find_t *find, uint16_t req_ disc_calccrc(decodefm(drive, d86f[drive].last_word[side]), &(d86f[drive].calc_crc)); find->sync_marks = find->bits_obtained = find->bytes_obtained = 0; find->sync_pos = 0xFFFFFFFF; - // d86f_log("AM found (%04X) (%02X)\n", req_am, d86f[drive].state); d86f[drive].preceding_bit[side] = d86f[drive].last_word[side] & 1; d86f[drive].state++; return; @@ -1160,7 +1191,6 @@ void d86f_find_address_mark_mfm(int drive, int side, find_t *find, uint16_t req_ else { /* Not skip mode, process the sector anyway. */ - // d86f_log("Wrong AM found (%04X) (%02X)\n", other_am, d86f[drive].state); fdc_set_wrong_am(); d86f[drive].preceding_bit[side] = d86f[drive].last_word[side] & 1; d86f[drive].state++; @@ -1212,8 +1242,6 @@ void d86f_write_find_address_mark_mfm(int drive, int side, find_t *find) /* State 2: Read sector ID and CRC*/ void d86f_read_sector_id(int drive, int side, int match) { - uint16_t temp; - if (d86f[drive].id_find.bits_obtained) { if (!(d86f[drive].id_find.bits_obtained & 15)) @@ -1264,12 +1292,10 @@ void d86f_read_sector_id(int drive, int side, int match) else { /* CRC is valid. */ - // d86f_log("Sector ID found: %08X; Requested: %08X\n", d86f[drive].last_sector.dword, d86f[drive].req_sector.dword); d86f[drive].id_find.sync_marks = d86f[drive].id_find.bits_obtained = d86f[drive].id_find.bytes_obtained = 0; d86f[drive].id_found++; if ((d86f[drive].last_sector.dword == d86f[drive].req_sector.dword) || !match) { - // d86f_log("ID read (%02X)\n", d86f[drive].state); d86f_handler[drive].set_sector(drive, side, d86f[drive].last_sector.id.c, d86f[drive].last_sector.id.h, d86f[drive].last_sector.id.r, d86f[drive].last_sector.id.n); if (d86f[drive].state == STATE_02_READ_ID) { @@ -1291,12 +1317,10 @@ void d86f_read_sector_id(int drive, int side, int match) { if (d86f[drive].last_sector.id.c == 0xFF) { - // d86f_log("[State: %02X] [Side %i] Bad cylinder (%i != %i?) (%02X) (%08X) (%i)\n", d86f[drive].state, side, fdc_get_bitcell_period(), d86f_get_bitcell_period(drive), d86f_handler[drive].side_flags(drive), d86f[drive].req_sector.dword, d86f_handler[drive].get_raw_size(drive, side)); d86f[drive].error_condition |= 8; } else { - // d86f_log("[State: %02X] [Side %i] Wrong cylinder (%i != %i?) (%02X) (%08X) (%i)\n", d86f[drive].state, side, fdc_get_bitcell_period(), d86f_get_bitcell_period(drive), d86f_handler[drive].side_flags(drive), d86f[drive].req_sector.dword, d86f_handler[drive].get_raw_size(drive, side)); d86f[drive].error_condition |= 0x10; } } @@ -1372,7 +1396,6 @@ void d86f_read_sector_data(int drive, int side) int data = 0; int recv_data = 0; int read_status = 0; - uint16_t temp; uint32_t sector_len = d86f[drive].last_sector.id.n; uint32_t crc_pos = 0; sector_len = 1 << (7 + sector_len); @@ -1402,7 +1425,6 @@ void d86f_read_sector_data(int drive, int side) if (read_status == -1) { d86f[drive].dma_over++; - // d86f_log("DMA over now: %i\n", d86f[drive].dma_over); } } } @@ -1420,7 +1442,6 @@ void d86f_read_sector_data(int drive, int side) /* We've got the data. */ if (d86f[drive].dma_over > 1) { - // d86f_log("DMA overrun while reading data!\n"); d86f[drive].data_find.sync_marks = d86f[drive].data_find.bits_obtained = d86f[drive].data_find.bytes_obtained = 0; d86f[drive].error_condition = 0; d86f[drive].state = STATE_IDLE; @@ -1432,10 +1453,6 @@ void d86f_read_sector_data(int drive, int side) d86f[drive].data_find.bits_obtained++; return; } - else - { - // d86f_log("Bytes over DMA: %i\n", d86f[drive].dma_over); - } if ((d86f[drive].calc_crc.word != d86f[drive].track_crc.word) && (d86f[drive].state != STATE_02_READ_DATA)) { @@ -1448,7 +1465,6 @@ void d86f_read_sector_data(int drive, int side) } else if ((d86f[drive].calc_crc.word != d86f[drive].track_crc.word) && (d86f[drive].state == STATE_02_READ_DATA)) { - // printf("%04X != %04X (%08X)\n", d86f[drive].track_crc.word, d86f[drive].calc_crc.word, d86f[drive].last_sector.dword); d86f[drive].data_find.sync_marks = d86f[drive].data_find.bits_obtained = d86f[drive].data_find.bytes_obtained = 0; d86f[drive].error_condition |= 2; /* Mark that there was a data error. */ d86f[drive].state = STATE_IDLE; @@ -1507,7 +1523,6 @@ void d86f_write_sector_data(int drive, int side, int mfm, uint16_t am) { /* We're in the data field of the sector, use a CRC byte. */ d86f[drive].current_byte[side] = d86f[drive].calc_crc.bytes[(d86f[drive].data_find.bytes_obtained & 1)]; - // d86f_log("BO: %04X (%02X)\n", d86f[drive].data_find.bytes_obtained, d86f[drive].current_byte[side]); } d86f[drive].current_bit[side] = (15 - (d86f[drive].data_find.bits_obtained & 15)) >> 1; @@ -1591,7 +1606,6 @@ void d86f_write_sector_data(int drive, int side, int mfm, uint16_t am) { if (d86f[drive].dma_over > 1) { - // d86f_log("DMA overrun while writing data!\n"); d86f[drive].data_find.sync_marks = d86f[drive].data_find.bits_obtained = d86f[drive].data_find.bytes_obtained = 0; d86f[drive].error_condition = 0; d86f[drive].state = STATE_IDLE; @@ -1628,7 +1642,6 @@ void d86f_advance_bit(int drive, int side) if (d86f[drive].state != STATE_IDLE) { d86f[drive].index_count++; - // d86f_log("Index count now: %i\n", d86f[drive].index_count); } } } @@ -1650,7 +1663,7 @@ void d86f_spin_to_index(int drive, int side) if (d86f[drive].track_pos == d86f_handler[drive].index_hole_pos(drive, side)) { - if (d86f[drive].state == STATE_0D_SPIN_TO_INDEX) + if ((d86f[drive].state == STATE_0D_SPIN_TO_INDEX) || (d86f[drive].state == STATE_0D_NOP_SPIN_TO_INDEX)) { /* When starting format, reset format state to the beginning. */ d86f[drive].preceding_bit[side] = 1; @@ -1664,12 +1677,11 @@ void d86f_spin_to_index(int drive, int side) void d86f_write_direct_common(int drive, int side, uint16_t byte, uint8_t type, uint32_t pos) { - uint16_t encoded_byte, mask_data, mask_surface, mask_hole, mask_fuzzy; + uint16_t encoded_byte = 0, mask_data, mask_surface, mask_hole, mask_fuzzy; decoded_t dbyte, dpbyte; dbyte.byte = byte; dpbyte.byte = d86f[drive].preceding_bit[side]; - d86f[drive].preceding_bit[side] = encoded_byte & 1; if (type == 0) { @@ -1696,6 +1708,8 @@ void d86f_write_direct_common(int drive, int side, uint16_t byte, uint8_t type, } } + d86f[drive].preceding_bit[side] = encoded_byte & 1; + if (d86f_has_surface_desc(drive)) { mask_data = d86f[drive].track_encoded_data[side][pos] ^= 0xFFFF; @@ -1737,21 +1751,23 @@ void d86f_format_finish(int drive, int side, int mfm, uint16_t sc, uint16_t gap_ } d86f[drive].state = STATE_IDLE; - d86f_handler[drive].writeback(drive); - // d86f_log("Format finished (%i) (%i)!\n", d86f[drive].track_pos, sc); + + if (do_write) + { + d86f_handler[drive].writeback(drive); + } + d86f[drive].error_condition = 0; d86f[drive].datac = 0; fdc_sector_finishread(); } -void d86f_format_track(int drive, int side) +void d86f_format_track(int drive, int side, int do_write) { int data; - uint16_t max_len, temp, temp2; + uint16_t max_len; int mfm; - uint16_t i = 0; - uint16_t j = 0; uint16_t sc = 0; uint16_t dtl = 0; int gap_sizes[4] = { 0, 0, 0, 0 }; @@ -1764,7 +1780,6 @@ void d86f_format_track(int drive, int side) uint16_t idam_fm = 0x7EF5; uint16_t dataam_fm = 0x6FF5; uint16_t gap_fill = 0x4E; - int do_write = 0; mfm = d86f_is_mfm(drive); am_len = mfm ? 4 : 1; @@ -1776,7 +1791,6 @@ void d86f_format_track(int drive, int side) sc = fdc_get_format_sectors(); dtl = 128 << fdc_get_format_n(); gap_fill = mfm ? 0x4E : 0xFF; - do_write = (d86f[drive].version == D86FVER); switch(d86f[drive].format_state) { @@ -1789,6 +1803,7 @@ void d86f_format_track(int drive, int side) if (do_write) d86f_write_direct(drive, side, gap_fill, 0); break; case FMT_SECTOR_ID_SYNC: + max_len = sync_len; if (d86f[drive].datac <= 3) { data = fdc_getdata(0); @@ -1801,11 +1816,9 @@ void d86f_format_track(int drive, int side) data = 0; } d86f[drive].format_sector_id.byte_array[d86f[drive].datac] = data & 0xff; - // d86f_log("format_sector_id[%i] = %i\n", d86f[drive].datac, d86f[drive].format_sector_id.byte_array[d86f[drive].datac]); if (d86f[drive].datac == 3) { fdc_stop_id_request(); - // d86f_log("Formatting sector: %08X (%i) (%i)...\n", d86f[drive].format_sector_id.dword, d86f[drive].track_pos, sc); } } case FMT_PRETRK_SYNC: @@ -1890,15 +1903,17 @@ void d86f_format_track(int drive, int side) max_len = gap_sizes[3]; if (do_write) d86f_write_direct(drive, side, gap_fill, 0); break; + default: + max_len = 0; + break; } d86f[drive].datac++; d86f_advance_word(drive, side); - if ((d86f[drive].index_count) && (d86f[drive].format_state < FMT_SECTOR_ID_SYNC) || (d86f[drive].format_state > FMT_SECTOR_GAP3)) + if ((d86f[drive].index_count) && ((d86f[drive].format_state < FMT_SECTOR_ID_SYNC) || (d86f[drive].format_state > FMT_SECTOR_GAP3))) { - // d86f_log("Format finished regularly\n"); d86f_format_finish(drive, side, mfm, sc, gap_fill, do_write); return; } @@ -1920,7 +1935,6 @@ void d86f_format_track(int drive, int side) case FMT_POSTTRK_CHECK: if (d86f[drive].index_count) { - // d86f_log("Format finished with delay\n"); d86f_format_finish(drive, side, mfm, sc, gap_fill, do_write); return; } @@ -1942,6 +1956,16 @@ void d86f_format_track(int drive, int side) } } +void d86f_format_track_normal(int drive, int side) +{ + d86f_format_track(drive, side, (d86f[drive].version == D86FVER)); +} + +void d86f_format_track_nop(int drive, int side) +{ + d86f_format_track(drive, side, 0); +} + void d86f_poll(int drive) { int side = 0; @@ -1980,6 +2004,7 @@ void d86f_poll(int drive) { case STATE_02_SPIN_TO_INDEX: case STATE_0D_SPIN_TO_INDEX: + case STATE_0D_NOP_SPIN_TO_INDEX: d86f_spin_to_index(drive, side); return; case STATE_02_FIND_ID: @@ -2084,7 +2109,13 @@ void d86f_poll(int drive) case STATE_0D_FORMAT_TRACK: if (!(d86f[drive].track_pos & 15)) { - d86f_format_track(drive, side); + d86f_format_track_normal(drive, side); + } + return; + case STATE_0D_NOP_FORMAT_TRACK: + if (!(d86f[drive].track_pos & 15)) + { + d86f_format_track_nop(drive, side); } return; case STATE_IDLE: @@ -2098,7 +2129,6 @@ void d86f_poll(int drive) if (d86f_wrong_densel(drive) && (d86f[drive].state != STATE_IDLE)) { - // d86f_log("[State: %02X] [Side %i] No ID address mark (%i != %i?) (%02X) (%08X) (%i)\n", d86f[drive].state, side, fdc_get_bitcell_period(), d86f_get_bitcell_period(drive), d86f_handler[drive].side_flags(drive), d86f[drive].req_sector.dword, d86f_handler[drive].get_raw_size(drive, side)); d86f[drive].state = STATE_IDLE; fdc_noidam(); return; @@ -2110,7 +2140,6 @@ void d86f_poll(int drive) { case STATE_0A_FIND_ID: case STATE_SECTOR_NOT_FOUND: - // d86f_log("[State: %02X] [Side %i] No ID address mark (%i != %i?) (%02X) (%08X) (%i)\n", d86f[drive].state, side, fdc_get_bitcell_period(), d86f_get_bitcell_period(drive), d86f_handler[drive].side_flags(drive), d86f[drive].req_sector.dword, d86f_handler[drive].get_raw_size(drive, side)); d86f[drive].state = STATE_IDLE; fdc_noidam(); break; @@ -2121,7 +2150,6 @@ void d86f_poll(int drive) case STATE_05_FIND_DATA: case STATE_09_FIND_DATA: case STATE_0C_FIND_DATA: - // d86f_log("[State: %02X] [Side %i] No data address mark (%i != %i?) (%02X) (%08X) (%i)\n", d86f[drive].state, side, fdc_get_bitcell_period(), d86f_get_bitcell_period(drive), d86f_handler[drive].side_flags(drive), d86f[drive].req_sector.dword, d86f_handler[drive].get_raw_size(drive, side)); d86f[drive].state = STATE_IDLE; fdc_nodataam(); break; @@ -2145,24 +2173,20 @@ void d86f_poll(int drive) { if ((d86f[drive].error_condition & 0x18) == 0x08) { - // d86f_log("[State: %02X] [Side %i] Bad cylinder (%i != %i?) (%02X) (%08X) (%i)\n", d86f[drive].state, side, fdc_get_bitcell_period(), d86f_get_bitcell_period(drive), d86f_handler[drive].side_flags(drive), d86f[drive].req_sector.dword, d86f_handler[drive].get_raw_size(drive, side)); fdc_badcylinder(); } if ((d86f[drive].error_condition & 0x10) == 0x10) { - // d86f_log("[State: %02X] [Side %i] Wrong cylinder (%i != %i?) (%02X) (%08X) (%i)\n", d86f[drive].state, side, fdc_get_bitcell_period(), d86f_get_bitcell_period(drive), d86f_handler[drive].side_flags(drive), d86f[drive].req_sector.dword, d86f_handler[drive].get_raw_size(drive, side)); fdc_wrongcylinder(); } } else { - // d86f_log("[State: %02X] [Side %i] Sector not found (%i != %i?) (%02X) (%08X) (%i)\n", d86f[drive].state, side, fdc_get_bitcell_period(), d86f_get_bitcell_period(drive), d86f_handler[drive].side_flags(drive), d86f[drive].req_sector.dword, d86f_handler[drive].get_raw_size(drive, side)); fdc_nosector(); } } else { - // d86f_log("[State: %02X] [Side %i] No ID address mark (%i != %i?) (%02X) (%08X) (%i)\n", d86f[drive].state, side, fdc_get_bitcell_period(), d86f_get_bitcell_period(drive), d86f_handler[drive].side_flags(drive), d86f[drive].req_sector.dword, d86f_handler[drive].get_raw_size(drive, side)); fdc_noidam(); } break; @@ -2245,7 +2269,7 @@ uint16_t d86f_prepare_pretrack(int drive, int side, int iso) d86f_write_direct_common(drive, side, mfm ? iam_mfm : iam_fm, 1, pos); pos = (pos + 1) % raw_size; } - for (i = 0; i < real_gap0_len; i++) + for (i = 0; i < real_gap1_len; i++) { d86f_write_direct_common(drive, side, gap_fill, 0, pos); pos = (pos + 1) % raw_size; @@ -2427,7 +2451,6 @@ void d86f_decompose_encoded_buffer(int drive, int side) uint16_t temp, temp2; uint32_t len; uint16_t *dst = d86f[drive].track_encoded_data[side]; - uint16_t *dst_s = d86f[drive].track_surface_data[side]; uint16_t *src1 = d86f[drive].thin_track_encoded_data[0][side]; uint16_t *src1_s = d86f[drive].thin_track_surface_data[0][side]; uint16_t *src2 = d86f[drive].thin_track_encoded_data[1][side]; @@ -2538,7 +2561,6 @@ void d86f_read_track(int drive, int track, int thin_track, int side, uint16_t *d void d86f_seek(int drive, int track) { - uint8_t track_id = track; int sides; int side, thin_track; sides = d86f_get_sides(drive); @@ -2597,8 +2619,6 @@ void d86f_seek(int drive, int track) void d86f_write_track(int drive, int side, uint16_t *da0, uint16_t *sa0) { - // d86f_log("Pos: %08X\n", ftell(d86f[drive].f)); - fwrite(&(d86f[drive].side_flags[side]), 1, 2, d86f[drive].f); if (d86f_has_extra_bit_cells(drive)) @@ -2614,8 +2634,6 @@ void d86f_write_track(int drive, int side, uint16_t *da0, uint16_t *sa0) } fwrite(da0, 1, d86f_get_array_size(drive, side) << 1, d86f[drive].f); - - // d86f_log("Pos: %08X\n", ftell(d86f[drive].f)); } int d86f_get_track_table_size(int drive) @@ -2632,16 +2650,12 @@ int d86f_get_track_table_size(int drive) void d86f_writeback(int drive) { - uint8_t track_id = d86f[drive].cur_track; uint8_t header[32]; int sides, header_size; int side, thin_track; - // uint64_t crc64; uint32_t len; - int i = 0; int ret = 0; int logical_track = 0; - uint8_t tempb; FILE *cf; sides = d86f_get_sides(drive); header_size = d86f_header_size(drive); @@ -2656,9 +2670,7 @@ void d86f_writeback(int drive) fread(header, 1, header_size, d86f[drive].f); fseek(d86f[drive].f, 8, SEEK_SET); - // d86f_log("PosEx: %08X\n", ftell(d86f[drive].f)); fwrite(d86f[drive].track_offset, 1, d86f_get_track_table_size(drive), d86f[drive].f); - // d86f_log("PosEx: %08X\n", ftell(d86f[drive].f)); if (!fdd_doublestep_40(drive)) { @@ -2698,15 +2710,12 @@ void d86f_writeback(int drive) } if (d86f[drive].track_offset[logical_track]) { - // d86f_log("Writing track...\n"); fseek(d86f[drive].f, d86f[drive].track_offset[logical_track], SEEK_SET); d86f_write_track(drive, side, d86f[drive].track_encoded_data[side], d86f[drive].track_surface_data[side]); } } } - // d86f_log("Position: %08X\n", ftell(d86f[drive].f)); - if (d86f[drive].is_compressed) { /* The image is compressed. */ @@ -2729,7 +2738,6 @@ void d86f_writeback(int drive) fread(d86f[drive].filebuf, 1, len, d86f[drive].f); ret = lzf_compress(d86f[drive].filebuf, len, d86f[drive].outbuf, len - 1); - // ret = d86f_zlib(cf, d86f[drive].f, 0); if (!ret) { d86f_log("86F: Error compressing file\n"); @@ -2738,58 +2746,7 @@ void d86f_writeback(int drive) fwrite(d86f[drive].outbuf, 1, ret, cf); free(d86f[drive].outbuf); free(d86f[drive].filebuf); - -#ifdef DO_CRC64 - len = ftell(cf); - - fclose(cf); - cf = fopen(d86f[drive].original_file_name, "rb+"); - - crc64 = 0xffffffffffffffff; - fseek(cf, 8, SEEK_SET); - fwrite(&crc64, 1, 8, cf); - - fseek(cf, 0, SEEK_SET); - d86f[drive].filebuf = (uint8_t *) malloc(len); - fread(d86f[drive].filebuf, 1, len, cf); - *(uint64_t *) &(d86f[drive].filebuf[8]) = 0xffffffffffffffff; - - crc64 = (uint64_t) crc64speed(0, d86f[drive].filebuf, len); - free(d86f[drive].filebuf); - - fseek(cf, 8, SEEK_SET); - fwrite(&crc64, 1, 8, cf); - - /* Close the original file. */ - fclose(cf); -#endif } -#ifdef DO_CRC64 - else - { - fseek(d86f[drive].f, 0, SEEK_END); - len = ftell(d86f[drive].f); - - fseek(d86f[drive].f, 0, SEEK_SET); - - crc64 = 0xffffffffffffffff; - fseek(d86f[drive].f, 8, SEEK_SET); - fwrite(&crc64, 1, 8, d86f[drive].f); - - fseek(d86f[drive].f, 0, SEEK_SET); - d86f[drive].filebuf = (uint8_t *) malloc(len); - fread(d86f[drive].filebuf, 1, len, d86f[drive].f); - *(uint64_t *) &(d86f[drive].filebuf[8]) = 0xffffffffffffffff; - - crc64 = (uint64_t) crc64speed(0, d86f[drive].filebuf, len); - free(d86f[drive].filebuf); - - fseek(d86f[drive].f, 8, SEEK_SET); - fwrite(&crc64, 1, 8, d86f[drive].f); - } -#endif - - // d86f_log("d86f_writeback(): %08X\n", d86f[drive].track_offset[track]); } void d86f_stop(int drive) @@ -2819,7 +2776,6 @@ int d86f_common_command(int drive, int sector, int track, int side, int rate, in if (fdd_get_head(drive) && (d86f_get_sides(drive) == 1)) { - // d86f_log("Wrong side!\n"); fdc_noidam(); d86f[drive].state = STATE_IDLE; d86f[drive].index_count = 0; @@ -2880,11 +2836,8 @@ void d86f_comparesector(int drive, int sector, int track, int side, int rate, in void d86f_readaddress(int drive, int side, int rate) { - // d86f_log("Reading sector ID on drive %i...\n", drive); - if (fdd_get_head(drive) && (d86f_get_sides(drive) == 1)) { - // d86f_log("Trying to access the second side of a single-sided disk\n"); fdc_noidam(); d86f[drive].state = STATE_IDLE; d86f[drive].index_count = 0; @@ -2952,7 +2905,7 @@ void d86f_common_format(int drive, int side, int rate, uint8_t fill, int proxy) return; } - if ((side && (d86f_get_sides(drive) == 1)) || !(d86f_can_format(drive))) + if (!(d86f_can_format(drive))) { fdc_cannotformat(); d86f[drive].state = STATE_IDLE; @@ -2960,49 +2913,48 @@ void d86f_common_format(int drive, int side, int rate, uint8_t fill, int proxy) return; } - if (!proxy) + if (!side || (d86f_get_sides(drive) == 2)) { - d86f_reset_index_hole_pos(drive, side); - - if (d86f[drive].cur_track > 256) + if (!proxy) { - // d86f_log("Track above 256\n"); - fdc_writeprotect(); - d86f[drive].state = STATE_IDLE; - d86f[drive].index_count = 0; - return; - } + d86f_reset_index_hole_pos(drive, side); - array_size = d86f_get_array_size(drive, side); - - if (d86f_has_surface_desc(drive)) - { - /* Preserve the physical holes but get rid of the fuzzy bytes. */ - for (i = 0; i < array_size; i++) + if (d86f[drive].cur_track > 256) { - temp = d86f[drive].track_encoded_data[side][i] ^ 0xffff; - temp2 = d86f[drive].track_surface_data[side][i]; - temp &= temp2; - d86f[drive].track_surface_data[side][i] = temp; + fdc_writeprotect(); + d86f[drive].state = STATE_IDLE; + d86f[drive].index_count = 0; + return; + } + + array_size = d86f_get_array_size(drive, side); + + if (d86f_has_surface_desc(drive)) + { + /* Preserve the physical holes but get rid of the fuzzy bytes. */ + for (i = 0; i < array_size; i++) + { + temp = d86f[drive].track_encoded_data[side][i] ^ 0xffff; + temp2 = d86f[drive].track_surface_data[side][i]; + temp &= temp2; + d86f[drive].track_surface_data[side][i] = temp; + } + } + /* Zero the data buffer. */ + memset(d86f[drive].track_encoded_data[side], 0, array_size << 1); + + d86f_add_track(drive, d86f[drive].cur_track, side); + if (!fdd_doublestep_40(drive)) + { + d86f_add_track(drive, d86f[drive].cur_track + 1, side); } } - /* Zero the data buffer. */ - memset(d86f[drive].track_encoded_data[side], 0, array_size << 1); - - d86f_add_track(drive, d86f[drive].cur_track, side); - if (!fdd_doublestep_40(drive)) - { - d86f_add_track(drive, d86f[drive].cur_track + 1, side); - } } - // d86f_log("Formatting track %i side %i\n", track, side); - d86f[drive].fill = fill; if (!proxy) { - // d86f[drive].side_flags[side] &= 0xc0; d86f[drive].side_flags[side] = 0; d86f[drive].side_flags[side] |= (fdd_getrpm(real_drive(drive)) == 360) ? 0x20 : 0; d86f[drive].side_flags[side] |= fdc_get_bit_rate(); @@ -3016,7 +2968,14 @@ void d86f_common_format(int drive, int side, int rate, uint8_t fill, int proxy) d86f[drive].index_count = d86f[drive].error_condition = d86f[drive].satisfying_bytes = d86f[drive].sector_count = 0; d86f[drive].dma_over = 0; - d86f[drive].state = STATE_0D_SPIN_TO_INDEX; + if (!side || (d86f_get_sides(drive) == 2)) + { + d86f[drive].state = STATE_0D_SPIN_TO_INDEX; + } + else + { + d86f[drive].state = STATE_0D_NOP_SPIN_TO_INDEX; + } } void d86f_proxy_format(int drive, int side, int rate, uint8_t fill) @@ -3046,12 +3005,8 @@ void d86f_load(int drive, char *fn) { uint32_t magic = 0; uint32_t len = 0; - uint32_t len2 = 0; - uint8_t temp_file_name[2048]; + char temp_file_name[2048]; uint16_t temp = 0; - uint8_t tempb = 0; - // uint64_t crc64 = 0; - // uint64_t read_crc64 = 0; int i = 0; FILE *tf; @@ -3173,8 +3128,6 @@ void d86f_load(int drive, char *fn) fread(&temp, 1, 2, tf); fwrite(&temp, 1, 2, d86f[drive].f); } - - // temp = d86f_zlib(d86f[drive].f, tf, 1); d86f[drive].filebuf = (uint8_t *) malloc(len); d86f[drive].outbuf = (uint8_t *) malloc(67108864); @@ -3328,19 +3281,15 @@ void d86f_load(int drive, char *fn) void d86f_init() { - disc_random_init(); - memset(d86f, 0, sizeof(d86f)); d86f_setupcrc(0x1021); - // crc64speed_init(); - d86f[0].state = d86f[1].state = STATE_IDLE; } void d86f_close(int drive) { - uint8_t temp_file_name[2048]; + char temp_file_name[2048]; append_filename(temp_file_name, pcempath, drive ? "TEMP$$$1.$$$" : "TEMP$$$0.$$$", 511); memcpy(temp_file_name, drive ? "TEMP$$$1.$$$" : "TEMP$$$0.$$$", 13); diff --git a/src/disc_fdi.c b/src/disc_fdi.c index a016d4462..091524b20 100644 --- a/src/disc_fdi.c +++ b/src/disc_fdi.c @@ -172,7 +172,6 @@ void fdi_read_revolution(int drive) memset(fdi[drive].track_data[1][density], 0, 106096); fdi[drive].tracklen[0][density] = fdi[drive].tracklen[1][density] = 100000; } - // pclog("Track is bigger than last track\n"); return; } @@ -185,16 +184,15 @@ void fdi_read_revolution(int drive) (track * fdi[drive].sides) + side, &fdi[drive].tracklen[side][density], &fdi[drive].trackindex[side][density], NULL, density); - // pclog("Side 0 [%i]: len %i, index %i\n", density, fdi[drive].tracklen[side][density], fdi[drive].trackindex[side][density]); if (!c) memset(fdi[drive].track_data[side][density], 0, fdi[drive].tracklen[side][density]); } - } - if (fdi[drive].sides == 1) - { - memset(fdi[drive].track_data[1][density], 0, 106096); - fdi[drive].tracklen[1][density] = 100000; + if (fdi[drive].sides == 1) + { + memset(fdi[drive].track_data[1][density], 0, 106096); + fdi[drive].tracklen[1][density] = 100000; + } } } @@ -264,10 +262,8 @@ void fdi_load(int drive, char *fn) } fdi[drive].h = fdi2raw_header(fdi[drive].f); -// if (!fdih[drive]) printf("Failed to load!\n"); fdi[drive].lasttrack = fdi2raw_get_last_track(fdi[drive].h); fdi[drive].sides = fdi2raw_get_last_head(fdi[drive].h) + 1; -// printf("Last track %i\n",fdilasttrack[drive]); d86f_register_fdi(drive); @@ -297,11 +293,9 @@ void fdi_seek(int drive, int track) track /= 2; } } - // pclog("fdi_seek(): %i %i (%i)\n", fdi[drive].lasttrack, track); if (!fdi[drive].f) return; -// printf("Track start %i\n",track); if (track < 0) track = 0; if (track > fdi[drive].lasttrack) @@ -314,5 +308,5 @@ void fdi_seek(int drive, int track) void fdi_init() { -// printf("FDI reset\n"); + return; } diff --git a/src/disc_imd.c b/src/disc_imd.c index f5db814f6..c69a0b674 100644 --- a/src/disc_imd.c +++ b/src/disc_imd.c @@ -28,7 +28,7 @@ typedef struct static struct { FILE *f; - uint8_t *buffer; + char *buffer; uint32_t start_offs; int track_count, sides; int track; @@ -38,7 +38,7 @@ static struct uint16_t current_side_flags[2]; uint8_t xdf_ordered_pos[256][2]; uint8_t interleave_ordered_pos[256][2]; - uint8_t *current_data[2]; + char *current_data[2]; uint8_t track_buffer[2][25000]; } imd[FDD_NUM]; @@ -53,18 +53,14 @@ void imd_load(int drive, char *fn) { uint32_t magic = 0; uint32_t fsize = 0; - uint8_t *buffer; - uint8_t *buffer2; + char *buffer; + char *buffer2; int i = 0; - int has_cyl_map = 0; - int has_head_map = 0; - int has_size_map = 0; int track_spt = 0; int sector_size = 0; int track = 0; int side = 0; int extra = 0; - int fm = 0; uint32_t last_offset = 0; uint32_t data_size = 512; uint32_t mfm = 0; @@ -72,7 +68,6 @@ void imd_load(int drive, char *fn) uint32_t track_total = 0; uint32_t raw_tsize = 0; uint32_t minimum_gap3 = 0; - // uint32_t minimum_gap4 = 12; uint32_t minimum_gap4 = 0; d86f_unregister(drive); @@ -149,7 +144,6 @@ void imd_load(int drive, char *fn) if (side & 1) imd[drive].sides = 2; extra = side & 0xC0; side &= 0x3F; - // pclog("IMD: Loading track %i, side %i\n", track, side); imd[drive].tracks[track][side].side_flags = (buffer2[0] % 3); if (!imd[drive].tracks[track][side].side_flags) imd[drive].disk_flags |= (0x02); @@ -295,10 +289,10 @@ int imd_track_is_xdf(int drive, int side, int track) int i, effective_sectors, xdf_sectors; int high_sectors, low_sectors; int max_high_id, expected_high_count, expected_low_count; - uint8_t *r_map; - uint8_t *n_map; - uint8_t *data_base; - uint8_t *cur_data; + char *r_map; + char *n_map; + char *data_base; + char *cur_data; effective_sectors = xdf_sectors = high_sectors = low_sectors = 0; @@ -341,12 +335,12 @@ int imd_track_is_xdf(int drive, int side, int track) if ((r_map[i] >= 0x81) && (r_map[i] <= max_high_id)) { high_sectors++; - imd[drive].xdf_ordered_pos[r_map[i]][side] = i; + imd[drive].xdf_ordered_pos[(int) r_map[i]][side] = i; } if ((r_map[i] >= 0x01) && (r_map[i] <= 0x08)) { low_sectors++; - imd[drive].xdf_ordered_pos[r_map[i]][side] = i; + imd[drive].xdf_ordered_pos[(int) r_map[i]][side] = i; } if ((high_sectors == expected_high_count) && (low_sectors == expected_low_count)) { @@ -376,7 +370,7 @@ int imd_track_is_xdf(int drive, int side, int track) if ((r_map[i] == (n_map[i] | 0x80))) { xdf_sectors++; - imd[drive].xdf_ordered_pos[r_map[i]][side] = i; + imd[drive].xdf_ordered_pos[(int) r_map[i]][side] = i; } cur_data += (128 << ((uint32_t) n_map[i])); } @@ -392,12 +386,14 @@ int imd_track_is_xdf(int drive, int side, int track) } return 0; } + + return 0; } int imd_track_is_interleave(int drive, int side, int track) { int i, effective_sectors; - uint8_t *r_map; + char *r_map; int track_spt; effective_sectors = 0; @@ -429,7 +425,7 @@ int imd_track_is_interleave(int drive, int side, int track) if ((r_map[i] >= 1) && (r_map[i] <= track_spt)) { effective_sectors++; - imd[drive].interleave_ordered_pos[r_map[i]][side] = i; + imd[drive].interleave_ordered_pos[(int) r_map[i]][side] = i; } } @@ -492,18 +488,16 @@ void imd_seek(int drive, int track) int real_sector = 0; int actual_sector = 0; - uint8_t *c_map; - uint8_t *h_map; - uint8_t *r_map; - uint8_t *n_map; + char *c_map; + char *h_map; + char *r_map; + char *n_map; uint8_t *data; uint32_t track_buf_pos[2] = { 0, 0 }; if (!imd[drive].f) return; - // pclog("IMD: Seeking...\n"); - if (!imd[drive].track_width && fdd_doublestep_40(drive)) track /= 2; @@ -514,8 +508,6 @@ void imd_seek(int drive, int track) imd[drive].current_side_flags[0] = imd[drive].tracks[track][0].side_flags; imd[drive].current_side_flags[1] = imd[drive].tracks[track][1].side_flags; - // pclog("IMD Seek: %02X %02X (%02X)\n", imd[drive].current_side_flags[0], imd[drive].current_side_flags[1], imd[drive].disk_flags); - d86f_reset_index_hole_pos(drive, 0); d86f_reset_index_hole_pos(drive, 1); @@ -543,7 +535,7 @@ void imd_seek(int drive, int track) if (n == 0xFF) { n_map = imd[drive].buffer + imd[drive].tracks[track][side].n_map_offs; - track_gap3 = gap3_sizes[track_rate][n_map[0]][imd[drive].tracks[track][side].params[3]]; + track_gap3 = gap3_sizes[track_rate][(int) n_map[0]][imd[drive].tracks[track][side].params[3]]; } else { @@ -586,7 +578,6 @@ void imd_seek(int drive, int track) if ((type == 2) || (type == 4)) deleted = 1; if ((type == 3) || (type == 4)) bad_crc = 1; - // pclog("IMD: (%i %i) %i %i %i %i (%i %i) (GPL=%i)\n", track, side, id[0], id[1], id[2], id[3], deleted, bad_crc, track_gap3); imd_sector_to_buffer(drive, track, side, data, actual_sector, ssize); current_pos = d86f_prepare_sector(drive, side, current_pos, id, data, ssize, 22, track_gap3, deleted, bad_crc); track_buf_pos[side] += ssize; @@ -627,8 +618,6 @@ void imd_seek(int drive, int track) } } } - - // pclog("Seeked to track: %i (%02X, %02X)\n", imd[drive].track, imd[drive].current_side_flags[0], imd[drive].current_side_flags[1]); } uint16_t imd_disk_flags(int drive) @@ -652,7 +641,7 @@ void imd_set_sector(int drive, int side, uint8_t c, uint8_t h, uint8_t r, uint8_ int sc = 0; int sh = 0; int sn = 0; - uint8_t *c_map, *h_map, *r_map, *n_map; + char *c_map, *h_map, *r_map, *n_map; uint8_t id[4] = { 0, 0, 0, 0 }; sc = imd[drive].tracks[track][side].params[1]; sh = imd[drive].tracks[track][side].params[2]; @@ -673,10 +662,10 @@ void imd_set_sector(int drive, int side, uint8_t c, uint8_t h, uint8_t r, uint8_ if (c != imd[drive].track) return; for (i = 0; i < imd[drive].tracks[track][side].params[3]; i++) { - id[0] = (h & 0x80) ? c_map[i] : sc; - id[1] = (h & 0x40) ? h_map[i] : (sh & 1); + id[0] = (sh & 0x80) ? c_map[i] : sc; + id[1] = (sh & 0x40) ? h_map[i] : (sh & 1); id[2] = r_map[i]; - id[3] = (n == 0xFF) ? n_map[i] : sn; + id[3] = (sn == 0xFF) ? n_map[i] : sn; if ((id[0] == c) && (id[1] == h) && (id[2] == r) && @@ -693,18 +682,18 @@ void imd_writeback(int drive) int side; int track = imd[drive].track; + int i = 0; + + char *n_map; + + uint8_t h, n, spt; + uint32_t ssize; + if (writeprot[drive]) { return; } - int i = 0; - - uint8_t *n_map; - - uint8_t h, n, spt; - uint32_t ssize; - for (side = 0; side < imd[drive].sides; side++) { if (imd[drive].tracks[track][side].is_present) diff --git a/src/disc_img.c b/src/disc_img.c index 7f8417196..a9e60c880 100644 --- a/src/disc_img.c +++ b/src/disc_img.c @@ -37,7 +37,6 @@ static struct } img[FDD_NUM]; uint8_t dmf_r[21] = { 12, 2, 13, 3, 14, 4, 15, 5, 16, 6, 17, 7, 18, 8, 19, 9, 20, 10, 21, 11, 1 }; -static uint8_t xdf_spt[2] = { 6, 8 }; static uint8_t xdf_logical_sectors[2][2] = { { 38, 6 }, { 46, 8 } }; uint8_t xdf_physical_sectors[2][2] = { { 16, 3 }, { 19, 4 } }; uint8_t xdf_gap3_sizes[2][2] = { { 60, 69 }, { 60, 50 } }; @@ -115,53 +114,126 @@ static uint8_t rates[6] = { 2, 2, 1, 4, 0, 3 }; static uint8_t holes[6] = { 0, 0, 0, 1, 1, 2 }; -int gap3_sizes[5][8][256] = { [0][1][16] = 0x54, - [0][2][18] = 0x6C, - [0][2][19] = 0x48, - [0][2][20] = 0x2A, - [0][2][21] = 0x08, /* Microsoft DMFWRITE.EXE uses this, 0x0C is used by FDFORMAT. */ - [0][2][22] = 0x02, - [0][2][23] = 0x01, - [0][3][10] = 0x83, - [0][3][11] = 0x26, - [1][2][11] = 0x54, - [1][2][12] = 0x1C, - [1][2][13] = 0x0E, - [1][3][6] = 0x79, - [1][3][7] = 0x06, - [2][1][10] = 0x32, - [2][1][11] = 0x0C, - [2][1][15] = 0x36, - [2][1][16] = 0x32, - [2][2][8] = 0x58, - [2][2][9] = 0x50, - [2][2][10] = 0x2E, - [2][2][21] = 0x1C, - [2][2][22] = 0x1C, - [2][3][4] = 0xF0, - [2][3][5] = 0x74, - [3][2][36] = 0x53, - [3][2][37] = 0x4E, - [3][2][38] = 0x3D, - [3][2][39] = 0x2C, - [3][2][40] = 0x1C, - [3][2][41] = 0x0D, - [3][2][42] = 0x02, - [3][2][46] = 0x01, - [3][3][18] = 0xF7, - [3][3][19] = 0xAF, - [3][3][20] = 0x6F, - [3][3][21] = 0x55, - [3][3][22] = 0x1F, - [4][1][32] = 0x36, - [4][2][14] = 0x92, - [4][2][15] = 0x54, - [4][2][16] = 0x38, - [4][2][17] = 0x23, - [4][2][19] = 0x01, - [4][3][8] = 0x74, - [4][3][9] = 0x24 -}; +int gap3_sizes[5][8][48] = { { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [0][0] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [0][1] */ + 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [0][2] */ + 0x00, 0x00, 0x6C, 0x48, 0x2A, 0x08, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x26, 0x00, 0x00, 0x00, 0x00, /* [0][3] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [0][4] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [0][5] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [0][6] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [0][7] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [1][0] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [1][1] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x1C, 0x0E, 0x00, 0x00, /* [1][2] */ + 0x00, 0x00, 0x6C, 0x48, 0x2A, 0x08, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [1][3] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [1][4] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [1][5] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [1][6] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [1][7] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [2][0] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x0C, 0x00, 0x00, 0x00, 0x36, /* [2][1] */ + 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x50, 0x2E, 0x00, 0x00, 0x00, 0x00, 0x00, /* [2][2] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0xF0, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [2][3] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [2][4] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [2][5] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [2][6] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [2][7] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [3][0] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [3][1] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [3][2] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x53, 0x4E, 0x3D, 0x2C, 0x1C, 0x0D, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [3][3] */ + 0x00, 0x00, 0xF7, 0xAF, 0x6F, 0x55, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [3][4] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [3][5] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [3][6] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [3][7] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [4][0] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [4][1] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x92, 0x54, /* [4][2] */ + 0x38, 0x23, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [4][3] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [4][4] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [4][5] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [4][6] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* [4][7] */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }; void img_writeback(int drive); @@ -189,15 +261,9 @@ static int sector_size_code(int sector_size) } } -static int img_sector_size_code(int drive) -{ - return sector_size_code(img[drive].sector_size); -} - void img_init() { memset(img, 0, sizeof(img)); -// adl[0] = adl[1] = 0; } void d86f_register_img(int drive); @@ -245,8 +311,6 @@ void img_load(int drive, char *fn) uint8_t bpb_mid; /* Media type ID. */ uint8_t bpb_sectors; uint8_t bpb_sides; - uint32_t bpt; - uint8_t max_spt; /* Used for XDF detection. */ int temp_rate; uint8_t fdi, cqm, fdf; int i; @@ -635,6 +699,8 @@ jump_if_fdf: if (size <= (160*1024)) { img[drive].sectors = 8; img[drive].tracks = 40; img[drive].sides = 1; } else if (size <= (180*1024)) { img[drive].sectors = 9; img[drive].tracks = 40; img[drive].sides = 1; } + else if (size <= (315*1024)) { img[drive].sectors = 9; img[drive].tracks = 70; img[drive].sides = 1; } + else if (size <= (320*1024)) { img[drive].sectors = 8; img[drive].tracks = 40; } else if (size <= (320*1024)) { img[drive].sectors = 8; img[drive].tracks = 40; } else if (size <= (360*1024)) { img[drive].sectors = 9; img[drive].tracks = 40; } /*Double density*/ else if (size <= (400*1024)) { img[drive].sectors = 10; img[drive].tracks = 80; img[drive].sides = 1; } /*DEC RX50*/ @@ -653,7 +719,6 @@ jump_if_fdf: else if (size <= 1720320) { img[drive].sectors = 21; img[drive].tracks = 80; } /*DMF format - used by Windows 95 */ else if (size <= 1741824) { img[drive].sectors = 21; img[drive].tracks = 81; } else if (size <= 1763328) { img[drive].sectors = 21; img[drive].tracks = 82; } - // else if (size <= 1802240) { img[drive].sectors = 11; img[drive].tracks = 80; img[drive].sector_size = 3; } /*High density (not supported by Tandy 1000)*/ else if (size <= 1802240) { img[drive].sectors = 22; img[drive].tracks = 80; img[drive].sector_size = 3; } /*High density (not supported by Tandy 1000)*/ else if (size == 1884160) { img[drive].sectors = 23; img[drive].tracks = 80; } /*XDF format - used by OS/2 Warp*/ else if (size <= 2949120) { img[drive].sectors = 36; img[drive].tracks = 80; } /*E density*/ @@ -839,9 +904,7 @@ void img_seek(int drive, int track) if (img[drive].disk_at_once) { cur_pos = (track * img[drive].sectors * ssize * img[drive].sides) + (side * img[drive].sectors * ssize); - // pclog("Current position: %i... ", cur_pos); memcpy(img[drive].track_data[side], img[drive].disk_data + cur_pos, img[drive].sectors * ssize); - // pclog("done!\n"); } else { @@ -864,7 +927,6 @@ void img_seek(int drive, int track) for (sector = 0; sector < img[drive].sectors; sector++) { - // sr = img[drive].dmf ? (dmf_r[sector]) : (sector + 1); if (img[drive].is_cqm) { if (img[drive].interleave) @@ -898,7 +960,6 @@ void img_seek(int drive, int track) id[3] = img[drive].sector_size; img[drive].sector_pos_side[side][sr] = side; img[drive].sector_pos[side][sr] = (sr - 1) * ssize; - // pclog("Seek: %i %i %i %i | %i %04X\n", id[0], id[1], id[2], id[3], side, (sr - 1) * ssize); current_pos = d86f_prepare_sector(drive, side, current_pos, id, &img[drive].track_data[side][(sr - 1) * ssize], ssize, img[drive].gap2_size, img[drive].gap3_size, 0, 0); } } @@ -922,7 +983,6 @@ void img_seek(int drive, int track) { img[drive].sector_pos_side[xdf_img_sector.id.h][xdf_img_sector.id.r] = sside; img[drive].sector_pos[xdf_img_sector.id.h][xdf_img_sector.id.r] = img_pos; - // pclog("Side: %i, Position: %04X\n", sside, img_pos); } if (!is_t0) @@ -941,13 +1001,10 @@ void img_seek(int drive, int track) for (sector = 0; sector < xdf_physical_sectors[current_xdft][!is_t0]; sector++) { array_sector = (side * xdf_physical_sectors[current_xdft][!is_t0]) + sector; - // pclog("Sector %i, array sector %i\n", sector, array_sector); buf_side = img[drive].sector_pos_side[xdf_disk_sector.id.h][xdf_disk_sector.id.r]; buf_pos = img[drive].sector_pos[xdf_disk_sector.id.h][xdf_disk_sector.id.r]; - // pclog("Side: %i, Position: %04X\n", buf_side, buf_pos); - id[0] = track; id[1] = xdf_disk_sector.id.h; id[2] = xdf_disk_sector.id.r; @@ -955,21 +1012,17 @@ void img_seek(int drive, int track) if (is_t0) { id[3] = 2; - // pclog("XDF Track 0: Registering sector: %i %i %i %i\n", id[0], id[1], id[2], id[3]); current_pos = d86f_prepare_sector(drive, side, current_pos, id, &img[drive].track_data[buf_side][buf_pos], ssize, img[drive].gap2_size, xdf_gap3_sizes[current_xdft][!is_t0], 0, 0); } else { id[3] = id[2] & 7; - // pclog("XDF Track X: Registering sector: %i %i %i %i\n", id[0], id[1], id[2], id[3]); ssize = (128 << id[3]); current_pos = d86f_prepare_sector(drive, side, xdf_trackx_spos[current_xdft][array_sector], id, &img[drive].track_data[buf_side][buf_pos], ssize, img[drive].gap2_size, xdf_gap3_sizes[current_xdft][!is_t0], 0, 0); } } } } - - // pclog("Seeked to track: %i\n", img[drive].track); } void img_writeback(int drive) diff --git a/src/disc_random.c b/src/disc_random.c index da4b09673..1712193e4 100644 --- a/src/disc_random.c +++ b/src/disc_random.c @@ -5,7 +5,7 @@ #include -#include +#include #include #include #include @@ -33,7 +33,15 @@ static __inline__ uint32_t rotr32c (uint32_t x, uint32_t n) static __inline__ unsigned long long rdtsc(void) { unsigned hi, lo; - __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi)); +#ifdef __MSC__ + __asm { + rdtsc + mov hi, edx ; EDX:EAX is already standard return!! + mov lo, eax + } +#else + __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi)); +#endif return ( (unsigned long long)lo)|( ((unsigned long long)hi)<<32 ); } diff --git a/src/disc_td0.c b/src/disc_td0.c index 9e21a9b11..5905527b9 100644 --- a/src/disc_td0.c +++ b/src/disc_td0.c @@ -1,5 +1,5 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic,Kiririn (translation to C and port to 86Box) +/* license:BSD-3-Clause + copyright-holders:Miodrag Milanovic,Kiririn (translation to C and port to 86Box) */ /********************************************************************* formats/td0_dsk.c @@ -22,7 +22,7 @@ #include -#define BUFSZ 512 // new input buffer +#define BUFSZ 512 /* new input buffer */ /* LZSS Parameters */ @@ -44,10 +44,10 @@ typedef struct { uint16_t r, - bufcnt,bufndx,bufpos, // string buffer - // the following to allow block reads from input in next_word() - ibufcnt,ibufndx; // input buffer counters - uint8_t inbuf[BUFSZ]; // input buffer + bufcnt,bufndx,bufpos, /* string buffer */ + /* the following to allow block reads from input in next_word() */ + ibufcnt,ibufndx; /* input buffer counters */ + uint8_t inbuf[BUFSZ]; /* input buffer */ } tdlzhuf; typedef struct @@ -72,8 +72,6 @@ typedef struct uint8_t getlen; } td0dsk_t; -//static td0dsk_t td0dsk; - typedef struct { uint8_t track; @@ -118,7 +116,7 @@ void floppy_image_read(int drive, char *buffer, uint32_t offset, uint32_t len) int td0_dsk_identify(int drive) { - uint8_t header[2]; + char header[2]; floppy_image_read(drive, header, 0, 2); if (header[0]=='T' && header[1]=='D') { @@ -230,7 +228,7 @@ int td0_state_next_word(td0dsk_t *state) if(state->tdctl.ibufcnt == 0) return(-1); } - while (state->getlen <= 8) { // typically reads a word at a time + while (state->getlen <= 8) { /* typically reads a word at a time */ state->getbuf |= state->tdctl.inbuf[state->tdctl.ibufndx++] << (8 - state->getlen); state->getlen += 8; } @@ -427,7 +425,7 @@ void td0_state_init_Decode(td0dsk_t *state) int i; state->getbuf = 0; state->getlen = 0; - state->tdctl.ibufcnt= state->tdctl.ibufndx = 0; // input buffer is empty + state->tdctl.ibufcnt= state->tdctl.ibufndx = 0; /* input buffer is empty */ state->tdctl.bufcnt = 0; td0_state_StartHuff(state); for (i = 0; i < N - F; i++) @@ -439,11 +437,11 @@ void td0_state_init_Decode(td0dsk_t *state) int td0_state_Decode(td0dsk_t *state, uint8_t *buf, int len) /* Decoding/Uncompressing */ { int16_t c,pos; - int count; // was an unsigned long, seems unnecessary + int count; /* was an unsigned long, seems unnecessary */ for (count = 0; count < len; ) { if(state->tdctl.bufcnt == 0) { if((c = td0_state_DecodeChar(state)) < 0) - return(count); // fatal error + return(count); /* fatal error */ if (c < 256) { *(buf++) = c; state->text_buf[state->tdctl.r++] = c; @@ -452,13 +450,13 @@ int td0_state_Decode(td0dsk_t *state, uint8_t *buf, int len) /* Decoding/Uncomp } else { if((pos = td0_state_DecodePosition(state)) < 0) - return(count); // fatal error + return(count); /* fatal error */ state->tdctl.bufpos = (state->tdctl.r - pos - 1) & (N - 1); state->tdctl.bufcnt = c - 255 + THRESHOLD; state->tdctl.bufndx = 0; } } - else { // still chars from last string + else { /* still chars from last string */ while( state->tdctl.bufndx < state->tdctl.bufcnt && count < len ) { c = state->text_buf[(state->tdctl.bufpos + state->tdctl.bufndx) & (N - 1)]; *(buf++) = c; @@ -467,12 +465,12 @@ int td0_state_Decode(td0dsk_t *state, uint8_t *buf, int len) /* Decoding/Uncomp state->tdctl.r &= (N - 1); count++; } - // reset bufcnt after copy string from text_buf[] + /* reset bufcnt after copy string from text_buf[] */ if(state->tdctl.bufndx >= state->tdctl.bufcnt) state->tdctl.bufndx = state->tdctl.bufcnt = 0; } } - return(count); // count == len, success + return(count); /* count == len, success */ } @@ -495,8 +493,7 @@ void td0_init() void d86f_register_td0(int drive); -// static const int rates[3] = { 2, 1, 0, 2, 3 }; /* 0 = 250 kbps, 1 = 300 kbps, 2 = 500 kbps, 3 = unknown, 4 = 1000 kbps */ -const int max_size = 4*1024*1024; // 4MB ought to be large enough for any floppy +const int max_size = 4*1024*1024; /* 4MB ought to be large enough for any floppy */ const int max_processed_size = 5*1024*1024; uint8_t imagebuf[4*1024*1024]; uint8_t processed_buf[5*1024*1024]; @@ -632,12 +629,10 @@ int td0_initialize(int drive) int head_count = 0; int track_spt; int offset = 0; - int ret = 0; - int gap3_len = 0; - // int rate = 0; int density = 0; int i = 0; int j = 0; + int k = 0; int temp_rate = 0; uint32_t file_size; uint16_t len; @@ -651,7 +646,6 @@ int td0_initialize(int drive) uint32_t track_size = 0; uint32_t raw_tsize = 0; uint32_t minimum_gap3 = 0; - // uint32_t minimum_gap4 = 12; uint32_t minimum_gap4 = 0; if (!td0[drive].f) @@ -698,7 +692,7 @@ int td0_initialize(int drive) offset = 10 + imagebuf[2] + (imagebuf[3] << 8); track_spt = imagebuf[offset]; - if(track_spt == 255) // Empty file? + if(track_spt == 255) /* Empty file? */ { pclog("TD0: File has no tracks\n"); return 0; @@ -738,9 +732,6 @@ int td0_initialize(int drive) td0[drive].track_width = (header[7] & 1) ^ 1; - // rate = (header[5] & 0x7f) >= 3 ? 0 : rates[header[5] & 0x7f]; - // td0[drive].default_track_flags |= rate; - for (i = 0; i < 256; i++) { memset(td0[drive].side_flags[i], 0, 4); @@ -756,7 +747,7 @@ int td0_initialize(int drive) { track = imagebuf[offset + 1]; head = imagebuf[offset + 2] & 1; - fm = (header[5] & 0x80) || (imagebuf[offset + 2] & 0x80); // ? + fm = (header[5] & 0x80) || (imagebuf[offset + 2] & 0x80); /* ? */ td0[drive].side_flags[track][head] = td0[drive].default_track_flags | (fm ? 0 : 8); td0[drive].track_in_file[track][head] = 1; offset += 4; @@ -766,7 +757,6 @@ int td0_initialize(int drive) for(i = 0; i < track_spt; i++) { hs = &imagebuf[offset]; - size; offset += 6; td0[drive].sects[track][head][i].track = hs[0]; @@ -792,7 +782,6 @@ int td0_initialize(int drive) else { offset += 3; - int j, k; switch(hs[8]) { default: @@ -890,7 +879,6 @@ int td0_initialize(int drive) temp_rate = td0[drive].default_track_flags & 7; if ((td0[drive].default_track_flags & 0x27) == 0x20) temp_rate = 4; td0[drive].gap3_len = gap3_sizes[temp_rate][td0[drive].sects[0][0][0].size][td0[drive].track_spt[0][0]]; - // pclog("GAP3 length for %i %i %i is %i\n", temp_rate, td0[drive].sects[0][0][0].size, td0[drive].track_spt[0][0], td0[drive].gap3_len); if (!td0[drive].gap3_len) { td0[drive].gap3_len = td0[drive].calculated_gap3_lengths[0][0]; /* If we can't determine the GAP3 length, assume the smallest one we possibly know of. */ @@ -968,12 +956,10 @@ int td0_track_is_xdf(int drive, int side, int track) td0[drive].current_side_flags[side] = (td0[drive].track_spt[track][side] == 19) ? 0x08 : 0x28; return (td0[drive].track_spt[track][side] == 19) ? 2 : 1; } - // pclog("XDF: %i %i %i %i\n", high_sectors, expected_high_count, low_sectors, expected_low_count); return 0; } else { - // pclog("XDF: %i sectors per track (%i %i)\n", td0[drive].track_spt[track][side], track, side); return 0; } } @@ -996,7 +982,6 @@ int td0_track_is_xdf(int drive, int side, int track) td0[drive].xdf_ordered_pos[id[2]][side] = i; } } - // pclog("XDF: %i %i\n", effective_sectors, xdf_sectors); if ((effective_sectors == 3) && (xdf_sectors == 3)) { td0[drive].current_side_flags[side] = 0x28; @@ -1087,8 +1072,6 @@ void td0_seek(int drive, int track) td0[drive].current_side_flags[0] = td0[drive].side_flags[track][0]; td0[drive].current_side_flags[1] = td0[drive].side_flags[track][1]; - // pclog("TD0 Seek: %02X %02X (%02X)\n", td0[drive].current_side_flags[0], td0[drive].current_side_flags[1], td0[drive].disk_flags); - d86f_reset_index_hole_pos(drive, 0); d86f_reset_index_hole_pos(drive, 1); @@ -1128,7 +1111,6 @@ void td0_seek(int drive, int track) id[1] = td0[drive].sects[track][side][actual_sector].head; id[2] = real_sector; id[3] = td0[drive].sects[track][side][actual_sector].size; - // pclog("TD0: %i %i %i %i (%i %i) (GPL=%i)\n", id[0], id[1], id[2], id[3], td0[drive].sects[track][side][actual_sector].deleted, td0[drive].sects[track][side][actual_sector].bad_crc, track_gap3); ssize = 128 << ((uint32_t) td0[drive].sects[track][side][actual_sector].size); current_pos = d86f_prepare_sector(drive, side, current_pos, id, td0[drive].sects[track][side][actual_sector].data, ssize, track_gap2, track_gap3, td0[drive].sects[track][side][actual_sector].deleted, td0[drive].sects[track][side][actual_sector].bad_crc); } @@ -1146,7 +1128,6 @@ void td0_seek(int drive, int track) id[3] = is_trackx ? (id[2] & 7) : 2; ssize = 128 << ((uint32_t) id[3]); ordered_pos = td0[drive].xdf_ordered_pos[id[2]][side]; - // pclog("TD0: XDF: (%i %i) %i %i %i %i (%i %i) (GPL=%i)\n", track, side, id[0], id[1], id[2], id[3], td0[drive].sects[track][side][ordered_pos].deleted, td0[drive].sects[track][side][ordered_pos].bad_crc, track_gap3); if (is_trackx) { current_pos = d86f_prepare_sector(drive, side, xdf_trackx_spos[xdf_type][xdf_sector], id, td0[drive].sects[track][side][ordered_pos].data, ssize, track_gap2, xdf_gap3_sizes[xdf_type][is_trackx], td0[drive].sects[track][side][ordered_pos].deleted, td0[drive].sects[track][side][ordered_pos].bad_crc); @@ -1158,8 +1139,6 @@ void td0_seek(int drive, int track) } } } - - // pclog("Seeked to track: %i (%02X, %02X)\n", td0[drive].track, td0[drive].current_side_flags[0], td0[drive].current_side_flags[1]); } uint16_t td0_disk_flags(int drive) @@ -1208,4 +1187,4 @@ void d86f_register_td0(int drive) d86f_handler[drive].index_hole_pos = null_index_hole_pos; d86f_handler[drive].get_raw_size = common_get_raw_size; d86f_handler[drive].check_crc = 1; -} \ No newline at end of file +} diff --git a/src/dma.c b/src/dma.c index 391121c18..c1c039ffa 100644 --- a/src/dma.c +++ b/src/dma.c @@ -1,19 +1,13 @@ -/* Copyright holders: Sarah Walker - see COPYING for more details -*/ #include "ibm.h" -#include "disc.h" #include "dma.h" -#include "fdc.h" #include "io.h" #include "mem.h" #include "video.h" +#include "x86.h" static uint8_t dmaregs[16]; -static int dmaon[4]; static uint8_t dma16regs[16]; -static int dma16on[4]; static uint8_t dmapages[16]; void dma_reset() @@ -49,14 +43,13 @@ void dma_reset() uint8_t dma_read(uint16_t addr, void *priv) { uint8_t temp; -// printf("Read DMA %04X %04X:%04X %i %02X\n",addr,CS,pc, pic_intpending, pic.pend); switch (addr & 0xf) { case 0: case 2: case 4: case 6: /*Address registers*/ dma.wp ^= 1; if (dma.wp) return dma.ac[(addr >> 1) & 3] & 0xff; - return dma.ac[(addr >> 1) & 3] >> 8; + return (dma.ac[(addr >> 1) & 3] >> 8) & 0xff; case 1: case 3: case 5: case 7: /*Count registers*/ dma.wp ^= 1; @@ -66,72 +59,55 @@ uint8_t dma_read(uint16_t addr, void *priv) case 8: /*Status register*/ temp = dma.stat; - dma.stat &= 0xf0; + dma.stat = 0; return temp; - - case 0xd: /*Temporary register*/ - // return dmaregs[addr & 0xd]; - return 0; - - case 0xf: /*Mask register*/ - return dma16.m; - - default: - return 0; + + case 0xd: + return 0; } + return dmaregs[addr & 0xf]; } void dma_write(uint16_t addr, uint8_t val, void *priv) { - int channel = val & 3; -// printf("Write DMA %04X %02X %04X:%04X\n",addr,val,CS,pc); dmaregs[addr & 0xf] = val; switch (addr & 0xf) { case 0: case 2: case 4: case 6: /*Address registers*/ dma.wp ^= 1; - // if (dma.wp) dma.ab[(addr >> 1) & 3] = (dma.ab[(addr >> 1) & 3] & 0xff00) | val; - // else dma.ab[(addr >> 1) & 3] = (dma.ab[(addr >> 1) & 3] & 0x00ff) | (val << 8); - if (dma.wp) dma.ab[(addr >> 1) & 3] = val; - else dma.ab[(addr >> 1) & 3] |= (((uint16_t) val) << 8); - dma.ac[(addr >> 1) & 3] = dma.ab[(addr >> 1) & 3] & 0xffff; - dmaon[(addr >> 1) & 3] = 1; + if (dma.wp) dma.ab[(addr >> 1) & 3] = (dma.ab[(addr >> 1) & 3] & 0xffff00) | val; + else dma.ab[(addr >> 1) & 3] = (dma.ab[(addr >> 1) & 3] & 0xff00ff) | (val << 8); + dma.ac[(addr >> 1) & 3] = dma.ab[(addr >> 1) & 3]; return; case 1: case 3: case 5: case 7: /*Count registers*/ dma.wp ^= 1; - // if (dma.wp) dma.cb[(addr >> 1) & 3] = (dma.cb[(addr >> 1) & 3] & 0xff00) | val; - // else dma.cb[(addr >> 1) & 3] = (dma.cb[(addr >> 1) & 3] & 0x00ff) | (val << 8); - if (dma.wp) dma.cb[(addr >> 1) & 3] = val; - else dma.cb[(addr >> 1) & 3] |= (((uint16_t) val) << 8); - dma.cc[(addr >> 1) & 3] = dma.cb[(addr >> 1) & 3] & 0xffff; - // pclog("DMA count for channel %i now: %02X\n", (addr >> 1) & 3, dma.cc[(addr >> 1) & 3]); - dmaon[(addr >> 1) & 3] = 1; + if (dma.wp) dma.cb[(addr >> 1) & 3] = (dma.cb[(addr >> 1) & 3] & 0xff00) | val; + else dma.cb[(addr >> 1) & 3] = (dma.cb[(addr >> 1) & 3] & 0x00ff) | (val << 8); + dma.cc[(addr >> 1) & 3] = dma.cb[(addr >> 1) & 3]; return; case 8: /*Control register*/ dma.command = val; return; - - case 9: /*Request register*/ - if (val & 4) - { - dma.stat |= (1 << (channel + 4)); - } - else - { - dma.stat &= ~(1 << (channel + 4)); - } - return; case 0xa: /*Mask*/ if (val & 4) dma.m |= (1 << (val & 3)); else dma.m &= ~(1 << (val & 3)); return; - + case 0xb: /*Mode*/ - dma.mode[val & 3] = val & 0xfc; - dma.stat &= ~(1 << (val & 3)); + dma.mode[val & 3] = val; + if (dma.is_ps2) + { + dma.ps2_mode[val & 3] &= ~0x1c; + if (val & 0x20) + dma.ps2_mode[val & 3] |= 0x10; + if ((val & 0xc) == 8) + dma.ps2_mode[val & 3] |= 4; + else if ((val & 0xc) == 4) + dma.ps2_mode[val & 3] |= 0xc; + } return; case 0xc: /*Clear FF*/ @@ -139,14 +115,8 @@ void dma_write(uint16_t addr, uint8_t val, void *priv) return; case 0xd: /*Master clear*/ - dma.m = 0xf; - dma.command = 0; - dma.stat = 0; dma.wp = 0; - return; - - case 0xe: /*Mask reset*/ - dma.m = 0; + dma.m = 0xf; return; case 0xf: /*Mask write*/ @@ -155,18 +125,194 @@ void dma_write(uint16_t addr, uint8_t val, void *priv) } } +static uint8_t dma_ps2_read(uint16_t addr, void *priv) +{ + uint8_t temp = 0xff; + + switch (addr) + { + case 0x1a: + switch (dma.xfr_command) + { + case 2: /*Address*/ + case 3: + switch (dma.byte_ptr) + { + case 0: + temp = (dma.xfr_channel & 4) ? (dma16.ac[dma.xfr_channel & 3] & 0xff) : (dma.ac[dma.xfr_channel] & 0xff); + dma.byte_ptr = 1; + break; + case 1: + temp = (dma.xfr_channel & 4) ? (dma16.ac[dma.xfr_channel & 3] >> 8) : (dma.ac[dma.xfr_channel] >> 8); + dma.byte_ptr = 2; + break; + case 2: + temp = (dma.xfr_channel & 4) ? (dma16.ac[dma.xfr_channel & 3] >> 16) : (dma.ac[dma.xfr_channel] >> 16); + dma.byte_ptr = 0; + break; + } + break; + case 4: /*Count*/ + case 5: + if (dma.byte_ptr) + temp = (dma.xfr_channel & 4) ? (dma16.cc[dma.xfr_channel & 3] >> 8) : (dma.cc[dma.xfr_channel] >> 8); + else + temp = (dma.xfr_channel & 4) ? (dma16.cc[dma.xfr_channel & 3] & 0xff) : (dma.cc[dma.xfr_channel] & 0xff); + dma.byte_ptr = (dma.byte_ptr + 1) & 1; + break; + case 7: /*Mode*/ + temp = (dma.xfr_channel & 4) ? dma16.ps2_mode[dma.xfr_channel & 3] : dma.ps2_mode[dma.xfr_channel]; + break; + case 8: /*Arbitration Level*/ + temp = (dma.xfr_channel & 4) ? dma16.arb_level[dma.xfr_channel & 3] : dma.arb_level[dma.xfr_channel]; + break; + + default: + fatal("Bad XFR Read command %i channel %i\n", dma.xfr_command, dma.xfr_channel); + } + break; + } + + return temp; +} + +static void dma_ps2_write(uint16_t addr, uint8_t val, void *priv) +{ + uint8_t mode; + + switch (addr) + { + case 0x18: + dma.xfr_channel = val & 0x7; + dma.xfr_command = val >> 4; + dma.byte_ptr = 0; + switch (dma.xfr_command) + { + case 9: /*Set DMA mask*/ + if (dma.xfr_channel & 4) + dma16.m |= (1 << (dma.xfr_channel & 3)); + else + dma.m |= (1 << dma.xfr_channel); + break; + case 0xa: /*Reset DMA mask*/ + if (dma.xfr_channel & 4) + dma16.m &= ~(1 << (dma.xfr_channel & 3)); + else + dma.m &= ~(1 << dma.xfr_channel); + break; + } + break; + case 0x1a: + switch (dma.xfr_command) + { + case 2: /*Address*/ + switch (dma.byte_ptr) + { + case 0: + if (dma.xfr_channel & 4) + dma16.ac[dma.xfr_channel & 3] = (dma16.ac[dma.xfr_channel & 3] & 0xffff00) | val; + else + dma.ac[dma.xfr_channel] = (dma.ac[dma.xfr_channel] & 0xffff00) | val; + dma.byte_ptr = 1; + break; + case 1: + if (dma.xfr_channel & 4) + dma16.ac[dma.xfr_channel & 3] = (dma16.ac[dma.xfr_channel & 3] & 0xff00ff) | (val << 8); + else + dma.ac[dma.xfr_channel] = (dma.ac[dma.xfr_channel] & 0xff00ff) | (val << 8); + dma.byte_ptr = 2; + break; + case 2: + if (dma.xfr_channel & 4) + dma16.ac[dma.xfr_channel & 3] = (dma16.ac[dma.xfr_channel & 3] & 0x00ffff) | (val << 16); + else + dma.ac[dma.xfr_channel] = (dma.ac[dma.xfr_channel] & 0x00ffff) | (val << 16); + dma.byte_ptr = 0; + break; + } + if (dma.xfr_channel & 4) + dma16.ab[dma.xfr_channel & 3] = dma16.ac[dma.xfr_channel & 3]; + else + dma.ab[dma.xfr_channel] = dma.ac[dma.xfr_channel]; + break; + + case 4: /*Count*/ + if (dma.byte_ptr) + { + if (dma.xfr_channel & 4) + dma16.cc[dma.xfr_channel & 3] = (dma16.cc[dma.xfr_channel & 3] & 0xff) | (val << 8); + else + dma.cc[dma.xfr_channel] = (dma.cc[dma.xfr_channel] & 0xff) | (val << 8); + } + else + { + if (dma.xfr_channel & 4) + dma16.cc[dma.xfr_channel & 3] = (dma16.cc[dma.xfr_channel & 3] & 0xff00) | val; + else + dma.cc[dma.xfr_channel] = (dma.cc[dma.xfr_channel] & 0xff00) | val; + } + dma.byte_ptr = (dma.byte_ptr + 1) & 1; + if (dma.xfr_channel & 4) + dma16.cb[dma.xfr_channel & 3] = dma16.cc[dma.xfr_channel & 3]; + else + dma.cb[dma.xfr_channel] = dma.cc[dma.xfr_channel]; + break; + + case 7: /*Mode register*/ + mode = 0; + if (val & 0x10) + mode |= 0x20; + if ((val & 0xc) == 4) + mode |= 8; + else if ((val & 0xc) == 0xc) + mode |= 4; + if ((val & 0x40) && !(dma.xfr_channel & 4)) + fatal("16-bit DMA on 8-bit channel\n"); + if (!(val & 0x40) && (dma.xfr_channel & 4)) + fatal("8-bit DMA on 16-bit channel\n"); + if (dma.xfr_channel & 4) + { + dma16.mode[dma.xfr_channel & 3] = (dma16.mode[dma.xfr_channel & 3] & ~0x2c) | mode; + dma16.ps2_mode[dma.xfr_channel & 3] = val; + } + else + { + dma.mode[dma.xfr_channel] = (dma.mode[dma.xfr_channel] & ~0x2c) | mode; + dma.ps2_mode[dma.xfr_channel] = val; + } + break; + + case 8: /*Arbitration Level*/ + if (dma.xfr_channel & 4) + dma16.arb_level[dma.xfr_channel & 3] = val; + else + dma.arb_level[dma.xfr_channel] = val; + break; + + default: + fatal("Bad XFR command %i channel %i val %02x\n", dma.xfr_command, dma.xfr_channel, val); + } + break; + } +} + uint8_t dma16_read(uint16_t addr, void *priv) { uint8_t temp; - // printf("Read DMA %04X %04X:%04X\n",addr,cs>>4,cpu_state.pc); addr >>= 1; switch (addr & 0xf) { case 0: case 2: case 4: case 6: /*Address registers*/ dma16.wp ^= 1; + if (dma.is_ps2) + { + if (dma16.wp) + return dma16.ac[(addr >> 1) & 3] & 0xff; + return (dma16.ac[(addr >> 1) & 3] >> 8) & 0xff; + } if (dma16.wp) - return dma16.ac[(addr >> 1) & 3] & 0xff; - return dma16.ac[(addr >> 1) & 3] >> 8; + return (dma16.ac[(addr >> 1) & 3] >> 1) & 0xff; + return (dma16.ac[(addr >> 1) & 3] >> 9) & 0xff; case 1: case 3: case 5: case 7: /*Count registers*/ dma16.wp ^= 1; @@ -176,63 +322,42 @@ uint8_t dma16_read(uint16_t addr, void *priv) case 8: /*Status register*/ temp = dma16.stat; - dma16.stat &= 0xf0; + dma16.stat = 0; return temp; - - case 0xd: /*Temporary register*/ - // return dma16regs[addr & 0xd]; - return 0; - - case 0xf: /*Mask register*/ - return dma16.m; - - default: - return 0; } + return dma16regs[addr & 0xf]; } void dma16_write(uint16_t addr, uint8_t val, void *priv) { - int channel = val & 3; - // printf("Write dma16 %04X %02X %04X:%04X\n",addr,val,CS,cpu_state.pc); addr >>= 1; dma16regs[addr & 0xf] = val; switch (addr & 0xf) { case 0: case 2: case 4: case 6: /*Address registers*/ dma16.wp ^= 1; - // if (dma16.wp) dma16.ab[(addr >> 1) & 3] = (dma16.ab[(addr >> 1) & 3] & 0xff00) | val; - // else dma16.ab[(addr >> 1) & 3] = (dma16.ab[(addr >> 1) & 3] & 0x00ff) | (val << 8); - if (dma16.wp) dma16.ab[(addr >> 1) & 3] = val; - else dma16.ab[(addr >> 1) & 3] |= (((uint16_t) val) << 8); - dma16.ac[(addr >> 1) & 3] = dma16.ab[(addr >> 1) & 3] & 0xffff; - dma16on[(addr >> 1) & 3] = 1; + if (dma.is_ps2) + { + if (dma16.wp) dma16.ab[(addr >> 1) & 3] = (dma16.ab[(addr >> 1) & 3] & 0xffff00) | val; + else dma16.ab[(addr >> 1) & 3] = (dma16.ab[(addr >> 1) & 3] & 0xff00ff) | (val << 8); + } + else + { + if (dma16.wp) dma16.ab[(addr >> 1) & 3] = (dma16.ab[(addr >> 1) & 3] & 0xfffe00) | (val << 1); + else dma16.ab[(addr >> 1) & 3] = (dma16.ab[(addr >> 1) & 3] & 0xfe01ff) | (val << 9); + } + dma16.ac[(addr >> 1) & 3] = dma16.ab[(addr >> 1) & 3]; return; case 1: case 3: case 5: case 7: /*Count registers*/ dma16.wp ^= 1; - // if (dma16.wp) dma16.cb[(addr >> 1) & 3] = (dma16.cb[(addr >> 1) & 3] & 0xff00) | val; - // else dma16.cb[(addr >> 1) & 3] = (dma16.cb[(addr >> 1) & 3] & 0x00ff) | (val << 8); - if (dma16.wp) dma16.cb[(addr >> 1) & 3] = val; - else dma16.cb[(addr >> 1) & 3] |= (((uint16_t) val) << 8); - dma16.cc[(addr >> 1) & 3] = dma16.cb[(addr >> 1) & 3] & 0xffff; - dma16on[(addr >> 1) & 3] = 1; + if (dma16.wp) dma16.cb[(addr >> 1) & 3] = (dma16.cb[(addr >> 1) & 3] & 0xff00) | val; + else dma16.cb[(addr >> 1) & 3] = (dma16.cb[(addr >> 1) & 3] & 0x00ff) | (val << 8); + dma16.cc[(addr >> 1) & 3] = dma16.cb[(addr >> 1) & 3]; return; case 8: /*Control register*/ - dma16.command = val; return; - - case 9: /*Request register*/ - if (val & 4) - { - dma16.stat |= (1 << (channel + 4)); - } - else - { - dma16.stat &= ~(1 << (channel + 4)); - } - return; case 0xa: /*Mask*/ if (val & 4) dma16.m |= (1 << (val & 3)); @@ -240,8 +365,17 @@ void dma16_write(uint16_t addr, uint8_t val, void *priv) return; case 0xb: /*Mode*/ - dma16.mode[val & 3] = val & 0xfc; - dma16.stat &= ~(1 << (val & 3)); + dma16.mode[val & 3] = val; + if (dma.is_ps2) + { + dma16.ps2_mode[val & 3] &= ~0x1c; + if (val & 0x20) + dma16.ps2_mode[val & 3] |= 0x10; + if ((val & 0xc) == 8) + dma16.ps2_mode[val & 3] |= 4; + else if ((val & 0xc) == 4) + dma16.ps2_mode[val & 3] |= 0xc; + } return; case 0xc: /*Clear FF*/ @@ -249,18 +383,12 @@ void dma16_write(uint16_t addr, uint8_t val, void *priv) return; case 0xd: /*Master clear*/ - dma16.m = 0xf; - dma16.command = 0; - dma16.stat = 0; dma16.wp = 0; - return; - - case 0xe: /*Mask reset*/ - dma16.m = 0; + dma16.m = 0xf; return; case 0xf: /*Mask write*/ - dma16.m = val & 0xf; + dma16.m = val&0xf; return; } } @@ -268,43 +396,54 @@ void dma16_write(uint16_t addr, uint8_t val, void *priv) void dma_page_write(uint16_t addr, uint8_t val, void *priv) { - // printf("Write dma16 Page %04X %02X %04X:%04X\n",addr,val,CS,cpu_state.pc); dmapages[addr & 0xf] = val; switch (addr & 0xf) { case 1: dma.page[2] = (AT) ? val : val & 0xf; + dma.ab[2] = (dma.ab[2] & 0xffff) | (dma.page[2] << 16); + dma.ac[2] = (dma.ac[2] & 0xffff) | (dma.page[2] << 16); break; case 2: dma.page[3] = (AT) ? val : val & 0xf; + dma.ab[3] = (dma.ab[3] & 0xffff) | (dma.page[3] << 16); + dma.ac[3] = (dma.ac[3] & 0xffff) | (dma.page[3] << 16); break; case 3: dma.page[1] = (AT) ? val : val & 0xf; + dma.ab[1] = (dma.ab[1] & 0xffff) | (dma.page[1] << 16); + dma.ac[1] = (dma.ac[1] & 0xffff) | (dma.page[1] << 16); + break; + case 7: + dma.page[0] = (AT) ? val : val & 0xf; + dma.ab[0] = (dma.ab[0] & 0xffff) | (dma.page[0] << 16); + dma.ac[0] = (dma.ac[0] & 0xffff) | (dma.page[0] << 16); break; - case 0x7: - dma.page[0] = (AT) ? val : val & 0xf; - break; case 0x9: - dma16.page[2] = val; + dma16.page[2] = val & 0xfe; + dma16.ab[2] = (dma16.ab[2] & 0x1ffff) | (dma16.page[2] << 16); + dma16.ac[2] = (dma16.ac[2] & 0x1ffff) | (dma16.page[2] << 16); break; case 0xa: - dma16.page[3] = val; + dma16.page[3] = val & 0xfe; + dma16.ab[3] = (dma16.ab[3] & 0x1ffff) | (dma16.page[3] << 16); + dma16.ac[3] = (dma16.ac[3] & 0x1ffff) | (dma16.page[3] << 16); break; case 0xb: - dma16.page[1] = val; + dma16.page[1] = val & 0xfe; + dma16.ab[1] = (dma16.ab[1] & 0x1ffff) | (dma16.page[1] << 16); + dma16.ac[1] = (dma16.ac[1] & 0x1ffff) | (dma16.page[1] << 16); break; case 0xf: - dma16.page[0] = val; + dma16.page[0] = val & 0xfe; + dma16.ab[0] = (dma16.ab[0] & 0x1ffff) | (dma16.page[0] << 16); + dma16.ac[0] = (dma16.ac[0] & 0x1ffff) | (dma16.page[0] << 16); break; - default: - // pclog("DMA write to extra page register: %02X\n", addr & 0xf); - break; } } uint8_t dma_page_read(uint16_t addr, void *priv) { - // printf("Read DMA Page %04X %04X:%04X\n",addr,cs>>4,cpu_state.pc); return dmapages[addr & 0xf]; } @@ -312,6 +451,7 @@ void dma_init() { io_sethandler(0x0000, 0x0010, dma_read, NULL, NULL, dma_write, NULL, NULL, NULL); io_sethandler(0x0080, 0x0008, dma_page_read, NULL, NULL, dma_page_write, NULL, NULL, NULL); + dma.is_ps2 = 0; } void dma16_init() @@ -338,15 +478,18 @@ void dma_alias_remove_piix() io_removehandler(0x009C, 0x0003, dma_page_read, NULL, NULL, dma_page_write, NULL, NULL, NULL); } +void ps2_dma_init() +{ + io_sethandler(0x0018, 0x0001, dma_ps2_read, NULL, NULL, dma_ps2_write, NULL, NULL, NULL); + io_sethandler(0x001a, 0x0001, dma_ps2_read, NULL, NULL, dma_ps2_write, NULL, NULL, NULL); + dma.is_ps2 = 1; +} + uint8_t _dma_read(uint32_t addr) { - return mem_readb_phys(addr); -} - -uint16_t _dma_readw(uint32_t addr) -{ - return mem_readw_phys(addr); + uint8_t temp = mem_readb_phys(addr); + return temp; } void _dma_write(uint32_t addr, uint8_t val) @@ -355,291 +498,194 @@ void _dma_write(uint32_t addr, uint8_t val) mem_invalidate_range(addr, addr); } -void _dma_writew(uint32_t addr, uint16_t val) -{ - mem_writew_phys(addr, val); - mem_invalidate_range(addr, addr + 1); -} - -int dma_is_masked(int channel) -{ - if (channel < 4) - { - if (dma.m & (1 << channel)) - { - return 1; - } - if (AT) - { - if (dma16.m & 1) - { - return 1; - } - } - } - else - { - channel &= 3; - if (dma16.m & (1 << channel)) - { - return 1; - } - } - return 0; -} - -int dma_channel_mode(int channel) -{ - if (channel < 4) - { - return (dma.mode[channel] & 0xC) >> 2; - } - else - { - channel &= 3; - return (dma16.mode[channel] & 0xC) >> 2; - } -} - -DMA * get_dma_controller(int channel) -{ - if (channel < 4) - { - return &dma; - } - else - { - return &dma16; - } -} - -int dma_tc(DMA *dma_controller, int channel) -{ - if (dma_controller->command & 1) - { - /* Memory to memory command */ - dma_controller->stat |= (1 << 0); - dma_controller->stat |= (1 << 1); - dma_controller->request &= ~(1 << 0); - dma_controller->request &= ~(1 << 1); - } - else - { - dma_controller->stat |= (1 << channel); - dma_controller->request &= ~(1 << channel); - } - - if (dma_controller->mode[channel] & 0x10) /*Auto-init*/ - { - // pclog("DMA read auto-init\n"); - dma_controller->cc[channel] = dma_controller->cb[channel] & 0xffff; - dma_controller->ac[channel] = dma_controller->ab[channel] & 0xffff; - } - else - { - dma_controller->cc[channel] &= 0xffff; - dma_controller->m |= (1 << channel); - } -} - int dma_channel_read(int channel) { uint16_t temp; int tc = 0; - - int cmode = 0; - int real_channel = channel & 3; - - int mem_over = 0; - - DMA *dma_controller; - - cmode = dma_channel_mode(channel); - - channel &= 7; - - if ((channel >= 4) && !AT) - { - // pclog ("DMA read - channel is 4 or higher on a non-AT machine\n"); + + if (dma.command & 0x04) return DMA_NODATA; - } - - dma_controller = get_dma_controller(channel); - - if (dma_controller->command & 0x04) - { - // pclog ("DMA read - channel bit 2 of control bit is set\n"); - return DMA_NODATA; - } - + if (!AT) refreshread(); - - if ((channel == 4) || dma_is_masked(channel)) - { - // pclog ("DMA read - channel is 4 or masked\n"); - return DMA_NODATA; - } - - if (cmode) - { - if (cmode != 2) - { - // pclog ("DMA read - transfer mode (%i) is 1 or 3\n", cmode); + + if (channel < 4) + { + if (dma.m & (1 << channel)) + return DMA_NODATA; + if ((dma.mode[channel] & 0xC) != 8) return DMA_NODATA; - } - else - { - if (channel < 4) - { - temp = _dma_read(dma_controller->ac[real_channel] + (dma_controller->page[real_channel] << 16)); - } - else - { - temp = _dma_readw((dma_controller->ac[real_channel] << 1) + ((dma_controller->page[real_channel] & ~1) << 16)); - } - } - } - if (dma_controller->mode[real_channel] & 0x20) - { - if (dma_controller->ac[real_channel] == 0) - { - mem_over = 1; - } - dma_controller->ac[real_channel]--; - } - else - { - if (dma_controller->ac[real_channel] == 0xFFFF) - { - mem_over = 1; - } - dma_controller->ac[real_channel]++; - } - dma_controller->ac[real_channel] &= 0xffff; + temp = _dma_read(dma.ac[channel]); - dma_controller->cc[real_channel]--; - if ((dma_controller->cc[real_channel] < 0) || mem_over) - { - tc = 1; - dma_tc(dma_controller, real_channel); - } + if (dma.mode[channel] & 0x20) + { + if (dma.is_ps2) + dma.ac[channel]--; + else + dma.ac[channel] = (dma.ac[channel] & 0xff0000) | ((dma.ac[channel] - 1) & 0xffff); + } + else + { + if (dma.is_ps2) + dma.ac[channel]++; + else + dma.ac[channel] = (dma.ac[channel] & 0xff0000) | ((dma.ac[channel] + 1) & 0xffff); + } + dma.cc[channel]--; + if (dma.cc[channel] < 0) + { + tc = 1; + if (dma.mode[channel] & 0x10) /*Auto-init*/ + { + dma.cc[channel] = dma.cb[channel]; + dma.ac[channel] = dma.ab[channel]; + } + else + dma.m |= (1 << channel); + dma.stat |= (1 << channel); + } - if (tc) - { - // pclog("DMA read over in transfer mode %i (value %04X)!\n", cmode, temp); - return temp | DMA_OVER; - } + if (tc) + return temp | DMA_OVER; + return temp; + } + else + { + channel &= 3; + if (dma16.m & (1 << channel)) + return DMA_NODATA; + if ((dma16.mode[channel] & 0xC) != 8) + return DMA_NODATA; - // pclog("DMA read success (value %04X)\n", temp); - return temp; + temp = _dma_read(dma16.ac[channel]) | + (_dma_read(dma16.ac[channel] + 1) << 8); + + if (dma16.mode[channel] & 0x20) + { + if (dma.is_ps2) + dma16.ac[channel] -= 2; + else + dma16.ac[channel] = (dma16.ac[channel] & 0xfe0000) | ((dma16.ac[channel] - 2) & 0x1ffff); + } + else + { + if (dma.is_ps2) + dma16.ac[channel] += 2; + else + dma16.ac[channel] = (dma16.ac[channel] & 0xfe0000) | ((dma16.ac[channel] + 2) & 0x1ffff); + } + + dma16.cc[channel]--; + if (dma16.cc[channel] < 0) + { + tc = 1; + if (dma16.mode[channel] & 0x10) /*Auto-init*/ + { + dma16.cc[channel] = dma16.cb[channel]; + dma16.ac[channel] = dma16.ab[channel]; + } + else + dma16.m |= (1 << channel); + dma16.stat |= (1 << channel); + } + + if (tc) + return temp | DMA_OVER; + return temp; + } } int dma_channel_write(int channel, uint16_t val) { - int tc = 0; - - int cmode = 0; - int real_channel = channel & 3; - - int mem_over = 0; - - DMA *dma_controller; - - cmode = dma_channel_mode(channel); - - channel &= 7; - - if ((channel >= 4) && !AT) - { - // pclog ("DMA write - channel is 4 or higher on a non-AT machine\n"); + if (dma.command & 0x04) return DMA_NODATA; - } - - dma_controller = get_dma_controller(channel); - - if (dma_controller->command & 0x04) - { - // pclog ("DMA write - channel bit 2 of control bit is set\n"); - return DMA_NODATA; - } if (!AT) refreshread(); - if ((channel == 4) || dma_is_masked(channel)) - { - // pclog ("DMA write - channel is 4 or masked\n"); - return DMA_NODATA; - } - - if (cmode) - { - if (cmode != 1) - { - // pclog ("DMA write - transfer mode (%i) is 2 or 3\n", cmode); + if (channel < 4) + { + if (dma.m & (1 << channel)) + return DMA_NODATA; + if ((dma.mode[channel] & 0xC) != 4) return DMA_NODATA; - } - if (channel < 4) - { - _dma_write(dma_controller->ac[real_channel] + (dma_controller->page[real_channel] << 16), val); - } - else - { - _dma_writew((dma_controller->ac[real_channel] << 1) + ((dma_controller->page[real_channel] & ~1) << 16), val); - } - } + _dma_write(dma.ac[channel], val); - if (dma_controller->mode[real_channel] & 0x20) - { - if (dma_controller->ac[real_channel] == 0) - { - mem_over = 1; - } - dma_controller->ac[real_channel]--; - } - else - { - if (dma_controller->ac[real_channel] == 0xFFFF) - { - mem_over = 1; - } - dma_controller->ac[real_channel]++; - } - dma_controller->ac[real_channel] &= 0xffff; + if (dma.mode[channel] & 0x20) + { + if (dma.is_ps2) + dma.ac[channel]--; + else + dma.ac[channel] = (dma.ac[channel] & 0xff0000) | ((dma.ac[channel] - 1) & 0xffff); + } + else + { + if (dma.is_ps2) + dma.ac[channel]++; + else + dma.ac[channel] = (dma.ac[channel] & 0xff0000) | ((dma.ac[channel] + 1) & 0xffff); + } - dma_controller->cc[real_channel]--; - if ((dma_controller->cc[real_channel] < 0) || mem_over) - { - tc = 1; - dma_tc(dma_controller, real_channel); - } + dma.cc[channel]--; + if (dma.cc[channel] < 0) + { + if (dma.mode[channel] & 0x10) /*Auto-init*/ + { + dma.cc[channel] = dma.cb[channel]; + dma.ac[channel] = dma.ab[channel]; + } + else + dma.m |= (1 << channel); + dma.stat |= (1 << channel); + } - // if (dma_is_masked(channel)) - if (tc) - { - // pclog("DMA write over in transfer mode %i (value %04X)\n", cmode, val); - return DMA_OVER; - } + if (dma.m & (1 << channel)) + return DMA_OVER; + } + else + { + channel &= 3; + if (dma16.m & (1 << channel)) + return DMA_NODATA; + if ((dma16.mode[channel] & 0xC) != 4) + return DMA_NODATA; - // pclog("DMA write success (value %04X)\n", val); - return 0; -} + _dma_write(dma16.ac[channel], val); + _dma_write(dma16.ac[channel] + 1, val >> 8); -//DMA Bus Master Page Read/Write -void DMAPageRead(uint32_t PhysAddress, void *DataRead, uint32_t TotalSize) -{ - memcpy(DataRead, &ram[PhysAddress], TotalSize); - DataRead -= TotalSize; -} + if (dma16.mode[channel] & 0x20) + { + if (dma.is_ps2) + dma16.ac[channel] -= 2; + else + dma16.ac[channel] = (dma16.ac[channel] & 0xfe0000) | ((dma16.ac[channel] - 2) & 0x1ffff); + } + else + { + if (dma.is_ps2) + dma16.ac[channel] += 2; + else + dma16.ac[channel] = (dma16.ac[channel] & 0xfe0000) | ((dma16.ac[channel] + 2) & 0x1ffff); + } -void DMAPageWrite(uint32_t PhysAddress, const void *DataWrite, uint32_t TotalSize) -{ - mem_invalidate_range(PhysAddress, PhysAddress + TotalSize - 1); - memcpy(&ram[PhysAddress], DataWrite, TotalSize); - DataWrite -= TotalSize; + dma16.cc[channel]--; + if (dma16.cc[channel] < 0) + { + if (dma16.mode[channel] & 0x10) /*Auto-init*/ + { + dma16.cc[channel] = dma16.cb[channel] + 1; + dma16.ac[channel] = dma16.ab[channel]; + } + dma16.m |= (1 << channel); + dma16.stat |= (1 << channel); + } + + if (dma.m & (1 << channel)) + return DMA_OVER; + } + return 0; } int dma_mode(int channel) @@ -654,7 +700,14 @@ int dma_mode(int channel) } } -/* void dma_c2_mode() +/* DMA Bus Master Page Read/Write */ +void DMAPageRead(uint32_t PhysAddress, char *DataRead, uint32_t TotalSize) { - printf("DMA Channel 2 mode: %02X\n", dma.mode[2]); -} */ + memcpy(DataRead, &ram[PhysAddress], TotalSize); +} + +void DMAPageWrite(uint32_t PhysAddress, const char *DataWrite, uint32_t TotalSize) +{ + mem_invalidate_range(PhysAddress, PhysAddress + TotalSize - 1); + memcpy(&ram[PhysAddress], DataWrite, TotalSize); +} diff --git a/src/dma.h b/src/dma.h index e8eb7fbc4..3cf611ea2 100644 --- a/src/dma.h +++ b/src/dma.h @@ -3,7 +3,9 @@ */ void dma_init(); void dma16_init(); +void ps2_dma_init(); void dma_reset(); +int dma_mode(int channel); #define DMA_NODATA -1 #define DMA_OVER 0x10000 @@ -19,5 +21,9 @@ void writedma2(uint8_t temp); int dma_channel_read(int channel); int dma_channel_write(int channel, uint16_t val); -void DMAPageRead(uint32_t PhysAddress, void *DataRead, uint32_t TotalSize); -void DMAPageWrite(uint32_t PhysAddress, const void *DataWrite, uint32_t TotalSize); \ No newline at end of file +void dma_alias_set(); +void dma_alias_remove(); +void dma_alias_remove_piix(); + +void DMAPageRead(uint32_t PhysAddress, char *DataRead, uint32_t TotalSize); +void DMAPageWrite(uint32_t PhysAddress, const char *DataWrite, uint32_t TotalSize); \ No newline at end of file diff --git a/src/dosbox/vid_cga_comp.c b/src/dosbox/vid_cga_comp.c index 7752f5ba6..63e54cdad 100644 --- a/src/dosbox/vid_cga_comp.c +++ b/src/dosbox/vid_cga_comp.c @@ -19,10 +19,10 @@ static double saturation = 100; static double sharpness = 0; static double hue_offset = 0; -// New algorithm by reenigne -// Works in all CGA modes/color settings and can simulate older and newer CGA revisions +/* New algorithm by reenigne + Works in all CGA modes/color settings and can simulate older and newer CGA revisions */ -static const double tau = 6.28318531; // == 2*pi +static const double tau = 6.28318531; /* == 2*pi */ static unsigned char chroma_multiplexer[256] = { 2, 2, 2, 2, 114,174, 4, 3, 2, 1,133,135, 2,113,150, 4, @@ -58,26 +58,28 @@ int video_sharpness; int tandy_mode_control = 0; static bool new_cga = 0; -static bool is_bw = 0; -static bool is_bpp1 = 0; - -static uint8_t comp_pal[256][3]; - -static Bit8u byte_clamp_other(int v) { return v < 0 ? 0 : (v > 255 ? 255 : v); } - -FILE *df; void update_cga16_color(uint8_t cgamode) { int x; - Bit32u x2; + double c, i, v; + double q, a, s, r; + double iq_adjust_i, iq_adjust_q; + double i0, i3, mode_saturation; + + static const double ri = 0.9563; + static const double rq = 0.6210; + static const double gi = -0.2721; + static const double gq = -0.6474; + static const double bi = -1.1069; + static const double bq = 1.7046; if (!new_cga) { min_v = chroma_multiplexer[0] + intensity[0]; max_v = chroma_multiplexer[255] + intensity[3]; } else { - double i0 = intensity[0]; - double i3 = intensity[3]; + i0 = intensity[0]; + i3 = intensity[3]; min_v = NEW_CGA(chroma_multiplexer[0], i0, i0, i0, i0); max_v = NEW_CGA(chroma_multiplexer[255], i3, i3, i3, i3); } @@ -88,9 +90,9 @@ void update_cga16_color(uint8_t cgamode) { else mode_hue = 4; - mode_contrast *= contrast * (new_cga ? 1.2 : 1)/100; // new CGA: 120% - mode_brightness += (new_cga ? brightness-10 : brightness)*5; // new CGA: -10 - double mode_saturation = (new_cga ? 4.35 : 2.9)*saturation/100; // new CGA: 150% + mode_contrast *= contrast * (new_cga ? 1.2 : 1)/100; /* new CGA: 120% */ + mode_brightness += (new_cga ? brightness-10 : brightness)*5; /* new CGA: -10 */ + mode_saturation = (new_cga ? 4.35 : 2.9)*saturation/100; /* new CGA: 150% */ for (x = 0; x < 1024; ++x) { int phase = x & 3; @@ -102,10 +104,8 @@ void update_cga16_color(uint8_t cgamode) { rc = (right & 8) | ((right & 7) != 0 ? 7 : 0); lc = (left & 8) | ((left & 7) != 0 ? 7 : 0); } - double c = - chroma_multiplexer[((lc & 7) << 5) | ((rc & 7) << 2) | phase]; - double i = intensity[(left >> 3) | ((right >> 2) & 2)]; - double v; + c = chroma_multiplexer[((lc & 7) << 5) | ((rc & 7) << 2) | phase]; + i = intensity[(left >> 3) | ((right >> 2) & 2)]; if (!new_cga) v = c + i; else { @@ -117,23 +117,16 @@ void update_cga16_color(uint8_t cgamode) { CGA_Composite_Table[x] = (int) (v*mode_contrast + mode_brightness); } - double i = CGA_Composite_Table[6*68] - CGA_Composite_Table[6*68 + 2]; - double q = CGA_Composite_Table[6*68 + 1] - CGA_Composite_Table[6*68 + 3]; + i = CGA_Composite_Table[6*68] - CGA_Composite_Table[6*68 + 2]; + q = CGA_Composite_Table[6*68 + 1] - CGA_Composite_Table[6*68 + 3]; - double a = tau*(33 + 90 + hue_offset + mode_hue)/360.0; - double c = cos(a); - double s = sin(a); - double r = 256*mode_saturation/sqrt(i*i+q*q); + a = tau*(33 + 90 + hue_offset + mode_hue)/360.0; + c = cos(a); + s = sin(a); + r = 256*mode_saturation/sqrt(i*i+q*q); - double iq_adjust_i = -(i*c + q*s)*r; - double iq_adjust_q = (q*c - i*s)*r; - - static const double ri = 0.9563; - static const double rq = 0.6210; - static const double gi = -0.2721; - static const double gq = -0.6474; - static const double bi = -1.1069; - static const double bq = 1.7046; + iq_adjust_i = -(i*c + q*s)*r; + iq_adjust_q = (q*c - i*s)*r; video_ri = (int) (ri*iq_adjust_i + rq*iq_adjust_q); video_rq = (int) (-ri*iq_adjust_q + rq*iq_adjust_i); @@ -163,6 +156,13 @@ Bit8u * Composite_Process(uint8_t cgamode, Bit8u border, Bit32u blocks/*, bool d int w = blocks*4; + int *o; + Bit8u *rgbi; + int *b; + int *i; + Bit32u* srgb; + int *ap, *bp; + #define COMPOSITE_CONVERT(I, Q) do { \ i[1] = (i[1]<<3) - ap[1]; \ a = ap[0]; \ @@ -182,10 +182,10 @@ Bit8u * Composite_Process(uint8_t cgamode, Bit8u border, Bit32u blocks/*, bool d #define OUT(v) do { *o = (v); ++o; } while (0) - // Simulate CGA composite output - int* o = temp; - Bit8u* rgbi = TempLine; - int* b = &CGA_Composite_Table[border*68]; + /* Simulate CGA composite output */ + o = temp; + rgbi = TempLine; + b = &CGA_Composite_Table[border*68]; for (x = 0; x < 4; ++x) OUT(b[(x+3)&3]); OUT(CGA_Composite_Table[(border<<6) | ((*rgbi)<<2) | 3]); @@ -198,9 +198,9 @@ Bit8u * Composite_Process(uint8_t cgamode, Bit8u border, Bit32u blocks/*, bool d OUT(b[x&3]); if ((cgamode & 4) != 0) { - // Decode - int* i = temp + 5; - Bit32u* srgb = (Bit32u *)TempLine; + /* Decode */ + i = temp + 5; + srgb = (Bit32u *)TempLine; for (x2 = 0; x2 < blocks*4; ++x2) { int c = (i[0]+i[0])<<3; int d = (i[-1]+i[1])<<3; @@ -211,21 +211,21 @@ Bit8u * Composite_Process(uint8_t cgamode, Bit8u border, Bit32u blocks/*, bool d } } else { - // Store chroma - int* i = temp + 4; - int* ap = atemp + 1; - int* bp = btemp + 1; + /* Store chroma */ + i = temp + 4; + ap = atemp + 1; + bp = btemp + 1; for (x = -1; x < w + 1; ++x) { ap[x] = i[-4]-((i[-2]-i[0]+i[2])<<1)+i[4]; bp[x] = (i[-3]-i[-1]+i[1]-i[3])<<1; ++i; } - // Decode + /* Decode */ i = temp + 5; i[-1] = (i[-1]<<3) - ap[-1]; i[0] = (i[0]<<3) - ap[0]; - Bit32u* srgb = (Bit32u *)TempLine; + srgb = (Bit32u *)TempLine; for (x2 = 0; x2 < blocks; ++x2) { int y,a,b,c,d,rr,gg,bb; COMPOSITE_CONVERT(a, b); diff --git a/src/fdc.c b/src/fdc.c index 42ea7ff49..0174778f5 100644 --- a/src/fdc.c +++ b/src/fdc.c @@ -18,20 +18,44 @@ extern int motoron[FDD_NUM]; int ui_writeprot[FDD_NUM] = {0, 0, 0, 0}; -int command_has_drivesel[256] = { [0x02] = 1, /* READ TRACK */ - [0x04] = 1, /* SENSE DRIVE STATUS */ - [0x05] = 1, /* WRITE DATA */ - [0x06] = 1, /* READ DATA */ - [0x07] = 1, /* RECALIBRATE */ - [0x09] = 1, /* WRITE DELETED DATA */ - [0x0A] = 1, /* READ ID */ - [0x0C] = 1, /* READ DELETED DATA */ - [0x0D] = 1, /* FORMAT TRACK */ - [0x0F] = 1, /* SEEK, RELATIVE SEEK */ - [0x11] = 1, /* SCAN EQUAL */ - [0x16] = 1, /* VERIFY */ - [0x19] = 1, /* SCAN LOW OR EQUAL */ - [0x1D] = 1 }; /* SCAN HIGH OR EQUAL */ +int command_has_drivesel[256] = { 0, 0, + 1, /* READ TRACK */ + 0, + 1, /* SENSE DRIVE STATUS */ + 1, /* WRITE DATA */ + 1, /* READ DATA */ + 1, /* RECALIBRATE */ + 0, + 1, /* WRITE DELETED DATA */ + 1, /* READ ID */ + 0, + 1, /* READ DELETED DATA */ + 1, /* FORMAT TRACK */ + 0, + 1, /* SEEK, RELATIVE SEEK */ + 0, + 1, /* SCAN EQUAL */ + 0, 0, 0, 0, + 1, /* VERIFY */ + 0, 0, 0, + 1, /* SCAN LOW OR EQUAL */ + 0, 0, 0, + 1, /* SCAN HIGH OR EQUAL */ + 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }; static int fdc_reset_stat = 0; /*FDC*/ @@ -110,7 +134,6 @@ static FDC fdc; void fdc_callback(); int timetolive; -//#define SECTORS 9 int lastbyte=0; uint8_t disc_3f7; @@ -146,9 +169,7 @@ void fdc_reset() if (!AT) { fdc.rate = 2; - // fdc_update_rate(); } -// fdc_log("Reset FDC\n"); } sector_id_t fdc_get_read_track_sector() @@ -314,7 +335,6 @@ void fdc_fifo_buf_advance() { fdc.fifobufpos++; } - // fdc_log("FIFO buffer position = %02X\n", fdc.fifobufpos); } void fdc_fifo_buf_write(int val) @@ -337,7 +357,6 @@ static void fdc_int() { if (fdc.dor & 8) { - // fdc_log("FDC interrupt!\n"); picint(1 << 6); fdc.fintr = 1; } @@ -352,9 +371,7 @@ static void fdc_watchdog_poll(void *p) if (fdc->watchdog_count) fdc->watchdog_timer += 1000 * TIMER_USEC; else - { -// fdc_log("Watchdog timed out\n"); - + { fdc->watchdog_timer = 0; if (fdc->dor & 0x20) picint(1 << 6); @@ -492,7 +509,6 @@ void fdc_update_rate(int drive) } fdc.bitcell_period = 1000000 / bit_rate*2; /*Bitcell period in ns*/ - // fdc_log("fdc_update_rate: rate=%i bit_rate=%i bitcell_period=%i\n", fdc.rate, bit_rate, fdc.bitcell_period); } int fdc_get_bit_rate() @@ -564,6 +580,8 @@ static int fdc_get_densel(int drive) case 2: return fdc.densel_polarity ? 0 : 1; } + + return 0; } static void fdc_rate(int drive) @@ -605,18 +623,16 @@ void fdc_implied_seek() void fdc_write(uint16_t addr, uint8_t val, void *priv) { - fdc_log("Write FDC %04X %02X\n",addr,val); - // fdc_log("Write FDC %04X %02X %04X:%04X %i %02X %i rate=%i %i\n",addr,val,cs>>4,pc,ins,fdc.st0,ins,fdc.rate, fdc.data_ready); int drive, i, drive_num; int seek_time, seek_time_base; + fdc_log("Write FDC %04X %02X\n",addr,val); + switch (addr&7) { case 0: return; case 1: return; case 2: /*DOR*/ -// if (val == 0xD && (cs >> 4) == 0xFC81600 && ins > 769619936) output = 3; -// printf("DOR was %02X\n",fdc.dor); if (fdc.pcjr) { if ((fdc.dor & 0x40) && !(val & 0x40)) @@ -624,7 +640,6 @@ void fdc_write(uint16_t addr, uint8_t val, void *priv) fdc.watchdog_timer = 1000 * TIMER_USEC; fdc.watchdog_count = 1000; picintc(1 << 6); -// fdc_log("watchdog set %i %i\n", fdc.watchdog_timer, TIMER_USEC); } if ((val & 0x80) && !(fdc.dor & 0x80)) { @@ -639,15 +654,6 @@ void fdc_write(uint16_t addr, uint8_t val, void *priv) val &= 0xfe; } motoron[0 ^ fdd_swap] = val & 0x01; - /* if (!motoron[0 ^ fdd_swap]) - { - disc_changed[0 ^ fdd_swap] = 0; - } */ - // fdc.drive = 0; -/* if (motoron) - output = 3; - else - output = 0;*/ } else { @@ -678,7 +684,6 @@ void fdc_write(uint16_t addr, uint8_t val, void *priv) } timer_process(); timer_update_outstanding(); - // val &= 0x3f; /* Drives 2 and 3 are not emulated, so their motors are always forced off. */ /* We can now simplify this since each motor now spins separately. */ for (i = 0; i < FDD_NUM; i++) { @@ -693,13 +698,8 @@ void fdc_write(uint16_t addr, uint8_t val, void *priv) } } drive_num = real_drive(val & 3); - /* if (!motoron[drive_num]) - { - disc_changed[drive_num] = 0; - } */ } fdc.dor=val; - // printf("DOR now %02X (%04X:%04X)\n",val, CS, cpu_state.pc); return; case 3: /* TDR */ @@ -719,10 +719,8 @@ void fdc_write(uint16_t addr, uint8_t val, void *priv) fdc.perp &= 0xfc; fdc_reset(); } - // fdc_log("DSR now: %02X\n", val); return; case 5: /*Command register*/ - // fdc_log("CMD now: %02X\n", val); if ((fdc.stat & 0xf0) == 0xb0) { if (fdc.pcjr || !fdc.fifo) @@ -737,12 +735,8 @@ void fdc_write(uint16_t addr, uint8_t val, void *priv) } break; } -// if (fdc.inread) -// rfdc_log("c82c711_fdc_write : writing while inread! %02X\n", val); -// rfdc_log("Write command reg %i %i\n",fdc.pnum, fdc.ptot); if (fdc.pnum==fdc.ptot) { - // if ((fdc.stat & 0x10) || !fdc.stat) if ((fdc.stat & 0xf0) != 0x80) { /* If bit 4 of the MSR is set, or the MSR is 0x00, the FDC is NOT in the command phase, therefore do NOT accept commands. */ @@ -794,13 +788,11 @@ void fdc_write(uint16_t addr, uint8_t val, void *priv) fdc.sc=0; fdc.wrong_am=0; fdc.deleted = ((fdc.command&0x1F) == 9) ? 1 : 0; -// printf("Write data!\n"); fdc.pnum=0; fdc.ptot=8; fdc.stat |= 0x90; fdc.pos=0; fdc.mfm=(fdc.command&0x40)?1:0; -// readflash=1; break; case 6: /*Read data*/ case 0xC: /*Read deleted data*/ @@ -826,12 +818,8 @@ void fdc_write(uint16_t addr, uint8_t val, void *priv) fdc.stat |= 0x90; break; case 8: /*Sense interrupt status*/ - // if (!fdc.fintr && !fdc_reset_stat) fdc_log("Attempted SENSE INTERRUPT STATUS without FINTR\n"); if (!fdc.fintr && !fdc_reset_stat) goto bad_command; -// printf("Sense interrupt status %i\n",curdrive); fdc.lastdrive = fdc.drive; -// fdc.stat = 0x10 | (fdc.stat & 0xf); -// fdc_time=1024; discint = 8; fdc.pos = 0; fdc_callback(); @@ -902,9 +890,6 @@ void fdc_write(uint16_t addr, uint8_t val, void *priv) default: bad_command: - // fatal("Bad FDC command %02X\n",val); -// dumpregs(); -// exit(-1); fdc.stat |= 0x10; discint=0xfc; timer_process(); @@ -954,7 +939,6 @@ bad_command: fdc.read_track_sector.id.n = fdc.params[4]; fdc_implied_seek(); fdc.rw_track = fdc.params[1]; -// fdc_log("Read a track track=%i head=%i sector=%i eot=%i\n", fdc.pcn[fdc.params[0] & 3], fdc.head, fdc.sector, fdc.eot[fdc.drive]); disc_readsector(fdc.drive, SECTOR_FIRST, fdc.params[1], fdc.head, fdc.rate, fdc.params[4]); if (fdc.pcjr || !fdc.dma) { @@ -965,6 +949,7 @@ bad_command: fdc.stat = 0x50; } disctime = 0; + update_status_bar_icon(fdc.drive, 1); readflash = 1; fdc.inread = 1; break; @@ -988,7 +973,6 @@ bad_command: fdc.perp &= 0xfc; fdc.perp |= (fdc.params[0] & 0x03); } - // fdc_log("PERPENDICULAR: Set to: %02X\n", fdc.perp); disctime = 0; return; @@ -1011,7 +995,7 @@ bad_command: disc_writesector(fdc.drive, fdc.sector, fdc.params[1], fdc.head, fdc.rate, fdc.params[4]); disctime = 0; fdc.written = 0; - readflash = 1; + update_status_bar_icon(fdc.drive, 1); fdc.pos = 0; if (fdc.pcjr) fdc.stat = 0xb0; @@ -1026,7 +1010,6 @@ bad_command: fdc.stat = 0xb0; } } - // ioc_fiq(IOC_FIQ_DISC_DATA); break; case 0x11: /*Scan equal*/ @@ -1045,7 +1028,7 @@ bad_command: disc_comparesector(fdc.drive, fdc.sector, fdc.params[1], fdc.head, fdc.rate, fdc.params[4]); disctime = 0; fdc.written = 0; - readflash = 1; + update_status_bar_icon(fdc.drive, 1); fdc.pos = 0; if (fdc.pcjr || !fdc.dma) { @@ -1055,7 +1038,6 @@ bad_command: { fdc.stat = 0x90; } - // ioc_fiq(IOC_FIQ_DISC_DATA); break; case 0x16: /*Verify*/ @@ -1080,7 +1062,6 @@ bad_command: fdc.tc = 1; fdc.deleted |= 2; } - // dma_c2_mode(); disc_readsector(fdc.drive, fdc.sector, fdc.params[1], fdc.head, fdc.rate, fdc.params[4]); if (fdc.pcjr || !fdc.dma) { @@ -1091,7 +1072,7 @@ bad_command: fdc.stat = 0x50; } disctime = 0; - readflash = 1; + update_status_bar_icon(fdc.drive, 1); fdc.inread = 1; break; @@ -1136,12 +1117,10 @@ bad_command: fdc.gap = fdc.params[3]; fdc.dtl = 4000000; fdc.format_sectors = fdc.params[2]; - // fdc_log("Formatting with %i sectors per track\n", fdc.format_sectors); fdc.format_n = fdc.params[1]; fdc.format_state = 1; fdc.pos = 0; fdc.stat = 0x10; - // fdc_log("FDC FORMAT: %02X %02X %02X %02X %02X\n", fdc.params[0], fdc.params[1], fdc.params[2], fdc.params[3], fdc.params[4]); break; case 0xf: /*Seek*/ @@ -1197,7 +1176,7 @@ bad_command: fdc_seek(fdc.drive, -fdc.params[1]); fdc.pcn[fdc.params[0] & 3] -= fdc.params[1]; } - disctime = ((int) fdc.params[1]) * seek_time * TIMER_USEC; + disctime = ((int) fdc.params[1]) * seek_time_base * TIMER_USEC; } else { @@ -1266,13 +1245,10 @@ bad_command: case 7: if (!AT) return; fdc.rate=val&3; - // fdc_log("Rate now: %i\n", val & 3); disc_3f7=val; return; } -// dumpregs(); -// exit(-1); } int paramstogo=0; @@ -1281,7 +1257,6 @@ uint8_t fdc_read(uint16_t addr, void *priv) uint8_t temp; int drive; fdc_log("Read FDC %04X\n",addr); - // /*if (addr!=0x3f4) */printf("Read FDC %04X %04X:%04X %04X %i %02X %02x %i ",addr,cs>>4,pc,BX,fdc.pos,fdc.st0,fdc.stat,ins); switch (addr&7) { case 0: /* STA */ @@ -1295,16 +1270,19 @@ uint8_t fdc_read(uint16_t addr, void *priv) drive = real_drive(fdc.dor & 3); if (!fdc.enable_3f1) return 0xff; -// temp=0x50; temp = 0x70; if (drive) temp &= ~0x40; else temp &= ~0x20; + + if (fdc.dor & 0x10) + temp |= 1; + if (fdc.dor & 0x20) + temp |= 2; break; case 2: temp = fdc.dor; - // fdc_log("Read DOR: %02X\n", fdc.dor); break; case 3: drive = real_drive(fdc.dor & 3); @@ -1334,7 +1312,6 @@ uint8_t fdc_read(uint16_t addr, void *priv) return 0; } temp=fdc.stat; - // fdc_log("Read MSR: %02X\n", fdc.stat); break; case 5: /*Data*/ fdc.stat&=~0x80; @@ -1346,24 +1323,19 @@ uint8_t fdc_read(uint16_t addr, void *priv) { temp = fdc_fifo_buf_read(); } - // fdc_log("Read DAT: %02X\n", temp); break; } if (paramstogo) { paramstogo--; temp=fdc.res[10 - paramstogo]; - // fdc_log("Read result: %02X\n", temp); -// fdc_log("Read param %i %02X\n",10-paramstogo,temp); if (!paramstogo) { fdc.stat=0x80; -// fdc.st0=0; } else { fdc.stat|=0xC0; -// fdc_poll(); } } else @@ -1372,7 +1344,6 @@ uint8_t fdc_read(uint16_t addr, void *priv) fdc.stat = 0x80; lastbyte=0; temp=fdc.dat; - // fdc_log("Read DAT: %02X\n", temp); fdc.data_ready = 0; } /* What the heck is this even doing?! */ @@ -1392,21 +1363,11 @@ uint8_t fdc_read(uint16_t addr, void *priv) temp = 0; if (fdc.dskchg_activelow) /*PC2086/3086 seem to reverse this bit*/ temp ^= 0x80; - if (AT) - { - temp |= 0x7F; - } - // fdc_log("Read CCR: %02X\n", temp); -// printf("- DC %i %02X %02X %i %i - ",fdc.dor & 3, fdc.dor, 0x10 << (fdc.dor & 3), discchanged[fdc.dor & 1], driveempty[fdc.dor & 1]); -// discchanged[fdc.dor&1]=0; + temp |= 0x01; break; default: temp=0xFF; -// printf("Bad read FDC %04X\n",addr); -// dumpregs(); -// exit(-1); } -// /*if (addr!=0x3f4) */printf("%02X rate=%i %i\n",temp,fdc.rate, fdc.data_ready); return temp; } @@ -1464,6 +1425,7 @@ void fdc_poll_common_finish(int compare, int st5) fdc.res[8]=fdc.head; fdc.res[9]=fdc.sector; fdc.res[10]=fdc.params[4]; + update_status_bar_icon(fdc.drive, 0); paramstogo=7; } @@ -1484,20 +1446,13 @@ void fdc_no_dma_end(int compare) void fdc_callback() { - int temp; int compare = 0; int drive_num = 0; int old_sector = 0; - int bad_end = 0; disctime = 0; -// fdc_log("fdc_callback %i %i\n", discint, disctime); -// if (fdc.inread) -// rfdc_log("c82c711_fdc_callback : while inread! %08X %i %02X %i\n", discint, fdc.drive, fdc.st0, ins); switch (discint) { case -3: /*End of command with interrupt*/ -// if (output) printf("EOC - interrupt!\n"); -//rfdc_log("EOC\n"); fdc_int(); fdc.stat = (fdc.stat & 0xf) | 0x80; return; @@ -1505,7 +1460,6 @@ void fdc_callback() fdc.stat = (fdc.stat & 0xf) | 0x80; return; case -1: /*Reset*/ -//rfdc_log("Reset\n"); fdc_int(); fdc.fintr = 0; memset(fdc.pcn, 0, 4); @@ -1517,10 +1471,9 @@ void fdc_callback() return; case 2: /*Read track*/ - readflash = 1; + update_status_bar_icon(fdc.drive, 1); fdc.eot[fdc.drive]--; fdc.read_track_sector.id.r++; -// fdc_log("Read a track callback, eot=%i\n", fdc.eot[fdc.drive]); if (!fdc.eot[fdc.drive] || fdc.tc) { fdc_poll_readwrite_finish(2); @@ -1564,7 +1517,6 @@ void fdc_callback() case 0x19: /*Scan low or equal*/ case 0x1C: /*Verify*/ case 0x1D: /*Scan high or equal*/ -// rfdc_log("Read data %i\n", fdc.tc); if ((discint == 0x11) || (discint == 0x19) || (discint == 0x1D)) { compare = 1; @@ -1573,14 +1525,12 @@ void fdc_callback() { compare = 0; } - bad_end = 1; if ((discint == 6) || (discint == 0xC)) { if (fdc.wrong_am && !(fdc.deleted & 0x20)) { /* Mismatching data address mark and no skip, set TC. */ fdc.tc = 1; - bad_end = 0; } } old_sector = fdc.sector; @@ -1657,7 +1607,7 @@ void fdc_callback() { fdc.sector++; } - readflash = 1; + update_status_bar_icon(fdc.drive, 1); switch (discint) { case 5: @@ -1703,7 +1653,6 @@ void fdc_callback() return; case 7: /*Recalibrate*/ - // if (!driveempty[fdc.dor & 3]) discchanged[fdc.dor & 3] = 0; fdc.pcn[fdc.params[0] & 3] = 0; drive_num = real_drive(fdc.rw_drive); fdc.st0 = 0x20 | (fdc.params[0] & 3); @@ -1715,12 +1664,10 @@ void fdc_callback() timer_process(); disctime = 2048 * (1 << TIMER_SHIFT); timer_update_outstanding(); -// printf("Recalibrate complete!\n"); fdc.stat = 0x80 | (1 << fdc.drive); return; case 8: /*Sense interrupt status*/ -// fdc_log("Sense interrupt status %i\n", fdc_reset_stat); fdc.stat = (fdc.stat & 0xf) | 0xd0; @@ -1751,18 +1698,14 @@ void fdc_callback() fdc.res[10] = fdc.pcn[fdc.res[9] & 3]; - // fdc_log("SENSE INTERRUPT STATUS: Results %02X %02X, ST0 %02X\n", fdc.res[9], fdc.res[10], fdc.st0); - paramstogo = 2; discint = 0; disctime = 0; return; case 0x0d: /*Format track*/ -// rfdc_log("Format\n"); if (fdc.format_state == 1) { -// ioc_fiq(IOC_FIQ_DISC_DATA); fdc.format_state = 2; timer_process(); disctime = 128 * (1 << TIMER_SHIFT); @@ -1770,7 +1713,6 @@ void fdc_callback() } else if (fdc.format_state == 2) { - // fdc_log("Format next stage track %i head %i n %i is_mfm %i gap %i sc %i\n", fdc.pcn[fdc.params[0] & 3], fdc.head, fdc_get_format_n(), fdc_is_mfm(), fdc_get_gap(), fdc_get_format_sectors()); disc_format(fdc.drive, fdc.head, fdc.rate, fdc.params[4]); fdc.format_state = 3; } @@ -1793,7 +1735,6 @@ void fdc_callback() return; case 15: /*Seek*/ -// printf("Seeked to track %i %i\n",fdc.pcn[fdc.params[0] & 3], fdc.drive); drive_num = real_drive(fdc.rw_drive); fdc.st0 = 0x20 | (fdc.params[0] & 7); discint=-3; @@ -1801,7 +1742,6 @@ void fdc_callback() disctime = 2048 * (1 << TIMER_SHIFT); timer_update_outstanding(); fdc.stat = 0x80 | (1 << fdc.drive); -// fdc_log("Stat %02X ST0 %02X\n", fdc.stat, fdc.st0); return; case 0x0e: /*Dump registers*/ fdc.stat = (fdc.stat & 0xf) | 0xd0; @@ -1833,11 +1773,8 @@ void fdc_callback() fdc.pretrk = fdc.params[2]; fdc.fifo = (fdc.params[1] & 0x20) ? 0 : 1; fdc.tfifo = (fdc.params[1] & 0xF) + 1; - // fdc_log("CONFIGURE (%02X, %02X, %02X)\n", fdc.params[0], fdc.params[1], fdc.params[2]); - // fdc_log("FIFO is now %02X, threshold is %02X\n", fdc.fifo, fdc.tfifo); fdc.stat = 0x80; disctime = 0; -// picint(0x40); return; case 0x14: /*Unlock*/ fdc.lock = 0; @@ -1866,19 +1803,13 @@ void fdc_callback() case 0xfc: /*Invalid*/ fdc.dat = fdc.st0 = 0x80; -// fdc_log("Inv!\n"); - //picint(0x40); fdc.stat = (fdc.stat & 0xf) | 0xd0; -// fdc.stat|=0xC0; fdc.res[10] = fdc.st0; paramstogo=1; discint=0; disctime = 0; return; } -// printf("Bad FDC disc int %i\n",discint); -// dumpregs(); -// exit(-1); } void fdc_error(int st5, int st6) @@ -1914,6 +1845,7 @@ void fdc_error(int st5, int st6) fdc.res[10]=0; break; } + update_status_bar_icon(fdc.drive, 0); paramstogo=7; } @@ -1948,7 +1880,6 @@ int fdc_data(uint8_t data) if (fdc.data_ready) { fdc_overrun(); -// fdc_log("Overrun\n"); return -1; } @@ -1960,11 +1891,11 @@ int fdc_data(uint8_t data) } else { - // FIFO enabled + /* FIFO enabled */ fdc_fifo_buf_write(data); if (fdc.fifobufpos == 0) { - // We have wrapped around, means FIFO is over + /* We have wrapped around, means FIFO is over */ fdc.data_ready = 1; fdc.stat = 0xf0; } @@ -1995,7 +1926,7 @@ int fdc_data(uint8_t data) fdc_fifo_buf_advance(); if (fdc.fifobufpos == 0) { - // We have wrapped around, means FIFO is over + /* We have wrapped around, means FIFO is over */ fdc.data_ready = 1; fdc.stat = 0xd0; } @@ -2008,8 +1939,6 @@ int fdc_data(uint8_t data) void fdc_finishread() { fdc.inread = 0; - // disctime = 200 * TIMER_USEC; -// rfdc_log("fdc_finishread\n"); } void fdc_track_finishread(int condition) @@ -2018,7 +1947,6 @@ void fdc_track_finishread(int condition) fdc.satisfying_sectors |= condition; fdc.inread = 0; fdc_callback(); -// rfdc_log("fdc_finishread\n"); } void fdc_sector_finishcompare(int satisfying) @@ -2027,7 +1955,6 @@ void fdc_sector_finishcompare(int satisfying) fdc.satisfying_sectors++; fdc.inread = 0; fdc_callback(); -// rfdc_log("fdc_finishread\n"); } void fdc_sector_finishread() @@ -2035,18 +1962,8 @@ void fdc_sector_finishread() fdc.stat = 0x10; fdc.inread = 0; fdc_callback(); -// rfdc_log("fdc_finishread\n"); } -#if 0 -void fdc_notfound() -{ - fdc_error(5, 0); - -// rfdc_log("c82c711_fdc_notfound\n"); -} -#endif - /* There is no sector ID. */ void fdc_noidam() { @@ -2075,15 +1992,11 @@ void fdc_cannotformat() void fdc_datacrcerror() { fdc_error(0x20, 0x20); - -// rfdc_log("c82c711_fdc_datacrcerror\n"); } void fdc_headercrcerror() { fdc_error(0x20, 0); - -// rfdc_log("c82c711_fdc_headercrcerror\n"); } void fdc_wrongcylinder() @@ -2110,7 +2023,6 @@ int fdc_getdata(int last) if (fdc.written) { fdc_overrun(); -// fdc_log("Overrun\n"); return -1; } if (fdc.pcjr || !fdc.fifo) @@ -2155,7 +2067,6 @@ int fdc_getdata(int last) void fdc_sectorid(uint8_t track, uint8_t side, uint8_t sector, uint8_t size, uint8_t crc1, uint8_t crc2) { - // fdc_log("SectorID %i %i %i %i\n", track, side, sector, size); fdc_int(); fdc.stat=0xD0; fdc.res[4]=(fdd_get_head(real_drive(fdc.drive))?4:0)|fdc.drive; @@ -2170,8 +2081,7 @@ void fdc_sectorid(uint8_t track, uint8_t side, uint8_t sector, uint8_t size, uin void fdc_indexpulse() { -// ioc_irqa(IOC_IRQA_DISC_INDEX); -// rfdc_log("c82c711_fdc_indexpulse\n"); + return; } void fdc_hard_reset() diff --git a/src/fdc.h b/src/fdc.h index 9b1f840aa..5bdb7d00e 100644 --- a/src/fdc.h +++ b/src/fdc.h @@ -64,3 +64,7 @@ void fdc_track_finishread(int condition); int fdc_is_verify(); int real_drive(int drive); +void fdc_overrun(); +void fdc_set_base(int base, int super_io); +int fdc_ps1_525(); +void fdc_hard_reset(); diff --git a/src/fdc37c665.c b/src/fdc37c665.c index 59e0bcb78..53b4f6b24 100644 --- a/src/fdc37c665.c +++ b/src/fdc37c665.c @@ -6,6 +6,7 @@ #include "disc.h" #include "fdc.h" #include "fdd.h" +#include "ide.h" #include "io.h" #include "lpt.h" #include "serial.h" @@ -14,6 +15,7 @@ static uint8_t fdc37c665_lock[2]; static int fdc37c665_curreg; static uint8_t fdc37c665_regs[16]; +static int com3_addr, com4_addr; static void write_lock(uint8_t val) { @@ -26,9 +28,127 @@ static void write_lock(uint8_t val) fdc37c665_lock[1] = val; } +static void ide_handler() +{ + uint16_t or_value = 0; + if (romset == ROM_440FX) + { + return; + } + ide_pri_disable(); + if (fdc37c665_regs[0] & 1) + { + if (fdc37c665_regs[5] & 2) + { + or_value = 0; + } + else + { + or_value = 0x800; + } + ide_set_base(0, 0x170 | or_value); + ide_set_side(0, 0x376 | or_value); + ide_pri_enable_ex(); + } + else + { + pclog("Disabling IDE...\n"); + } +} + +static void set_com34_addr() +{ + switch (fdc37c665_regs[1] & 0x60) + { + case 0x00: + com3_addr = 0x338; + com4_addr = 0x238; + break; + case 0x20: + com3_addr = 0x3e8; + com4_addr = 0x2e8; + break; + case 0x40: + com3_addr = 0x3e8; + com4_addr = 0x2e0; + break; + case 0x60: + com3_addr = 0x220; + com4_addr = 0x228; + break; + } +} + +void set_serial1_addr() +{ + if (fdc37c665_regs[2] & 4) + { + switch (fdc37c665_regs[2] & 3) + { + case 0: + serial1_set(0x3f8, 4); + break; + + case 1: + serial1_set(0x2f8, 3); + break; + + case 2: + serial1_set(com3_addr, 4); + break; + + case 3: + serial1_set(com4_addr, 3); + break; + } + } +} + +void set_serial2_addr() +{ + if (fdc37c665_regs[2] & 0x40) + { + switch (fdc37c665_regs[2] & 0x30) + { + case 0: + serial2_set(0x3f8, 4); + break; + + case 1: + serial2_set(0x2f8, 3); + break; + + case 2: + serial2_set(com3_addr, 4); + break; + + case 3: + serial2_set(com4_addr, 3); + break; + } + } +} + +static void lpt1_handler() +{ + lpt1_remove(); + switch (fdc37c665_regs[1] & 3) + { + case 1: + lpt1_init(0x3bc); + break; + case 2: + lpt1_init(0x378); + break; + case 3: + lpt1_init(0x278); + break; + } +} + void fdc37c665_write(uint16_t port, uint8_t val, void *priv) { - // pclog("Write SuperIO %04x %02x\n", port, val); + uint8_t valxor = 0; if (fdc37c665_lock[0] == 0x55 && fdc37c665_lock[1] == 0x55) { if (port == 0x3f0) @@ -36,89 +156,75 @@ void fdc37c665_write(uint16_t port, uint8_t val, void *priv) if (val == 0xaa) write_lock(val); else - fdc37c665_curreg = val & 0xf; + if (fdc37c665_curreg != 0) + { + fdc37c665_curreg = val & 0xf; + } + else + { + /* Hardcode the IDE to AT type. */ + fdc37c665_curreg = (val & 0xf) | 2; + } } else { - uint16_t com3_addr, com4_addr; + valxor = val ^ fdc37c665_regs[fdc37c665_curreg]; fdc37c665_regs[fdc37c665_curreg] = val; -// pclog("Write superIO %02x %02x %04x(%08x):%08x\n", fdc37c665_curreg, val, CS, cs, pc); - switch (fdc37c665_regs[1] & 0x60) - { - case 0x00: - com3_addr = 0x338; - com4_addr = 0x238; - break; - case 0x20: - com3_addr = 0x3e8; - com4_addr = 0x2e8; - break; - case 0x40: - com3_addr = 0x3e8; - com4_addr = 0x2e0; - break; - case 0x60: - com3_addr = 0x220; - com4_addr = 0x228; - break; + switch(fdc37c665_curreg) + { + case 0: + if (valxor & 1) + { + ide_handler(); + } + break; + case 1: + if (valxor & 3) + { + lpt1_handler(); + } + if (valxor & 0x60) + { + serial1_remove(); + set_com34_addr(); + set_serial1_addr(); + set_serial2_addr(); + } + break; + case 2: + if (valxor & 7) + { + serial1_remove(); + set_serial1_addr(); + } + if (valxor & 0x70) + { + serial2_remove(); + set_serial2_addr(); + } + break; + case 3: + if (valxor & 2) + { + fdc_update_enh_mode((fdc37c665_regs[3] & 2) ? 1 : 0); + } + break; + case 5: + if (valxor & 2) + { + ide_handler(); + } + if (valxor & 0x18) + { + fdc_update_densel_force((fdc37c665_regs[5] & 0x18) >> 3); + } + if (valxor & 0x20) + { + fdd_swap = ((fdc37c665_regs[5] & 0x20) >> 5); + } + break; } - - if (!(fdc37c665_regs[2] & 4)) - serial1_remove(); - else switch (fdc37c665_regs[2] & 3) - { - case 0: - serial1_set(0x3f8, 4); - break; - case 1: - serial1_set(0x2f8, 4); - break; - case 2: - serial1_set(com3_addr, 4); - break; - case 3: - serial1_set(com4_addr, 4); - break; - } - - if (!(fdc37c665_regs[2] & 0x40)) - serial2_remove(); - else switch (fdc37c665_regs[2] & 0x30) - { - case 0x00: - serial2_set(0x3f8, 3); - break; - case 0x10: - serial2_set(0x2f8, 3); - break; - case 0x20: - serial2_set(com3_addr, 3); - break; - case 0x30: - serial2_set(com4_addr, 3); - break; - } - - lpt1_remove(); - lpt2_remove(); - switch (fdc37c665_regs[1] & 3) - { - case 1: - lpt1_init(0x3bc); - break; - case 2: - lpt1_init(0x378); - break; - case 3: - lpt1_init(0x278); - break; - } - - fdc_update_enh_mode((fdc37c665_regs[3] & 2) ? 1 : 0); - - fdc_update_densel_force((fdc37c665_regs[5] & 0x18) >> 3); - fdd_swap = ((fdc37c665_regs[5] & 0x20) >> 5); } } else @@ -130,7 +236,6 @@ void fdc37c665_write(uint16_t port, uint8_t val, void *priv) uint8_t fdc37c665_read(uint16_t port, void *priv) { - // pclog("Read SuperIO %04x %02x\n", port, fdc37c665_curreg); if (fdc37c665_lock[0] == 0x55 && fdc37c665_lock[1] == 0x55) { if (port == 0x3f1) @@ -141,8 +246,25 @@ uint8_t fdc37c665_read(uint16_t port, void *priv) void fdc37c665_reset(void) { + com3_addr = 0x338; + com4_addr = 0x238; + + fdc_remove(); + fdc_add_for_superio(); + fdc_update_is_nsc(0); + serial1_remove(); + serial1_set(0x3f8, 4); + + serial2_remove(); + serial2_set(0x2f8, 3); + + lpt2_remove(); + + lpt1_remove(); + lpt1_init(0x378); + memset(fdc37c665_lock, 0, 2); memset(fdc37c665_regs, 0, 16); fdc37c665_regs[0x0] = 0x3b; diff --git a/src/fdc37c669.c b/src/fdc37c669.c new file mode 100644 index 000000000..337b8cec1 --- /dev/null +++ b/src/fdc37c669.c @@ -0,0 +1,335 @@ +/* + SMSC SMC FDC37C669 Super I/O Chip + Used by the 430TX +*/ + +#include "ibm.h" + +#include "disc.h" +#include "fdc.h" +#include "fdd.h" +#include "io.h" +#include "ide.h" +#include "lpt.h" +#include "serial.h" +#include "fdc37c669.h" + +static int fdc37c669_locked; +static int fdc37c669_rw_locked = 0; +static int fdc37c669_curreg = 0; +static uint8_t fdc37c669_regs[42]; +static uint8_t tries; + +static uint16_t fdc_valid_ports[2] = {0x3F0, 0x370}; +static uint16_t ide_valid_ports[2] = {0x1F0, 0x170}; +static uint16_t ide_as_valid_ports[2] = {0x3F6, 0x376}; +static uint16_t lpt1_valid_ports[3] = {0x3BC, 0x378, 0x278}; +static uint16_t com1_valid_ports[9] = {0x3F8, 0x2F8, 0x338, 0x3E8, 0x2E8, 0x220, 0x238, 0x2E0, 0x228}; +static uint16_t com2_valid_ports[9] = {0x3F8, 0x2F8, 0x338, 0x3E8, 0x2E8, 0x220, 0x238, 0x2E0, 0x228}; + +static uint8_t is_in_array(uint16_t *port_array, uint8_t max, uint16_t port) +{ + uint8_t i = 0; + + for (i = 0; i < max; i++) + { + if (port_array[i] == port) return 1; + } + return 0; +} + +static uint16_t make_port(uint8_t reg) +{ + uint16_t p = 0; + + switch(reg) + { + case 0x20: + p = ((uint16_t) (fdc37c669_regs[reg] & 0xfc)) << 2; + p &= 0xFF0; + if ((p < 0x100) || (p > 0x3F0)) p = 0x3F0; + if (!(is_in_array(fdc_valid_ports, 2, p))) p = 0x3F0; + fdc37c669_regs[reg] = ((p >> 2) & 0xfc) | (fdc37c669_regs[reg] & 3); + break; + case 0x21: + p = ((uint16_t) (fdc37c669_regs[reg] & 0xfc)) << 2; + p &= 0xFF0; + if ((p < 0x100) || (p > 0x3F0)) p = 0x1F0; + if (!(is_in_array(ide_valid_ports, 2, p))) p = 0x1F0; + fdc37c669_regs[reg] = ((p >> 2) & 0xfc) | (fdc37c669_regs[reg] & 3); + break; + case 0x22: + p = ((uint16_t) (fdc37c669_regs[reg] & 0xfc)) << 2; + p &= 0xFF0; + if ((p < 0x106) || (p > 0x3F6)) p = 0x3F6; + if (!(is_in_array(ide_as_valid_ports, 2, p))) p = 0x3F6; + fdc37c669_regs[reg] = ((p >> 2) & 0xfc) | (fdc37c669_regs[reg] & 3); + break; + case 0x23: + p = ((uint16_t) (fdc37c669_regs[reg] & 0xff)) << 2; + p &= 0xFFC; + if ((p < 0x100) || (p > 0x3F8)) p = 0x378; + if (!(is_in_array(lpt1_valid_ports, 3, p))) p = 0x378; + fdc37c669_regs[reg] = (p >> 2); + break; + case 0x24: + p = ((uint16_t) (fdc37c669_regs[reg] & 0xfe)) << 2; + p &= 0xFF8; + if ((p < 0x100) || (p > 0x3F8)) p = 0x3F8; + if (!(is_in_array(com1_valid_ports, 9, p))) p = 0x3F8; + fdc37c669_regs[reg] = ((p >> 2) & 0xfe) | (fdc37c669_regs[reg] & 1); + break; + case 0x25: + p = ((uint16_t) (fdc37c669_regs[reg] & 0xfe)) << 2; + p &= 0xFF8; + if ((p < 0x100) || (p > 0x3F8)) p = 0x2F8; + if (!(is_in_array(com2_valid_ports, 9, p))) p = 0x2F8; + fdc37c669_regs[reg] = ((p >> 2) & 0xfe) | (fdc37c669_regs[reg] & 1); + break; + } + + return p; +} + +void fdc37c669_write(uint16_t port, uint8_t val, void *priv) +{ + uint8_t index = (port & 1) ? 0 : 1; + uint8_t valxor = 0; + uint8_t max = 42; + pclog("fdc37c669_write : port=%04x reg %02X = %02X locked=%i\n", port, fdc37c669_curreg, val, fdc37c669_locked); + + if (index) + { + if ((val == 0x55) && !fdc37c669_locked) + { + if (tries) + { + fdc37c669_locked = 1; + tries = 0; + } + else + { + tries++; + } + } + else + { + if (fdc37c669_locked) + { + if (val < max) fdc37c669_curreg = val; + if (val == 0xaa) fdc37c669_locked = 0; + } + else + { + if (tries) + tries = 0; + } + } + } + else + { + if (fdc37c669_locked) + { + if ((fdc37c669_curreg < 0x18) && (fdc37c669_rw_locked)) return; + if ((fdc37c669_curreg >= 0x26) && (fdc37c669_curreg <= 0x27)) return; + if (fdc37c669_curreg == 0x29) return; + valxor = val ^ fdc37c669_regs[fdc37c669_curreg]; + fdc37c669_regs[fdc37c669_curreg] = val; + goto process_value; + } + } + return; + +process_value: + switch(fdc37c669_curreg) + { + case 0: + if (valxor & 3) + { + ide_pri_disable(); + if ((fdc37c669_regs[0] & 3) == 2) ide_pri_enable_ex(); + break; + } + if (valxor & 8) + { + fdc_remove(); + if ((fdc37c669_regs[0] & 8) && (fdc37c669_regs[0x20] & 0xc0)) fdc_set_base(make_port(0x20), 1); + } + break; + case 1: + if (valxor & 4) + { + lpt1_remove(); + if ((fdc37c669_regs[1] & 4) && (fdc37c669_regs[0x23] & 0xc0)) lpt1_init(make_port(0x23)); + } + if (valxor & 7) + { + fdc37c669_rw_locked = (val & 8) ? 0 : 1; + } + break; + case 2: + if (valxor & 8) + { + serial1_remove(); + if ((fdc37c669_regs[2] & 8) && (fdc37c669_regs[0x24] & 0xc0)) serial1_set(make_port(0x24), (fdc37c669_regs[0x28] & 0xF0) >> 8); + } + if (valxor & 0x80) + { + serial2_remove(); + if ((fdc37c669_regs[2] & 0x80) && (fdc37c669_regs[0x25] & 0xc0)) serial2_set(make_port(0x25), fdc37c669_regs[0x28] & 0xF); + } + break; + case 3: + if (valxor & 2) fdc_update_enh_mode((val & 2) ? 1 : 0); + break; + case 5: + if (valxor & 0x18) fdc_update_densel_force((val & 0x18) >> 3); + if (valxor & 0x20) fdd_swap = ((val & 0x20) >> 5); + break; + case 0xB: + if (valxor & 3) fdc_update_rwc(0, val & 3); + if (valxor & 0xC) fdc_update_rwc(1, (val & 0xC) >> 2); + break; + case 0x20: + if (valxor & 0xfc) + { + fdc_remove(); + if ((fdc37c669_regs[0] & 8) && (fdc37c669_regs[0x20] & 0xc0)) fdc_set_base(make_port(0x20), 1); + } + break; + case 0x21: + case 0x22: + if (valxor & 0xfc) + { + ide_pri_disable(); + switch (fdc37c669_curreg) + { + case 0x21: + ide_set_base(0, make_port(0x21)); + break; + case 0x22: + ide_set_side(0, make_port(0x22)); + break; + } + if ((fdc37c669_regs[0] & 3) == 2) ide_pri_enable_ex(); + } + break; + case 0x23: + if (valxor) + { + lpt1_remove(); + if ((fdc37c669_regs[1] & 4) && (fdc37c669_regs[0x23] & 0xc0)) lpt1_init(make_port(0x23)); + } + break; + case 0x24: + if (valxor & 0xfe) + { + serial1_remove(); + if ((fdc37c669_regs[2] & 8) && (fdc37c669_regs[0x24] & 0xc0)) serial1_set(make_port(0x24), (fdc37c669_regs[0x28] & 0xF0) >> 8); + } + break; + case 0x25: + if (valxor & 0xfe) + { + serial2_remove(); + if ((fdc37c669_regs[2] & 0x80) && (fdc37c669_regs[0x25] & 0xc0)) serial2_set(make_port(0x25), fdc37c669_regs[0x28] & 0xF); + } + break; + case 0x28: + if (valxor & 0xf) + { + serial2_remove(); + if ((fdc37c669_regs[0x28] & 0xf) == 0) fdc37c669_regs[0x28] |= 0x3; + if ((fdc37c669_regs[2] & 0x80) && (fdc37c669_regs[0x25] & 0xc0)) serial2_set(make_port(0x25), fdc37c669_regs[0x28] & 0xF); + } + if (valxor & 0xf0) + { + serial1_remove(); + if ((fdc37c669_regs[0x28] & 0xf0) == 0) fdc37c669_regs[0x28] |= 0x40; + if ((fdc37c669_regs[2] & 8) && (fdc37c669_regs[0x24] & 0xc0)) serial1_set(make_port(0x24), (fdc37c669_regs[0x28] & 0xF0) >> 8); + } + break; + } +} + +uint8_t fdc37c669_read(uint16_t port, void *priv) +{ + uint8_t index = (port & 1) ? 0 : 1; + + pclog("fdc37c669_read : port=%04x reg %02X locked=%i\n", port, fdc37c669_curreg, fdc37c669_locked); + + if (!fdc37c669_locked) + { + return 0xFF; + } + + if (index) + return fdc37c669_curreg; + else + { + pclog("0x03F1: %02X\n", fdc37c669_regs[fdc37c669_curreg]); + if ((fdc37c669_curreg < 0x18) && (fdc37c669_rw_locked)) return 0xff; + return fdc37c669_regs[fdc37c669_curreg]; + } +} + +void fdc37c669_reset(void) +{ + fdc_remove(); + fdc_add_for_superio(); + + fdc_update_is_nsc(0); + + serial1_remove(); + serial1_set(0x3f8, 4); + + serial2_remove(); + serial2_set(0x2f8, 3); + + lpt2_remove(); + + lpt1_remove(); + lpt1_init(0x378); + + memset(fdc37c669_regs, 0, 42); + fdc37c669_regs[0] = 0x28; + fdc37c669_regs[1] = 0x9C; + fdc37c669_regs[2] = 0x88; + fdc37c669_regs[3] = 0x78; + fdc37c669_regs[4] = 0; + fdc37c669_regs[5] = 0; + fdc37c669_regs[6] = 0xFF; + fdc37c669_regs[7] = 0; + fdc37c669_regs[8] = 0; + fdc37c669_regs[9] = 0; + fdc37c669_regs[0xA] = 0; + fdc37c669_regs[0xB] = 0; + fdc37c669_regs[0xC] = 0; + fdc37c669_regs[0xD] = 3; + fdc37c669_regs[0xE] = 2; + fdc37c669_regs[0x1E] = 0x80; /* Gameport controller. */ + fdc37c669_regs[0x20] = (0x3f0 >> 2) & 0xfc; + fdc37c669_regs[0x21] = (0x1f0 >> 2) & 0xfc; + fdc37c669_regs[0x22] = ((0x3f6 >> 2) & 0xfc) | 1; + fdc37c669_regs[0x23] = (0x378 >> 2); + fdc37c669_regs[0x24] = (0x3f8 >> 2) & 0xfe; + fdc37c669_regs[0x25] = (0x2f8 >> 2) & 0xfe; + fdc37c669_regs[0x26] = (2 << 4) | 3; + fdc37c669_regs[0x27] = (6 << 4) | 7; + fdc37c669_regs[0x28] = (4 << 4) | 3; + + fdc_update_densel_polarity(1); + fdc_update_densel_force(0); + fdd_swap = 0; + fdc37c669_locked = 0; + fdc37c669_rw_locked = 0; +} + +void fdc37c669_init() +{ + io_sethandler(0x3f0, 0x0002, fdc37c669_read, NULL, NULL, fdc37c669_write, NULL, NULL, NULL); + + fdc37c669_reset(); + + pci_reset_handler.super_io_reset = fdc37c669_reset; +} diff --git a/src/fdc37c669.h b/src/fdc37c669.h new file mode 100644 index 000000000..f3fa420d7 --- /dev/null +++ b/src/fdc37c669.h @@ -0,0 +1 @@ +extern void fdc37c669_init(); diff --git a/src/fdc37c932fr.c b/src/fdc37c932fr.c index 27385712a..13b8371bd 100644 --- a/src/fdc37c932fr.c +++ b/src/fdc37c932fr.c @@ -144,9 +144,6 @@ void fdc37c932fr_write(uint16_t port, uint8_t val, void *priv) uint8_t index = (port & 1) ? 0 : 1; uint8_t valxor = 0; uint16_t ld_port = 0; - uint16_t ld_port2 = 0; - int temp; - // pclog("fdc37c932fr_write : port=%04x reg %02X = %02X locked=%i\n", port, fdc37c932fr_curreg, val, fdc37c932fr_locked); if (index) { @@ -367,7 +364,6 @@ uint8_t fdc37c932fr_gpio_read(uint16_t port, void *priv) uint8_t fdc37c932fr_read(uint16_t port, void *priv) { - // pclog("fdc37c932fr_read : port=%04x reg %02X locked=%i\n", port, fdc37c932fr_curreg, fdc37c932fr_locked); uint8_t index = (port & 1) ? 0 : 1; if (!fdc37c932fr_locked) @@ -381,12 +377,10 @@ uint8_t fdc37c932fr_read(uint16_t port, void *priv) { if (fdc37c932fr_curreg < 0x30) { - // pclog("0x03F1: %02X\n", fdc37c932fr_regs[fdc37c932fr_curreg]); return fdc37c932fr_regs[fdc37c932fr_curreg]; } else { - // pclog("0x03F1 (CD=%02X): %02X\n", fdc37c932fr_regs[7], fdc37c932fr_ld_regs[fdc37c932fr_regs[7]][fdc37c932fr_curreg]); if ((fdc37c932fr_regs[7] == 0) && (fdc37c932fr_curreg == 0xF2)) return (fdc_get_rwc(0) | (fdc_get_rwc(1) << 2)); return fdc37c932fr_ld_regs[fdc37c932fr_regs[7]][fdc37c932fr_curreg]; } diff --git a/src/fdd.c b/src/fdd.c index b6c49143a..1ecc6eebd 100644 --- a/src/fdd.c +++ b/src/fdd.c @@ -18,85 +18,116 @@ static struct } fdd[FDD_NUM]; /* Flags: - Bit 0: 300 rpm supported; - Bit 1: 360 rpm supported; - Bit 2: size (0 = 3.5", 1 = 5.25"); - Bit 3: double density supported; - Bit 4: high density supported; - Bit 5: extended density supported; - Bit 6: double step for 40-track media; - Bit 7: invert DENSEL polarity; - Bit 8: ignore DENSEL; - Bit 9: drive is a PS/2 drive; + Bit 0: 300 rpm supported; + Bit 1: 360 rpm supported; + Bit 2: size (0 = 3.5", 1 = 5.25"); + Bit 3: sides (0 = 1, 1 = 2); + Bit 4: double density supported; + Bit 5: high density supported; + Bit 6: extended density supported; + Bit 7: double step for 40-track media; + Bit 8: invert DENSEL polarity; + Bit 9: ignore DENSEL; + Bit 10: drive is a PS/2 drive; */ #define FLAG_RPM_300 1 #define FLAG_RPM_360 2 -#define FLAG_525 4 -#define FLAG_HOLE0 8 -#define FLAG_HOLE1 16 -#define FLAG_HOLE2 32 -#define FLAG_DOUBLE_STEP 64 -#define FLAG_INVERT_DENSEL 128 -#define FLAG_IGNORE_DENSEL 256 -#define FLAG_PS2 512 +#define FLAG_525 4 +#define FLAG_DS 8 +#define FLAG_HOLE0 16 +#define FLAG_HOLE1 32 +#define FLAG_HOLE2 64 +#define FLAG_DOUBLE_STEP 128 +#define FLAG_INVERT_DENSEL 256 +#define FLAG_IGNORE_DENSEL 512 +#define FLAG_PS2 1024 static struct { int max_track; int flags; + char name[64]; + char internal_name[24]; } drive_types[] = { { /*None*/ - .max_track = 0, - .flags = 0 + 0, 0, "None", "none" + }, + { /*5.25" 1DD*/ + 43, FLAG_RPM_300 | FLAG_525 | FLAG_HOLE0, "5.25\" 180k", "525_1dd" }, { /*5.25" DD*/ - .max_track = 43, - .flags = FLAG_RPM_300 | FLAG_525 | FLAG_HOLE0 + 43, FLAG_RPM_300 | FLAG_525 | FLAG_DS | FLAG_HOLE0, "5.25\" 360k", "525_2dd" + }, + { /*5.25" QD*/ + 86, FLAG_RPM_300 | FLAG_525 | FLAG_DS | FLAG_HOLE0 | FLAG_DOUBLE_STEP, "5.25\" 720k", "525_2qd" + }, + { /*5.25" HD PS/2*/ + 86, FLAG_RPM_360 | FLAG_525 | FLAG_DS | FLAG_HOLE0 | FLAG_HOLE1 | FLAG_DOUBLE_STEP | FLAG_INVERT_DENSEL | FLAG_PS2, "5.25\" 1.2M PS/2", "525_2hd_ps2" }, { /*5.25" HD*/ - .max_track = 86, - .flags = FLAG_RPM_360 | FLAG_525 | FLAG_HOLE0 | FLAG_HOLE1 | FLAG_DOUBLE_STEP + 86, FLAG_RPM_360 | FLAG_525 | FLAG_DS | FLAG_HOLE0 | FLAG_HOLE1 | FLAG_DOUBLE_STEP, "5.25\" 1.2M", "525_2hd" }, { /*5.25" HD Dual RPM*/ - .max_track = 86, - .flags = FLAG_RPM_300 | FLAG_RPM_360 | FLAG_525 | FLAG_HOLE0 | FLAG_HOLE1 | FLAG_DOUBLE_STEP + 86, FLAG_RPM_300 | FLAG_RPM_360 | FLAG_525 | FLAG_DS | FLAG_HOLE0 | FLAG_HOLE1 | FLAG_DOUBLE_STEP, "5.25\" 1.2M 300/360 RPM", "525_2hd_dualrpm" + }, + { /*3.5" 1DD*/ + 86, FLAG_RPM_300 | FLAG_HOLE0 | FLAG_DOUBLE_STEP, "3.5\" 360k", "35_1dd" }, { /*3.5" DD*/ - .max_track = 86, - .flags = FLAG_RPM_300 | FLAG_HOLE0 | FLAG_DOUBLE_STEP + 86, FLAG_RPM_300 | FLAG_DS | FLAG_HOLE0 | FLAG_DOUBLE_STEP, "3.5\" 720k", "35_2dd" }, { /*3.5" HD PS/2*/ - .max_track = 86, - .flags = FLAG_RPM_300 | FLAG_HOLE0 | FLAG_HOLE1 | FLAG_DOUBLE_STEP | FLAG_INVERT_DENSEL | FLAG_PS2 + 86, FLAG_RPM_300 | FLAG_DS | FLAG_HOLE0 | FLAG_HOLE1 | FLAG_DOUBLE_STEP | FLAG_INVERT_DENSEL | FLAG_PS2, "3.5\" 1.44M PS/2", "35_2hd_ps2" }, { /*3.5" HD*/ - .max_track = 86, - .flags = FLAG_RPM_300 | FLAG_HOLE0 | FLAG_HOLE1 | FLAG_DOUBLE_STEP + 86, FLAG_RPM_300 | FLAG_DS | FLAG_HOLE0 | FLAG_HOLE1 | FLAG_DOUBLE_STEP, "3.5\" 1.44M", "35_2hd" }, { /*3.5" HD PC-98*/ - .max_track = 86, - .flags = FLAG_RPM_300 | FLAG_RPM_360 | FLAG_HOLE0 | FLAG_HOLE1 | FLAG_DOUBLE_STEP | FLAG_INVERT_DENSEL + 86, FLAG_RPM_300 | FLAG_RPM_360 | FLAG_DS | FLAG_HOLE0 | FLAG_HOLE1 | FLAG_DOUBLE_STEP | FLAG_INVERT_DENSEL, "3.5\" 1.25M PC-98", "35_2hd_nec" }, { /*3.5" HD 3-Mode*/ - .max_track = 86, - .flags = FLAG_RPM_300 | FLAG_RPM_360 | FLAG_HOLE0 | FLAG_HOLE1 | FLAG_DOUBLE_STEP + 86, FLAG_RPM_300 | FLAG_RPM_360 | FLAG_DS | FLAG_HOLE0 | FLAG_HOLE1 | FLAG_DOUBLE_STEP, "3.5\" 1.44M 300/360 RPM", "35_2hd_3mode" }, { /*3.5" ED*/ - .max_track = 86, - .flags = FLAG_RPM_300 | FLAG_HOLE0 | FLAG_HOLE1 | FLAG_HOLE2 | FLAG_DOUBLE_STEP + 86, FLAG_RPM_300 | FLAG_DS | FLAG_HOLE0 | FLAG_HOLE1 | FLAG_HOLE2 | FLAG_DOUBLE_STEP, "3.5\" 2.88M", "35_2ed" + }, + { /*End of list*/ + -1, -1, "", "" } }; int fdd_swap = 0; +char *fdd_getname(int type) +{ + return drive_types[type].name; +} + +char *fdd_get_internal_name(int type) +{ + return drive_types[type].internal_name; +} + +int fdd_get_from_internal_name(char *s) +{ + int c = 0; + + while (strlen(drive_types[c].internal_name)) + { + if (!strcmp(drive_types[c].internal_name, s)) + return c; + c++; + } + + return 0; +} + void fdd_forced_seek(int drive, int track_diff) { drive = real_drive(drive); fdd[drive].track += track_diff; - - // pclog("Seeking %i tracks...\n", track_diff); if (fdd[drive].track < 0) fdd[drive].track = 0; @@ -120,8 +151,6 @@ void fdd_seek(int drive, int track_diff) fdd[drive].track += track_diff; - // pclog("Seeking %i tracks...\n", track_diff); - if (fdd[drive].track < 0) fdd[drive].track = 0; @@ -209,7 +238,6 @@ int fdd_can_read_medium(int drive) hole = 1 << (hole + 3); -// pclog("Drive %02X, type %02X, hole flag %02X, flags %02X, result %02X\n", drive, fdd[drive].type, hole, drive_types[fdd[drive].type].flags, drive_types[fdd[drive].type].flags & hole); return (drive_types[fdd[drive].type].flags & hole) ? 1 : 0; } diff --git a/src/fdd.h b/src/fdd.h index 131e94bcf..f9481148f 100644 --- a/src/fdd.h +++ b/src/fdd.h @@ -21,4 +21,9 @@ int fdd_get_flags(int drive); extern int fdd_swap; -void fdd_init(); \ No newline at end of file +void fdd_init(); +int fdd_get_densel(int drive); + +void fdd_setswap(int swap); + +char *fdd_getname(int type); diff --git a/src/fdi2raw.c b/src/fdi2raw.c index a82af5230..68edb5e26 100644 --- a/src/fdi2raw.c +++ b/src/fdi2raw.c @@ -28,7 +28,6 @@ #include "sysdeps.h" #include "zfile.h"*/ /* ELSE */ -//#include "types.h" #define xmalloc malloc #include "fdi2raw.h" @@ -243,26 +242,26 @@ static void fdi_decode (uae_u8 *stream, int size, uae_u8 *out) sub_stream_shift = 1; while (sub_stream_shift) { - //sub-stream header decode + /* sub-stream header decode */ sign_extend = *stream++; sub_stream_shift = sign_extend & 0x7f; sign_extend &= 0x80; sixteen_bit = (*stream++) & 0x80; - //huffman tree architecture decode + /* huffman tree architecture decode */ temp = *stream++; temp2 = 0x80; stream = expand_tree (stream, &root); if (temp2 == 0x80) stream--; - //huffman output values decode + /* huffman output values decode */ if (sixteen_bit) stream = values_tree16 (stream, &root); else stream = values_tree8 (stream, &root); - //sub-stream data decode + /* sub-stream data decode */ temp2 = 0; for (i = 0; i < size; i++) { uae_u32 v; @@ -312,20 +311,18 @@ static int decode_raw_track (FDI *fdi) static void zxx (FDI *fdi) { outlog ("track %d: unknown track type 0x%02.2X\n", fdi->current_track, fdi->track_type); -// return -1; } /* unsupported track */ #if 0 static void zyy (FDI *fdi) { outlog ("track %d: unsupported track type 0x%02.2X\n", fdi->current_track, fdi->track_type); -// return -1; } #endif /* empty track */ static void track_empty (FDI *fdi) { -// return 0; + return; } /* unknown sector described type */ @@ -575,7 +572,6 @@ static void s0d(FDI *fdi) } }*/ -//static int check_offset; /*static uae_u16 getmfmword (uae_u8 *mbuf) { uae_u32 v; @@ -633,7 +629,6 @@ static int amiga_check_track (FDI *fdi) mbuf = bigmfmbuf; memset (sectable, 0, sizeof (sectable)); - //memcpy (mbuf + fwlen, mbuf, fwlen * sizeof (uae_u16)); mend = bigmfmbuf + length; mend -= (4 + 16 + 8 + 512); @@ -648,7 +643,6 @@ static int amiga_check_track (FDI *fdi) mbuf[0] = 0x44; mbuf[1] = 0x89; } -// check_offset++; if (check_offset > 7) { check_offset = 0; mbuf++; @@ -1399,7 +1393,7 @@ static void init_array(uint32_t standard_MFM_2_bit_cell_size, int nb_of_bits) int i; for (i = 0; i < FDI_MAX_ARRAY; i++) { - psarray[i].size = standard_MFM_2_bit_cell_size; // That is (total track length / 50000) for Amiga double density + psarray[i].size = standard_MFM_2_bit_cell_size; /* That is (total track length / 50000) for Amiga double density */ total += psarray[i].size; psarray[i].number_of_bits = nb_of_bits; totaldiv += psarray[i].number_of_bits; @@ -1448,7 +1442,6 @@ static void fdi2_decode (FDI *fdi, uint32_t totalavg, uae_u32 *avgp, uae_u32 *mi /* you can try tighter ranges than 25%, or wider ranges. I would probably go for tighter... */ if ((avg_size < (standard_MFM_8_bit_cell_size - (pulse_limitval * standard_MFM_8_bit_cell_size / 100))) || (avg_size > (standard_MFM_8_bit_cell_size + (pulse_limitval * standard_MFM_8_bit_cell_size / 100)))) { - //init_array(standard_MFM_2_bit_cell_size, 2); avg_size = standard_MFM_8_bit_cell_size; } /* this is to prevent the average value from going too far @@ -1578,7 +1571,6 @@ static void fdi2_decode (FDI *fdi, uint32_t totalavg, uae_u32 *avgp, uae_u32 *mi /* you can try tighter ranges than 25%, or wider ranges. I would probably go for tighter... */ if ((avg_size < (standard_MFM_8_bit_cell_size - (pulse_limitval * standard_MFM_8_bit_cell_size / 100))) || (avg_size > (standard_MFM_8_bit_cell_size + (pulse_limitval * standard_MFM_8_bit_cell_size / 100)))) { - //init_array(standard_MFM_2_bit_cell_size, mfm + 1); avg_size = standard_MFM_8_bit_cell_size; } /* this is to prevent the average value from going too far @@ -1801,16 +1793,15 @@ static void fdi2_celltiming (FDI *fdi, uint32_t totalavg, int bitoffset, uae_u16 static int decode_lowlevel_track (FDI *fdi, int track, struct fdi_cache *cache) { - uae_u8 *p1, *d; + uae_u8 *p1; uae_u32 *p2; uae_u32 *avgp, *minp = 0, *maxp = 0; uae_u8 *idxp = 0; uae_u32 maxidx, totalavg, weakbits; int i, j, len, pulses, indexoffset; int avg_free, min_free = 0, max_free = 0, idx_free; - int idx_off1, idx_off2, idx_off3; + int idx_off1 = 0, idx_off2 = 0, idx_off3 = 0; - d = fdi->track_dst; p1 = fdi->track_src; pulses = get_u32 (p1); if (!pulses) @@ -2077,7 +2068,6 @@ int fdi2raw_loadrevolution_2 (FDI *fdi, uae_u16 *mfmbuf, uae_u16 *tracktiming, i fdi2_decode (fdi, cache->totalavg, cache->avgp, cache->minp, cache->maxp, cache->idxp, cache->maxidx, &idx, cache->pulses, mfm); - //fdi2_gcr_decode (fdi, totalavg, avgp, minp, maxp, idxp, idx_off1, idx_off2, idx_off3, maxidx, pulses); /* outlog("track %d: nbits=%d avg len=%.2f weakbits=%d idx=%d\n", track, bitoffset, (double)cache->totalavg / bitoffset, cache->weakbits, cache->indexoffset); */ len = fdi->out; @@ -2164,8 +2154,6 @@ int fdi2raw_loadtrack (FDI *fdi, uae_u16 *mfmbuf, uae_u16 *tracktiming, int trac } -// amiga_check_track (fdi); - if (fdi->err) return 0; diff --git a/src/fdi2raw.h b/src/fdi2raw.h index 207dabd7e..b8c3201e5 100644 --- a/src/fdi2raw.h +++ b/src/fdi2raw.h @@ -8,7 +8,6 @@ #define uae_u16 uint16_t #define uae_u32 uint32_t -//#include "types.h" #include typedef struct fdi FDI; diff --git a/src/filters.h b/src/filters.h index acc022ba0..6269b55e3 100644 --- a/src/filters.h +++ b/src/filters.h @@ -3,8 +3,7 @@ */ #define NCoef 2 -//fc=350Hz -static inline float low_iir(int i, float NewSample) { +static __inline float low_iir(int i, float NewSample) { float ACoef[NCoef+1] = { 0.00049713569693400649, 0.00099427139386801299, @@ -17,17 +16,17 @@ static inline float low_iir(int i, float NewSample) { 0.93726236021404663000 }; - static float y[2][NCoef+1]; //output samples - static float x[2][NCoef+1]; //input samples + static float y[2][NCoef+1]; /* output samples */ + static float x[2][NCoef+1]; /* input samples */ int n; - //shift the old samples + /* shift the old samples */ for(n=NCoef; n>0; n--) { x[i][n] = x[i][n-1]; y[i][n] = y[i][n-1]; } - //Calculate the new output + /* Calculate the new output */ x[i][0] = NewSample; y[i][0] = ACoef[0] * x[i][0]; for(n=1; n<=NCoef; n++) @@ -36,8 +35,7 @@ static inline float low_iir(int i, float NewSample) { return y[i][0]; } -//fc=350Hz -static inline float low_cut_iir(int i, float NewSample) { +static __inline float low_cut_iir(int i, float NewSample) { float ACoef[NCoef+1] = { 0.96839970114733542000, -1.93679940229467080000, @@ -50,17 +48,17 @@ static inline float low_cut_iir(int i, float NewSample) { 0.93726236021916731000 }; - static float y[2][NCoef+1]; //output samples - static float x[2][NCoef+1]; //input samples + static float y[2][NCoef+1]; /* output samples */ + static float x[2][NCoef+1]; /* input samples */ int n; - //shift the old samples + /* shift the old samples */ for(n=NCoef; n>0; n--) { x[i][n] = x[i][n-1]; y[i][n] = y[i][n-1]; } - //Calculate the new output + /* Calculate the new output */ x[i][0] = NewSample; y[i][0] = ACoef[0] * x[i][0]; for(n=1; n<=NCoef; n++) @@ -69,8 +67,7 @@ static inline float low_cut_iir(int i, float NewSample) { return y[i][0]; } -//fc=3.5kHz -static inline float high_iir(int i, float NewSample) { +static __inline float high_iir(int i, float NewSample) { float ACoef[NCoef+1] = { 0.72248704753064896000, -1.44497409506129790000, @@ -82,17 +79,17 @@ static inline float high_iir(int i, float NewSample) { -1.36640781670578510000, 0.52352474706139873000 }; - static float y[2][NCoef+1]; //output samples - static float x[2][NCoef+1]; //input samples + static float y[2][NCoef+1]; /* output samples */ + static float x[2][NCoef+1]; /* input samples */ int n; - //shift the old samples + /* shift the old samples */ for(n=NCoef; n>0; n--) { x[i][n] = x[i][n-1]; y[i][n] = y[i][n-1]; } - //Calculate the new output + /* Calculate the new output */ x[i][0] = NewSample; y[i][0] = ACoef[0] * x[i][0]; for(n=1; n<=NCoef; n++) @@ -101,8 +98,7 @@ static inline float high_iir(int i, float NewSample) { return y[i][0]; } -//fc=3.5kHz -static inline float high_cut_iir(int i, float NewSample) { +static __inline float high_cut_iir(int i, float NewSample) { float ACoef[NCoef+1] = { 0.03927726802250377400, 0.07855453604500754700, @@ -114,17 +110,17 @@ static inline float high_cut_iir(int i, float NewSample) { -1.36640781666419950000, 0.52352474703279628000 }; - static float y[2][NCoef+1]; //output samples - static float x[2][NCoef+1]; //input samples + static float y[2][NCoef+1]; /* output samples */ + static float x[2][NCoef+1]; /* input samples */ int n; - //shift the old samples + /* shift the old samples */ for(n=NCoef; n>0; n--) { x[i][n] = x[i][n-1]; y[i][n] = y[i][n-1]; } - //Calculate the new output + /* Calculate the new output */ x[i][0] = NewSample; y[i][0] = ACoef[0] * x[i][0]; for(n=1; n<=NCoef; n++) @@ -137,8 +133,7 @@ static inline float high_cut_iir(int i, float NewSample) { #undef NCoef #define NCoef 1 -//fc=3.2kHz -static inline float sb_iir(int i, float NewSample) { +static __inline float sb_iir(int i, float NewSample) { /* float ACoef[NCoef+1] = { 0.03356837051492005100, 0.06713674102984010200, @@ -160,17 +155,17 @@ static inline float sb_iir(int i, float NewSample) { 1.00000000000000000000, -0.64940759319751051000 }; - static float y[2][NCoef+1]; //output samples - static float x[2][NCoef+1]; //input samples + static float y[2][NCoef+1]; /* output samples */ + static float x[2][NCoef+1]; /* input samples */ int n; - //shift the old samples + /* shift the old samples */ for(n=NCoef; n>0; n--) { x[i][n] = x[i][n-1]; y[i][n] = y[i][n-1]; } - //Calculate the new output + /* Calculate the new output */ x[i][0] = NewSample; y[i][0] = ACoef[0] * x[i][0]; for(n=1; n<=NCoef; n++) @@ -184,8 +179,7 @@ static inline float sb_iir(int i, float NewSample) { #undef NCoef #define NCoef 2 -//fc=150Hz -static inline float adgold_highpass_iir(int i, float NewSample) { +static __inline float adgold_highpass_iir(int i, float NewSample) { float ACoef[NCoef+1] = { 0.98657437157334349000, -1.97314874314668700000, @@ -198,17 +192,17 @@ static inline float adgold_highpass_iir(int i, float NewSample) { 0.97261396931534050000 }; - static float y[2][NCoef+1]; //output samples - static float x[2][NCoef+1]; //input samples + static float y[2][NCoef+1]; /* output samples */ + static float x[2][NCoef+1]; /* input samples */ int n; - //shift the old samples + /* shift the old samples */ for(n=NCoef; n>0; n--) { x[i][n] = x[i][n-1]; y[i][n] = y[i][n-1]; } - //Calculate the new output + /* Calculate the new output */ x[i][0] = NewSample; y[i][0] = ACoef[0] * x[i][0]; for(n=1; n<=NCoef; n++) @@ -217,8 +211,7 @@ static inline float adgold_highpass_iir(int i, float NewSample) { return y[i][0]; } -//fc=150Hz -static inline float adgold_lowpass_iir(int i, float NewSample) { +static __inline float adgold_lowpass_iir(int i, float NewSample) { float ACoef[NCoef+1] = { 0.00009159473951071446, 0.00018318947902142891, @@ -231,17 +224,17 @@ static inline float adgold_lowpass_iir(int i, float NewSample) { 0.97261396931306277000 }; - static float y[2][NCoef+1]; //output samples - static float x[2][NCoef+1]; //input samples + static float y[2][NCoef+1]; /* output samples */ + static float x[2][NCoef+1]; /* input samples */ int n; - //shift the old samples + /* shift the old samples */ for(n=NCoef; n>0; n--) { x[i][n] = x[i][n-1]; y[i][n] = y[i][n-1]; } - //Calculate the new output + /* Calculate the new output */ x[i][0] = NewSample; y[i][0] = ACoef[0] * x[i][0]; for(n=1; n<=NCoef; n++) @@ -250,8 +243,7 @@ static inline float adgold_lowpass_iir(int i, float NewSample) { return y[i][0]; } -//fc=56Hz -static inline float adgold_pseudo_stereo_iir(float NewSample) { +static __inline float adgold_pseudo_stereo_iir(float NewSample) { float ACoef[NCoef+1] = { 0.00001409030866231767, 0.00002818061732463533, @@ -264,17 +256,17 @@ static inline float adgold_pseudo_stereo_iir(float NewSample) { 0.98738361004063568000 }; - static float y[NCoef+1]; //output samples - static float x[NCoef+1]; //input samples + static float y[NCoef+1]; /* output samples */ + static float x[NCoef+1]; /* input samples */ int n; - //shift the old samples + /* shift the old samples */ for(n=NCoef; n>0; n--) { x[n] = x[n-1]; y[n] = y[n-1]; } - //Calculate the new output + /* Calculate the new output */ x[0] = NewSample; y[0] = ACoef[0] * x[0]; for(n=1; n<=NCoef; n++) diff --git a/src/gameport.c b/src/gameport.c index 7b135dc39..45e2cb8d8 100644 --- a/src/gameport.c +++ b/src/gameport.c @@ -19,16 +19,16 @@ int joystick_type; joystick_if_t joystick_none = { - .name = "No joystick", - .init = NULL, - .close = NULL, - .read = NULL, - .write = NULL, - .read_axis = NULL, - .a0_over = NULL, - .max_joysticks = 0, - .axis_count = 0, - .button_count = 0 + "No joystick", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + 0, + 0, + 0 }; static joystick_if_t *joystick_list[] = @@ -140,12 +140,7 @@ uint8_t gameport_read(uint16_t addr, void *p) uint8_t ret; timer_clock(); -// if (joysticks_present) - ret = gameport->state | gameport->joystick->read(gameport->joystick_dat);//0xf0; -// else -// ret = 0xff; - - // pclog("gameport_read: ret=%02x %08x:%08x isa_cycles=%i %i\n", ret, cs, cpu_state.pc, isa_cycles, gameport->axis[0].count); + ret = gameport->state | gameport->joystick->read(gameport->joystick_dat); cycles -= ISA_CYCLES(8); diff --git a/src/hdd.c b/src/hdd.c index eed719db5..f9491ec7a 100644 --- a/src/hdd.c +++ b/src/hdd.c @@ -2,7 +2,9 @@ #include "device.h" #include "hdd.h" +#include "hdd_esdi.h" #include "mfm_at.h" +#include "mfm_xebec.h" #include "xtide.h" char hdd_controller_name[16]; @@ -21,8 +23,13 @@ static struct { {"None", "none", &null_hdd_device, 0}, {"AT Fixed Disk Adapter", "mfm_at", &mfm_at_device, 1}, + {"DTC 5150X", "dtc5150x", &dtc_5150x_device, 1}, + {"Fixed Disk Adapter (Xebec)", "mfm_xebec", &mfm_xebec_device, 1}, + {"IBM ESDI Fixed Disk Adapter (MCA)", "esdi_mca", &hdd_esdi_device, 1}, {"XTIDE", "xtide", &xtide_device, 0}, {"XTIDE (AT)", "xtide_at", &xtide_at_device, 0}, + {"XTIDE (PS/2)", "xtide_ps2",&xtide_ps2_device,0}, + {"XTIDE (AT) (PS/2)", "xtide_at_ps2",&xtide_at_ps2_device,0}, {"", "", NULL, 0} }; diff --git a/src/hdd_esdi.c b/src/hdd_esdi.c new file mode 100644 index 000000000..4dfc0b4b6 --- /dev/null +++ b/src/hdd_esdi.c @@ -0,0 +1,899 @@ +#define _LARGEFILE_SOURCE +#define _LARGEFILE64_SOURCE +#define _GNU_SOURCE +#include +#include +#include +#include +#include + +#include +#include "ibm.h" + +#include "device.h" +#include "dma.h" +#include "io.h" +#include "mca.h" +#include "mem.h" +#include "pic.h" +#include "rom.h" +#include "timer.h" + +#include "hdd_esdi.h" + +#define ESDI_TIME (2000 * TIMER_USEC) + +#define CMD_ADAPTER 0 + +typedef struct esdi_drive_t +{ + int spt, hpc; + int tracks; + int sectors; + FILE *hdfile; +} esdi_drive_t; + +typedef struct esdi_t +{ + rom_t bios_rom; + + uint8_t basic_ctrl; + uint8_t status; + uint8_t irq_status; + + int irq_in_progress; + int cmd_req_in_progress; + + int cmd_pos; + uint16_t cmd_data[4]; + int cmd_dev; + + int status_pos, status_len; + uint16_t status_data[256]; + + int data_pos; + uint16_t data[256]; + + uint16_t sector_buffer[16][256]; + + int sector_pos; + int sector_count; + + int command; + int cmd_state; + + int in_reset; + int callback; + + uint32_t rba; + + struct + { + int req_in_progress; + } cmds[3]; + + esdi_drive_t drives[2]; + + uint8_t pos_regs[8]; +} esdi_t; + +#define STATUS_DMA_ENA (1 << 7) +#define STATUS_IRQ_PENDING (1 << 6) +#define STATUS_CMD_IN_PROGRESS (1 << 5) +#define STATUS_BUSY (1 << 4) +#define STATUS_STATUS_OUT_FULL (1 << 3) +#define STATUS_CMD_IR_FULL (1 << 2) +#define STATUS_TRANSFER_REQ (1 << 1) +#define STATUS_IRQ (1 << 0) + +#define CTRL_RESET (1 << 7) +#define CTRL_DMA_ENA (1 << 1) +#define CTRL_IRQ_ENA (1 << 0) + +#define IRQ_HOST_ADAPTER (7 << 5) +#define IRQ_DEVICE_0 (0 << 5) +#define IRQ_CMD_COMPLETE_SUCCESS 0x1 +#define IRQ_RESET_COMPLETE 0xa +#define IRQ_DATA_TRANSFER_READY 0xb +#define IRQ_CMD_COMPLETE_FAILURE 0xc + +#define ATTN_DEVICE_SEL (7 << 5) +#define ATTN_HOST_ADAPTER (7 << 5) +#define ATTN_DEVICE_0 (0 << 5) +#define ATTN_DEVICE_1 (1 << 5) +#define ATTN_REQ_MASK 0xf +#define ATTN_CMD_REQ 1 +#define ATTN_EOI 2 +#define ATTN_RESET 4 + +#define CMD_SIZE_4 (1 << 14) + +#define CMD_DEVICE_SEL (7 << 5) +#define CMD_MASK 0x1f +#define CMD_READ 0x01 +#define CMD_WRITE 0x02 +#define CMD_READ_VERIFY 0x03 +#define CMD_WRITE_VERIFY 0x04 +#define CMD_SEEK 0x05 +#define CMD_GET_DEV_CONFIG 0x09 +#define CMD_GET_POS_INFO 0x0a + +#define STATUS_LEN(x) ((x) << 8) +#define STATUS_DEVICE_HOST_ADAPTER (7 << 5) + +static __inline void esdi_set_irq(esdi_t *esdi) +{ + if (esdi->basic_ctrl & CTRL_IRQ_ENA) + picint(1 << 14); +} +static __inline void esdi_clear_irq() +{ + picintc(1 << 14); +} + +static uint8_t esdi_read(uint16_t port, void *p) +{ + esdi_t *esdi = (esdi_t *)p; + uint8_t temp = 0xff; + + switch (port) + { + case 0x3512: /*Basic status register*/ + temp = esdi->status; + break; + case 0x3513: /*IRQ status*/ + esdi->status &= ~STATUS_IRQ; + temp = esdi->irq_status; + break; + + default: + fatal("esdi_read port=%04x\n", port); + } + + return temp; +} + +static void esdi_write(uint16_t port, uint8_t val, void *p) +{ + esdi_t *esdi = (esdi_t *)p; + + switch (port) + { + case 0x3512: /*Basic control register*/ + if ((esdi->basic_ctrl & CTRL_RESET) && !(val & CTRL_RESET)) + { + esdi->in_reset = 1; + esdi->callback = ESDI_TIME * 50; + esdi->status = STATUS_BUSY; + } + esdi->basic_ctrl = val; + if (!(esdi->basic_ctrl & CTRL_IRQ_ENA)) + picintc(1 << 14); + break; + case 0x3513: /*Attention register*/ + switch (val & ATTN_DEVICE_SEL) + { + case ATTN_HOST_ADAPTER: + switch (val & ATTN_REQ_MASK) + { + case ATTN_CMD_REQ: + if (esdi->cmd_req_in_progress) + fatal("Try to start command on in_progress adapter\n"); + esdi->cmd_req_in_progress = 1; + esdi->cmd_dev = ATTN_HOST_ADAPTER; + esdi->status |= STATUS_BUSY; + esdi->cmd_pos = 0; + break; + + case ATTN_EOI: + esdi->irq_in_progress = 0; + esdi->status &= ~STATUS_IRQ; + esdi_clear_irq(); + break; + + case ATTN_RESET: + esdi->in_reset = 1; + esdi->callback = ESDI_TIME * 50; + esdi->status = STATUS_BUSY; + break; + + default: + fatal("Bad attention request %02x\n", val); + } + break; + + case ATTN_DEVICE_0: + switch (val & ATTN_REQ_MASK) + { + case ATTN_CMD_REQ: + if (esdi->cmd_req_in_progress) + fatal("Try to start command on in_progress device0\n"); + esdi->cmd_req_in_progress = 1; + esdi->cmd_dev = ATTN_DEVICE_0; + esdi->status |= STATUS_BUSY; + esdi->cmd_pos = 0; + break; + + case ATTN_EOI: + esdi->irq_in_progress = 0; + esdi->status &= ~STATUS_IRQ; + esdi_clear_irq(); + break; + + default: + fatal("Bad attention request %02x\n", val); + } + break; + + case ATTN_DEVICE_1: + switch (val & ATTN_REQ_MASK) + { + case ATTN_CMD_REQ: + if (esdi->cmd_req_in_progress) + fatal("Try to start command on in_progress device0\n"); + esdi->cmd_req_in_progress = 1; + esdi->cmd_dev = ATTN_DEVICE_1; + esdi->status |= STATUS_BUSY; + esdi->cmd_pos = 0; + break; + + case ATTN_EOI: + esdi->irq_in_progress = 0; + esdi->status &= ~STATUS_IRQ; + esdi_clear_irq(); + break; + + default: + fatal("Bad attention request %02x\n", val); + } + break; + + default: + fatal("Attention to unknown device %02x\n", val); + } + break; + + default: + fatal("esdi_write port=%04x val=%02x\n", port, val); + } +} + +static uint16_t esdi_readw(uint16_t port, void *p) +{ + esdi_t *esdi = (esdi_t *)p; + uint16_t temp = 0xffff; + + switch (port) + { + case 0x3510: /*Status Interface Register*/ + if (esdi->status_pos >= esdi->status_len) + return 0; + temp = esdi->status_data[esdi->status_pos++]; + if (esdi->status_pos >= esdi->status_len) + { + esdi->status &= ~STATUS_STATUS_OUT_FULL; + esdi->status_pos = esdi->status_len = 0; + } + break; + + default: + fatal("esdi_readw port=%04x\n", port); + } + + return temp; +} + +static void esdi_writew(uint16_t port, uint16_t val, void *p) +{ + esdi_t *esdi = (esdi_t *)p; + + switch (port) + { + case 0x3510: /*Command Interface Register*/ + if (esdi->cmd_pos >= 4) + fatal("CIR pos 4\n"); + esdi->cmd_data[esdi->cmd_pos++] = val; + if ( ((esdi->cmd_data[0] & CMD_SIZE_4) && esdi->cmd_pos == 4) || + (!(esdi->cmd_data[0] & CMD_SIZE_4) && esdi->cmd_pos == 2)) + { + + esdi->cmd_pos = 0; + esdi->cmd_req_in_progress = 0; + esdi->cmd_state = 0; + + if ((esdi->cmd_data[0] & CMD_DEVICE_SEL) != esdi->cmd_dev) + fatal("Command device mismatch with attn\n"); + esdi->command = esdi->cmd_data[0] & CMD_MASK; + esdi->callback = ESDI_TIME; + esdi->status = STATUS_BUSY; + esdi->data_pos = 0; + } + break; + + default: + fatal("esdi_writew port=%04x val=%04x\n", port, val); + } +} + +static void cmd_unsupported(esdi_t *esdi) +{ + esdi->status_len = 9; + esdi->status_data[0] = esdi->command | STATUS_LEN(9) | esdi->cmd_dev; + esdi->status_data[1] = 0x0f03; /*Attention error, command not supported*/ + esdi->status_data[2] = 0x0002; /*Interface fault*/ + esdi->status_data[3] = 0; + esdi->status_data[4] = 0; + esdi->status_data[5] = 0; + esdi->status_data[6] = 0; + esdi->status_data[7] = 0; + esdi->status_data[8] = 0; + + esdi->status = STATUS_IRQ | STATUS_STATUS_OUT_FULL; + esdi->irq_status = esdi->cmd_dev | IRQ_CMD_COMPLETE_FAILURE; + esdi->irq_in_progress = 1; + esdi_set_irq(esdi); +} + +static void device_not_present(esdi_t *esdi) +{ + esdi->status_len = 9; + esdi->status_data[0] = esdi->command | STATUS_LEN(9) | esdi->cmd_dev; + esdi->status_data[1] = 0x0c11; /*Command failed, internal hardware error*/ + esdi->status_data[2] = 0x000b; /*Selection error*/ + esdi->status_data[3] = 0; + esdi->status_data[4] = 0; + esdi->status_data[5] = 0; + esdi->status_data[6] = 0; + esdi->status_data[7] = 0; + esdi->status_data[8] = 0; + + esdi->status = STATUS_IRQ | STATUS_STATUS_OUT_FULL; + esdi->irq_status = esdi->cmd_dev | IRQ_CMD_COMPLETE_FAILURE; + esdi->irq_in_progress = 1; + esdi_set_irq(esdi); +} + +#define ESDI_ADAPTER_ONLY() do \ + { \ + if (esdi->cmd_dev != ATTN_HOST_ADAPTER) \ + { \ + cmd_unsupported(esdi); \ + return; \ + } \ + } while (0) + +#define ESDI_DRIVE_ONLY() do \ + { \ + if (esdi->cmd_dev != ATTN_DEVICE_0 && esdi->cmd_dev != ATTN_DEVICE_1) \ + { \ + cmd_unsupported(esdi); \ + return; \ + } \ + if (esdi->cmd_dev == ATTN_DEVICE_0) \ + drive = &esdi->drives[0]; \ + else \ + drive = &esdi->drives[1]; \ + } while (0) + +static void esdi_callback(void *p) +{ + esdi_t *esdi = (esdi_t *)p; + esdi_drive_t *drive; + + esdi->callback = 0; + + if (esdi->in_reset) + { + esdi->in_reset = 0; + esdi->status = STATUS_IRQ; + esdi->irq_status = IRQ_HOST_ADAPTER | IRQ_RESET_COMPLETE; + + return; + } + switch (esdi->command) + { + case CMD_READ: + ESDI_DRIVE_ONLY(); + + if (!drive->hdfile) + { + device_not_present(esdi); + return; + } + + switch (esdi->cmd_state) + { + case 0: + esdi->rba = (esdi->cmd_data[2] | (esdi->cmd_data[3] << 16)) & 0x0fffffff; + + esdi->sector_pos = 0; + esdi->sector_count = esdi->cmd_data[1]; + + esdi->status = STATUS_IRQ | STATUS_CMD_IN_PROGRESS | STATUS_TRANSFER_REQ; + esdi->irq_status = esdi->cmd_dev | IRQ_DATA_TRANSFER_READY; + esdi->irq_in_progress = 1; + esdi_set_irq(esdi); + + esdi->cmd_state = 1; + esdi->callback = ESDI_TIME; + esdi->data_pos = 0; + break; + + case 1: + if (!(esdi->basic_ctrl & CTRL_DMA_ENA)) + { + esdi->callback = ESDI_TIME; + return; + } + while (esdi->sector_pos < esdi->sector_count) + { + if (!esdi->data_pos) + { + if (esdi->rba >= drive->sectors) + fatal("Read past end of drive\n"); + fseek(drive->hdfile, esdi->rba * 512, SEEK_SET); + fread(esdi->data, 512, 1, drive->hdfile); + update_status_bar_icon(0x20, 1); + } + while (esdi->data_pos < 256) + { + int val = dma_channel_write(5, esdi->data[esdi->data_pos]); + + if (val == DMA_NODATA) + { + esdi->callback = ESDI_TIME; + return; + } + + esdi->data_pos++; + } + + esdi->data_pos = 0; + esdi->sector_pos++; + esdi->rba++; + } + + esdi->status = STATUS_CMD_IN_PROGRESS; + esdi->cmd_state = 2; + esdi->callback = ESDI_TIME; + break; + + case 2: + esdi->status = STATUS_IRQ; + esdi->irq_status = esdi->cmd_dev | IRQ_CMD_COMPLETE_SUCCESS; + esdi->irq_in_progress = 1; + esdi_set_irq(esdi); + break; + } + break; + + case CMD_WRITE: + case CMD_WRITE_VERIFY: + ESDI_DRIVE_ONLY(); + + if (!drive->hdfile) + { + device_not_present(esdi); + return; + } + + switch (esdi->cmd_state) + { + case 0: + esdi->rba = (esdi->cmd_data[2] | (esdi->cmd_data[3] << 16)) & 0x0fffffff; + + esdi->sector_pos = 0; + esdi->sector_count = esdi->cmd_data[1]; + + esdi->status = STATUS_IRQ | STATUS_CMD_IN_PROGRESS | STATUS_TRANSFER_REQ; + esdi->irq_status = esdi->cmd_dev | IRQ_DATA_TRANSFER_READY; + esdi->irq_in_progress = 1; + esdi_set_irq(esdi); + + esdi->cmd_state = 1; + esdi->callback = ESDI_TIME; + esdi->data_pos = 0; + break; + + case 1: + if (!(esdi->basic_ctrl & CTRL_DMA_ENA)) + { + esdi->callback = ESDI_TIME; + return; + } + while (esdi->sector_pos < esdi->sector_count) + { + while (esdi->data_pos < 256) + { + int val = dma_channel_read(5); + + if (val == DMA_NODATA) + { + esdi->callback = ESDI_TIME; + return; + } + + esdi->data[esdi->data_pos++] = val & 0xffff; + } + + if (esdi->rba >= drive->sectors) + fatal("Write past end of drive\n"); + fseek(drive->hdfile, esdi->rba * 512, SEEK_SET); + fwrite(esdi->data, 512, 1, drive->hdfile); + esdi->rba++; + esdi->sector_pos++; + update_status_bar_icon(0x20, 1); + + esdi->data_pos = 0; + } + update_status_bar_icon(0x20, 0); + + esdi->status = STATUS_CMD_IN_PROGRESS; + esdi->cmd_state = 2; + esdi->callback = ESDI_TIME; + break; + + case 2: + esdi->status = STATUS_IRQ; + esdi->irq_status = esdi->cmd_dev | IRQ_CMD_COMPLETE_SUCCESS; + esdi->irq_in_progress = 1; + esdi_set_irq(esdi); + break; + } + break; + + case CMD_READ_VERIFY: + ESDI_DRIVE_ONLY(); + + if (!drive->hdfile) + { + device_not_present(esdi); + return; + } + + esdi->status = STATUS_IRQ; + esdi->irq_status = esdi->cmd_dev | IRQ_CMD_COMPLETE_SUCCESS; + esdi->irq_in_progress = 1; + esdi_set_irq(esdi); + break; + + case CMD_SEEK: + ESDI_DRIVE_ONLY(); + + if (!drive->hdfile) + { + device_not_present(esdi); + return; + } + + esdi->status = STATUS_IRQ; + esdi->irq_status = esdi->cmd_dev | IRQ_CMD_COMPLETE_SUCCESS; + esdi->irq_in_progress = 1; + esdi_set_irq(esdi); + break; + + case CMD_GET_DEV_CONFIG: + ESDI_DRIVE_ONLY(); + + if (!drive->hdfile) + { + device_not_present(esdi); + return; + } + + if (esdi->status_pos) + fatal("Status send in progress\n"); + if ((esdi->status & STATUS_IRQ) || esdi->irq_in_progress) + fatal("IRQ in progress %02x %i\n", esdi->status, esdi->irq_in_progress); + + esdi->status_len = 6; + esdi->status_data[0] = CMD_GET_POS_INFO | STATUS_LEN(6) | STATUS_DEVICE_HOST_ADAPTER; + esdi->status_data[1] = 0x10; /*Zero defect*/ + esdi->status_data[2] = drive->sectors & 0xffff; + esdi->status_data[3] = drive->sectors >> 16; + esdi->status_data[4] = drive->tracks; + esdi->status_data[5] = drive->hpc | (drive->spt << 16); + +/* pclog("CMD_GET_DEV_CONFIG %i %04x %04x %04x %04x %04x %04x\n", drive->sectors, + esdi->status_data[0], esdi->status_data[1], + esdi->status_data[2], esdi->status_data[3], + esdi->status_data[4], esdi->status_data[5]);*/ + + esdi->status = STATUS_IRQ | STATUS_STATUS_OUT_FULL; + esdi->irq_status = esdi->cmd_dev | IRQ_CMD_COMPLETE_SUCCESS; + esdi->irq_in_progress = 1; + esdi_set_irq(esdi); + break; + + case CMD_GET_POS_INFO: + ESDI_ADAPTER_ONLY(); + if (esdi->status_pos) + fatal("Status send in progress\n"); + if ((esdi->status & STATUS_IRQ) || esdi->irq_in_progress) + fatal("IRQ in progress %02x %i\n", esdi->status, esdi->irq_in_progress); + + esdi->status_len = 5; + esdi->status_data[0] = CMD_GET_POS_INFO | STATUS_LEN(5) | STATUS_DEVICE_HOST_ADAPTER; + esdi->status_data[1] = 0xffdd; /*MCA ID*/ + esdi->status_data[2] = esdi->pos_regs[3] | (esdi->pos_regs[2] << 8); + esdi->status_data[3] = 0xff; + esdi->status_data[4] = 0xff; + + esdi->status = STATUS_IRQ | STATUS_STATUS_OUT_FULL; + esdi->irq_status = IRQ_HOST_ADAPTER | IRQ_CMD_COMPLETE_SUCCESS; + esdi->irq_in_progress = 1; + esdi_set_irq(esdi); + break; + + case 0x11: + ESDI_ADAPTER_ONLY(); + switch (esdi->cmd_state) + { + case 0: + esdi->sector_pos = 0; + esdi->sector_count = esdi->cmd_data[1]; + if (esdi->sector_count > 16) + fatal("Read sector buffer count %04x\n", esdi->cmd_data[1]); + + esdi->status = STATUS_IRQ | STATUS_CMD_IN_PROGRESS | STATUS_TRANSFER_REQ; + esdi->irq_status = IRQ_HOST_ADAPTER | IRQ_DATA_TRANSFER_READY; + esdi->irq_in_progress = 1; + esdi_set_irq(esdi); + + esdi->cmd_state = 1; + esdi->callback = ESDI_TIME; + esdi->data_pos = 0; + break; + + case 1: + if (!(esdi->basic_ctrl & CTRL_DMA_ENA)) + { + esdi->callback = ESDI_TIME; + return; + } + while (esdi->sector_pos < esdi->sector_count) + { + if (!esdi->data_pos) + memcpy(esdi->data, esdi->sector_buffer[esdi->sector_pos++], 512); + while (esdi->data_pos < 256) + { + int val = dma_channel_write(5, esdi->data[esdi->data_pos]); + + if (val == DMA_NODATA) + { + esdi->callback = ESDI_TIME; + return; + } + + esdi->data_pos++; + } + + esdi->data_pos = 0; + } + + esdi->status = STATUS_CMD_IN_PROGRESS; + esdi->cmd_state = 2; + esdi->callback = ESDI_TIME; + break; + + case 2: + esdi->status = STATUS_IRQ; + esdi->irq_status = IRQ_HOST_ADAPTER | IRQ_CMD_COMPLETE_SUCCESS; + esdi->irq_in_progress = 1; + esdi_set_irq(esdi); + break; + } + break; + + case 0x10: + ESDI_ADAPTER_ONLY(); + switch (esdi->cmd_state) + { + case 0: + esdi->sector_pos = 0; + esdi->sector_count = esdi->cmd_data[1]; + if (esdi->sector_count > 16) + fatal("Write sector buffer count %04x\n", esdi->cmd_data[1]); + + esdi->status = STATUS_IRQ | STATUS_CMD_IN_PROGRESS | STATUS_TRANSFER_REQ; + esdi->irq_status = IRQ_HOST_ADAPTER | IRQ_DATA_TRANSFER_READY; + esdi->irq_in_progress = 1; + esdi_set_irq(esdi); + + esdi->cmd_state = 1; + esdi->callback = ESDI_TIME; + esdi->data_pos = 0; + break; + + case 1: + if (!(esdi->basic_ctrl & CTRL_DMA_ENA)) + { + esdi->callback = ESDI_TIME; + return; + } + while (esdi->sector_pos < esdi->sector_count) + { + while (esdi->data_pos < 256) + { + int val = dma_channel_read(5); + + if (val == DMA_NODATA) + { + esdi->callback = ESDI_TIME; + return; + } + + esdi->data[esdi->data_pos++] = val & 0xffff;; + } + + memcpy(esdi->sector_buffer[esdi->sector_pos++], esdi->data, 512); + esdi->data_pos = 0; + } + + esdi->status = STATUS_CMD_IN_PROGRESS; + esdi->cmd_state = 2; + esdi->callback = ESDI_TIME; + break; + + case 2: + esdi->status = STATUS_IRQ; + esdi->irq_status = IRQ_HOST_ADAPTER | IRQ_CMD_COMPLETE_SUCCESS; + esdi->irq_in_progress = 1; + esdi_set_irq(esdi); + break; + } + break; + + case 0x12: + ESDI_ADAPTER_ONLY(); + if (esdi->status_pos) + fatal("Status send in progress\n"); + if ((esdi->status & STATUS_IRQ) || esdi->irq_in_progress) + fatal("IRQ in progress %02x %i\n", esdi->status, esdi->irq_in_progress); + + esdi->status_len = 2; + esdi->status_data[0] = 0x12 | STATUS_LEN(5) | STATUS_DEVICE_HOST_ADAPTER; + esdi->status_data[1] = 0; + + esdi->status = STATUS_IRQ | STATUS_STATUS_OUT_FULL; + esdi->irq_status = IRQ_HOST_ADAPTER | IRQ_CMD_COMPLETE_SUCCESS; + esdi->irq_in_progress = 1; + esdi_set_irq(esdi); + break; + + default: + fatal("Bad command %02x %i\n", esdi->command, esdi->cmd_dev); + + } +} + +static uint8_t esdi_mca_read(int port, void *p) +{ + esdi_t *esdi = (esdi_t *)p; + + return esdi->pos_regs[port & 7]; +} + +static void esdi_mca_write(int port, uint8_t val, void *p) +{ + esdi_t *esdi = (esdi_t *)p; + + if (port < 0x102) + return; + + esdi->pos_regs[port & 7] = val; + + io_removehandler(0x3510, 0x0008, esdi_read, esdi_readw, NULL, esdi_write, esdi_writew, NULL, esdi); + mem_mapping_disable(&esdi->bios_rom.mapping); + if (esdi->pos_regs[2] & 1) + { + io_sethandler(0x3510, 0x0008, esdi_read, esdi_readw, NULL, esdi_write, esdi_writew, NULL, esdi); + if (!(esdi->pos_regs[3] & 8)) + { + mem_mapping_enable(&esdi->bios_rom.mapping); + mem_mapping_set_addr(&esdi->bios_rom.mapping, ((esdi->pos_regs[3] & 7) * 0x4000) + 0xc0000, 0x4000); + } + } +} + +static void loadhd(esdi_t *esdi, int d, const char *fn) +{ + esdi_drive_t *drive = &esdi->drives[d]; + + if (drive->hdfile == NULL) + { + /* Try to open existing hard disk image */ + drive->hdfile = fopen64(fn, "rb+"); + if (drive->hdfile == NULL) + { + /* Failed to open existing hard disk image */ + if (errno == ENOENT) + { + /* Failed because it does not exist, + so try to create new file */ + drive->hdfile = fopen64(fn, "wb+"); + if (drive->hdfile == NULL) + { + pclog("Cannot create file '%s': %s", + fn, strerror(errno)); + return; + } + } + else + { + /* Failed for another reason */ + pclog("Cannot open file '%s': %s", + fn, strerror(errno)); + return; + } + } + } + + drive->spt = hdc[d].spt; + drive->hpc = hdc[d].hpc; + drive->tracks = hdc[d].tracks; + drive->sectors = hdc[d].spt * hdc[d].hpc * hdc[d].tracks; +} + +static void *esdi_init() +{ + int i = 0; + + esdi_t *esdi = malloc(sizeof(esdi_t)); + memset(esdi, 0, sizeof(esdi_t)); + + rom_init_interleaved(&esdi->bios_rom, "roms/90x8970.bin", "roms/90x8969.bin", 0xc8000, 0x4000, 0x3fff, 0, MEM_MAPPING_EXTERNAL); + mem_mapping_disable(&esdi->bios_rom.mapping); + + for (i = 0; i < HDC_NUM; i++) + { + loadhd(esdi, hdc[i].mfm_channel, hdd_fn[i]); + } + + timer_add(esdi_callback, &esdi->callback, &esdi->callback, esdi); + + mca_add(esdi_mca_read, esdi_mca_write, esdi); + + esdi->pos_regs[0] = 0xff; + esdi->pos_regs[1] = 0xdd; + + esdi->in_reset = 1; + esdi->callback = ESDI_TIME * 50; + esdi->status = STATUS_BUSY; + + return esdi; +} + +static void esdi_close(void *p) +{ + esdi_t *esdi = (esdi_t *)p; + int d; + + for (d = 0; d < 2; d++) + { + esdi_drive_t *drive = &esdi->drives[d]; + + if (drive->hdfile != NULL) + fclose(drive->hdfile); + } + + free(esdi); +} + +static int esdi_available() +{ + return rom_present("roms/90x8969.bin") && rom_present("roms/90x8970.bin"); +} + +device_t hdd_esdi_device = +{ + "IBM ESDI Fixed Disk Adapter (MCA)", + DEVICE_MCA, + esdi_init, + esdi_close, + esdi_available, + NULL, + NULL, + NULL, + NULL +}; diff --git a/src/hdd_esdi.h b/src/hdd_esdi.h new file mode 100644 index 000000000..4fea361bd --- /dev/null +++ b/src/hdd_esdi.h @@ -0,0 +1 @@ +extern device_t hdd_esdi_device; diff --git a/src/headland.c b/src/headland.c index cba96b7ef..b100b85c8 100644 --- a/src/headland.c +++ b/src/headland.c @@ -17,7 +17,6 @@ void headland_write(uint16_t addr, uint8_t val, void *priv) { if (headland_index == 0xc1 && !is486) val = 0; headland_regs[headland_index] = val; - // pclog("Headland write %02X %02X\n",headland_index,val); if (headland_index == 0x82) { shadowbios = val & 0x10; diff --git a/src/i430hx.c b/src/i430hx.c index 8d20e98e4..e13da7606 100644 --- a/src/i430hx.c +++ b/src/i430hx.c @@ -50,7 +50,6 @@ void i430hx_write(int func, int addr, uint8_t val, void *priv) i430hx_map(0xf0000, 0x10000, val >> 4); shadowbios = (val & 0x10); } - // pclog("i430hx_write : PAM0 write %02X\n", val); break; case 0x5a: /*PAM1*/ if ((card_i430hx[0x5a] ^ val) & 0x0f) @@ -81,14 +80,12 @@ void i430hx_write(int func, int addr, uint8_t val, void *priv) i430hx_map(0xe0000, 0x04000, val & 0xf); if ((card_i430hx[0x5e] ^ val) & 0xf0) i430hx_map(0xe4000, 0x04000, val >> 4); - // pclog("i430hx_write : PAM5 write %02X\n", val); break; case 0x5f: /*PAM6*/ if ((card_i430hx[0x5f] ^ val) & 0x0f) i430hx_map(0xe8000, 0x04000, val & 0xf); if ((card_i430hx[0x5f] ^ val) & 0xf0) i430hx_map(0xec000, 0x04000, val >> 4); - // pclog("i430hx_write : PAM6 write %02X\n", val); break; } diff --git a/src/ibm.h b/src/ibm.h index f2fd339cb..ffbc18593 100644 --- a/src/ibm.h +++ b/src/ibm.h @@ -24,13 +24,6 @@ extern int mmu_perm; #define readmemw(s,a) ((readlookup2[(uint32_t)((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF || (((s)+(a))&0xFFF)>0xFFE)?readmemwl(s,a):*(uint16_t *)(readlookup2[(uint32_t)((s)+(a))>>12]+(uint32_t)((s)+(a)))) #define readmeml(s,a) ((readlookup2[(uint32_t)((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF || (((s)+(a))&0xFFF)>0xFFC)?readmemll(s,a):*(uint32_t *)(readlookup2[(uint32_t)((s)+(a))>>12]+(uint32_t)((s)+(a)))) -//#define writememb(a,v) if (writelookup2[(a)>>12]==0xFFFFFFFF) writemembl(a,v); else ram[writelookup2[(a)>>12]+((a)&0xFFF)]=v -//#define writememw(s,a,v) if (writelookup2[((s)+(a))>>12]==0xFFFFFFFF || (s)==0xFFFFFFFF) writememwl(s,a,v); else *((uint16_t *)(&ram[writelookup2[((s)+(a))>>12]+(((s)+(a))&0xFFF)]))=v -//#define writememl(s,a,v) if (writelookup2[((s)+(a))>>12]==0xFFFFFFFF || (s)==0xFFFFFFFF) writememll(s,a,v); else *((uint32_t *)(&ram[writelookup2[((s)+(a))>>12]+(((s)+(a))&0xFFF)]))=v -//#define readmemb(a) ((isram[((a)>>16)&255] && !(cr0>>31))?ram[a&0xFFFFFF]:readmembl(a)) -//#define writememb(a,v) if (isram[((a)>>16)&255] && !(cr0>>31)) ram[a&0xFFFFFF]=v; else writemembl(a,v) - -//void writememb(uint32_t addr, uint8_t val); uint8_t readmembl(uint32_t addr); void writemembl(uint32_t addr, uint8_t val); uint8_t readmemb386l(uint32_t seg, uint32_t addr); @@ -138,7 +131,6 @@ struct uint32_t pc; uint32_t oldpc; uint32_t op32; - uint32_t last_ea; int TOP; @@ -167,15 +159,20 @@ struct MMX_REG MM[8]; uint16_t old_npxc, new_npxc; + uint32_t last_ea; } cpu_state; #define cycles cpu_state._cycles -#define COMPILE_TIME_ASSERT(expr) typedef char COMP_TIME_ASSERT[(expr) ? 1 : 0]; +#ifdef __MSC__ +# define COMPILE_TIME_ASSERT(expr) /*nada*/ +#else +# define COMPILE_TIME_ASSERT(expr) typedef char COMP_TIME_ASSERT[(expr) ? 1 : 0]; +#endif -COMPILE_TIME_ASSERT(sizeof(cpu_state) <= 128); +COMPILE_TIME_ASSERT(sizeof(cpu_state) <= 128) -#define cpu_state_offset(MEMBER) ((uintptr_t)&cpu_state.MEMBER - (uintptr_t)&cpu_state - 128) +#define cpu_state_offset(MEMBER) ((uint8_t)((uintptr_t)&cpu_state.MEMBER - (uintptr_t)&cpu_state - 128)) /*x86reg regs[8];*/ @@ -242,9 +239,7 @@ uint32_t dr[8]; #define IOPL ((flags>>12)&3) #define IOPLp ((!(msw&1)) || (CPL<=IOPL)) -//#define IOPLp 1 -//#define IOPLV86 ((!(msw&1)) || (CPL<=IOPL)) extern int cycles_lost; extern int israpidcad; extern int is486; @@ -260,6 +255,12 @@ extern int CPUID; extern int cpl_override; /*Timer*/ +typedef struct PIT_nr +{ + int nr; + struct PIT *pit; +} PIT_nr; + typedef struct PIT { uint32_t l[3]; @@ -284,9 +285,13 @@ typedef struct PIT uint8_t read_status[3]; int do_read_status[3]; + + PIT_nr pit_nr[3]; + + void (*set_out_funcs[3])(int new_out, int old_out); } PIT; -PIT pit; +PIT pit, pit2; void setpitclock(float clock); float pit_timer0_freq(); @@ -300,7 +305,7 @@ float pit_timer0_freq(); /*DMA*/ typedef struct DMA { - uint16_t ab[4],ac[4]; + uint32_t ab[4],ac[4]; uint16_t cb[4]; int cc[4]; int wp; @@ -309,6 +314,13 @@ typedef struct DMA uint8_t stat; uint8_t command; uint8_t request; + + int xfr_command, xfr_channel; + int byte_ptr; + + int is_ps2; + uint8_t arb_level[4]; + uint8_t ps2_mode[4]; } DMA; DMA dma,dma16; @@ -341,8 +353,8 @@ int disctime; char discfns[4][256]; int driveempty[4]; -#define MDA ((gfxcard==GFX_MDA || gfxcard==GFX_HERCULES || gfxcard==GFX_HERCULESPLUS || gfxcard==GFX_INCOLOR) && (romset=ROM_IBMAT)) -#define VGA ((gfxcard>=GFX_TVGA || romset==ROM_ACER386) && gfxcard!=GFX_COLORPLUS && gfxcard!=GFX_INCOLOR && gfxcard!=GFX_WY700 && gfxcard!=GFX_COMPAQ_EGA && gfxcard!=GFX_SUPER_EGA && gfxcard!=GFX_HERCULESPLUS && romset!=ROM_PC1640 && romset!=ROM_PC1512 && romset!=ROM_TANDY && romset!=ROM_PC200) +#define MDA ((gfxcard==GFX_MDA || gfxcard==GFX_HERCULES || gfxcard==GFX_HERCULESPLUS || gfxcard==GFX_INCOLOR || gfxcard==GFX_GENIUS) && (romset=ROM_IBMAT)) +#define VGA ((gfxcard>=GFX_TVGA || romset==ROM_ACER386) && gfxcard!=GFX_COLORPLUS && gfxcard!=GFX_INCOLOR && gfxcard!=GFX_WY700 && gfxcard!=GFX_GENIUS && gfxcard!=GFX_COMPAQ_EGA && gfxcard!=GFX_SUPER_EGA && gfxcard!=GFX_HERCULESPLUS && romset!=ROM_PC1640 && romset!=ROM_PC1512 && romset!=ROM_TANDY && romset!=ROM_PC200) #define PCJR (romset == ROM_IBMPCJR) #define AMIBIOS (romset==ROM_AMI386SX || romset==ROM_AMI486 || romset == ROM_WIN486) @@ -395,13 +407,16 @@ enum ROM_PORTABLE, ROM_PORTABLEII, ROM_PORTABLEIII, - ROM_PORTABLEIII386, //The original Compaq Portable III shipped with an Intel 80286 CPU, but later switched to a 386DX. + ROM_PORTABLEIII386, /* The original Compaq Portable III shipped with an Intel 80286 CPU, but later switched to a 386DX. */ ROM_IBMPS1_2121, ROM_AMI386DX_OPTI495, ROM_MR386DX_OPTI495, ROM_IBMPS2_M30_286, + ROM_IBMPS2_M50, + ROM_IBMPS2_M55SX, + ROM_IBMPS2_M80, ROM_DTK486, /*DTK PKM-0038S E-2 / SiS 471 / Award BIOS / SiS 85C471*/ ROM_VLI486SV2G, /*ASUS VL/I-486SV2G / SiS 471 / Award BIOS / SiS 85C471*/ @@ -410,13 +425,15 @@ enum ROM_PLATO, /*Intel Premiere/PCI II / 430NX / AMI BIOS / SMC FDC37C665*/ ROM_MB500N, /*PC Partner MB500N / 430FX / Award BIOS / SMC FDC37C665*/ ROM_P54TP4XE, /*ASUS P/I-P55TP4XE / 430FX / Award BIOS / SMC FDC37C665*/ + ROM_AP53, /*AOpen AP53 / 430HX / AMI BIOS / SMC FDC37C665/669*/ + ROM_P55T2S, /*ASUS P/I-P55T2S / 430HX / AMI BIOS / National Semiconductors PC87306*/ ROM_ACERM3A, /*Acer M3A / 430HX / Acer BIOS / SMC FDC37C932FR*/ ROM_ACERV35N, /*Acer V35N / 430HX / Acer BIOS / SMC FDC37C932FR*/ ROM_P55T2P4, /*ASUS P/I-P55T2P4 / 430HX / Award BIOS / Winbond W8387F*/ ROM_P55TVP4, /*ASUS P/I-P55TVP4 / 430HX / Award BIOS / Winbond W8387F*/ ROM_P55VA, /*Epox P55-VA / 430VX / Award BIOS / SMC FDC37C932FR*/ - ROM_440FX, /*Unknown / 440FX / Award BIOS / SMC FDC37C665*/ + ROM_440FX, /*Tyan Titan-Pro AT / 440FX / Award BIOS / SMC FDC37C665*/ ROM_MARL, /*Intel Advanced/ML / 430HX / AMI BIOS / National Semiconductors PC87306*/ ROM_THOR, /*Intel Advanced/ATX / 430FX / AMI BIOS / National Semiconductors PC87306*/ @@ -433,6 +450,8 @@ enum ROM_CMDPC60, + ROM_S1668, /*Tyan Titan-Pro ATX / 440FX / AMI BIOS / SMC FDC37C669*/ + ROM_MAX }; @@ -466,6 +485,9 @@ enum GFX_INCOLOR, /* Hercules InColor */ GFX_COLORPLUS, /* Plantronics ColorPlus */ GFX_WY700, /* Wyse 700 */ + GFX_GENIUS, /* MDSI Genius */ + GFX_MACH64VT2, /*ATI Mach64 VT2*/ + GFX_COMPAQ_EGA, /*Compaq EGA*/ GFX_SUPER_EGA, /*Using Chips & Technologies SuperEGA BIOS*/ GFX_COMPAQ_VGA, /*Compaq/Paradise VGA*/ @@ -485,6 +507,8 @@ enum GFX_TRIGEM_UNK, GFX_OTI037, /*Oak OTI-037*/ + GFX_VIRGEVX, /*S3 Virge/VX*/ + GFX_MAX }; @@ -532,7 +556,12 @@ char pcempath[512]; /*Hard disc*/ -typedef struct __attribute__((__packed__)) +#ifdef __MSC__ +# pragma pack(push,1) +typedef struct +#else +typedef struct __attribute((__packed__)) +#endif { FILE *f; uint64_t spt,hpc; /*Sectors per track, heads per cylinder*/ @@ -540,15 +569,78 @@ typedef struct __attribute__((__packed__)) int is_hdi; uint32_t base; uint64_t at_spt,at_hpc; /*[Translation] Sectors per track, heads per cylinder*/ + int bus; /* 0 = none, 1 = MFM/RLL, 2 = IDE, 3 = SCSI */ + uint8_t mfm_channel; + uint8_t ide_channel; + uint8_t scsi_id; + uint8_t scsi_lun; } hard_disk_t; +#ifdef __MSC__ +# pragma pack(pop) +#endif +#ifdef __MSC__ +# pragma pack(push,1) +typedef struct +#else +typedef struct __attribute((__packed__)) +#endif +{ + /* Stuff for SCSI hard disks. */ + uint8_t cdb[16]; + uint8_t current_cdb[16]; + uint8_t max_cdb_len; + int requested_blocks; + int max_blocks_at_once; + uint16_t request_length; + int block_total; + int all_blocks_total; + uint32_t packet_len; + int packet_status; + uint8_t status; + uint8_t phase; + uint32_t pos; + int callback; + int total_read; + int unit_attention; + uint8_t sense[256]; + uint8_t previous_command; + uint8_t error; + uint16_t buffer[390144]; + uint32_t sector_pos; + uint32_t sector_len; + uint32_t last_sector; + uint32_t seek_pos; + int data_pos; + int old_len; + int cdb_len_setting; + int cdb_len; + int request_pos; + uint64_t base; + uint8_t hd_cdb[16]; +} scsi_hard_disk_t; +#ifdef __MSC__ +# pragma pack(pop) +#endif + +#define HDC_NUM 16 #define IDE_NUM 8 +#define MFM_NUM 2 +#define SCSI_NUM 16 /* Theoretically the controller can have at least 64 devices, or even 128 in case of a wide bus, but + let's not exaggerate with them - 16 ought to be enough for everyone. */ -hard_disk_t hdc[IDE_NUM]; +hard_disk_t hdc[HDC_NUM]; +scsi_hard_disk_t shdc[HDC_NUM]; + +FILE *shdf[HDC_NUM]; uint64_t hdt[128][3]; +uint64_t hdt_mfm[128][3]; + +extern char hdd_fn[HDC_NUM][512]; int image_is_hdi(const char *s); +int image_is_hdx(const char *s, int check_signature); /*Keyboard*/ int keybsenddelay; @@ -573,6 +665,7 @@ extern int ui_writeprot[4]; void pclog(const char *format, ...); extern int nmi; +extern int nmi_auto_clear; extern float isa_timing, bus_timing; @@ -590,6 +683,7 @@ void onesec(); void resetpc_cad(); +extern int dump_on_exit; extern int start_in_fullscreen; extern int window_w, window_h, window_x, window_y, window_remember; @@ -647,3 +741,51 @@ extern int invert_display; uint32_t svga_color_transform(uint32_t color); extern int scale; + +/* Function prototypes. */ +void BuslogicSoftReset(); +int checkio(int port); +void closepc(); +void codegen_block_end(); +void codegen_reset(); +void cpu_set_edx(); +int divl(uint32_t val); +void dumpregs(); +void exec386(int cycs); +void exec386_dynarec(int cycs); +void execx86(int cycs); +void flushmmucache(); +void flushmmucache_cr3(); +int idivl(int32_t val); +void initpc(int argc, char *argv[]); +void loadcscall(uint16_t seg); +void loadcsjmp(uint16_t seg, uint32_t oxpc); +void mmu_invalidate(uint32_t addr); +void pclog(const char *format, ...); +void pmodeint(int num, int soft); +void pmoderetf(int is32, uint16_t off); +void pmodeiret(int is32); +void port_92_clear_reset(); +uint8_t readdacfifo(); +void refreshread(); +int rep386(int fv); +void resetmcr(); +void resetpchard(); +void resetreadlookup(); +void resetx86(); +void runpc(); +void saveconfig(); +void softresetx86(); +void speedchanged(); +void trc_reset(uint8_t val); +void update_status_bar_icon(int tag, int active); +void x86_int_sw(int num); +void x86gpf(char *s, uint16_t error); +void x86np(char *s, uint16_t error); +void x86ss(char *s, uint16_t error); +void x86ts(char *s, uint16_t error); +void x87_dumpregs(); +void x87_reset(); + +extern int serial_enabled[2]; +extern int lpt_enabled, bugger_enabled; diff --git a/src/ide.c b/src/ide.c index 2750802b8..525534189 100644 --- a/src/ide.c +++ b/src/ide.c @@ -46,7 +46,7 @@ #define WIN_WRITE 0x30 /* 28-Bit Write */ #define WIN_WRITE_NORETRY 0x31 /* 28-Bit Write */ #define WIN_VERIFY 0x40 /* 28-Bit Verify */ -#define WIN_VERIFY_ONCE 0x41 /* Added by OBattler - deprected older ATA command, according to the specification I found, it is identical to 0x40 */ +#define WIN_VERIFY_ONCE 0x41 /* Added by OBattler - deprected older ATA command, according to the specification I found, it is identical to 0x40 */ #define WIN_FORMAT 0x50 #define WIN_SEEK 0x70 #define WIN_DRIVE_DIAGNOSTICS 0x90 /* Execute Drive Diagnostics */ @@ -62,21 +62,11 @@ #define WIN_IDLENOW1 0xE1 #define WIN_SETIDLE1 0xE3 #define WIN_CHECKPOWERMODE1 0xE5 -#define WIN_SLEEP1 0xE6 +#define WIN_SLEEP1 0xE6 #define WIN_IDENTIFY 0xEC /* Ask drive to identify itself */ #define WIN_SET_FEATURES 0xEF #define WIN_READ_NATIVE_MAX 0xF8 -/** Evaluate to non-zero if the currently selected drive is an ATAPI device */ -// #define IDE_DRIVE_IS_CDROM(ide) (ide->type == IDE_CDROM) - -#define ATAPI_STATUS_IDLE 0 -#define ATAPI_STATUS_COMMAND 1 -#define ATAPI_STATUS_COMPLETE 2 -#define ATAPI_STATUS_DATA_IN 3 -#define ATAPI_STATUS_DATA_OUT 4 -#define ATAPI_STATUS_ERROR 0x80 - enum { IDE_NONE = 0, @@ -84,26 +74,6 @@ enum IDE_CDROM }; -static struct -{ - uint8_t opcode; - uint8_t polled; - uint8_t reserved2[2]; - uint8_t class; - uint8_t reserved3[2]; - uint16_t len; - uint8_t control; -} *gesn_cdb; - -static struct -{ - uint16_t len; - uint8_t notification_class; - uint8_t supported_events; -} *gesn_event_header; - -static unsigned int used_len; - uint64_t hdt[128][3] = { { 306, 4, 17 }, { 615, 2, 17 }, { 306, 4, 26 }, { 1024, 2, 17 }, { 697, 3, 17 }, { 306, 8, 17 }, { 614, 4, 17 }, { 615, 4, 17 }, /* 000-007 */ { 670, 4, 17 }, { 697, 4, 17 }, { 987, 3, 17 }, { 820, 4, 17 }, { 670, 5, 17 }, { 697, 5, 17 }, { 733, 5, 17 }, { 615, 6, 17 }, /* 008-015 */ { 462, 8, 17 }, { 306, 8, 26 }, { 615, 4, 26 }, { 1024, 4, 17 }, { 855, 5, 17 }, { 925, 5, 17 }, { 932, 5, 17 }, { 1024, 2, 40 }, /* 016-023 */ @@ -125,15 +95,12 @@ IDE ide_drives[IDE_NUM]; IDE *ext_ide; -char ide_fn[IDE_NUM][512]; +char hdd_fn[HDC_NUM][512]; int (*ide_bus_master_read)(int channel, uint8_t *data, int transfer_length); int (*ide_bus_master_write)(int channel, uint8_t *data, int transfer_length); void (*ide_bus_master_set_irq)(int channel); -static void atapi_callback(IDE *ide); -static void atapicommand(int ide_board); - int idecallback[4] = {0, 0, 0, 0}; int cur_ide[4]; @@ -234,7 +201,7 @@ int image_is_hdx(const char *s, int check_signature) } fread(&signature, 1, 8, f); fclose(f); - if (signature == 0xD778A82044445459) + if (signature == 0xD778A82044445459ll) { return 1; } @@ -261,7 +228,6 @@ void ide_irq_raise(IDE *ide) { if ((ide->board > 3) || ide->irqstat) { - // ide_log("Not raising IRQ %i (board %i)\n", ide_irq[ide->board], ide->board); return; } @@ -270,7 +236,6 @@ void ide_irq_raise(IDE *ide) if (!(ide->fdisk&2)) { picint(1 << ide_irq[ide->board]); - // if (ide->board && !ide->irqstat) ide_log("IDE_IRQ_RAISE\n"); if (ide->board < 2) { @@ -283,14 +248,12 @@ void ide_irq_raise(IDE *ide) ide->irqstat=1; ide->service=1; - // ide_log("raising interrupt %i\n", 14 + ide->board); } void ide_irq_lower(IDE *ide) { if ((ide->board > 3) || !(ide->irqstat)) { - // ide_log("Not lowering IRQ %i (board %i)\n", ide_irq[ide->board], ide->board); return; } @@ -298,7 +261,6 @@ void ide_irq_lower(IDE *ide) picintc(1 << ide_irq[ide->board]); ide->irqstat=0; - // ide->service=0; } void ide_irq_update(IDE *ide) @@ -314,8 +276,6 @@ void ide_irq_update(IDE *ide) mask = ide_irq[ide->board]; mask &= 7; - // ide_log("Updating IRQ %i (%i) (board %i)\n", ide_irq[ide->board], mask, ide->board); - pending = (pic2.pend | pic2.ins); pending &= (1 << mask); @@ -387,22 +347,19 @@ void ide_padstr8(uint8_t *buf, int buf_size, const char *src) */ static void ide_identify(IDE *ide) { - int c, h, s; - uint8_t device_identify[8] = { '8', '6', 'B', '_', 'H', 'D', '0', 0 }; + uint32_t c, h, s; + char device_identify[8] = { '8', '6', 'B', '_', 'H', 'D', '0', 0 }; uint64_t full_size = (hdc[cur_ide[ide->board]].tracks * hdc[cur_ide[ide->board]].hpc * hdc[cur_ide[ide->board]].spt); device_identify[6] = ide->channel + 0x30; ide_log("IDE Identify: %s\n", device_identify); memset(ide->buffer, 0, 512); - - //ide->buffer[1] = 101; /* Cylinders */ c = hdc[cur_ide[ide->board]].tracks; /* Cylinders */ h = hdc[cur_ide[ide->board]].hpc; /* Heads */ s = hdc[cur_ide[ide->board]].spt; /* Sectors */ - // ide->buffer[0] = 0x40; /* Fixed disk */ if (hdc[cur_ide[ide->board]].tracks <= 16383) { ide->buffer[1] = hdc[cur_ide[ide->board]].tracks; /* Cylinders */ @@ -420,7 +377,7 @@ static void ide_identify(IDE *ide) ide->buffer[21] = 512; /*Buffer size*/ ide->buffer[47] = 16; /*Max sectors on multiple transfer command*/ ide->buffer[48] = 1; /*Dword transfers supported*/ - if (ide->board < 2) + if (PCI && (ide->board < 2)) { ide->buffer[49] = (1 << 8); /* LBA and DMA supported */ } @@ -435,7 +392,7 @@ static void ide_identify(IDE *ide) ide->buffer[50] = 0x4000; /* Capabilities */ ide->buffer[51] = 2 << 8; /*PIO timing mode*/ ide->buffer[52] = 2 << 8; /*DMA timing mode*/ - ide->buffer[53] = ide->specify_success ? 1 : 0; + ide->buffer[53] = 1; ide->buffer[55] = ide->hpc; ide->buffer[56] = ide->spt; if (((full_size / ide->hpc) / ide->spt) <= 16383) @@ -448,24 +405,18 @@ static void ide_identify(IDE *ide) } full_size = ((uint64_t) ide->hpc) * ((uint64_t) ide->spt) * ((uint64_t) ide->buffer[54]); ide->buffer[57] = full_size & 0xFFFF; /* Total addressable sectors (LBA) */ - ide->buffer[61] = full_size >> 16; + ide->buffer[58] = (full_size >> 16) & 0x0FFF; ide->buffer[59] = ide->blocksize ? (ide->blocksize | 0x100) : 0; if (ide->buffer[49] & (1 << 9)) { ide->buffer[60] = (hdc[cur_ide[ide->board]].tracks * hdc[cur_ide[ide->board]].hpc * hdc[cur_ide[ide->board]].spt) & 0xFFFF; /* Total addressable sectors (LBA) */ ide->buffer[61] = ((hdc[cur_ide[ide->board]].tracks * hdc[cur_ide[ide->board]].hpc * hdc[cur_ide[ide->board]].spt) >> 16) & 0x0FFF; } - ide->buffer[80] = 0x1e; /*ATA-1 to ATA-4 supported*/ - // ide->buffer[63] = 7; /*Multiword DMA*/ - if (ide->board < 2) + if (PCI && (ide->board < 2)) { - ide->buffer[53] = 2; - ide->buffer[63] = ide->dma_identify_data[0]; - ide->buffer[65] = 150; - ide->buffer[66] = 150; - // ide->buffer[80] = 0xe; /*ATA-1 to ATA-3 supported*/ - // ide->buffer[88] = ide->dma_identify_data[2]; + ide->buffer[63] = 7; } + ide->buffer[80] = 0xe; /*ATA-1 to ATA-3 supported*/ } /** @@ -473,10 +424,12 @@ static void ide_identify(IDE *ide) */ static void ide_atapi_identify(IDE *ide) { - memset(ide->buffer, 0, 512); - uint8_t device_identify[8] = { '8', '6', 'B', '_', 'C', 'D', '0', 0 }; - uint8_t cdrom_id = atapi_cdrom_drives[ide->channel]; + char device_identify[8] = { '8', '6', 'B', '_', 'C', 'D', '0', 0 }; + uint8_t cdrom_id; + memset(ide->buffer, 0, 512); + cdrom_id = atapi_cdrom_drives[ide->channel]; + device_identify[6] = cdrom_id + 0x30; ide_log("ATAPI Identify: %s\n", device_identify); @@ -486,20 +439,14 @@ static void ide_atapi_identify(IDE *ide) ide_padstr((char *) (ide->buffer + 27), device_identify, 40); /* Model */ ide->buffer[48] = 1; /*Dword transfers supported*/ ide->buffer[49] = 0x200; /* LBA supported */ - ide->buffer[51] = 2 << 8; /*PIO timing mode*/ ide->buffer[73] = 6; ide->buffer[74] = 9; ide->buffer[80] = 0x10; /*ATA/ATAPI-4 supported*/ - if ((ide->board < 2) && (cdrom_drives[cdrom_id].bus_mode & 2)) + if (PCI && (ide->board < 2) && (cdrom_drives[cdrom_id].bus_mode & 2)) { ide->buffer[49] |= 0x100; /* DMA supported */ - ide->buffer[52] = 2 << 8; /*DMA timing mode*/ - ide->buffer[53] = 2; - ide->buffer[63] = ide->dma_identify_data[0]; - ide->buffer[65] = 150; - ide->buffer[66] = 150; - // ide->buffer[88] = ide->dma_identify_data[2]; + ide->buffer[63] = 7; } } @@ -514,8 +461,8 @@ static off64_t ide_get_sector(IDE *ide) } else { - int heads = ide->hpc; - int sectors = ide->spt; + uint32_t heads = ide->hpc; + uint32_t sectors = ide->spt; return ((((off64_t) ide->cylinder * heads) + ide->head) * sectors) + (ide->sector - 1) + ide->skip512; @@ -551,7 +498,7 @@ static void loadhd(IDE *ide, int d, const char *fn) { uint32_t sector_size = 512; uint32_t zero = 0; - uint64_t signature = 0xD778A82044445459; + uint64_t signature = 0xD778A82044445459ll; uint64_t full_size = 0; int c; ide->base = 0; @@ -707,6 +654,7 @@ int ide_cdrom_is_pio_only(IDE *ide) return 1; } +#if 0 int ide_set_features(IDE *ide) { uint8_t cdrom_id = cur_ide[ide->board]; @@ -777,6 +725,7 @@ int ide_set_features(IDE *ide) } return 1; } +#endif void ide_set_sector(IDE *ide, int64_t sector_num) { @@ -797,9 +746,12 @@ void ide_set_sector(IDE *ide, int64_t sector_num) } } +void ide_ter_disable_cond(); +void ide_qua_disable_cond(); + void resetide(void) { - int d; + int c, d; build_atapi_cdrom_map(); @@ -825,23 +777,33 @@ void resetide(void) idecallback[0]=idecallback[1]=0; idecallback[2]=idecallback[3]=0; + c = 0; + for (d = 0; d < HDC_NUM; d++) + { + if ((hdc[d].bus == 2) && (hdc[d].ide_channel < IDE_NUM)) + { + pclog("Found IDE hard disk on channel %i\n", hdc[d].ide_channel); + loadhd(&ide_drives[hdc[d].ide_channel], d, hdd_fn[d]); + c++; + if (c >= IDE_NUM) break; + } + } + for (d = 0; d < IDE_NUM; d++) { - if (ide_drive_is_cdrom(&ide_drives[d])) + if (ide_drive_is_cdrom(&ide_drives[d]) && (ide_drives[d].type != IDE_HDD)) { ide_drives[d].type = IDE_CDROM; } - else - { - loadhd(&ide_drives[d], d, ide_fn[d]); - } ide_set_signature(&ide_drives[d]); +#if 0 if (ide_drives[d].type != IDE_NONE) { ide_drives[d].dma_identify_data[0] = 7; } +#endif ide_drives[d].error = 1; } @@ -859,7 +821,6 @@ int idetimes = 0; void ide_write_data(int ide_board, uint32_t val, int length) { - int ret = 0; IDE *ide = &ide_drives[cur_ide[ide_board]]; uint8_t *idebufferb = (uint8_t *) ide->buffer; @@ -873,7 +834,6 @@ void ide_write_data(int ide_board, uint32_t val, int length) } #endif - // ide_log("Write IDEw %04X\n",val); if (ide->command == WIN_PACKETCMD) { ide->pos = 0; @@ -931,14 +891,11 @@ void ide_write_data(int ide_board, uint32_t val, int length) void writeidew(int ide_board, uint16_t val) { - // ide_log("WriteIDEw %04X\n", val); ide_write_data(ide_board, val, 2); } void writeidel(int ide_board, uint32_t val) { - // ide_log("WriteIDEl %08X\n", val); - // ide_write_data(ide_board, val, 4); writeidew(ide_board, val); writeidew(ide_board, val >> 16); } @@ -957,7 +914,6 @@ void writeide(int ide_board, uint16_t addr, uint8_t val) switch (addr) { case 0x1F0: /* Data */ - // writeidew(ide_board, val | (val << 8)); writeidew(ide_board, val | (val << 8)); return; @@ -1094,39 +1050,9 @@ void writeide(int ide_board, uint16_t addr, uint8_t val) return; } -#if 0 - if (ide_drive_is_cdrom(ide)) - { -#if 0 - ide_log("Write CD-ROM ATA command: %02X\n", val); -#endif - switch(val) - { - case WIN_SRST: - case WIN_CHECKPOWERMODE1: - case WIN_DRIVE_DIAGNOSTICS: - case WIN_IDLENOW1: - case WIN_PACKETCMD: - case WIN_PIDENTIFY: - case WIN_IDENTIFY: - case WIN_SET_FEATURES: - case WIN_SLEEP1: - case WIN_STANDBYNOW1: - break; - default: - ide_irq_lower(ide); - ide->command=val; - val = 0xFF; - goto skip_to_command_processing; - break; - } - } -#endif ide_irq_lower(ide); ide->command=val; -skip_to_command_processing: - // ide_log("New IDE command - %02X %i %i\n",ide->command,cur_ide[ide_board],ide_board); ide->error=0; if (ide_drive_is_cdrom(ide)) { @@ -1260,8 +1186,6 @@ skip_to_command_processing: case WIN_FORMAT: if (ide_drive_is_cdrom(ide)) { - // cdrom[atapi_cdrom_drives[ide->channel]].status = DRQ_STAT; - // cdrom[atapi_cdrom_drives[ide->channel]].pos = 0; goto ide_bad_command; } else @@ -1315,8 +1239,7 @@ skip_to_command_processing: timer_update_outstanding(); return; - case WIN_IDENTIFY: /* Identify Device */ - case WIN_SET_FEATURES: + case WIN_IDENTIFY: /* Identify Device */ case WIN_READ_NATIVE_MAX: if (ide_drive_is_cdrom(ide)) { @@ -1346,10 +1269,9 @@ skip_to_command_processing: } else { - ide->packetstatus = ATAPI_STATUS_IDLE; ide->atastat = BUSY_STAT; timer_process(); - idecallback[ide_board]=1;//30*IDE_TIME; + idecallback[ide_board]=1; timer_update_outstanding(); ide->pos=0; } @@ -1397,7 +1319,6 @@ ide_bad_command: cdrom[atapi_cdrom_drives[ide->channel]].status = BUSY_STAT; } ide->atastat = ide_other->atastat = BUSY_STAT; - // ide_log("IDE Reset %i\n", ide_board); } if (val & 4) { @@ -1411,7 +1332,6 @@ ide_bad_command: ide_irq_update(ide); return; } - // fatal("Bad IDE write %04X %02X\n", addr, val); } uint32_t ide_read_data(int ide_board, int length) @@ -1463,11 +1383,9 @@ uint32_t ide_read_data(int ide_board, int length) ide->atastat = READY_STAT | DSC_STAT; if (ide_drive_is_cdrom(ide)) { - // cdrom[atapi_cdrom_drives[cur_ide[ide_board]]].pos = 0; cdrom[atapi_cdrom_drives[cur_ide[ide_board]]].status = READY_STAT | DSC_STAT; cdrom[atapi_cdrom_drives[cur_ide[ide_board]]].packet_status = CDROM_PHASE_IDLE; } - ide->packetstatus = ATAPI_STATUS_IDLE; if (ide->command == WIN_READ || ide->command == WIN_READ_NORETRY || ide->command == WIN_READ_MULTIPLE) { ide->secount = (ide->secount - 1) & 0xff; @@ -1486,10 +1404,13 @@ uint32_t ide_read_data(int ide_board, int length) } timer_update_outstanding(); } + else + { + update_status_bar_icon(0x21, 0); + } } } - // ide_log("Read IDEw %04X\n",temp); return temp; } @@ -1499,17 +1420,13 @@ uint8_t readide(int ide_board, uint16_t addr) uint8_t temp; uint16_t tempw; - uint8_t temp2; - - addr|=0x90; - addr&=0xFFF7; + addr |= 0x90; + addr &= 0xFFF7; switch (addr) { case 0x1F0: /* Data */ - // temp = ide_read_data(ide_board, 1); tempw = readidew(ide_board); - // ide_log("Read IDEW %04X\n", tempw); temp = tempw & 0xff; break; @@ -1613,7 +1530,6 @@ uint8_t readide(int ide_board, uint16_t addr) if (ide_drive_is_cdrom(ide)) { temp = (cdrom[atapi_cdrom_drives[cur_ide[ide_board]]].status & ~DSC_STAT) | (ide->service ? SERVICE_STAT : 0); - // ide_log("Read CD-ROM status: %02X\n", temp); } else { @@ -1629,17 +1545,18 @@ uint8_t readide(int ide_board, uint16_t addr) if (ide_drive_is_cdrom(ide)) { temp = (cdrom[atapi_cdrom_drives[cur_ide[ide_board]]].status & ~DSC_STAT) | (ide->service ? SERVICE_STAT : 0); - // ide_log("Read CD-ROM alternate status: %02X\n", temp); } else { temp = ide->atastat; } break; + + default: + return 0xff; } /* if (ide_board) */ ide_log("Read IDEb %04X %02X %02X %02X %i %04X:%04X %i\n", addr, temp, ide->atastat,(ide->atastat & ~DSC_STAT) | (ide->service ? SERVICE_STAT : 0),cur_ide[ide_board],CS,cpu_state.pc,ide_board); return temp; - // fatal("Bad IDE read %04X\n", addr); } uint8_t cdb[16]; @@ -1656,16 +1573,9 @@ uint16_t readidew(int ide_board) return ide_read_data(ide_board, 2); } -/* uint32_t readidel(int ide_board) -{ - // ide_log("Read IDEl %i\n", ide_board); - return ide_read_data(ide_board, 4); -} */ - uint32_t readidel(int ide_board) { uint16_t temp; - // ide_log("Read IDEl %i\n", ide_board); temp = readidew(ide_board); return temp | (readidew(ide_board) << 16); } @@ -1673,15 +1583,17 @@ uint32_t readidel(int ide_board) int times30=0; void callbackide(int ide_board) { - IDE *ide = &ide_drives[cur_ide[ide_board]]; - IDE *ide_other = &ide_drives[cur_ide[ide_board] ^ 1]; + IDE *ide, *ide_other; off64_t addr; - uint64_t faddr; int c; - ext_ide = ide; int64_t snum; int cdrom_id; - uint64_t full_size = (hdc[cur_ide[ide->board]].tracks * hdc[cur_ide[ide->board]].hpc * hdc[cur_ide[ide->board]].spt); + uint64_t full_size; + + ide = &ide_drives[cur_ide[ide_board]]; + ide_other = &ide_drives[cur_ide[ide_board] ^ 1]; + full_size = (hdc[cur_ide[ide->board]].tracks * hdc[cur_ide[ide->board]].hpc * hdc[cur_ide[ide->board]].spt); + ext_ide = ide; if (ide_drive_is_cdrom(ide)) { @@ -1735,7 +1647,6 @@ void callbackide(int ide_board) { ide_other->cylinder=0xFFFF; } - // ide_log("Reset callback\n"); return; } @@ -1818,7 +1729,7 @@ void callbackide(int ide_board) ide_irq_raise(ide); - readflash=1; + update_status_bar_icon(0x21, 1); return; case WIN_READ_DMA: @@ -1852,15 +1763,16 @@ void callbackide(int ide_board) ide_next_sector(ide); ide->atastat = BUSY_STAT; idecallback[ide_board]=6*IDE_TIME; + update_status_bar_icon(0x21, 1); } else { ide_irq_raise(ide); + update_status_bar_icon(0x21, 0); } } } - readflash=1; return; case WIN_READ_MULTIPLE: @@ -1886,7 +1798,6 @@ void callbackide(int ide_board) ide->atastat = DRQ_STAT | READY_STAT | DSC_STAT; if (!ide->blockcount) { - // ide_log("Read multiple int\n"); ide_irq_raise(ide); } ide->blockcount++; @@ -1895,7 +1806,7 @@ void callbackide(int ide_board) ide->blockcount = 0; } - readflash=1; + update_status_bar_icon(0x21, 1); return; case WIN_WRITE: @@ -1918,13 +1829,14 @@ void callbackide(int ide_board) ide->atastat = DRQ_STAT | READY_STAT | DSC_STAT; ide->pos=0; ide_next_sector(ide); + update_status_bar_icon(0x21, 1); } else { ide->atastat = READY_STAT | DSC_STAT; + update_status_bar_icon(0x21, 0); } - readflash=1; return; case WIN_WRITE_DMA: @@ -1958,15 +1870,16 @@ void callbackide(int ide_board) ide_next_sector(ide); ide->atastat = BUSY_STAT; idecallback[ide_board]=6*IDE_TIME; + update_status_bar_icon(0x21, 1); } else { ide_irq_raise(ide); + update_status_bar_icon(0x21, 0); } } } - readflash=1; return; case WIN_WRITE_MULTIPLE: @@ -1993,13 +1906,13 @@ void callbackide(int ide_board) ide->atastat = DRQ_STAT | READY_STAT | DSC_STAT; ide->pos=0; ide_next_sector(ide); + update_status_bar_icon(0x21, 1); } else { ide->atastat = READY_STAT | DSC_STAT; + update_status_bar_icon(0x21, 0); } - - readflash=1; return; case WIN_VERIFY: @@ -2015,7 +1928,7 @@ void callbackide(int ide_board) ide->pos=0; ide->atastat = READY_STAT | DSC_STAT; ide_irq_raise(ide); - readflash=1; + update_status_bar_icon(0x21, 1); return; case WIN_FORMAT: @@ -2028,7 +1941,6 @@ void callbackide(int ide_board) goto id_not_found; } addr = ide_get_sector(ide) * 512; - // ide_log("Format cyl %i head %i offset %08X %08X %08X secount %i\n",ide.cylinder,ide.head,addr,addr>>32,addr,ide.secount); fseeko64(ide->hdfile, ide->base + addr, SEEK_SET); memset(ide->buffer, 0, 512); for (c=0;csecount;c++) @@ -2038,7 +1950,7 @@ void callbackide(int ide_board) ide->atastat = READY_STAT | DSC_STAT; ide_irq_raise(ide); - readflash=1; + /* update_status_bar_icon(0x21, 1); */ return; case WIN_DRIVE_DIAGNOSTICS: @@ -2064,32 +1976,17 @@ void callbackide(int ide_board) { goto abort_cmd; } - /* if (((hdc[cur_ide[ide->board]].at_hpc == 0) && (hdc[cur_ide[ide->board]].at_spt == 0)) || (ide->hdi != 2)) - { */ - full_size /= (ide->head+1); - full_size /= ide->secount; - ide->specify_success = 1; - if (ide->hdi == 2) - { - hdc[cur_ide[ide->board]].at_hpc = ide->head+1; - hdc[cur_ide[ide->board]].at_spt = ide->secount; - fseeko64(ide->hdfile, 0x20, SEEK_SET); - fwrite(&(hdc[cur_ide[ide->board]].at_spt), 1, 4, ide->hdfile); - fwrite(&(hdc[cur_ide[ide->board]].at_hpc), 1, 4, ide->hdfile); - } - /* } - else + full_size /= (ide->head+1); + full_size /= ide->secount; + ide->specify_success = 1; + if (ide->hdi == 2) { - if ((hdc[cur_ide[ide->board]].at_hpc == (ide->head + 1)) && (hdc[cur_ide[ide->board]].at_spt == ide->secount)) - { - ide->specify_success = 1; - } - else - { - ide_log("WIN_SPECIFY error (%04X, %04X)\n", ide->head + 1, ide->secount); - ide->specify_success = 0; - } - } */ + hdc[cur_ide[ide->board]].at_hpc = ide->head+1; + hdc[cur_ide[ide->board]].at_spt = ide->secount; + fseeko64(ide->hdfile, 0x20, SEEK_SET); + fwrite(&(hdc[cur_ide[ide->board]].at_spt), 1, 4, ide->hdfile); + fwrite(&(hdc[cur_ide[ide->board]].at_hpc), 1, 4, ide->hdfile); + } ide->spt=ide->secount; ide->hpc=ide->head+1; ide->atastat = READY_STAT | DSC_STAT; @@ -2116,10 +2013,10 @@ void callbackide(int ide_board) } ide->blocksize = ide->secount; ide->atastat = READY_STAT | DSC_STAT; - // ide_log("Set multiple mode - %i\n", ide->blocksize); ide_irq_raise(ide); return; +#if 0 case WIN_SET_FEATURES: if (!(ide_set_features(ide))) { @@ -2135,7 +2032,8 @@ void callbackide(int ide_board) } ide_irq_raise(ide); return; - +#endif + case WIN_READ_NATIVE_MAX: if ((ide->type != IDE_HDD) || ide_drive_is_cdrom(ide)) { @@ -2335,28 +2233,71 @@ uint32_t ide_read_qua_l(uint16_t addr, void *priv) } /* *** REMOVE FROM CODE SUBMITTED TO MAINLINE - END *** */ +static uint16_t ide_base_main[2] = { 0x1f0, 0x170 }; +static uint16_t ide_side_main[2] = { 0x3f6, 0x376 }; + void ide_pri_enable() { io_sethandler(0x01f0, 0x0008, ide_read_pri, ide_read_pri_w, ide_read_pri_l, ide_write_pri, ide_write_pri_w, ide_write_pri_l, NULL); io_sethandler(0x03f6, 0x0001, ide_read_pri, NULL, NULL, ide_write_pri, NULL, NULL , NULL); + ide_base_main[0] = 0x1f0; + ide_side_main[0] = 0x3f6; +} + +void ide_pri_enable_ex() +{ + if (ide_base_main[0] & 0x300) + { + pclog("Enabling primary base (%04X)...\n", ide_base_main[0]); + io_sethandler(ide_base_main[0], 0x0008, ide_read_pri, ide_read_pri_w, ide_read_pri_l, ide_write_pri, ide_write_pri_w, ide_write_pri_l, NULL); + } + if (ide_side_main[0] & 0x300) + { + pclog("Enabling primary side (%04X)...\n", ide_side_main[0]); + io_sethandler(ide_side_main[0], 0x0001, ide_read_pri, NULL, NULL, ide_write_pri, NULL, NULL , NULL); + } } void ide_pri_disable() { - io_removehandler(0x01f0, 0x0008, ide_read_pri, ide_read_pri_w, ide_read_pri_l, ide_write_pri, ide_write_pri_w, ide_write_pri_l, NULL); - io_removehandler(0x03f6, 0x0001, ide_read_pri, NULL, NULL, ide_write_pri, NULL, NULL , NULL); + io_removehandler(ide_base_main[0], 0x0008, ide_read_pri, ide_read_pri_w, ide_read_pri_l, ide_write_pri, ide_write_pri_w, ide_write_pri_l, NULL); + io_removehandler(ide_side_main[0], 0x0001, ide_read_pri, NULL, NULL, ide_write_pri, NULL, NULL , NULL); } void ide_sec_enable() { io_sethandler(0x0170, 0x0008, ide_read_sec, ide_read_sec_w, ide_read_sec_l, ide_write_sec, ide_write_sec_w, ide_write_sec_l, NULL); io_sethandler(0x0376, 0x0001, ide_read_sec, NULL, NULL, ide_write_sec, NULL, NULL , NULL); + ide_base_main[1] = 0x170; + ide_side_main[1] = 0x376; +} + +void ide_sec_enable_ex() +{ + if (ide_base_main[1] & 0x300) + { + io_sethandler(ide_base_main[1], 0x0008, ide_read_sec, ide_read_sec_w, ide_read_sec_l, ide_write_sec, ide_write_sec_w, ide_write_sec_l, NULL); + } + if (ide_side_main[1] & 0x300) + { + io_sethandler(ide_side_main[1], 0x0001, ide_read_sec, NULL, NULL, ide_write_sec, NULL, NULL , NULL); + } } void ide_sec_disable() { - io_removehandler(0x0170, 0x0008, ide_read_sec, ide_read_sec_w, ide_read_sec_l, ide_write_sec, ide_write_sec_w, ide_write_sec_l, NULL); - io_removehandler(0x0376, 0x0001, ide_read_sec, NULL, NULL, ide_write_sec, NULL, NULL , NULL); + io_removehandler(ide_base_main[1], 0x0008, ide_read_sec, ide_read_sec_w, ide_read_sec_l, ide_write_sec, ide_write_sec_w, ide_write_sec_l, NULL); + io_removehandler(ide_side_main[1], 0x0001, ide_read_sec, NULL, NULL, ide_write_sec, NULL, NULL , NULL); +} + +void ide_set_base(int controller, uint16_t port) +{ + ide_base_main[controller] = port; +} + +void ide_set_side(int controller, uint16_t port) +{ + ide_side_main[controller] = port; } /* *** REMOVE FROM CODE SUBMITTED TO MAINLINE - START *** */ diff --git a/src/ide.h b/src/ide.h index 970bc557b..dedb41793 100644 --- a/src/ide.h +++ b/src/ide.h @@ -4,7 +4,12 @@ #ifndef __IDE__ #define __IDE__ +#ifdef __MSC__ +# pragma pack(push,1) +typedef struct IDE +#else typedef struct __attribute__((__packed__)) IDE +#endif { int type; int board; @@ -34,6 +39,9 @@ typedef struct __attribute__((__packed__)) IDE int hdc_num; uint8_t specify_success; } IDE; +#ifdef __MSC__ +# pragma pack(pop) +#endif extern void writeide(int ide_board, uint16_t addr, uint8_t val); extern void writeidew(int ide_board, uint16_t val); @@ -61,8 +69,6 @@ extern int ide_irq[4]; extern int idecallback[4]; -extern char ide_fn[IDE_NUM][512]; - void ide_irq_raise(IDE *ide); void ide_irq_lower(IDE *ide); @@ -73,4 +79,9 @@ void ide_padstr8(uint8_t *buf, int buf_size, const char *src); void win_cdrom_eject(uint8_t id); void win_cdrom_reload(uint8_t id); -#endif //__IDE__ +#endif + +void ide_pri_disable(); +void ide_pri_enable_ex(); +void ide_set_base(int controller, uint16_t port); +void ide_set_side(int controller, uint16_t port); diff --git a/src/intel.c b/src/intel.c index 9d305df2b..2eb47939b 100644 --- a/src/intel.c +++ b/src/intel.c @@ -12,7 +12,6 @@ uint8_t batman_brdconfig(uint16_t port, void *p) { -// pclog("batman_brdconfig read port=%04x\n", port); switch (port) { case 0x73: @@ -24,7 +23,7 @@ uint8_t batman_brdconfig(uint16_t port, void *p) } static uint16_t batman_timer_latch; -static int64_t batman_timer = 0; +static int batman_timer = 0; static void batman_timer_over(void *p) { batman_timer = 0; @@ -65,22 +64,3 @@ void intel_batman_init() io_sethandler(0x0078, 0x0002, batman_timer_read, NULL, NULL, batman_timer_write, NULL, NULL, NULL); timer_add(batman_timer_over, &batman_timer, &batman_timer, NULL); } - - -#if 0 -uint8_t endeavor_brdconfig(uint16_t port, void *p) -{ -// pclog("endeavor_brdconfig read port=%04x\n", port); - switch (port) - { - case 0x79: - return 0xff; - } - return 0; -} - -void intel_endeavor_init() -{ - io_sethandler(0x0079, 0x0001, endeavor_brdconfig, NULL, NULL, NULL, NULL, NULL, NULL); -} -#endif diff --git a/src/intel_flash.c b/src/intel_flash.c index de8fe15a5..39d40ec7d 100644 --- a/src/intel_flash.c +++ b/src/intel_flash.c @@ -20,7 +20,8 @@ enum CMD_ERASE_SETUP = 0x20, CMD_ERASE_CONFIRM = 0xd0, CMD_ERASE_SUSPEND = 0xb0, - CMD_PROGRAM_SETUP = 0x40 + CMD_PROGRAM_SETUP = 0x40, + CMD_PROGRAM_SETUP_ALT = 0x10 }; typedef struct flash_t @@ -40,11 +41,9 @@ static uint8_t flash_read(uint32_t addr, void *p) flash_t *flash = (flash_t *)p; if (flash->invert_high_pin) { - // pclog("flash_read : addr=%08x/%08x val=%02x command=%02x %04x:%08x\n", addr, addr ^ 0x10000, flash->array[(addr ^ 0x10000) & 0x1ffff], flash->command, CS, cpu_state.pc); addr ^= 0x10000; if (addr & 0xfff00000) return flash->array[addr & 0x1ffff]; } - // pclog("flash_read : addr=%08x command=%02x %04x:%08x\n", addr, flash->command, CS, cpu_state.pc); addr &= 0x1ffff; switch (flash->command) { @@ -82,7 +81,6 @@ static void flash_write(uint32_t addr, uint8_t val, void *p) { flash_t *flash = (flash_t *)p; int i; - // pclog("flash_write : addr=%08x val=%02x command=%02x %04x:%08x\n", addr, val, flash->command, CS, cpu_state.pc); if (flash->invert_high_pin) { @@ -96,8 +94,6 @@ static void flash_write(uint32_t addr, uint8_t val, void *p) case CMD_ERASE_SETUP: if (val == CMD_ERASE_CONFIRM) { - // pclog("flash_write: erase %05x\n", addr); - for (i = 0; i < 3; i++) { if ((addr >= flash->block_start[i]) && (addr <= flash->block_end[i])) @@ -110,7 +106,7 @@ static void flash_write(uint32_t addr, uint8_t val, void *p) break; case CMD_PROGRAM_SETUP: - // pclog("flash_write: program %05x %02x\n", addr, val); + case CMD_PROGRAM_SETUP_ALT: if ((addr & 0x1e000) != (flash->block_start[3] & 0x1e000)) flash->array[addr] = val; flash->command = CMD_READ_STATUS; @@ -154,10 +150,11 @@ static void intel_flash_add_mappings_inverted(flash_t *flash) void *intel_flash_init(uint8_t type) { FILE *f; - flash_t *flash = malloc(sizeof(flash_t)); - memset(flash, 0, sizeof(flash_t)); char fpath[1024]; int i; + flash_t *flash; + flash = malloc(sizeof(flash_t)); + memset(flash, 0, sizeof(flash_t)); switch(romset) { @@ -184,6 +181,12 @@ void *intel_flash_init(uint8_t type) case ROM_P54TP4XE: strcpy(flash_path, "roms/p54tp4xe/"); break; + case ROM_AP53: + strcpy(flash_path, "roms/ap53/"); + break; + case ROM_P55T2S: + strcpy(flash_path, "roms/p55t2s/"); + break; case ROM_ACERM3A: strcpy(flash_path, "roms/acerm3a/"); break; @@ -219,10 +222,12 @@ void *intel_flash_init(uint8_t type) case ROM_ZAPPA: strcpy(flash_path, "roms/zappa/"); break; + case ROM_S1668: + strcpy(flash_path, "roms/tpatx/"); + break; default: fatal("intel_flash_init on unsupported ROM set %i\n", romset); } - // pclog("Flash init: Path is: %s\n", flash_path); flash->flash_id = (type & FLASH_IS_BXB) ? 0x95 : 0x94; flash->invert_high_pin = (type & FLASH_INVERT); @@ -298,6 +303,11 @@ void *intel_flash_init(uint8_t type) return flash; } +void *intel_flash_bxb_ami_init() +{ + return intel_flash_init(FLASH_IS_BXB | FLASH_INVERT); +} + /* For AMI BIOS'es - Intel 28F001BXT with high address pin inverted. */ void *intel_flash_bxt_ami_init() { @@ -347,6 +357,19 @@ device_t intel_flash_bxt_ami_device = NULL }; +device_t intel_flash_bxb_ami_device = +{ + "Intel 28F001BXB Flash BIOS", + 0, + intel_flash_bxb_ami_init, + intel_flash_close, + NULL, + NULL, + NULL, + NULL, + NULL +}; + device_t intel_flash_bxt_device = { "Intel 28F001BXT Flash BIOS", diff --git a/src/intel_flash.h b/src/intel_flash.h index e8e0c1bc7..242480961 100644 --- a/src/intel_flash.h +++ b/src/intel_flash.h @@ -1,3 +1,4 @@ extern device_t intel_flash_bxt_ami_device; +extern device_t intel_flash_bxb_ami_device; extern device_t intel_flash_bxt_device; extern device_t intel_flash_bxb_device; diff --git a/src/io.c b/src/io.c index 9431268fd..da9e3318a 100644 --- a/src/io.c +++ b/src/io.c @@ -23,10 +23,12 @@ void io_init() pclog("io_init\n"); for (c = 0; c < 0x10000; c++) { - port_inb[c][0] = port_inw[c][0] = port_inl[c][0] = NULL; - port_outb[c][0] = port_outw[c][0] = port_outl[c][0] = NULL; - port_inb[c][1] = port_inw[c][1] = port_inl[c][1] = NULL; - port_outb[c][1] = port_outw[c][1] = port_outl[c][1] = NULL; + port_inb[c][0] = port_inb[c][1] = NULL; + port_outb[c][0] = port_outb[c][1] = NULL; + port_inw[c][0] = port_inw[c][1] = NULL; + port_outw[c][0] = port_outw[c][1] = NULL; + port_inl[c][0] = port_inl[c][1] = NULL; + port_outl[c][0] = port_outl[c][1] = NULL; port_priv[c][0] = port_priv[c][1] = NULL; } } @@ -94,6 +96,7 @@ void io_removehandler(uint16_t base, int size, port_outw[ base + c][0] = NULL; if (port_outl[ base + c][0] == outl) port_outl[ base + c][0] = NULL; + port_priv[base + c][0] = NULL; } if (port_priv[base + c][1] == priv) { @@ -109,6 +112,7 @@ void io_removehandler(uint16_t base, int size, port_outw[ base + c][1] = NULL; if (port_outl[ base + c][1] == outl) port_outl[ base + c][1] = NULL; + port_priv[base + c][1] = NULL; } } } @@ -133,6 +137,9 @@ uint8_t inb(uint16_t port) /* if (port_inb[port][0] || port_inb[port][1]) pclog("Good INB %04X %04X:%04X\n", port, CS, cpu_state.pc); */ +#ifdef IO_TRACE +if (CS == IO_TRACE) pclog("IOTRACE(%04X): inb(%04x)=%02x\n", IO_TRACE, port, temp); +#endif return temp; } @@ -145,6 +152,9 @@ void outb(uint16_t port, uint8_t val) if (port_outb[port][1]) port_outb[port][1](port, val, port_priv[port][1]); +#ifdef IO_TRACE +if (CS == IO_TRACE) pclog("IOTRACE(%04X): outb(%04x,%02x)\n", IO_TRACE, port, val); +#endif /* if (!port_outb[port][0] && !port_outb[port][1]) pclog("Bad OUTB %04X %02X %04X:%08X\n", port, val, CS, cpu_state.pc); */ diff --git a/src/jim.c b/src/jim.c index d1adcd5c3..ea7c5d64d 100644 --- a/src/jim.c +++ b/src/jim.c @@ -20,13 +20,11 @@ void writejim(uint16_t addr, uint8_t val, void *p) switch (addr) { case 0x25A: -// printf("Write RTC stat %i val %02X\n",europc_rtc.stat,val); switch (europc_rtc.stat) { case 0: europc_rtc.addr=val&0xF; europc_rtc.stat++; -// printf("RTC addr now %02X - contents %02X\n",val&0xF,europc_rtc.dat[europc_rtc.addr]); break; case 1: europc_rtc.dat[europc_rtc.addr]=(europc_rtc.dat[europc_rtc.addr]&0xF)|(val<<4); @@ -39,12 +37,10 @@ void writejim(uint16_t addr, uint8_t val, void *p) } break; } -// printf("Write JIM %04X %02X\n",addr,val); } uint8_t readjim(uint16_t addr, void *p) { -// printf("Read JIM %04X\n",addr); switch (addr) { case 0x250: case 0x251: case 0x252: case 0x253: return 0; diff --git a/src/joystick_ch_flightstick_pro.c b/src/joystick_ch_flightstick_pro.c index 3ced21653..9f0e97250 100644 --- a/src/joystick_ch_flightstick_pro.c +++ b/src/joystick_ch_flightstick_pro.c @@ -8,6 +8,7 @@ static void *ch_flightstick_pro_init() { + return NULL; } static void ch_flightstick_pro_close(void *p) @@ -63,6 +64,8 @@ static int ch_flightstick_pro_read_axis(void *p, int axis) return 0; case 3: return joystick_state[0].axis[2]; + default: + return 0; } } @@ -72,18 +75,18 @@ static void ch_flightstick_pro_a0_over(void *p) joystick_if_t joystick_ch_flightstick_pro = { - .name = "CH Flightstick Pro", - .init = ch_flightstick_pro_init, - .close = ch_flightstick_pro_close, - .read = ch_flightstick_pro_read, - .write = ch_flightstick_pro_write, - .read_axis = ch_flightstick_pro_read_axis, - .a0_over = ch_flightstick_pro_a0_over, - .max_joysticks = 1, - .axis_count = 3, - .button_count = 4, - .pov_count = 1, - .axis_names = {"X axis", "Y axis", "Throttle"}, - .button_names = {"Button 1", "Button 2", "Button 3", "Button 4"}, - .pov_names = {"POV"} + "CH Flightstick Pro", + ch_flightstick_pro_init, + ch_flightstick_pro_close, + ch_flightstick_pro_read, + ch_flightstick_pro_write, + ch_flightstick_pro_read_axis, + ch_flightstick_pro_a0_over, + 1, + 3, + 4, + 1, + {"X axis", "Y axis", "Throttle"}, + {"Button 1", "Button 2", "Button 3", "Button 4"}, + {"POV"} }; diff --git a/src/joystick_standard.c b/src/joystick_standard.c index 6f961a896..7c8098ba7 100644 --- a/src/joystick_standard.c +++ b/src/joystick_standard.c @@ -8,6 +8,7 @@ static void *joystick_standard_init() { + return NULL; } static void joystick_standard_close(void *p) @@ -79,6 +80,8 @@ static int joystick_standard_read_axis(void *p, int axis) if (!JOYSTICK_PRESENT(1)) return AXIS_NOT_PRESENT; return joystick_state[1].axis[1]; + default: + return 0; } } @@ -97,6 +100,8 @@ static int joystick_standard_read_axis_4button(void *p, int axis) return 0; case 3: return 0; + default: + return 0; } } static int joystick_standard_read_axis_6button(void *p, int axis) @@ -114,6 +119,8 @@ static int joystick_standard_read_axis_6button(void *p, int axis) return joystick_state[0].button[4] ? -32767 : 32768; case 3: return joystick_state[0].button[5] ? -32767 : 32768; + default: + return 0; } } static int joystick_standard_read_axis_8button(void *p, int axis) @@ -139,6 +146,8 @@ static int joystick_standard_read_axis_8button(void *p, int axis) if (joystick_state[0].button[7]) return 32768; return 0; + default: + return 0; } } @@ -148,61 +157,65 @@ static void joystick_standard_a0_over(void *p) joystick_if_t joystick_standard = { - .name = "Standard 2-button joystick(s)", - .init = joystick_standard_init, - .close = joystick_standard_close, - .read = joystick_standard_read, - .write = joystick_standard_write, - .read_axis = joystick_standard_read_axis, - .a0_over = joystick_standard_a0_over, - .max_joysticks = 2, - .axis_count = 2, - .button_count = 2, - .axis_names = {"X axis", "Y axis"}, - .button_names = {"Button 1", "Button 2"} + "Standard 2-button joystick(s)", + joystick_standard_init, + joystick_standard_close, + joystick_standard_read, + joystick_standard_write, + joystick_standard_read_axis, + joystick_standard_a0_over, + 2, + 2, + 2, + 0, + {"X axis", "Y axis"}, + {"Button 1", "Button 2"} }; joystick_if_t joystick_standard_4button = { - .name = "Standard 4-button joystick", - .init = joystick_standard_init, - .close = joystick_standard_close, - .read = joystick_standard_read_4button, - .write = joystick_standard_write, - .read_axis = joystick_standard_read_axis_4button, - .a0_over = joystick_standard_a0_over, - .max_joysticks = 1, - .axis_count = 2, - .button_count = 4, - .axis_names = {"X axis", "Y axis"}, - .button_names = {"Button 1", "Button 2", "Button 3", "Button 4"} + "Standard 4-button joystick", + joystick_standard_init, + joystick_standard_close, + joystick_standard_read_4button, + joystick_standard_write, + joystick_standard_read_axis_4button, + joystick_standard_a0_over, + 1, + 2, + 4, + 0, + {"X axis", "Y axis"}, + {"Button 1", "Button 2", "Button 3", "Button 4"} }; joystick_if_t joystick_standard_6button = { - .name = "Standard 6-button joystick", - .init = joystick_standard_init, - .close = joystick_standard_close, - .read = joystick_standard_read_4button, - .write = joystick_standard_write, - .read_axis = joystick_standard_read_axis_6button, - .a0_over = joystick_standard_a0_over, - .max_joysticks = 1, - .axis_count = 2, - .button_count = 6, - .axis_names = {"X axis", "Y axis"}, - .button_names = {"Button 1", "Button 2", "Button 3", "Button 4", "Button 5", "Button 6"} + "Standard 6-button joystick", + joystick_standard_init, + joystick_standard_close, + joystick_standard_read_4button, + joystick_standard_write, + joystick_standard_read_axis_6button, + joystick_standard_a0_over, + 1, + 2, + 6, + 0, + {"X axis", "Y axis"}, + {"Button 1", "Button 2", "Button 3", "Button 4", "Button 5", "Button 6"} }; joystick_if_t joystick_standard_8button = { - .name = "Standard 8-button joystick", - .init = joystick_standard_init, - .close = joystick_standard_close, - .read = joystick_standard_read_4button, - .write = joystick_standard_write, - .read_axis = joystick_standard_read_axis_8button, - .a0_over = joystick_standard_a0_over, - .max_joysticks = 1, - .axis_count = 2, - .button_count = 8, - .axis_names = {"X axis", "Y axis"}, - .button_names = {"Button 1", "Button 2", "Button 3", "Button 4", "Button 5", "Button 6", "Button 7", "Button 8"} + "Standard 8-button joystick", + joystick_standard_init, + joystick_standard_close, + joystick_standard_read_4button, + joystick_standard_write, + joystick_standard_read_axis_8button, + joystick_standard_a0_over, + 1, + 2, + 8, + 0, + {"X axis", "Y axis"}, + {"Button 1", "Button 2", "Button 3", "Button 4", "Button 5", "Button 6", "Button 7", "Button 8"} }; diff --git a/src/joystick_sw_pad.c b/src/joystick_sw_pad.c index 007dd5492..5fce2447a 100644 --- a/src/joystick_sw_pad.c +++ b/src/joystick_sw_pad.c @@ -149,7 +149,6 @@ static void sw_write(void *p) if (time_since_last > 9900 && time_since_last < 9940) { -// pclog("sw sends ID packet\n"); sw->poll_mode = 0; sw->poll_left = 49; sw->poll_data = 0x2400ull | (0x1830ull << 15) | (0x19b0ull << 30); @@ -157,8 +156,6 @@ static void sw_write(void *p) else { int c; - -// pclog("sw sends data packet %08x %i\n", cpu_state.pc, data_packets++); sw->poll_mode = sw->data_mode; sw->data_mode = !sw->data_mode; @@ -236,16 +233,17 @@ static void sw_a0_over(void *p) joystick_if_t joystick_sw_pad = { - .name = "Microsoft SideWinder Pad", - .init = sw_init, - .close = sw_close, - .read = sw_read, - .write = sw_write, - .read_axis = sw_read_axis, - .a0_over = sw_a0_over, - .max_joysticks = 4, - .axis_count = 2, - .button_count = 10, - .axis_names = {"X axis", "Y axis"}, - .button_names = {"A", "B", "C", "X", "Y", "Z", "L", "R", "Start", "M"} + "Microsoft SideWinder Pad", + sw_init, + sw_close, + sw_read, + sw_write, + sw_read_axis, + sw_a0_over, + 4, + 2, + 10, + 0, + {"X axis", "Y axis"}, + {"A", "B", "C", "X", "Y", "Z", "L", "R", "Start", "M"} }; diff --git a/src/joystick_tm_fcs.c b/src/joystick_tm_fcs.c index 02c153e49..a60e0ca5d 100644 --- a/src/joystick_tm_fcs.c +++ b/src/joystick_tm_fcs.c @@ -8,6 +8,7 @@ static void *tm_fcs_init() { + return NULL; } static void tm_fcs_close(void *p) @@ -62,6 +63,8 @@ static int tm_fcs_read_axis(void *p, int axis) if (joystick_state[0].pov[0] >= 225 && joystick_state[0].pov[0] < 315) return 16384; return 0; + default: + return 0; } } @@ -71,18 +74,18 @@ static void tm_fcs_a0_over(void *p) joystick_if_t joystick_tm_fcs = { - .name = "Thrustmaster Flight Control System", - .init = tm_fcs_init, - .close = tm_fcs_close, - .read = tm_fcs_read, - .write = tm_fcs_write, - .read_axis = tm_fcs_read_axis, - .a0_over = tm_fcs_a0_over, - .max_joysticks = 1, - .axis_count = 2, - .button_count = 4, - .pov_count = 1, - .axis_names = {"X axis", "Y axis"}, - .button_names = {"Button 1", "Button 2", "Button 3", "Button 4"}, - .pov_names = {"POV"} + "Thrustmaster Flight Control System", + tm_fcs_init, + tm_fcs_close, + tm_fcs_read, + tm_fcs_write, + tm_fcs_read_axis, + tm_fcs_a0_over, + 1, + 2, + 4, + 1, + {"X axis", "Y axis"}, + {"Button 1", "Button 2", "Button 3", "Button 4"}, + {"POV"} }; diff --git a/src/keyboard.c b/src/keyboard.c index 8090f9196..22924f504 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -467,7 +467,6 @@ void keyboard_process() if (!set3_all_break && !recv_key[scorder[c]] && !(set3_flags[scancodes[scorder[c]].scancodes_make[0]] & 2)) continue; } -// pclog("Key %02X start\n", scorder[c]); d = 0; if (recv_key[scorder[c]]) { diff --git a/src/keyboard_amstrad.c b/src/keyboard_amstrad.c index 7f1a99c9e..6ec66001f 100644 --- a/src/keyboard_amstrad.c +++ b/src/keyboard_amstrad.c @@ -88,7 +88,7 @@ void keyboard_amstrad_write(uint16_t port, uint8_t val, void *priv) speaker_enable = val & 2; if (speaker_enable) was_speaker_enable = 1; - pit_set_gate(2, val & 1); + pit_set_gate(&pit, 2, val & 1); if (val & 0x80) keyboard_amstrad.pa = 0; @@ -107,15 +107,12 @@ void keyboard_amstrad_write(uint16_t port, uint8_t val, void *priv) default: pclog("\nBad XT keyboard write %04X %02X\n", port, val); -// dumpregs(); -// exit(-1); } } uint8_t keyboard_amstrad_read(uint16_t port, void *priv) { uint8_t temp; -// pclog("keyboard_amstrad : read %04X ", port); switch (port) { case 0x60: @@ -155,10 +152,7 @@ uint8_t keyboard_amstrad_read(uint16_t port, void *priv) default: pclog("\nBad XT keyboard read %04X\n", port); -// dumpregs(); -// exit(-1); } -// pclog("%02X %04X:%04X\n", temp, CS, pc); return temp; } @@ -171,7 +165,6 @@ void keyboard_amstrad_reset() void keyboard_amstrad_init() { - //return; pclog("keyboard_amstrad_init\n"); io_sethandler(0x0060, 0x0006, keyboard_amstrad_read, NULL, NULL, keyboard_amstrad_write, NULL, NULL, NULL); keyboard_amstrad_reset(); diff --git a/src/keyboard_at.c b/src/keyboard_at.c index 9d9857945..4cf084829 100644 --- a/src/keyboard_at.c +++ b/src/keyboard_at.c @@ -4,6 +4,8 @@ #include #include "ibm.h" +#include "disc.h" +#include "fdc.h" #include "io.h" #include "mem.h" #include "pic.h" @@ -25,6 +27,8 @@ #define STAT_IFULL 0x02 #define STAT_OFULL 0x01 +#define PS2_REFRESH_TIME (16 * TIMER_USEC) + #define CCB_UNUSED 0x80 #define CCB_TRANSLATE 0x40 #define CCB_PCMODE 0x20 @@ -63,6 +67,11 @@ struct void (*mouse_write)(uint8_t val, void *p); void *mouse_p; + + int refresh_time; + int refresh; + + int is_ps2; } keyboard_at; static uint8_t key_ctrl_queue[16]; @@ -136,7 +145,6 @@ void keyboard_at_poll() keyboard_at.status |= STAT_OFULL; keyboard_at.status &= ~STAT_IFULL; keyboard_at.status |= STAT_MFULL; -// pclog("keyboard_at : take IRQ12\n"); keyboard_at.last_irq = 0x1000; } else @@ -148,12 +156,17 @@ void keyboard_at_poll() keyboard_at.status |= STAT_OFULL; keyboard_at.status &= ~STAT_IFULL; keyboard_at.status &= ~STAT_MFULL; -// pclog("keyboard_at : take IRQ1\n"); keyboard_at.last_irq = 2; } } - if (!(keyboard_at.status & STAT_OFULL) && keyboard_at.out_new == -1 && /*!(keyboard_at.mem[0] & 0x20) &&*/ + if (keyboard_at.out_new == -1 && !(keyboard_at.status & STAT_OFULL) && + key_ctrl_queue_start != key_ctrl_queue_end) + { + keyboard_at.out_new = key_ctrl_queue[key_ctrl_queue_start]; + key_ctrl_queue_start = (key_ctrl_queue_start + 1) & 0xf; + } + else if (!(keyboard_at.status & STAT_OFULL) && keyboard_at.out_new == -1 && /*!(keyboard_at.mem[0] & 0x20) &&*/ mouse_queue_start != mouse_queue_end) { keyboard_at.out_new = mouse_queue[mouse_queue_start] | 0x100; @@ -165,29 +178,12 @@ void keyboard_at_poll() keyboard_at.out_new = key_queue[key_queue_start]; key_queue_start = (key_queue_start + 1) & 0xf; } - else if (keyboard_at.out_new == -1 && !(keyboard_at.status & STAT_OFULL) && - key_ctrl_queue_start != key_ctrl_queue_end) - { - keyboard_at.out_new = key_ctrl_queue[key_ctrl_queue_start]; - key_ctrl_queue_start = (key_ctrl_queue_start + 1) & 0xf; - } } void keyboard_at_adddata(uint8_t val) { -// if (keyboard_at.status & STAT_OFULL) -// { key_ctrl_queue[key_ctrl_queue_end] = val; key_ctrl_queue_end = (key_ctrl_queue_end + 1) & 0xf; -// pclog("keyboard_at : %02X added to queue\n", val); -/* return; - } - keyboard_at.out = val; - keyboard_at.status |= STAT_OFULL; - keyboard_at.status &= ~STAT_IFULL; - if (keyboard_at.mem[0] & 0x01) - keyboard_at.wantirq = 1; - pclog("keyboard_at : output %02X (IRQ %i)\n", val, keyboard_at.wantirq);*/ } uint8_t sc_or = 0; @@ -223,18 +219,12 @@ void keyboard_at_adddata_mouse(uint8_t val) { mouse_queue[mouse_queue_end] = val; mouse_queue_end = (mouse_queue_end + 1) & 0xf; -// pclog("keyboard_at : %02X added to mouse queue\n", val); return; } void keyboard_at_write(uint16_t port, uint8_t val, void *priv) { int i = 0; -// pclog("keyboard_at : write %04X %02X %i %02X\n", port, val, keyboard_at.key_wantdata, ram[8]); -/* if (ram[8] == 0xc3) - { - output = 3; - }*/ switch (port) { case 0x60: @@ -244,7 +234,15 @@ void keyboard_at_write(uint16_t port, uint8_t val, void *priv) keyboard_at.want60 = 0; switch (keyboard_at.command) { - case 0x40 ... 0x5f: /* 0x40 - 0x5F are aliases for 0x60-0x7F */ + /* 0x40 - 0x5F are aliases for 0x60-0x7F */ + case 0x40: case 0x41: case 0x42: case 0x43: + case 0x44: case 0x45: case 0x46: case 0x47: + case 0x48: case 0x49: case 0x4a: case 0x4b: + case 0x4c: case 0x4d: case 0x4e: case 0x4f: + case 0x50: case 0x51: case 0x52: case 0x53: + case 0x54: case 0x55: case 0x56: case 0x57: + case 0x58: case 0x59: case 0x5a: case 0x5b: + case 0x5c: case 0x5d: case 0x5e: case 0x5f: keyboard_at.command |= 0x20; goto write_register; @@ -268,7 +266,6 @@ write_register: mouse_scan = !(val & 0x20); /* Addition by OBattler: Scan code translate ON/OFF. */ - // pclog("KEYBOARD_AT: Writing %02X to system register\n", val); mode &= 0x93; mode |= (val & MODE_MASK); if (first_write) @@ -285,7 +282,6 @@ write_register: } keyboard_at.default_mode = (mode & 3); first_write = 0; - // pclog("Keyboard set to scan code set %i, mode & 0x60 = 0x%02X\n", mode & 3, mode & 0x60); /* No else because in all other cases, translation is off, so we need to keep it set to set 0 which the mode &= 0xFC above will set it. */ } @@ -295,23 +291,18 @@ write_register: case 0xaf: /*AMI - set extended controller RAM*/ if (keyboard_at.secr_phase == 0) { - // pclog("Set extended controller RAM - phase 0 (bad)\n"); goto bad_command; } else if (keyboard_at.secr_phase == 1) { - // pclog("Set extended controller RAM - phase 1\n"); keyboard_at.mem_addr = val; keyboard_at.want60 = 1; keyboard_at.secr_phase = 2; - // pclog("Set extended controller RAM - starting phase 2\n"); } else if (keyboard_at.secr_phase == 2) { - // pclog("Set extended controller RAM - phase 2\n"); keyboard_at.mem[keyboard_at.mem_addr] = val; keyboard_at.secr_phase = 0; - // pclog("Set extended controller RAM - starting phase 0\n"); } break; @@ -325,12 +316,10 @@ write_register: break; case 0xd1: /*Write output port*/ -// pclog("Write output port - %02X %02X %04X:%04X\n", keyboard_at.output_port, val, CS, pc); if ((keyboard_at.output_port ^ val) & 0x02) /*A20 enable change*/ { mem_a20_key = val & 0x02; mem_a20_recalc(); -// pclog("Rammask change to %08X %02X\n", rammask, val & 0x02); flushmmucache(); } keyboard_at.output_port = val; @@ -352,8 +341,6 @@ write_register: default: bad_command: pclog("Bad AT keyboard controller 0060 write %02X command %02X\n", val, keyboard_at.command); -// dumpregs(); -// exit(-1); } } else @@ -370,7 +357,6 @@ bad_command: break; case 0xf0: /*Get/set scancode set*/ - // pclog("KEYBOARD_AT: Get/set scan code set: %i\n", val); if (val == 0) { keyboard_at_adddata_keyboard(mode & 3); @@ -392,8 +378,6 @@ bad_command: default: pclog("Bad AT keyboard 0060 write %02X command %02X\n", val, keyboard_at.key_command); -// dumpregs(); -// exit(-1); } } else @@ -452,11 +436,9 @@ bad_command: break; case 0xf6: /*Set defaults*/ - // pclog("KEYBOARD_AT: Set defaults\n"); set3_all_break = 0; set3_all_repeat = 0; memset(set3_flags, 0, 272); - // mode = (mode & 0xFC) | 2; mode = (mode & 0xFC) | keyboard_at.default_mode; keyboard_at_adddata_keyboard(0xfa); break; @@ -487,7 +469,6 @@ bad_command: break; case 0xff: /*Reset*/ - // pclog("KEYBOARD_AT: Set defaults\n"); key_queue_start = key_queue_end = 0; /*Clear key queue*/ keyboard_at_adddata_keyboard(0xfa); keyboard_at_adddata_keyboard(0xaa); @@ -499,8 +480,6 @@ bad_command: default: pclog("Bad AT keyboard command %02X\n", val); keyboard_at_adddata_keyboard(0xfe); -// dumpregs(); -// exit(-1); } } } @@ -517,7 +496,7 @@ bad_command: speaker_enable = val & 2; if (speaker_enable) was_speaker_enable = 1; - pit_set_gate(2, val & 1); + pit_set_gate(&pit, 2, val & 1); break; case 0x64: @@ -526,7 +505,14 @@ bad_command: /*New controller command*/ switch (val) { - case 0x00 ... 0x1f: + case 0x00: case 0x01: case 0x02: case 0x03: + case 0x04: case 0x05: case 0x06: case 0x07: + case 0x08: case 0x09: case 0x0a: case 0x0b: + case 0x0c: case 0x0d: case 0x0e: case 0x0f: + case 0x10: case 0x11: case 0x12: case 0x13: + case 0x14: case 0x15: case 0x16: case 0x17: + case 0x18: case 0x19: case 0x1a: case 0x1b: + case 0x1c: case 0x1d: case 0x1e: case 0x1f: val |= 0x20; /* 0x00-0x1f are aliases for 0x20-0x3f */ keyboard_at_adddata(keyboard_at.mem[val & 0x1f]); break; @@ -583,7 +569,6 @@ bad_command: { mem_a20_key = 2; mem_a20_recalc(); -// pclog("Rammask change to %08X %02X\n", rammask, val & 0x02); flushmmucache(); } keyboard_at.output_port = 0xcf; @@ -625,10 +610,12 @@ bad_command: case ROM_ENDEAVOR: case ROM_THOR: case ROM_MRTHOR: + case ROM_AP53: + case ROM_P55T2S: + case ROM_S1668: /*Set extended controlled RAM*/ keyboard_at.want60 = 1; keyboard_at.secr_phase = 1; - // pclog("Set extended controller RAM - starting phase 1\n"); break; default: /*Read keyboard version*/ @@ -637,7 +624,9 @@ bad_command: } break; - case 0xb0 ... 0xbf: /*Set keyboard lines low (B0-B7) or high (B8-BF)*/ + case 0xb0: case 0xb1: case 0xb2: case 0xb3: case 0xb4: case 0xb5: case 0xb6: case 0xb7: + case 0xb8: case 0xb9: case 0xba: case 0xbb: case 0xbc: case 0xbd: case 0xbe: case 0xbf: + /*Set keyboard lines low (B0-B7) or high (B8-BF)*/ keyboard_at_adddata(0x00); break; @@ -694,7 +683,6 @@ bad_command: keyboard_at.output_port &= ~0x02; mem_a20_key = 0; mem_a20_recalc(); - // pclog("Rammask change to %08X %02X\n", rammask, val & 0x02); flushmmucache(); break; @@ -702,7 +690,6 @@ bad_command: keyboard_at.output_port |= 0x02; mem_a20_key = 2; mem_a20_recalc(); - // pclog("Rammask change to %08X %02X\n", rammask, val & 0x02); flushmmucache(); break; @@ -713,19 +700,19 @@ bad_command: case 0xef: /*??? - sent by AMI486*/ break; - case 0xf0 ... 0xff: + case 0xf0: case 0xf1: case 0xf2: case 0xf3: case 0xf4: case 0xf5: case 0xf6: case 0xf7: + case 0xf8: case 0xf9: case 0xfa: case 0xfb: case 0xfc: case 0xfd: case 0xfe: case 0xff: if (!(val & 1)) { /* Pin 0 selected. */ - softresetx86(); /*Pulse reset!*/ - cpu_set_edx(); + /* trc_reset(2); */ + softresetx86(); /*Pulse reset!*/ + cpu_set_edx(); } break; default: pclog("Bad AT keyboard controller command %02X\n", val); -// dumpregs(); -// exit(-1); } } } @@ -733,8 +720,6 @@ bad_command: uint8_t keyboard_at_read(uint16_t port, void *priv) { uint8_t temp = 0xff; - cycles -= 4; -// if (port != 0x61) pclog("keyboard_at : read %04X ", port); switch (port) { case 0x60: @@ -753,9 +738,18 @@ uint8_t keyboard_at_read(uint16_t port, void *priv) keyboard_at.last_irq = 0; break; - case 0x61: - if (ppispeakon) return (ppi.pb&~0xC0)|0x20; - return ppi.pb&~0xe0; + case 0x61: + temp = ppi.pb & ~0xe0; + if (ppispeakon) + temp |= 0x20; + if (keyboard_at.is_ps2) + { + if (keyboard_at.refresh) + temp |= 0x10; + else + temp &= ~0x10; + } + break; case 0x64: temp = (keyboard_at.status & 0xFB) | (mode & CCB_SYSTEM); @@ -763,7 +757,6 @@ uint8_t keyboard_at_read(uint16_t port, void *priv) keyboard_at.status &= ~(STAT_RTIMEOUT/* | STAT_TTIMEOUT*/); break; } -// if (port != 0x61) pclog("%02X %08X\n", temp, rammask); return temp; } @@ -777,7 +770,7 @@ void keyboard_at_reset() first_write = 1; keyboard_at.wantirq = 0; keyboard_at.output_port = 0xcf; - keyboard_at.input_port = 0xb0; + keyboard_at.input_port = (MDA) ? 0xf0 : 0xb0; keyboard_at.out_new = -1; keyboard_at.last_irq = 0; keyboard_at.secr_phase = 0; @@ -791,15 +784,21 @@ void keyboard_at_reset() memset(set3_flags, 0, 272); } +static void at_refresh(void *p) +{ + keyboard_at.refresh = !keyboard_at.refresh; + keyboard_at.refresh_time += PS2_REFRESH_TIME; +} + void keyboard_at_init() { - //return; io_sethandler(0x0060, 0x0005, keyboard_at_read, NULL, NULL, keyboard_at_write, NULL, NULL, NULL); keyboard_at_reset(); keyboard_send = keyboard_at_adddata_keyboard; keyboard_poll = keyboard_at_poll; keyboard_at.mouse_write = NULL; keyboard_at.mouse_p = NULL; + keyboard_at.is_ps2 = 0; dtrans = 0; timer_add(keyboard_at_poll, &keybsenddelay, TIMER_ALWAYS_ENABLED, NULL); @@ -810,3 +809,9 @@ void keyboard_at_set_mouse(void (*mouse_write)(uint8_t val, void *p), void *p) keyboard_at.mouse_write = mouse_write; keyboard_at.mouse_p = p; } + +void keyboard_at_init_ps2() +{ + timer_add(at_refresh, &keyboard_at.refresh_time, TIMER_ALWAYS_ENABLED, NULL); + keyboard_at.is_ps2 = 1; +} diff --git a/src/keyboard_at.h b/src/keyboard_at.h index 5f0d758ee..2fdfb5ee8 100644 --- a/src/keyboard_at.h +++ b/src/keyboard_at.h @@ -2,9 +2,11 @@ see COPYING for more details */ void keyboard_at_init(); +void keyboard_at_init_ps2(); void keyboard_at_reset(); void keyboard_at_poll(); void keyboard_at_adddata_keyboard_raw(uint8_t val); +void keyboard_at_adddata_mouse(uint8_t val); void keyboard_at_set_mouse(void (*mouse_write)(uint8_t val, void *p), void *p); extern int mouse_queue_start, mouse_queue_end; diff --git a/src/keyboard_olim24.c b/src/keyboard_olim24.c index 79eff4217..498640777 100644 --- a/src/keyboard_olim24.c +++ b/src/keyboard_olim24.c @@ -1,8 +1,10 @@ +#include #include "ibm.h" #include "io.h" #include "mem.h" #include "mouse.h" #include "pic.h" +#include "pit.h" #include "sound.h" #include "sound_speaker.h" #include "timer.h" @@ -152,7 +154,7 @@ void keyboard_olim24_write(uint16_t port, uint8_t val, void *priv) speaker_enable = val & 2; if (speaker_enable) was_speaker_enable = 1; - pit_set_gate(2, val & 1); + pit_set_gate(&pit, 2, val & 1); break; } } @@ -221,7 +223,7 @@ typedef struct mouse_olim24_t int x, y, b; } mouse_olim24_t; -void mouse_olim24_poll(int x, int y, int z, int b, void *p) +uint8_t mouse_olim24_poll(int x, int y, int z, int b, void *p) { mouse_olim24_t *mouse = (mouse_olim24_t *)p; @@ -231,7 +233,7 @@ void mouse_olim24_poll(int x, int y, int z, int b, void *p) // pclog("mouse_poll - %i, %i %i, %i\n", x, y, mouse->x, mouse->y); if (((key_queue_end - key_queue_start) & 0xf) > 14) - return; + return(0xff); if ((b & 1) && !(mouse->b & 1)) keyboard_olim24_adddata(mouse_scancodes[0]); if (!(b & 1) && (mouse->b & 1)) @@ -239,7 +241,7 @@ void mouse_olim24_poll(int x, int y, int z, int b, void *p) mouse->b = (mouse->b & ~1) | (b & 1); if (((key_queue_end - key_queue_start) & 0xf) > 14) - return; + return(0xff); if ((b & 2) && !(mouse->b & 2)) keyboard_olim24_adddata(mouse_scancodes[2]); if (!(b & 2) && (mouse->b & 2)) @@ -247,7 +249,7 @@ void mouse_olim24_poll(int x, int y, int z, int b, void *p) mouse->b = (mouse->b & ~2) | (b & 2); if (((key_queue_end - key_queue_start) & 0xf) > 14) - return; + return(0xff); if ((b & 4) && !(mouse->b & 4)) keyboard_olim24_adddata(mouse_scancodes[1]); if (!(b & 4) && (mouse->b & 4)) @@ -257,9 +259,9 @@ void mouse_olim24_poll(int x, int y, int z, int b, void *p) if (keyboard_olim24.mouse_mode) { if (((key_queue_end - key_queue_start) & 0xf) > 12) - return; + return(0xff); if (!mouse->x && !mouse->y) - return; + return(0xff); mouse->y = -mouse->y; @@ -282,32 +284,34 @@ void mouse_olim24_poll(int x, int y, int z, int b, void *p) while (mouse->x < -4) { if (((key_queue_end - key_queue_start) & 0xf) > 14) - return; + return(0xff); mouse->x += 4; keyboard_olim24_adddata(mouse_scancodes[3]); } while (mouse->x > 4) { if (((key_queue_end - key_queue_start) & 0xf) > 14) - return; + return(0xff); mouse->x -= 4; keyboard_olim24_adddata(mouse_scancodes[4]); } while (mouse->y < -4) { if (((key_queue_end - key_queue_start) & 0xf) > 14) - return; + return(0xff); mouse->y += 4; keyboard_olim24_adddata(mouse_scancodes[5]); } while (mouse->y > 4) { if (((key_queue_end - key_queue_start) & 0xf) > 14) - return; + return(0xff); mouse->y -= 4; keyboard_olim24_adddata(mouse_scancodes[6]); } } + + return(0); } static void *mouse_olim24_init() @@ -328,10 +332,11 @@ static void mouse_olim24_close(void *p) mouse_t mouse_olim24 = { "Olivetti M24 mouse", + "olim24", + MOUSE_TYPE_OLIM24, mouse_olim24_init, mouse_olim24_close, - mouse_olim24_poll, - MOUSE_TYPE_OLIM24 + mouse_olim24_poll }; void keyboard_olim24_init() diff --git a/src/keyboard_pcjr.c b/src/keyboard_pcjr.c index 64fa693cd..38142dd14 100644 --- a/src/keyboard_pcjr.c +++ b/src/keyboard_pcjr.c @@ -9,6 +9,7 @@ #include "mem.h" #include "nmi.h" #include "pic.h" +#include "pit.h" #include "sound.h" #include "sound_sn76489.h" #include "sound_speaker.h" @@ -52,7 +53,6 @@ void keyboard_pcjr_poll() int p = 0; uint8_t key = key_queue[key_queue_start]; -// pclog("Reading %02X from the key queue at %i\n", key, key_queue_start); key_queue_start = (key_queue_start + 1) & 0xf; keyboard_pcjr.latched = 1; @@ -102,25 +102,18 @@ void keyboard_pcjr_poll() keyboard_pcjr.serial_pos++; if (keyboard_pcjr.serial_pos == 42+1) keyboard_pcjr.serial_pos = 0; -// pclog("Keyboard poll %i %i\n", keyboard_pcjr.data, keyboard_pcjr.serial_pos); } } void keyboard_pcjr_adddata(uint8_t val) { key_queue[key_queue_end] = val; -// pclog("keyboard_pcjr : %02X added to key queue at %i\n", val, key_queue_end); key_queue_end = (key_queue_end + 1) & 0xf; return; } void keyboard_pcjr_write(uint16_t port, uint8_t val, void *priv) { -// pclog("keyboard_pcjr : write %04X %02X %02X\n", port, val, keyboard_pcjr.pb); -/* if (ram[8] == 0xc3) - { - output = 3; - }*/ switch (port) { case 0x60: @@ -138,7 +131,7 @@ void keyboard_pcjr_write(uint16_t port, uint8_t val, void *priv) speaker_enable = val & 2; if (speaker_enable) was_speaker_enable = 1; - pit_set_gate(2, val & 1); + pit_set_gate(&pit, 2, val & 1); sn76489_mute = speaker_mute = 1; switch (val & 0x60) { @@ -153,7 +146,7 @@ void keyboard_pcjr_write(uint16_t port, uint8_t val, void *priv) case 0xa0: nmi_mask = val & 0x80; - pit_set_using_timer(1, !(val & 0x20)); + pit_set_using_timer(&pit, 1, !(val & 0x20)); break; } } @@ -161,7 +154,6 @@ void keyboard_pcjr_write(uint16_t port, uint8_t val, void *priv) uint8_t keyboard_pcjr_read(uint16_t port, void *priv) { uint8_t temp; -// pclog("keyboard_pcjr : read %04X ", port); switch (port) { case 0x60: @@ -178,21 +170,19 @@ uint8_t keyboard_pcjr_read(uint16_t port, void *priv) temp |= (ppispeakon ? 0x10 : 0); temp |= (ppispeakon ? 0x20 : 0); temp |= (keyboard_pcjr.data ? 0x40: 0); -// temp |= 0x04; if (keyboard_pcjr.data) temp |= 0x40; break; case 0xa0: keyboard_pcjr.latched = 0; + temp = 0; break; default: pclog("\nBad XT keyboard read %04X\n", port); - //dumpregs(); - //exit(-1); + temp = 0xff; } -// pclog("%02X\n", temp); return temp; } @@ -202,7 +192,6 @@ void keyboard_pcjr_reset() void keyboard_pcjr_init() { - //return; io_sethandler(0x0060, 0x0004, keyboard_pcjr_read, NULL, NULL, keyboard_pcjr_write, NULL, NULL, NULL); io_sethandler(0x00a0, 0x0008, keyboard_pcjr_read, NULL, NULL, keyboard_pcjr_write, NULL, NULL, NULL); keyboard_pcjr_reset(); diff --git a/src/keyboard_xt.c b/src/keyboard_xt.c index bb9233491..0541b2692 100644 --- a/src/keyboard_xt.c +++ b/src/keyboard_xt.c @@ -4,11 +4,14 @@ #include #include "ibm.h" +#include "device.h" #include "io.h" #include "mem.h" #include "pic.h" +#include "pit.h" #include "sound.h" #include "sound_speaker.h" +#include "tandy_eeprom.h" #include "timer.h" #include "keyboard.h" @@ -59,15 +62,9 @@ void keyboard_xt_adddata(uint8_t val) void keyboard_xt_write(uint16_t port, uint8_t val, void *priv) { -// pclog("keyboard_xt : write %04X %02X %02X\n", port, val, keyboard_xt.pb); -/* if (ram[8] == 0xc3) - { - output = 3; - }*/ switch (port) { case 0x61: -// pclog("keyboard_xt : pb write %02X %02X %i %02X %i\n", val, keyboard_xt.pb, !(keyboard_xt.pb & 0x40), keyboard_xt.pb & 0x40, (val & 0x40)); if (!(keyboard_xt.pb & 0x40) && (val & 0x40)) /*Reset keyboard*/ { pclog("keyboard_xt : reset keyboard\n"); @@ -91,7 +88,7 @@ void keyboard_xt_write(uint16_t port, uint8_t val, void *priv) speaker_enable = val & 2; if (speaker_enable) was_speaker_enable = 1; - pit_set_gate(2, val & 1); + pit_set_gate(&pit, 2, val & 1); break; } @@ -100,7 +97,6 @@ void keyboard_xt_write(uint16_t port, uint8_t val, void *priv) uint8_t keyboard_xt_read(uint16_t port, void *priv) { uint8_t temp; -// pclog("keyboard_xt : read %04X ", port); switch (port) { case 0x60: @@ -150,10 +146,8 @@ uint8_t keyboard_xt_read(uint16_t port, void *priv) default: pclog("\nBad XT keyboard read %04X\n", port); - //dumpregs(); - //exit(-1); + temp = 0xff; } -// pclog("%02X\n", temp); return temp; } @@ -166,7 +160,6 @@ void keyboard_xt_reset() void keyboard_xt_init() { - //return; io_sethandler(0x0060, 0x0004, keyboard_xt_read, NULL, NULL, keyboard_xt_write, NULL, NULL, NULL); keyboard_xt_reset(); keyboard_send = keyboard_xt_adddata; @@ -178,7 +171,6 @@ void keyboard_xt_init() void keyboard_tandy_init() { - //return; io_sethandler(0x0060, 0x0004, keyboard_xt_read, NULL, NULL, keyboard_xt_write, NULL, NULL, NULL); keyboard_xt_reset(); keyboard_send = keyboard_xt_adddata; diff --git a/src/libwpcapdelay.a b/src/libwpcapdelay.a new file mode 100644 index 000000000..c9d175845 Binary files /dev/null and b/src/libwpcapdelay.a differ diff --git a/src/lpt.c b/src/lpt.c index 1d29b7d9a..1f0ad05c5 100644 --- a/src/lpt.c +++ b/src/lpt.c @@ -4,6 +4,7 @@ #include "ibm.h" #include "io.h" +#include "dac.h" #include "lpt.h" static uint8_t lpt1_dat, lpt2_dat; @@ -14,11 +15,11 @@ void lpt1_write(uint16_t port, uint8_t val, void *priv) switch (port & 3) { case 0: - writedac(val); + writedac(port, val); lpt1_dat = val; break; case 2: - writedacctrl(val); + writedacctrl(port, val); lpt1_ctrl = val; break; } @@ -42,11 +43,11 @@ void lpt2_write(uint16_t port, uint8_t val, void *priv) switch (port & 3) { case 0: - writedac(val); + writedac(port, val); lpt2_dat = val; break; case 2: - writedacctrl(val); + writedacctrl(port, val); lpt2_ctrl = val; break; } @@ -72,7 +73,7 @@ void lpt_init() io_sethandler(0x0378, 0x0003, lpt1_read, NULL, NULL, lpt1_write, NULL, NULL, NULL); io_sethandler(0x0278, 0x0003, lpt2_read, NULL, NULL, lpt2_write, NULL, NULL, NULL); lpt_addr[0] = 0x378; - lpt_addr[1] = 0x378; + lpt_addr[1] = 0x278; } void lpt1_init(uint16_t port) diff --git a/src/mca.c b/src/mca.c new file mode 100644 index 000000000..aacebd792 --- /dev/null +++ b/src/mca.c @@ -0,0 +1,64 @@ +#include "ibm.h" +#include "io.h" +#include "mem.h" + +#include "mca.h" + +void (*mca_card_write[8])(int addr, uint8_t val, void *priv); +uint8_t (*mca_card_read[8])(int addr, void *priv); +void *mca_priv[8]; +static int mca_index; +static int mca_nr_cards; + +void mca_init(int nr_cards) +{ + int c; + + for (c = 0; c < 8; c++) + { + mca_card_read[c] = NULL; + mca_card_write[c] = NULL; + mca_priv[c] = NULL; + } + + mca_index = 0; + mca_nr_cards = nr_cards; +} + +void mca_set_index(int index) +{ + mca_index = index; +} + +uint8_t mca_read(uint16_t port) +{ + if (mca_index >= mca_nr_cards) + return 0xff; + if (!mca_card_read[mca_index]) + return 0xff; + return mca_card_read[mca_index](port, mca_priv[mca_index]); +} + +void mca_write(uint16_t port, uint8_t val) +{ + if (mca_index >= mca_nr_cards) + return; + if (mca_card_write[mca_index]) + mca_card_write[mca_index](port, val, mca_priv[mca_index]); +} + +void mca_add(uint8_t (*read)(int addr, void *priv), void (*write)(int addr, uint8_t val, void *priv), void *priv) +{ + int c; + + for (c = 0; c < mca_nr_cards; c++) + { + if (!mca_card_read[c] && !mca_card_write[c]) + { + mca_card_read[c] = read; + mca_card_write[c] = write; + mca_priv[c] = priv; + return; + } + } +} diff --git a/src/mca.h b/src/mca.h new file mode 100644 index 000000000..90d7f07ef --- /dev/null +++ b/src/mca.h @@ -0,0 +1,5 @@ +void mca_init(int nr_cards); +void mca_add(uint8_t (*read)(int addr, void *priv), void (*write)(int addr, uint8_t val, void *priv), void *priv); +void mca_set_index(int index); +uint8_t mca_read(uint16_t port); +void mca_write(uint16_t port, uint8_t val); diff --git a/src/mcr.c b/src/mcr.c index 32f67fd63..1cc47f441 100644 --- a/src/mcr.c +++ b/src/mcr.c @@ -21,12 +21,6 @@ void writemcr(uint16_t addr, uint8_t val) case 0x22: if (val==6 && mcr22==6) nextreg6=1; else nextreg6=0; -// if ((val&1) && (mcr22&1)) shadowbios=1; -// if (!(val&1) && !(mcr22&1)) shadowbios=0; -// if (!mcrfirst) shadowbios=val&1; -// mcrfirst=0; -// dumpregs(); -// exit(-1); break; case 0x23: if (nextreg6) shadowbios=!val; diff --git a/src/mem.c b/src/mem.c index 1f5ec3836..a48b6217d 100644 --- a/src/mem.c +++ b/src/mem.c @@ -13,6 +13,7 @@ #include "ibm.h" #include "config.h" +#include "io.h" #include "mem.h" #include "video.h" #include "x86.h" @@ -39,7 +40,7 @@ static int _mem_state[0x40000]; static mem_mapping_t base_mapping; mem_mapping_t ram_low_mapping; -static mem_mapping_t ram_high_mapping; +mem_mapping_t ram_high_mapping; static mem_mapping_t ram_mid_mapping; static mem_mapping_t ram_remapped_mapping; mem_mapping_t bios_mapping[8]; @@ -69,7 +70,6 @@ static void mem_load_atide115_bios() FILE *f; f=romfopen("roms/ide_at_1_1_5.bin","rb"); -// is486=0; if (f) { fread(romext,16384,1,f); @@ -355,7 +355,6 @@ int loadbios() fclose(f); return 1;*/ case ROM_AMI386SX: -// f=romfopen("roms/at386/at386.bin","rb"); f=romfopen("roms/ami386/ami386.bin","rb"); if (!f) break; fread(rom,65536,1,f); @@ -394,7 +393,6 @@ int loadbios() if (!f) break; fread(rom,65536,1,f); fclose(f); -// memset(romext,0x63,0x8000); return 1; case ROM_AWARD286: @@ -405,18 +403,15 @@ int loadbios() return 1; case ROM_EUROPC: -// return 0; f=romfopen("roms/europc/50145","rb"); if (!f) break; fread(rom+0x8000,32768,1,f); fclose(f); -// memset(romext,0x63,0x8000); return 1; case ROM_IBMPC: f=romfopen("roms/ibmpc/pc102782.bin","rb"); if (!f) break; -// f=fopen("pc081682.bin","rb"); fread(rom+0xE000,8192,1,f); fclose(f); f=romfopen("roms/ibmpc/basicc11.f6","rb"); @@ -458,31 +453,18 @@ int loadbios() if (!f) break; fread(rom,65536,1,f); fclose(f); - //is486=1; return 1; case ROM_WIN486: -// f=romfopen("roms/win486/win486.bin","rb"); f=romfopen("roms/win486/ALI1429G.AMW","rb"); if (!f) break; fread(rom,65536,1,f); fclose(f); - //is486=1; return 1; -#if 0 - case ROM_PCI486: - f=romfopen("roms/hot-433/hot-433.ami","rb"); - if (!f) break; - fread(rom, 0x20000, 1, f); - fclose(f); - biosmask = 0x1ffff; - //is486=1; - return 1; -#endif - case ROM_SIS496: - f = romfopen("roms/sis496/SIS496-1.AWA", "rb"); + /* f = romfopen("roms/sis496/SIS496-1.AWA", "rb"); */ + f = romfopen("roms/sis496/SIS496_3.AWA", "rb"); if (!f) break; fread(rom, 0x20000, 1, f); fclose(f); @@ -491,15 +473,11 @@ int loadbios() return 1; case ROM_430VX: -// f = romfopen("roms/430vx/Ga586atv.bin", "rb"); -// f = fopen("roms/430vx/vx29.BIN", "rb"); f = romfopen("roms/430vx/55XWUQ0E.BIN", "rb"); -// f=romfopen("roms/430vx/430vx","rb"); if (!f) break; fread(rom, 0x20000, 1, f); fclose(f); biosmask = 0x1ffff; - //is486=1; return 1; case ROM_REVENGE: @@ -514,7 +492,6 @@ int loadbios() fread(rom, 0xc000, 1, f); fclose(f); biosmask = 0x1ffff; - //is486=1; return 1; case ROM_ENDEAVOR: f = romfopen("roms/endeavor/1006CB0_.BIO", "rb"); @@ -528,31 +505,14 @@ int loadbios() fread(rom, 0xd000, 1, f); fclose(f); biosmask = 0x1ffff; - //is486=1; return 1; case ROM_IBMPS1_2011: -#if 0 - f=romfopen("roms/ibmps1es/ibm_1057757_24-05-90.bin","rb"); - ff=romfopen("roms/ibmps1es/ibm_1057757_29-15-90.bin","rb"); - fseek(f, 0x10000, SEEK_SET); - fseek(ff, 0x10000, SEEK_SET); - if (!f || !ff) break; - for (c = 0x0000; c < 0x20000; c += 2) - { - rom[c] = getc(f); - rom[c+1] = getc(ff); - } - fclose(ff); - fclose(f); -#endif -//#if 0 f = romfopen("roms/ibmps1es/f80000.bin", "rb"); if (!f) break; fseek(f, 0x60000, SEEK_SET); fread(rom, 0x20000, 1, f); fclose(f); -//#endif biosmask = 0x1ffff; return 1; @@ -703,7 +663,6 @@ int loadbios() fread(rom, 0xd000, 1, f); fclose(f); biosmask = 0x1ffff; - //is486=1; return 1; case ROM_MB500N: @@ -714,15 +673,21 @@ int loadbios() biosmask = 0x1ffff; return 1; -#if 0 - case ROM_POWERMATE_V: - f = romfopen("roms/powermate_v/BIOS.ROM", "rb"); /* Works */ + case ROM_AP53: + f = romfopen("roms/ap53/AP53R2C0.ROM", "rb"); /* Works */ + if (!f) break; + fread(rom, 0x20000, 1, f); + fclose(f); + biosmask = 0x1ffff; + return 1; + + case ROM_P55T2S: + f = romfopen("roms/p55t2s/S6Y08T.ROM", "rb"); /* Works */ if (!f) break; fread(rom, 0x20000, 1, f); fclose(f); biosmask = 0x1ffff; return 1; -#endif case ROM_P54TP4XE: f = romfopen("roms/p54tp4xe/T15I0302.AWD", "rb"); @@ -780,22 +745,13 @@ int loadbios() biosmask = 0x1ffff; return 1; -#if 0 - case ROM_MARL: - f = romfopen("roms/marl/1008DB0_.BIO", "rb"); + case ROM_S1668: + f = romfopen("roms/tpatx/S1668P.ROM", "rb"); /* Working Tyan BIOS. */ if (!f) break; - fseek(f, 0x80, SEEK_SET); - fread(rom + 0x10000, 0x10000, 1, f); - fclose(f); - f = romfopen("roms/marl/1008DB0_.BI1", "rb"); - if (!f) break; - fseek(f, 0x80, SEEK_SET); - fread(rom, 0xd000, 1, f); + fread(rom, 0x20000, 1, f); fclose(f); biosmask = 0x1ffff; - //is486=1; return 1; -#endif case ROM_THOR: f = romfopen("roms/thor/1006CN0_.BIO", "rb"); @@ -809,7 +765,6 @@ int loadbios() fread(rom, 0x10000, 1, f); fclose(f); biosmask = 0x1ffff; - //is486=1; return 1; case ROM_MRTHOR: @@ -832,7 +787,58 @@ int loadbios() fread(rom, 0x10000, 1, f); fclose(f); biosmask = 0x1ffff; - //is486=1; + return 1; + + case ROM_IBMPS2_M50: + f=romfopen("roms/i8550021/90x7423.zm14","rb"); + ff=romfopen("roms/i8550021/90x7426.zm16","rb"); + if (!f || !ff) break; + for (c = 0x0000; c < 0x10000; c += 2) + { + rom[c] = getc(f); + rom[c+1] = getc(ff); + } + fclose(ff); + fclose(f); + f=romfopen("roms/i8550021/90x7420.zm13","rb"); + ff=romfopen("roms/i8550021/90x7429.zm18","rb"); + if (!f || !ff) break; + for (c = 0x10000; c < 0x20000; c += 2) + { + rom[c] = getc(f); + rom[c+1] = getc(ff); + } + fclose(ff); + fclose(f); + biosmask = 0x1ffff; + return 1; + + case ROM_IBMPS2_M55SX: + f=romfopen("roms/i8555081/33f8146.zm41","rb"); + ff=romfopen("roms/i8555081/33f8145.zm40","rb"); + if (!f || !ff) break; + for (c = 0x0000; c < 0x20000; c += 2) + { + rom[c] = getc(f); + rom[c+1] = getc(ff); + } + fclose(ff); + fclose(f); + biosmask = 0x1ffff; + return 1; + + case ROM_IBMPS2_M80: + f=romfopen("roms/i8580111/15f6637.bin","rb"); + ff=romfopen("roms/i8580111/15f6639.bin","rb"); + if (!f || !ff) break; + for (c = 0x0000; c < 0x20000; c += 2) + { + rom[c] = getc(f); + rom[c+1] = getc(ff); + } + fclose(ff); + fclose(f); + biosmask = 0x1ffff; return 1; } printf("Failed to load ROM!\n"); @@ -846,7 +852,6 @@ int loadbios() void resetreadlookup() { int c; -// /*if (output) */pclog("resetreadlookup\n"); memset(readlookup2,0xFF,1024*1024*sizeof(uintptr_t)); for (c=0;c<256;c++) readlookup[c]=0xFFFFFFFF; readlnext=0; @@ -855,8 +860,6 @@ void resetreadlookup() for (c=0;c<256;c++) writelookup[c]=0xFFFFFFFF; writelnext=0; pccache=0xFFFFFFFF; -// readlnum=writelnum=0; - } int mmuflush=0; @@ -865,12 +868,6 @@ int mmu_perm=4; void flushmmucache() { int c; -// /*if (output) */pclog("flushmmucache\n"); -/* for (c=0;c<16;c++) - { - if ( readlookup2[0xE0+c]!=0xFFFFFFFF) pclog("RL2 %02X = %08X\n",0xE0+c, readlookup2[0xE0+c]); - if (writelookup2[0xE0+c]!=0xFFFFFFFF) pclog("WL2 %02X = %08X\n",0xE0+c,writelookup2[0xE0+c]); - }*/ for (c=0;c<256;c++) { if (readlookup[c]!=0xFFFFFFFF) @@ -886,31 +883,9 @@ void flushmmucache() } } mmuflush++; -// readlnum=writelnum=0; pccache=(uint32_t)0xFFFFFFFF; pccache2=(uint8_t *)0xFFFFFFFF; -// memset(readlookup,0xFF,sizeof(readlookup)); -// memset(readlookup2,0xFF,1024*1024*4); -// memset(writelookup,0xFF,sizeof(writelookup)); -// memset(writelookup2,0xFF,1024*1024*4); -/* if (!(cr0>>31)) return;*/ - -/* for (c = 0; c < 1024*1024; c++) - { - if (readlookup2[c] != 0xFFFFFFFF) - { - pclog("Readlookup inconsistency - %05X %08X\n", c, readlookup2[c]); - dumpregs(); - exit(-1); - } - if (writelookup2[c] != 0xFFFFFFFF) - { - pclog("Readlookup inconsistency - %05X %08X\n", c, readlookup2[c]); - dumpregs(); - exit(-1); - } - }*/ codegen_flush(); } @@ -936,43 +911,26 @@ void flushmmucache_nopc() void flushmmucache_cr3() { int c; -// /*if (output) */pclog("flushmmucache_cr3\n"); for (c=0;c<256;c++) { - if (readlookup[c]!=0xFFFFFFFF)// && !readlookupp[c]) + if (readlookup[c]!=0xFFFFFFFF) { readlookup2[readlookup[c]] = -1; readlookup[c]=0xFFFFFFFF; } - if (writelookup[c] != 0xFFFFFFFF)// && !writelookupp[c]) + if (writelookup[c] != 0xFFFFFFFF) { page_lookup[writelookup[c]] = NULL; writelookup2[writelookup[c]] = -1; writelookup[c] = 0xFFFFFFFF; } } -/* for (c = 0; c < 1024*1024; c++) - { - if (readlookup2[c] != 0xFFFFFFFF) - { - pclog("Readlookup inconsistency - %05X %08X\n", c, readlookup2[c]); - dumpregs(); - exit(-1); - } - if (writelookup2[c] != 0xFFFFFFFF) - { - pclog("Readlookup inconsistency - %05X %08X\n", c, readlookup2[c]); - dumpregs(); - exit(-1); - } - }*/ } void mem_flush_write_page(uint32_t addr, uint32_t virt) { int c; page_t *page_target = &pages[addr >> 12]; -// pclog("mem_flush_write_page %08x %08x\n", virt, addr); for (c = 0; c < 256; c++) { @@ -980,11 +938,8 @@ void mem_flush_write_page(uint32_t addr, uint32_t virt) { uintptr_t target = (uintptr_t)&ram[(uintptr_t)(addr & ~0xfff) - (virt & ~0xfff)]; -// if ((virt & ~0xfff) == 0xc022e000) -// pclog(" Checking %02x %p %p\n", (void *)writelookup2[writelookup[c]], (void *)target); if (writelookup2[writelookup[c]] == target || page_lookup[writelookup[c]] == page_target) { -// pclog(" throw out %02x %p %p\n", writelookup[c], (void *)page_lookup[writelookup[c]], (void *)writelookup2[writelookup[c]]); writelookup2[writelookup[c]] = -1; page_lookup[writelookup[c]] = NULL; writelookup[c] = 0xffffffff; @@ -1029,7 +984,6 @@ int mmu_page_fault_check(uint32_t addr, int rw, uint32_t flags, int pde, int is_ if (!(flags & 1)) { - // pclog("Trying to read or write a page that is not present!\n"); is_page_fault = 1; } @@ -1037,12 +991,10 @@ int mmu_page_fault_check(uint32_t addr, int rw, uint32_t flags, int pde, int is_ { if (!(flags & 4) && mem_cpl3_check()) { - // pclog("Trying to read a system page from user mode!\n"); is_page_fault = 1; } if (rw && !(flags & 2) && (mem_cpl3_check() || (cr0 & WP_FLAG))) { - // pclog("Trying to write a read-only-for-user page from user mode!\n"); is_page_fault = 1; } } @@ -1124,25 +1076,16 @@ uint32_t mmutranslate_noabrt(uint32_t addr, int rw) void mmu_invalidate(uint32_t addr) { -// readlookup2[addr >> 12] = writelookup2[addr >> 12] = 0xFFFFFFFF; flushmmucache_cr3(); } void addreadlookup(uint32_t virt, uint32_t phys) { -// return; -// printf("Addreadlookup %08X %08X %08X %08X %08X %08X %02X %08X\n",virt,phys,cs,ds,es,ss,opcode,cpu_state.pc); if (virt == 0xffffffff) return; if (readlookup2[virt>>12] != -1) { -/* if (readlookup2[virt>>12] != phys&~0xfff) - { - pclog("addreadlookup mismatch - %05X000 %05X000\n", readlookup[readlnext], virt >> 12); - dumpregs(); - exit(-1); - }*/ return; } @@ -1150,7 +1093,6 @@ void addreadlookup(uint32_t virt, uint32_t phys) if (readlookup[readlnext]!=0xFFFFFFFF) { readlookup2[readlookup[readlnext]] = -1; -// readlnum--; } readlookup2[virt>>12] = (uintptr_t)&ram[(uintptr_t)(phys & ~0xFFF) - (uintptr_t)(virt & ~0xfff)]; readlookupp[readlnext]=mmu_perm; @@ -1162,19 +1104,11 @@ void addreadlookup(uint32_t virt, uint32_t phys) void addwritelookup(uint32_t virt, uint32_t phys) { -// return; -// printf("Addwritelookup %08X %08X\n",virt,phys); if (virt == 0xffffffff) return; if (page_lookup[virt >> 12]) { -/* if (writelookup2[virt>>12] != phys&~0xfff) - { - pclog("addwritelookup mismatch - %05X000 %05X000\n", readlookup[readlnext], virt >> 12); - dumpregs(); - exit(-1); - }*/ return; } @@ -1182,16 +1116,12 @@ void addwritelookup(uint32_t virt, uint32_t phys) { page_lookup[writelookup[writelnext]] = NULL; writelookup2[writelookup[writelnext]] = -1; -// writelnum--; } -// if (page_lookup[virt >> 12] && (writelookup2[virt>>12] != 0xffffffff)) -// fatal("Bad write mapping\n"); if (pages[phys >> 12].block || (phys & ~0xfff) == recomp_page) - page_lookup[virt >> 12] = &pages[phys >> 12];//(uintptr_t)&ram[(uintptr_t)(phys & ~0xFFF) - (uintptr_t)(virt & ~0xfff)]; + page_lookup[virt >> 12] = &pages[phys >> 12]; else writelookup2[virt>>12] = (uintptr_t)&ram[(uintptr_t)(phys & ~0xFFF) - (uintptr_t)(virt & ~0xfff)]; -// pclog("addwritelookup %08x %08x %p %p %016llx %p\n", virt, phys, (void *)page_lookup[virt >> 12], (void *)writelookup2[virt >> 12], pages[phys >> 12].dirty_mask, (void *)&pages[phys >> 12]); writelookupp[writelnext] = mmu_perm; writelookup[writelnext++] = virt >> 12; writelnext &= (cachesize - 1); @@ -1255,7 +1185,6 @@ uint8_t readmembl(uint32_t addr) addr &= rammask; if (_mem_read_b[addr >> 14]) return _mem_read_b[addr >> 14](addr, _mem_priv_r[addr >> 14]); -// pclog("Bad readmembl %08X %04X:%08X\n", addr, CS, pc); return 0xFF; } @@ -1282,7 +1211,6 @@ void writemembl(uint32_t addr, uint8_t val) addr &= rammask; if (_mem_write_b[addr >> 14]) _mem_write_b[addr >> 14](addr, val, _mem_priv_w[addr >> 14]); -// else pclog("Bad writemembl %08X %02X %04X:%08X\n", addr, val, CS, pc); } uint8_t readmemb386l(uint32_t seg, uint32_t addr) @@ -1290,14 +1218,9 @@ uint8_t readmemb386l(uint32_t seg, uint32_t addr) if (seg==-1) { x86gpf("NULL segment", 0); - // printf("NULL segment! rb %04X(%08X):%08X %02X %08X\n",CS,cs,cpu_state.pc,opcode,addr); return -1; } mem_logical_addr = addr = addr + seg; -/* if (readlookup2[mem_logical_addr >> 12] != 0xFFFFFFFF) - { - return ram[readlookup2[mem_logical_addr >> 12] + (mem_logical_addr & 0xFFF)]; - }*/ if (addr < 0x100000 && ram_mapped_addr[addr >> 14]) { addr = (ram_mapped_addr[addr >> 14] & MEM_MAP_TO_SHADOW_RAM_MASK) ? addr : (ram_mapped_addr[addr >> 14] & ~0x3FFF) + (addr & 0x3FFF); @@ -1314,7 +1237,6 @@ uint8_t readmemb386l(uint32_t seg, uint32_t addr) addr &= rammask; if (_mem_read_b[addr >> 14]) return _mem_read_b[addr >> 14](addr, _mem_priv_r[addr >> 14]); -// pclog("Bad readmemb386l %08X %04X:%08X\n", addr, CS, pc); return 0xFF; } @@ -1323,7 +1245,6 @@ void writememb386l(uint32_t seg, uint32_t addr, uint8_t val) if (seg==-1) { x86gpf("NULL segment", 0); - // printf("NULL segment! wb %04X(%08X):%08X %02X %08X\n",CS,cs,cpu_state.pc,opcode,addr); return; } @@ -1347,11 +1268,7 @@ void writememb386l(uint32_t seg, uint32_t addr, uint8_t val) addr &= rammask; -/* if (addr >= 0xa0000 && addr < 0xc0000) - pclog("writemembl %08X %02X\n", addr, val);*/ - if (_mem_write_b[addr >> 14]) _mem_write_b[addr >> 14](addr, val, _mem_priv_w[addr >> 14]); -// else pclog("Bad writememb386l %08X %02X %04X:%08X\n", addr, val, CS, pc); } uint16_t readmemwl(uint32_t seg, uint32_t addr) @@ -1374,7 +1291,6 @@ uint16_t readmemwl(uint32_t seg, uint32_t addr) if (seg==-1) { x86gpf("NULL segment", 0); - // printf("NULL segment! rw %04X(%08X):%08X %02X %08X\n",CS,cs,cpu_state.pc,opcode,addr); return -1; } if (addr2 < 0x100000 && ram_mapped_addr[addr2 >> 14]) @@ -1398,7 +1314,6 @@ uint16_t readmemwl(uint32_t seg, uint32_t addr) if (AT) return _mem_read_b[addr2 >> 14](addr2, _mem_priv_r[addr2 >> 14]) | (_mem_read_b[(addr2 + 1) >> 14](addr2 + 1, _mem_priv_r[addr2 >> 14]) << 8); else return _mem_read_b[addr2 >> 14](addr2, _mem_priv_r[addr2 >> 14]) | (_mem_read_b[(seg + ((addr + 1) & 0xffff)) >> 14](seg + ((addr + 1) & 0xffff), _mem_priv_r[addr2 >> 14]) << 8); } -// pclog("Bad readmemwl %08X\n", addr2); return 0xffff; } @@ -1434,7 +1349,6 @@ void writememwl(uint32_t seg, uint32_t addr, uint16_t val) if (seg==-1) { x86gpf("NULL segment", 0); - // printf("NULL segment! ww %04X(%08X):%08X %02X %08X\n",CS,cs,cpu_state.pc,opcode,addr); return; } if (addr2 < 0x100000 && ram_mapped_addr[addr2 >> 14]) @@ -1471,7 +1385,6 @@ void writememwl(uint32_t seg, uint32_t addr, uint16_t val) _mem_write_b[(addr2 + 1) >> 14](addr2 + 1, val >> 8, _mem_priv_w[addr2 >> 14]); return; } -// pclog("Bad writememwl %08X %04X\n", addr2, val); } uint32_t readmemll(uint32_t seg, uint32_t addr) @@ -1494,7 +1407,6 @@ uint32_t readmemll(uint32_t seg, uint32_t addr) if (seg==-1) { x86gpf("NULL segment", 0); - // printf("NULL segment! rl %04X(%08X):%08X %02X %08X\n",CS,cs,cpu_state.pc,opcode,addr); return -1; } @@ -1518,7 +1430,6 @@ uint32_t readmemll(uint32_t seg, uint32_t addr) if (_mem_read_b[addr2 >> 14]) return _mem_read_b[addr2 >> 14](addr2, _mem_priv_r[addr2 >> 14]) | (_mem_read_b[addr2 >> 14](addr2 + 1, _mem_priv_r[addr2 >> 14]) << 8) | (_mem_read_b[addr2 >> 14](addr2 + 2, _mem_priv_r[addr2 >> 14]) << 16) | (_mem_read_b[addr2 >> 14](addr2 + 3, _mem_priv_r[addr2 >> 14]) << 24); -// pclog("Bad readmemll %08X\n", addr2); return 0xffffffff; } @@ -1540,7 +1451,6 @@ void writememll(uint32_t seg, uint32_t addr, uint32_t val) if (seg==-1) { x86gpf("NULL segment", 0); - // printf("NULL segment! wl %04X(%08X):%08X %02X %08X\n",CS,cs,cpu_state.pc,opcode,addr); return; } if (addr2 < 0x100000 && ram_mapped_addr[addr2 >> 14]) @@ -1562,9 +1472,6 @@ void writememll(uint32_t seg, uint32_t addr, uint32_t val) addr2&=rammask; -/* if (addr >= 0xa0000 && addr < 0xc0000) - pclog("writememll %08X %08X\n", addr, val);*/ - if (_mem_write_l[addr2 >> 14]) { _mem_write_l[addr2 >> 14](addr2, val, _mem_priv_w[addr2 >> 14]); @@ -1584,7 +1491,6 @@ void writememll(uint32_t seg, uint32_t addr, uint32_t val) _mem_write_b[addr2 >> 14](addr2 + 3, val >> 24, _mem_priv_w[addr2 >> 14]); return; } -// pclog("Bad writememll %08X %08X\n", addr2, val); } uint64_t readmemql(uint32_t seg, uint32_t addr) @@ -1603,7 +1509,6 @@ uint64_t readmemql(uint32_t seg, uint32_t addr) if (seg==-1) { x86gpf("NULL segment", 0); - // printf("NULL segment! rl %04X(%08X):%08X %02X %08X\n",CS,cs,cpu_state.pc,opcode,addr); return -1; } @@ -1646,7 +1551,6 @@ void writememql(uint32_t seg, uint32_t addr, uint64_t val) if (seg==-1) { x86gpf("NULL segment", 0); - // printf("NULL segment! wl %04X(%08X):%08X %02X %08X\n",CS,cs,cpu_state.pc,opcode,addr); return; } if (addr2 < 0x100000 && ram_mapped_addr[addr2 >> 14]) @@ -1695,7 +1599,6 @@ void writememql(uint32_t seg, uint32_t addr, uint64_t val) _mem_write_b[addr2 >> 14](addr2 + 7, val >> 56, _mem_priv_w[addr2 >> 14]); return; } -// pclog("Bad writememql %08X %08X\n", addr2, val); } uint8_t mem_readb_phys(uint32_t addr) @@ -1736,19 +1639,16 @@ void mem_writew_phys(uint32_t addr, uint16_t val) uint8_t mem_read_ram(uint32_t addr, void *priv) { -// if (addr >= 0xc0000 && addr < 0x0c8000) pclog("Read RAMb %08X\n", addr); addreadlookup(mem_logical_addr, addr); return ram[addr]; } uint16_t mem_read_ramw(uint32_t addr, void *priv) { -// if (addr >= 0xc0000 && addr < 0x0c8000) pclog("Read RAMw %08X\n", addr); addreadlookup(mem_logical_addr, addr); return *(uint16_t *)&ram[addr]; } uint32_t mem_read_raml(uint32_t addr, void *priv) { -// if (addr >= 0xc0000 && addr < 0x0c8000) pclog("Read RAMl %08X\n", addr); addreadlookup(mem_logical_addr, addr); return *(uint32_t *)&ram[addr]; } @@ -1758,7 +1658,6 @@ void mem_write_ramb_page(uint32_t addr, uint8_t val, page_t *p) if (val != p->mem[addr & 0xfff] || codegen_in_recompile) { uint64_t mask = (uint64_t)1 << ((addr >> PAGE_MASK_SHIFT) & PAGE_MASK_MASK); -// pclog("mem_write_ramb_page: %08x %02x %08x %llx %llx\n", addr, val, cs+pc, p->dirty_mask, mask); p->dirty_mask |= mask; p->mem[addr & 0xfff] = val; } @@ -1770,7 +1669,6 @@ void mem_write_ramw_page(uint32_t addr, uint16_t val, page_t *p) uint64_t mask = (uint64_t)1 << ((addr >> PAGE_MASK_SHIFT) & PAGE_MASK_MASK); if ((addr & 0x3f) == 0x3f) mask |= (mask << 1); -// pclog("mem_write_ramw_page: %08x %04x %08x\n", addr, val, cs+pc); p->dirty_mask |= mask; *(uint16_t *)&p->mem[addr & 0xfff] = val; } @@ -1782,7 +1680,6 @@ void mem_write_raml_page(uint32_t addr, uint32_t val, page_t *p) uint64_t mask = (uint64_t)1 << ((addr >> PAGE_MASK_SHIFT) & PAGE_MASK_MASK); if ((addr & 0x3f) >= 0x3d) mask |= (mask << 1); -// pclog("mem_write_raml_page: %08x %08x %08x\n", addr, val, cs+pc); p->dirty_mask |= mask; *(uint32_t *)&p->mem[addr & 0xfff] = val; } @@ -1808,21 +1705,16 @@ uint8_t mem_read_bios(uint32_t addr, void *priv) { if (AMIBIOS && (addr&0xFFFFF)==0xF8281) /*This is read constantly during AMIBIOS POST, but is never written to. It's clearly a status register of some kind, but for what?*/ { -// pclog("Read magic addr %04X(%06X):%04X\n",CS,cs,cpu_state.pc); -// if (pc==0x547D) output=3; return 0x40; } -// pclog("Read BIOS %08X %02X %04X:%04X\n", addr, rom[addr & biosmask], CS, pc); return rom[addr & biosmask]; } uint16_t mem_read_biosw(uint32_t addr, void *priv) { -// pclog("Read BIOS %08X %04X %04X:%04X\n", addr, *(uint16_t *)&rom[addr & biosmask], CS, pc); return *(uint16_t *)&rom[addr & biosmask]; } uint32_t mem_read_biosl(uint32_t addr, void *priv) { -// pclog("Read BIOS %08X %02X %04X:%04X\n", addr, *(uint32_t *)&rom[addr & biosmask], CS, pc); return *(uint32_t *)&rom[addr & biosmask]; } @@ -1862,9 +1754,8 @@ void mem_invalidate_range(uint32_t start_addr, uint32_t end_addr) } } -static inline int mem_mapping_read_allowed(uint32_t flags, int state) +static __inline int mem_mapping_read_allowed(uint32_t flags, int state) { -// pclog("mem_mapping_read_allowed: flags=%x state=%x\n", flags, state); switch (state & MEM_READ_MASK) { case MEM_READ_ANY: @@ -1875,10 +1766,11 @@ static inline int mem_mapping_read_allowed(uint32_t flags, int state) return !(flags & MEM_MAPPING_EXTERNAL); default: fatal("mem_mapping_read_allowed : bad state %x\n", state); + return 0; } } -static inline int mem_mapping_write_allowed(uint32_t flags, int state) +static __inline int mem_mapping_write_allowed(uint32_t flags, int state) { switch (state & MEM_WRITE_MASK) { @@ -1892,6 +1784,7 @@ static inline int mem_mapping_write_allowed(uint32_t flags, int state) return !(flags & MEM_MAPPING_EXTERNAL); default: fatal("mem_mapping_write_allowed : bad state %x\n", state); + return 0; } } @@ -2061,7 +1954,6 @@ void mem_set_mem_state(uint32_t base, uint32_t size, int state) { uint32_t c; -// pclog("mem_set_pci_enable: base=%08x size=%08x\n", base, size); for (c = 0; c < size; c += 0x4000) _mem_state[(c + base) >> 14] = state; @@ -2158,7 +2050,29 @@ void mem_init() mem_mapping_add(&ram_mid_mapping, 0xc0000, 0x40000, mem_read_ram, mem_read_ramw, mem_read_raml, mem_write_ram, mem_write_ramw, mem_write_raml, ram + 0xc0000, MEM_MAPPING_INTERNAL, NULL); mem_mapping_add(&romext_mapping, 0xc8000, 0x08000, mem_read_romext, mem_read_romextw, mem_read_romextl, NULL, NULL, NULL, romext, 0, NULL); -// pclog("Mem resize %i %i\n",mem_size,c); +} + +void mem_remap_top_256k() +{ + int c; + + for (c = ((mem_size * 1024) >> 12); c < (((mem_size + 256) * 1024) >> 12); c++) + { + pages[c].mem = &ram[c << 12]; + pages[c].write_b = mem_write_ramb_page; + pages[c].write_w = mem_write_ramw_page; + pages[c].write_l = mem_write_raml_page; + } + + for (c = (mem_size / 256); c < ((mem_size + 256) / 256); c++) + { + isram[c] = 1; + if (c >= 0xa && c <= 0xd) + isram[c] = 0; + } + + mem_set_mem_state(mem_size * 1024, 256 * 1024, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL); + mem_mapping_add(&ram_remapped_mapping, mem_size * 1024, 256 * 1024, mem_read_ram, mem_read_ramw, mem_read_raml, mem_write_ram, mem_write_ramw, mem_write_raml, ram + (mem_size * 1024), MEM_MAPPING_INTERNAL, NULL); } void mem_remap_top_384k() @@ -2238,7 +2152,6 @@ void mem_resize() mem_mapping_add(&romext_mapping, 0xc8000, 0x08000, mem_read_romext, mem_read_romextw, mem_read_romextl, NULL, NULL, NULL, romext, 0, NULL); -// pclog("Mem resize %i %i\n",mem_size,c); mem_a20_key = 2; mem_a20_recalc(); } @@ -2257,34 +2170,11 @@ void mem_reset_page_blocks() } } -/* void mem_reset() -{ - int c; - - mem_reset_page_blocks(); - - memset(isram, 0, sizeof(isram)); - for (c = 0; c < (mem_size / 256); c++) - { - isram[c] = 1; - if (c >= 0xa && c <= 0xf) - isram[c] = 0; - } - - mem_set_mem_state(0x000000, (mem_size > 640) ? 0xa0000 : mem_size * 1024, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL); - mem_set_mem_state(0x0c0000, 0x40000, MEM_READ_EXTERNAL | MEM_WRITE_EXTERNAL); - mem_set_mem_state(0x100000, (mem_size - 1024) * 1024, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL); - - mem_a20_key = 2; - mem_a20_recalc(); -} */ - static int port_92_reg = 0; void mem_a20_recalc() { int state = mem_a20_key | mem_a20_alt; -// pclog("A20 recalc %i %i\n", state, mem_a20_state); if (state && !mem_a20_state) { rammask = 0xffffffff; @@ -2295,7 +2185,6 @@ void mem_a20_recalc() rammask = 0xffefffff; flushmmucache(); } -// pclog("rammask now %08X\n", rammask); mem_a20_state = state; } diff --git a/src/mem.h b/src/mem.h index 8f489411c..7e888e207 100644 --- a/src/mem.h +++ b/src/mem.h @@ -87,7 +87,9 @@ extern int mem_a20_key; void mem_a20_recalc(); uint8_t mem_readb_phys(uint32_t addr); +uint16_t mem_readw_phys(uint32_t addr); void mem_writeb_phys(uint32_t addr, uint8_t val); +void mem_writew_phys(uint32_t addr, uint16_t val); uint8_t mem_read_ram(uint32_t addr, void *priv); uint16_t mem_read_ramw(uint32_t addr, void *priv); @@ -110,6 +112,8 @@ FILE *romfopen(char *fn, char *mode); mem_mapping_t bios_mapping[8]; mem_mapping_t bios_high_mapping[8]; +extern mem_mapping_t ram_high_mapping; + typedef struct page_t { @@ -134,7 +138,7 @@ extern page_t **page_lookup; uint32_t mmutranslate_noabrt(uint32_t addr, int rw); extern uint32_t get_phys_virt,get_phys_phys; -static inline uint32_t get_phys(uint32_t addr) +static __inline uint32_t get_phys(uint32_t addr) { if (!((addr ^ get_phys_virt) & ~0xfff)) return get_phys_phys | (addr & 0xfff); @@ -149,10 +153,10 @@ static inline uint32_t get_phys(uint32_t addr) get_phys_phys = (mmutranslatereal(addr, 0) & rammask) & ~0xfff; return get_phys_phys | (addr & 0xfff); -// return mmutranslatereal(addr, 0) & rammask; + /* return mmutranslatereal(addr, 0) & rammask; */ } -static inline uint32_t get_phys_noabrt(uint32_t addr) +static __inline uint32_t get_phys_noabrt(uint32_t addr) { if (!(cr0 >> 31)) return addr & rammask; @@ -167,11 +171,27 @@ extern uint32_t mem_logical_addr; void mem_write_ramb_page(uint32_t addr, uint8_t val, page_t *p); void mem_write_ramw_page(uint32_t addr, uint16_t val, page_t *p); void mem_write_raml_page(uint32_t addr, uint32_t val, page_t *p); +void mem_flush_write_page(uint32_t addr, uint32_t virt); void mem_reset_page_blocks(); extern mem_mapping_t ram_low_mapping; +void mem_remap_top_256k(); void mem_remap_top_384k(); +void flushmmucache_nopc(); + +int loadbios(); + +void mem_add_bios(); + +void mem_init(); +void mem_resize(); + +void port_92_reset(); + +void port_92_add(); +void port_92_remove(); + #endif diff --git a/src/memregs.h b/src/memregs.h index 1e3dfbcec..590aa2af2 100644 --- a/src/memregs.h +++ b/src/memregs.h @@ -2,3 +2,4 @@ see COPYING for more details */ extern void memregs_init(); +void powermate_memregs_init(); diff --git a/src/mfm_at.c b/src/mfm_at.c index a6623c92c..ebbcde2a9 100644 --- a/src/mfm_at.c +++ b/src/mfm_at.c @@ -2,6 +2,7 @@ #define _LARGEFILE64_SOURCE #define _GNU_SOURCE #include +#include #include #include #include @@ -17,7 +18,7 @@ #include "mfm_at.h" -#define IDE_TIME (TIMER_USEC*10)//(5 * 100 * (1 << TIMER_SHIFT)) +#define IDE_TIME (TIMER_USEC*10) #define STAT_ERR 0x01 #define STAT_INDEX 0x02 @@ -44,8 +45,6 @@ #define CMD_DIAGNOSE 0x90 #define CMD_SET_PARAMETERS 0x91 -extern char ide_fn[4][512]; - typedef struct mfm_drive_t { int spt, hpc; @@ -78,16 +77,15 @@ typedef struct mfm_t uint16_t mfm_readw(uint16_t port, void *p); void mfm_writew(uint16_t port, uint16_t val, void *p); -static inline void mfm_irq_raise(mfm_t *mfm) +static __inline void mfm_irq_raise(mfm_t *mfm) { -// pclog("IDE_IRQ_RAISE\n"); if (!(mfm->fdisk&2)) picint(1 << 14); mfm->irqstat=1; } -static inline void mfm_irq_lower(mfm_t *mfm) +static __inline void mfm_irq_lower(mfm_t *mfm) { picintc(1 << 14); } @@ -161,9 +159,9 @@ static void mfm_next_sector(mfm_t *mfm) } } -static void loadhd(mfm_t *mfm, int d, const char *fn) +static void loadhd(mfm_t *mfm, int c, int d, const char *fn) { - mfm_drive_t *drive = &mfm->drives[d]; + mfm_drive_t *drive = &mfm->drives[c]; if (drive->hdfile == NULL) { @@ -205,7 +203,6 @@ void mfm_write(uint16_t port, uint8_t val, void *p) { mfm_t *mfm = (mfm_t *)p; -// pclog("mfm_write: addr=%04x val=%02x\n", port, val); switch (port) { case 0x1F0: /* Data */ @@ -252,7 +249,6 @@ void mfm_write(uint16_t port, uint8_t val, void *p) switch (val & 0xf0) { case CMD_RESTORE: -// pclog("Restore\n"); mfm->command &= ~0x0f; /*Mask off step rate*/ mfm->status = STAT_BUSY; timer_process(); @@ -261,7 +257,6 @@ void mfm_write(uint16_t port, uint8_t val, void *p) break; case CMD_SEEK: -// pclog("Seek to cylinder %i\n", mfm->cylinder); mfm->command &= ~0x0f; /*Mask off step rate*/ mfm->status = STAT_BUSY; timer_process(); @@ -274,7 +269,6 @@ void mfm_write(uint16_t port, uint8_t val, void *p) { case CMD_READ: case CMD_READ+1: case CMD_READ+2: case CMD_READ+3: -// pclog("Read %i sectors from sector %i cylinder %i head %i %i\n",mfm->secount,mfm->sector,mfm->cylinder,mfm->head,ins); mfm->command &= ~3; if (val & 2) fatal("Read with ECC\n"); @@ -286,16 +280,14 @@ void mfm_write(uint16_t port, uint8_t val, void *p) case CMD_WRITE: case CMD_WRITE+1: case CMD_WRITE+2: case CMD_WRITE+3: -// pclog("Write %i sectors to sector %i cylinder %i head %i\n",mfm->secount,mfm->sector,mfm->cylinder,mfm->head); mfm->command &= ~3; if (val & 2) fatal("Write with ECC\n"); - mfm->status = STAT_DRQ | STAT_DSC;// | STAT_BUSY; + mfm->status = STAT_DRQ | STAT_DSC; mfm->pos=0; break; case CMD_VERIFY: case CMD_VERIFY+1: -// pclog("Read verify %i sectors from sector %i cylinder %i head %i\n",mfm->secount,mfm->sector,mfm->cylinder,mfm->head); mfm->command &= ~1; mfm->status = STAT_BUSY; timer_process(); @@ -304,7 +296,6 @@ void mfm_write(uint16_t port, uint8_t val, void *p) break; case CMD_FORMAT: -// pclog("Format track %i head %i\n", mfm->cylinder, mfm->head); mfm->status = STAT_DRQ | STAT_BUSY; mfm->pos=0; break; @@ -342,7 +333,6 @@ void mfm_write(uint16_t port, uint8_t val, void *p) timer_update_outstanding(); mfm->reset = 1; mfm->status = STAT_BUSY; -// pclog("MFM Reset\n"); } if (val & 4) { @@ -356,14 +346,12 @@ void mfm_write(uint16_t port, uint8_t val, void *p) mfm_irq_update(mfm); return; } -// fatal("Bad IDE write %04X %02X\n", addr, val); } void mfm_writew(uint16_t port, uint16_t val, void *p) { mfm_t *mfm = (mfm_t *)p; -// pclog("Write IDEw %04X\n",val); mfm->buffer[mfm->pos >> 1] = val; mfm->pos += 2; @@ -416,9 +404,12 @@ uint8_t mfm_read(uint16_t port, void *p) mfm_irq_lower(mfm); temp = mfm->status; break; + + default: + temp = 0xff; + break; } -// pclog("mfm_read: addr=%04x val=%02x %04X:%04x\n", port, temp, CS, cpu_state.pc); return temp; } @@ -432,7 +423,6 @@ uint16_t mfm_readw(uint16_t port, void *p) if (mfm->pos >= 512) { -// pclog("Over! packlen %i %i\n",ide->packlen,ide->pos); mfm->pos=0; mfm->status = STAT_READY | STAT_DSC; if (mfm->command == CMD_READ) @@ -446,10 +436,13 @@ uint16_t mfm_readw(uint16_t port, void *p) mfm->callback = 6*IDE_TIME; timer_update_outstanding(); } + else + { + update_status_bar_icon(0x20, 0); + } } } -// pclog("mem_readw: temp=%04x %i\n", temp, mfm->pos); return temp; } @@ -470,7 +463,6 @@ void mfm_callback(void *p) off64_t addr; int c; -// pclog("mfm_callback: command=%02x reset=%i\n", mfm->command, mfm->reset); mfm->callback = 0; if (mfm->reset) { @@ -481,7 +473,6 @@ void mfm_callback(void *p) mfm->head = 0; mfm->cylinder = 0; mfm->reset = 0; -// pclog("Reset callback\n"); return; } switch (mfm->command) @@ -508,15 +499,12 @@ void mfm_callback(void *p) break; } -// pclog("Read %i %i %i %08X\n",ide.cylinder,ide.head,ide.sector,addr); fseeko64(drive->hdfile, addr * 512, SEEK_SET); fread(mfm->buffer, 512, 1, drive->hdfile); mfm->pos = 0; mfm->status = STAT_DRQ | STAT_READY | STAT_DSC; -// pclog("Read sector callback %i %i %i offset %08X %i left %i %02X\n",ide.sector,ide.cylinder,ide.head,addr,ide.secount,ide.spt,ide.atastat[ide.board]); -// if (addr) output=3; mfm_irq_raise(mfm); - readflash = 1; + update_status_bar_icon(0x20, 1); break; case CMD_WRITE: @@ -537,19 +525,21 @@ void mfm_callback(void *p) mfm->status = STAT_DRQ | STAT_READY | STAT_DSC; mfm->pos = 0; mfm_next_sector(mfm); + update_status_bar_icon(0x20, 1); } else + { mfm->status = STAT_READY | STAT_DSC; - readflash = 1; + update_status_bar_icon(0x20, 0); + } break; case CMD_VERIFY: do_seek(mfm); mfm->pos = 0; mfm->status = STAT_READY | STAT_DSC; -// pclog("Read verify callback %i %i %i offset %08X %i left\n",ide.sector,ide.cylinder,ide.head,addr,ide.secount); mfm_irq_raise(mfm); - readflash=1; + update_status_bar_icon(0x20, 1); break; case CMD_FORMAT: @@ -569,7 +559,7 @@ void mfm_callback(void *p) } mfm->status = STAT_READY | STAT_DSC; mfm_irq_raise(mfm); - readflash = 1; + update_status_bar_icon(0x20, 1); break; case CMD_DIAGNOSE: @@ -597,11 +587,21 @@ void mfm_callback(void *p) void *mfm_init() { + int c, d; + mfm_t *mfm = malloc(sizeof(mfm_t)); memset(mfm, 0, sizeof(mfm_t)); - loadhd(mfm, 0, ide_fn[0]); - loadhd(mfm, 1, ide_fn[1]); + c = 0; + for (d = 0; d < HDC_NUM; d++) + { + if ((hdc[d].bus == 1) && (hdc[d].mfm_channel < MFM_NUM)) + { + loadhd(mfm, hdc[d].mfm_channel, d, hdd_fn[d]); + c++; + if (c >= MFM_NUM) break; + } + } mfm->status = STAT_READY | STAT_DSC; mfm->error = 1; /*No errors*/ diff --git a/src/mfm_xebec.c b/src/mfm_xebec.c new file mode 100644 index 000000000..eac421b0a --- /dev/null +++ b/src/mfm_xebec.c @@ -0,0 +1,950 @@ +#define _LARGEFILE_SOURCE +#define _LARGEFILE64_SOURCE +#define _GNU_SOURCE +#include +#include +#include +#include +#include + +#include +#include "ibm.h" + +#include "device.h" +#include "dma.h" +#include "io.h" +#include "mem.h" +#include "pic.h" +#include "rom.h" +#include "timer.h" + +#include "mfm_xebec.h" + +#define XEBEC_TIME (2000 * TIMER_USEC) + +enum +{ + STATE_IDLE, + STATE_RECEIVE_COMMAND, + STATE_START_COMMAND, + STATE_RECEIVE_DATA, + STATE_RECEIVED_DATA, + STATE_SEND_DATA, + STATE_SENT_DATA, + STATE_COMPLETION_BYTE, + STATE_DUNNO +}; + +typedef struct mfm_drive_t +{ + int spt, hpc; + int tracks; + int cfg_spt; + int cfg_hpc; + int cfg_cyl; + int current_cylinder; + FILE *hdfile; +} mfm_drive_t; + +typedef struct xebec_t +{ + rom_t bios_rom; + + int callback; + + int state; + + uint8_t status; + + uint8_t command[6]; + int command_pos; + + uint8_t data[512]; + int data_pos, data_len; + + uint8_t sector_buf[512]; + + uint8_t irq_dma_mask; + + uint8_t completion_byte; + uint8_t error; + + int drive_sel; + + mfm_drive_t drives[2]; + + int sector, head, cylinder; + int sector_count; + + uint8_t switches; +} xebec_t; + +#define STAT_IRQ 0x20 +#define STAT_DRQ 0x10 +#define STAT_BSY 0x08 +#define STAT_CD 0x04 +#define STAT_IO 0x02 +#define STAT_REQ 0x01 + +#define IRQ_ENA 0x02 +#define DMA_ENA 0x01 + +#define CMD_TEST_DRIVE_READY 0x00 +#define CMD_RECALIBRATE 0x01 +#define CMD_READ_STATUS 0x03 +#define CMD_VERIFY_SECTORS 0x05 +#define CMD_FORMAT_TRACK 0x06 +#define CMD_READ_SECTORS 0x08 +#define CMD_WRITE_SECTORS 0x0a +#define CMD_SEEK 0x0b +#define CMD_INIT_DRIVE_PARAMS 0x0c +#define CMD_WRITE_SECTOR_BUFFER 0x0f +#define CMD_BUFFER_DIAGNOSTIC 0xe0 +#define CMD_CONTROLLER_DIAGNOSTIC 0xe4 +#define CMD_DTC_GET_DRIVE_PARAMS 0xfb +#define CMD_DTC_SET_STEP_RATE 0xfc +#define CMD_DTC_SET_GEOMETRY 0xfe +#define CMD_DTC_GET_GEOMETRY 0xff + +#define ERR_NOT_READY 0x04 +#define ERR_SEEK_ERROR 0x15 +#define ERR_ILLEGAL_SECTOR_ADDRESS 0x21 + +static uint8_t xebec_read(uint16_t port, void *p) +{ + xebec_t *xebec = (xebec_t *)p; + uint8_t temp = 0xff; + + switch (port) + { + case 0x320: /*Read data*/ + xebec->status &= ~STAT_IRQ; + switch (xebec->state) + { + case STATE_COMPLETION_BYTE: + if ((xebec->status & 0xf) != (STAT_CD | STAT_IO | STAT_REQ | STAT_BSY)) + fatal("Read data STATE_COMPLETION_BYTE, status=%02x\n", xebec->status); + + temp = xebec->completion_byte; + xebec->status = 0; + xebec->state = STATE_IDLE; + break; + + case STATE_SEND_DATA: + if ((xebec->status & 0xf) != (STAT_IO | STAT_REQ | STAT_BSY)) + fatal("Read data STATE_COMPLETION_BYTE, status=%02x\n", xebec->status); + if (xebec->data_pos >= xebec->data_len) + fatal("Data write with full data!\n"); + temp = xebec->data[xebec->data_pos++]; + if (xebec->data_pos == xebec->data_len) + { + xebec->status = STAT_BSY; + xebec->state = STATE_SENT_DATA; + xebec->callback = XEBEC_TIME; + } + break; + + default: + fatal("Read data register - %i, %02x\n", xebec->state, xebec->status); + } + break; + + case 0x321: /*Read status*/ + temp = xebec->status; + break; + + case 0x322: /*Read option jumpers*/ + temp = xebec->switches; + break; + } + + return temp; +} + +static void xebec_write(uint16_t port, uint8_t val, void *p) +{ + xebec_t *xebec = (xebec_t *)p; + + switch (port) + { + case 0x320: /*Write data*/ + switch (xebec->state) + { + case STATE_RECEIVE_COMMAND: + if ((xebec->status & 0xf) != (STAT_BSY | STAT_CD | STAT_REQ)) + fatal("Bad write data state - STATE_START_COMMAND, status=%02x\n", xebec->status); + if (xebec->command_pos >= 6) + fatal("Command write with full command!\n"); + /*Command data*/ + xebec->command[xebec->command_pos++] = val; + if (xebec->command_pos == 6) + { + xebec->status = STAT_BSY; + xebec->state = STATE_START_COMMAND; + xebec->callback = XEBEC_TIME; + } + break; + + case STATE_RECEIVE_DATA: + if ((xebec->status & 0xf) != (STAT_BSY | STAT_REQ)) + fatal("Bad write data state - STATE_RECEIVE_DATA, status=%02x\n", xebec->status); + if (xebec->data_pos >= xebec->data_len) + fatal("Data write with full data!\n"); + /*Command data*/ + xebec->data[xebec->data_pos++] = val; + if (xebec->data_pos == xebec->data_len) + { + xebec->status = STAT_BSY; + xebec->state = STATE_RECEIVED_DATA; + xebec->callback = XEBEC_TIME; + } + break; + + default: + fatal("Write data unknown state - %i %02x\n", xebec->state, xebec->status); + } + break; + + case 0x321: /*Controller reset*/ + xebec->status = 0; + break; + + case 0x322: /*Generate controller-select-pulse*/ + xebec->status = STAT_BSY | STAT_CD | STAT_REQ; + xebec->command_pos = 0; + xebec->state = STATE_RECEIVE_COMMAND; + break; + + case 0x323: /*DMA/IRQ mask register*/ + xebec->irq_dma_mask = val; + break; + } +} + +static void xebec_complete(xebec_t *xebec) +{ + xebec->status = STAT_REQ | STAT_CD | STAT_IO | STAT_BSY; + xebec->state = STATE_COMPLETION_BYTE; + if (xebec->irq_dma_mask & IRQ_ENA) + { + xebec->status |= STAT_IRQ; + picint(1 << 5); + } +} + +static void xebec_error(xebec_t *xebec, uint8_t error) +{ + xebec->completion_byte |= 0x02; + xebec->error = error; + pclog("xebec_error - %02x\n", xebec->error); +} + +static int xebec_get_sector(xebec_t *xebec, off64_t *addr) +{ + mfm_drive_t *drive = &xebec->drives[xebec->drive_sel]; + int heads = drive->cfg_hpc; + + if (drive->current_cylinder != xebec->cylinder) + { + pclog("mfm_get_sector: wrong cylinder\n"); + xebec->error = ERR_ILLEGAL_SECTOR_ADDRESS; + return 1; + } + if (xebec->head > heads) + { + pclog("mfm_get_sector: past end of configured heads\n"); + xebec->error = ERR_ILLEGAL_SECTOR_ADDRESS; + return 1; + } + if (xebec->head > drive->hpc) + { + pclog("mfm_get_sector: past end of heads\n"); + xebec->error = ERR_ILLEGAL_SECTOR_ADDRESS; + return 1; + } + if (xebec->sector >= 17) + { + pclog("mfm_get_sector: past end of sectors\n"); + xebec->error = ERR_ILLEGAL_SECTOR_ADDRESS; + return 1; + } + + *addr = ((((off64_t) xebec->cylinder * heads) + xebec->head) * + 17) + xebec->sector; + + return 0; +} + +static void xebec_next_sector(xebec_t *xebec) +{ + mfm_drive_t *drive = &xebec->drives[xebec->drive_sel]; + + xebec->sector++; + if (xebec->sector >= 17) + { + xebec->sector = 0; + xebec->head++; + if (xebec->head >= drive->cfg_hpc) + { + xebec->head = 0; + xebec->cylinder++; + drive->current_cylinder++; + if (drive->current_cylinder >= drive->cfg_cyl) + drive->current_cylinder = drive->cfg_cyl-1; + } + } +} + +static void xebec_callback(void *p) +{ + xebec_t *xebec = (xebec_t *)p; + mfm_drive_t *drive; + + xebec->callback = 0; + + xebec->drive_sel = (xebec->command[1] & 0x20) ? 1 : 0; + xebec->completion_byte = xebec->drive_sel & 0x20; + + drive = &xebec->drives[xebec->drive_sel]; + + switch (xebec->command[0]) + { + case CMD_TEST_DRIVE_READY: + if (!drive->hdfile) + xebec_error(xebec, ERR_NOT_READY); + xebec_complete(xebec); + break; + + case CMD_RECALIBRATE: + if (!drive->hdfile) + xebec_error(xebec, ERR_NOT_READY); + else + { + xebec->cylinder = 0; + drive->current_cylinder = 0; + } + xebec_complete(xebec); + break; + + case CMD_READ_STATUS: + switch (xebec->state) + { + case STATE_START_COMMAND: + xebec->state = STATE_SEND_DATA; + xebec->data_pos = 0; + xebec->data_len = 4; + xebec->status = STAT_BSY | STAT_IO | STAT_REQ; + xebec->data[0] = xebec->error; + xebec->data[1] = xebec->drive_sel ? 0x20 : 0; + xebec->data[2] = xebec->data[3] = 0; + xebec->error = 0; + break; + + case STATE_SENT_DATA: + xebec_complete(xebec); + break; + } + break; + + case CMD_VERIFY_SECTORS: + switch (xebec->state) + { + case STATE_START_COMMAND: + xebec->cylinder = xebec->command[3] | ((xebec->command[2] & 0xc0) << 2); + drive->current_cylinder = (xebec->cylinder >= drive->cfg_cyl) ? drive->cfg_cyl-1 : xebec->cylinder; + xebec->head = xebec->command[1] & 0x1f; + xebec->sector = xebec->command[2] & 0x1f; + xebec->sector_count = xebec->command[4]; + do + { + off64_t addr; + + if (xebec_get_sector(xebec, &addr)) + { + pclog("xebec_get_sector failed\n"); + xebec_error(xebec, xebec->error); + xebec_complete(xebec); + return; + } + + xebec_next_sector(xebec); + + xebec->sector_count = (xebec->sector_count-1) & 0xff; + } while (xebec->sector_count); + + xebec_complete(xebec); + + update_status_bar_icon(0x20, 1); + break; + + default: + fatal("CMD_VERIFY_SECTORS: bad state %i\n", xebec->state); + } + break; + + case CMD_FORMAT_TRACK: + { + off64_t addr; + int c; + + xebec->cylinder = xebec->command[3] | ((xebec->command[2] & 0xc0) << 2); + drive->current_cylinder = (xebec->cylinder >= drive->cfg_cyl) ? drive->cfg_cyl-1 : xebec->cylinder; + xebec->head = xebec->command[1] & 0x1f; + + if (xebec_get_sector(xebec, &addr)) + { + pclog("xebec_get_sector failed\n"); + xebec_error(xebec, xebec->error); + xebec_complete(xebec); + return; + } + + fseeko64(drive->hdfile, addr * 512, SEEK_SET); + for (c = 0; c < 17; c++) + fwrite(xebec->sector_buf, 512, 1, drive->hdfile); + + xebec_complete(xebec); + } + break; + + case CMD_READ_SECTORS: + switch (xebec->state) + { + case STATE_START_COMMAND: + xebec->cylinder = xebec->command[3] | ((xebec->command[2] & 0xc0) << 2); + drive->current_cylinder = (xebec->cylinder >= drive->cfg_cyl) ? drive->cfg_cyl-1 : xebec->cylinder; + xebec->head = xebec->command[1] & 0x1f; + xebec->sector = xebec->command[2] & 0x1f; + xebec->sector_count = xebec->command[4]; + xebec->state = STATE_SEND_DATA; + xebec->data_pos = 0; + xebec->data_len = 512; + { + off64_t addr; + + if (xebec_get_sector(xebec, &addr)) + { + xebec_error(xebec, xebec->error); + xebec_complete(xebec); + return; + } + + fseeko64(drive->hdfile, addr * 512, SEEK_SET); + fread(xebec->sector_buf, 512, 1, drive->hdfile); + update_status_bar_icon(0x20, 1); + } + if (xebec->irq_dma_mask & DMA_ENA) + xebec->callback = XEBEC_TIME; + else + { + xebec->status = STAT_BSY | STAT_IO | STAT_REQ; + memcpy(xebec->data, xebec->sector_buf, 512); + } + break; + + case STATE_SEND_DATA: + xebec->status = STAT_BSY; + if (xebec->irq_dma_mask & DMA_ENA) + { + for (; xebec->data_pos < 512; xebec->data_pos++) + { + int val = dma_channel_write(3, xebec->sector_buf[xebec->data_pos]); + + if (val == DMA_NODATA) + { + pclog("CMD_READ_SECTORS out of data!\n"); + xebec->status = STAT_BSY | STAT_CD | STAT_IO | STAT_REQ; + xebec->callback = XEBEC_TIME; + return; + } + } + xebec->state = STATE_SENT_DATA; + xebec->callback = XEBEC_TIME; + } + else + fatal("Read sectors no DMA! - shouldn't get here\n"); + break; + + case STATE_SENT_DATA: + xebec_next_sector(xebec); + + xebec->data_pos = 0; + + xebec->sector_count = (xebec->sector_count-1) & 0xff; + + if (xebec->sector_count) + { + off64_t addr; + + if (xebec_get_sector(xebec, &addr)) + { + xebec_error(xebec, xebec->error); + xebec_complete(xebec); + return; + } + + fseeko64(drive->hdfile, addr * 512, SEEK_SET); + fread(xebec->sector_buf, 512, 1, drive->hdfile); + update_status_bar_icon(0x20, 1); + + xebec->state = STATE_SEND_DATA; + + if (xebec->irq_dma_mask & DMA_ENA) + xebec->callback = XEBEC_TIME; + else + { + xebec->status = STAT_BSY | STAT_IO | STAT_REQ; + memcpy(xebec->data, xebec->sector_buf, 512); + } + } + else + { + xebec_complete(xebec); + update_status_bar_icon(0x20, 0); + } + break; + + + default: + fatal("CMD_READ_SECTORS: bad state %i\n", xebec->state); + } + break; + + case CMD_WRITE_SECTORS: + switch (xebec->state) + { + case STATE_START_COMMAND: + xebec->cylinder = xebec->command[3] | ((xebec->command[2] & 0xc0) << 2); + drive->current_cylinder = (xebec->cylinder >= drive->cfg_cyl) ? drive->cfg_cyl-1 : xebec->cylinder; + xebec->head = xebec->command[1] & 0x1f; + xebec->sector = xebec->command[2] & 0x1f; + xebec->sector_count = xebec->command[4]; + xebec->state = STATE_RECEIVE_DATA; + xebec->data_pos = 0; + xebec->data_len = 512; + if (xebec->irq_dma_mask & DMA_ENA) + xebec->callback = XEBEC_TIME; + else + xebec->status = STAT_BSY | STAT_REQ; + break; + + case STATE_RECEIVE_DATA: + xebec->status = STAT_BSY; + if (xebec->irq_dma_mask & DMA_ENA) + { + for (; xebec->data_pos < 512; xebec->data_pos++) + { + int val = dma_channel_read(3); + + if (val == DMA_NODATA) + { + pclog("CMD_WRITE_SECTORS out of data!\n"); + xebec->status = STAT_BSY | STAT_CD | STAT_IO | STAT_REQ; + xebec->callback = XEBEC_TIME; + return; + } + + xebec->sector_buf[xebec->data_pos] = val & 0xff; + } + + xebec->state = STATE_RECEIVED_DATA; + xebec->callback = XEBEC_TIME; + } + else + fatal("Write sectors no DMA! - should never get here\n"); + break; + + case STATE_RECEIVED_DATA: + if (!(xebec->irq_dma_mask & DMA_ENA)) + memcpy(xebec->sector_buf, xebec->data, 512); + + { + off64_t addr; + + if (xebec_get_sector(xebec, &addr)) + { + xebec_error(xebec, xebec->error); + xebec_complete(xebec); + return; + } + + fseeko64(drive->hdfile, addr * 512, SEEK_SET); + fwrite(xebec->sector_buf, 512, 1, drive->hdfile); + } + + update_status_bar_icon(0x20, 1); + + xebec_next_sector(xebec); + xebec->data_pos = 0; + xebec->sector_count = (xebec->sector_count-1) & 0xff; + + if (xebec->sector_count) + { + xebec->state = STATE_RECEIVE_DATA; + if (xebec->irq_dma_mask & DMA_ENA) + xebec->callback = XEBEC_TIME; + else + xebec->status = STAT_BSY | STAT_REQ; + } + else + xebec_complete(xebec); + break; + + default: + fatal("CMD_WRITE_SECTORS: bad state %i\n", xebec->state); + } + break; + + case CMD_SEEK: + if (!drive->hdfile) + xebec_error(xebec, ERR_NOT_READY); + else + { + int cylinder = xebec->command[3] | ((xebec->command[2] & 0xc0) << 2); + + drive->current_cylinder = (cylinder >= drive->cfg_cyl) ? drive->cfg_cyl-1 : cylinder; + + if (cylinder != drive->current_cylinder) + xebec_error(xebec, ERR_SEEK_ERROR); + } + xebec_complete(xebec); + break; + + case CMD_INIT_DRIVE_PARAMS: + switch (xebec->state) + { + case STATE_START_COMMAND: + xebec->state = STATE_RECEIVE_DATA; + xebec->data_pos = 0; + xebec->data_len = 8; + xebec->status = STAT_BSY | STAT_REQ; + break; + + case STATE_RECEIVED_DATA: + drive->cfg_cyl = xebec->data[1] | (xebec->data[0] << 8); + drive->cfg_hpc = xebec->data[2]; + pclog("Drive %i: cylinders=%i, heads=%i\n", xebec->drive_sel, drive->cfg_cyl, drive->cfg_hpc); + xebec_complete(xebec); + break; + + default: + fatal("CMD_INIT_DRIVE_PARAMS bad state %i\n", xebec->state); + } + break; + + case CMD_WRITE_SECTOR_BUFFER: + switch (xebec->state) + { + case STATE_START_COMMAND: + xebec->state = STATE_RECEIVE_DATA; + xebec->data_pos = 0; + xebec->data_len = 512; + if (xebec->irq_dma_mask & DMA_ENA) + xebec->callback = XEBEC_TIME; + else + xebec->status = STAT_BSY | STAT_REQ; + break; + + case STATE_RECEIVE_DATA: + if (xebec->irq_dma_mask & DMA_ENA) + { + xebec->status = STAT_BSY; + + for (; xebec->data_pos < 512; xebec->data_pos++) + { + int val = dma_channel_read(3); + + if (val == DMA_NODATA) + { + pclog("CMD_WRITE_SECTOR_BUFFER out of data!\n"); + xebec->status = STAT_BSY | STAT_CD | STAT_IO | STAT_REQ; + xebec->callback = XEBEC_TIME; + return; + } + + xebec->data[xebec->data_pos] = val & 0xff; + } + + xebec->state = STATE_RECEIVED_DATA; + xebec->callback = XEBEC_TIME; + } + else + fatal("CMD_WRITE_SECTOR_BUFFER - should never get here!\n"); + break; + case STATE_RECEIVED_DATA: + memcpy(xebec->sector_buf, xebec->data, 512); + xebec_complete(xebec); + break; + + default: + fatal("CMD_WRITE_SECTOR_BUFFER bad state %i\n", xebec->state); + } + break; + + case CMD_BUFFER_DIAGNOSTIC: + case CMD_CONTROLLER_DIAGNOSTIC: + xebec_complete(xebec); + break; + + case 0xfa: + xebec_complete(xebec); + break; + + case CMD_DTC_SET_STEP_RATE: + xebec_complete(xebec); + break; + + case CMD_DTC_GET_DRIVE_PARAMS: + switch (xebec->state) + { + case STATE_START_COMMAND: + xebec->state = STATE_SEND_DATA; + xebec->data_pos = 0; + xebec->data_len = 4; + xebec->status = STAT_BSY | STAT_IO | STAT_REQ; + memset(xebec->data, 0, 4); + xebec->data[0] = drive->tracks & 0xff; + xebec->data[1] = 17 | ((drive->tracks >> 2) & 0xc0); + xebec->data[2] = drive->hpc-1; + pclog("Get drive params %02x %02x %02x %i\n", xebec->data[0], xebec->data[1], xebec->data[2], drive->tracks); + break; + + case STATE_SENT_DATA: + xebec_complete(xebec); + break; + + default: + fatal("CMD_INIT_DRIVE_PARAMS bad state %i\n", xebec->state); + } + break; + + case CMD_DTC_GET_GEOMETRY: + switch (xebec->state) + { + case STATE_START_COMMAND: + xebec->state = STATE_SEND_DATA; + xebec->data_pos = 0; + xebec->data_len = 16; + xebec->status = STAT_BSY | STAT_IO | STAT_REQ; + memset(xebec->data, 0, 16); + xebec->data[0x4] = drive->tracks & 0xff; + xebec->data[0x5] = (drive->tracks >> 8) & 0xff; + xebec->data[0xa] = drive->hpc; + break; + + case STATE_SENT_DATA: + xebec_complete(xebec); + break; + } + break; + + case CMD_DTC_SET_GEOMETRY: + switch (xebec->state) + { + case STATE_START_COMMAND: + xebec->state = STATE_RECEIVE_DATA; + xebec->data_pos = 0; + xebec->data_len = 16; + xebec->status = STAT_BSY | STAT_REQ; + break; + + case STATE_RECEIVED_DATA: + /*Bit of a cheat here - we always report the actual geometry of the drive in use*/ + xebec_complete(xebec); + break; + } + break; + + default: + fatal("Unknown Xebec command - %02x %02x %02x %02x %02x %02x\n", + xebec->command[0], xebec->command[1], + xebec->command[2], xebec->command[3], + xebec->command[4], xebec->command[5]); + } +} + +static void loadhd(xebec_t *xebec, int d, const char *fn) +{ + mfm_drive_t *drive = &xebec->drives[d]; + + if (drive->hdfile == NULL) + { + /* Try to open existing hard disk image */ + drive->hdfile = fopen64(fn, "rb+"); + if (drive->hdfile == NULL) + { + /* Failed to open existing hard disk image */ + if (errno == ENOENT) + { + /* Failed because it does not exist, + so try to create new file */ + drive->hdfile = fopen64(fn, "wb+"); + if (drive->hdfile == NULL) + { + pclog("Cannot create file '%s': %s", + fn, strerror(errno)); + return; + } + } + else + { + /* Failed for another reason */ + pclog("Cannot open file '%s': %s", + fn, strerror(errno)); + return; + } + } + } + + drive->spt = hdc[d].spt; + drive->hpc = hdc[d].hpc; + drive->tracks = hdc[d].tracks; +} + +static struct +{ + int tracks, hpc; +} xebec_hd_types[4] = +{ + {306, 4}, /*Type 0*/ + {612, 4}, /*Type 16*/ + {615, 4}, /*Type 2*/ + {306, 8} /*Type 13*/ +}; + +static void xebec_set_switches(xebec_t *xebec) +{ + int c, d; + + xebec->switches = 0; + + for (d = 0; d < 2; d++) + { + mfm_drive_t *drive = &xebec->drives[d]; + + if (!drive->hdfile) + continue; + + for (c = 0; c < 4; c++) + { + if (drive->spt == 17 && + drive->hpc == xebec_hd_types[c].hpc && + drive->tracks == xebec_hd_types[c].tracks) + { + xebec->switches |= (c << (d ? 0 : 2)); + break; + } + } + + if (c == 4) + pclog("WARNING: Drive %c: has format not supported by Fixed Disk Adapter", d ? 'D' : 'C'); + } +} + +static void *xebec_init() +{ + int i = 0; + + xebec_t *xebec = malloc(sizeof(xebec_t)); + memset(xebec, 0, sizeof(xebec_t)); + + for (i = 0; i < HDC_NUM; i++) + { + if (hdc[i].bus == 1) + { + loadhd(xebec, hdc[i].mfm_channel, hdd_fn[i]); + } + } + + xebec_set_switches(xebec); + + rom_init(&xebec->bios_rom, "roms/ibm_xebec_62x0822_1985.bin", 0xc8000, 0x4000, 0x3fff, 0, MEM_MAPPING_EXTERNAL); + + io_sethandler(0x0320, 0x0004, xebec_read, NULL, NULL, xebec_write, NULL, NULL, xebec); + + timer_add(xebec_callback, &xebec->callback, &xebec->callback, xebec); + + return xebec; +} + +static void xebec_close(void *p) +{ + xebec_t *xebec = (xebec_t *)p; + int d; + + for (d = 0; d < 2; d++) + { + mfm_drive_t *drive = &xebec->drives[d]; + + if (drive->hdfile != NULL) + fclose(drive->hdfile); + } + + free(xebec); +} + +static int xebec_available() +{ + return rom_present("roms/ibm_xebec_62x0822_1985.bin"); +} + +device_t mfm_xebec_device = +{ + "IBM PC Fixed Disk Adapter", + 0, + xebec_init, + xebec_close, + xebec_available, + NULL, + NULL, + NULL, + NULL +}; + +static void *dtc_5150x_init() +{ + int i = 0; + + xebec_t *xebec = malloc(sizeof(xebec_t)); + memset(xebec, 0, sizeof(xebec_t)); + + for (i = 0; i < HDC_NUM; i++) + { + if (hdc[i].bus == 1) + { + loadhd(xebec, hdc[i].mfm_channel, hdd_fn[i]); + } + } + + xebec->switches = 0xff; + + xebec->drives[0].cfg_cyl = xebec->drives[0].tracks; + xebec->drives[0].cfg_hpc = xebec->drives[0].hpc; + xebec->drives[1].cfg_cyl = xebec->drives[1].tracks; + xebec->drives[1].cfg_hpc = xebec->drives[1].hpc; + + rom_init(&xebec->bios_rom, "roms/dtc_cxd21a.bin", 0xc8000, 0x4000, 0x3fff, 0, MEM_MAPPING_EXTERNAL); + + io_sethandler(0x0320, 0x0004, xebec_read, NULL, NULL, xebec_write, NULL, NULL, xebec); + + timer_add(xebec_callback, &xebec->callback, &xebec->callback, xebec); + + return xebec; +} +static int dtc_5150x_available() +{ + return rom_present("roms/dtc_cxd21a.bin"); +} + +device_t dtc_5150x_device = +{ + "DTC 5150X", + 0, + dtc_5150x_init, + xebec_close, + dtc_5150x_available, + NULL, + NULL, + NULL, + NULL +}; diff --git a/src/mfm_xebec.h b/src/mfm_xebec.h new file mode 100644 index 000000000..e6bafff17 --- /dev/null +++ b/src/mfm_xebec.h @@ -0,0 +1,2 @@ +extern device_t mfm_xebec_device; +extern device_t dtc_5150x_device; diff --git a/src/model.c b/src/model.c index fc34456dd..f92f0ea92 100644 --- a/src/model.c +++ b/src/model.c @@ -10,10 +10,10 @@ #include "mem.h" #include "model.h" #include "mouse.h" +#include "mouse_ps2.h" #include "io.h" #include "rom.h" -// #include "acer386sx.h" #include "acerm3a.h" #include "ali1429.h" #include "amstrad.h" @@ -23,6 +23,7 @@ #include "dma.h" #include "fdc.h" #include "fdc37c665.h" +#include "fdc37c669.h" #include "fdc37c932fr.h" #include "gameport.h" #include "headland.h" @@ -43,6 +44,7 @@ #include "keyboard_pcjr.h" #include "keyboard_xt.h" #include "lpt.h" +#include "mem.h" #include "memregs.h" #include "neat.h" #include "nmi.h" @@ -56,6 +58,7 @@ #include "pit.h" #include "ps1.h" #include "ps2.h" +#include "ps2_mca.h" #include "scat.h" #include "serial.h" #include "sis496.h" @@ -67,57 +70,56 @@ #include "tandy_eeprom.h" #include "tandy_rom.h" #include "um8669f.h" -// #include "um8881f.h" #include "vid_pcjr.h" #include "vid_tandy.h" #include "w83877f.h" #include "wd76c10.h" #include "xtide.h" +#include "bugger.h" -void xt_init(); -void pcjr_init(); -void tandy1k_init(); -void tandy1ksl2_init(); -void ams_init(); -void europc_init(); -void olim24_init(); -void at_init(); -void at_ide_init(); -void deskpro386_init(); -void ps1_m2011_init(); -void ps1_m2121_init(); -void ps2_m30_286_init(); -void at_neat_init(); -void at_scat_init(); -// void at_acer386sx_init(); -// void at_82335_init(); -void at_wd76c10_init(); -void at_ali1429_init(); -void at_headland_init(); -void at_opti495_init(); -// void at_um8881f_init(); -void at_sis496_init(); -void at_i430vx_init(); -void at_batman_init(); -void at_endeavor_init(); +void xt_init(); +void pcjr_init(); +void tandy1k_init(); +void tandy1ksl2_init(); +void ams_init(); +void europc_init(); +void olim24_init(); +void at_init(); +void ibm_at_init(); +void at_ide_init(); +void deskpro386_init(); +void ps1_m2011_init(); +void ps1_m2121_init(); +void ps2_m30_286_init(); +void ps2_model_50_init(); +void ps2_model_55sx_init(); +void ps2_model_80_init(); +void at_neat_init(); +void at_scat_init(); +void at_wd76c10_init(); +void at_ali1429_init(); +void at_headland_init(); +void at_opti495_init(); +void at_sis496_init(); +void at_i430vx_init(); +void at_batman_init(); +void at_endeavor_init(); -void at_dtk486_init(); -void at_r418_init(); -void at_586mc1_init(); -void at_plato_init(); -void at_mb500n_init(); -#if 0 -void at_powermate_v_init(); -#endif -void at_compaq_2000_init(); -void at_p54tp4xe_init(); -void at_acerm3a_init(); -void at_acerv35n_init(); -void at_p55t2p4_init(); -void at_p55tvp4_init(); -// void at_marl_init(); -void at_p55va_init(); -void at_i440fx_init(); +void at_dtk486_init(); +void at_r418_init(); +void at_586mc1_init(); +void at_plato_init(); +void at_mb500n_init(); +void at_p54tp4xe_init(); +void at_ap53_init(); +void at_p55t2s_init(); +void at_acerm3a_init(); +void at_acerv35n_init(); +void at_p55t2p4_init(); +void at_p55tvp4_init(); +void at_p55va_init(); +void at_i440fx_init(); +void at_s1668_init(); int model; @@ -125,72 +127,81 @@ int AMSTRAD, AT, PCI, TANDY; PCI_RESET pci_reset_handler; +int serial_enabled[2] = { 0, 0 }; +int lpt_enabled = 0, bugger_enabled = 0; + MODEL models[] = { - {"IBM PC", ROM_IBMPC, "ibmpc", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, - {"IBM XT", ROM_IBMXT, "ibmxt", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, - {"Compaq Portable", ROM_PORTABLE, "portable", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 128, 640, 128, xt_init, NULL}, - {"IBM PCjr", ROM_IBMPCJR, "ibmpcjr", { "", cpus_pcjr, "", NULL, "", NULL, "", NULL, "", NULL}, 1, 0, 128, 640, 128, pcjr_init, &pcjr_device}, - {"Generic XT clone", ROM_GENXT, "genxt", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, - {"AMI XT clone", ROM_AMIXT, "amixt", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, - {"DTK XT clone", ROM_DTKXT, "dtk", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, - {"VTech Laser Turbo XT", ROM_LTXT, "ltxt", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, - {"VTech Laser XT3", ROM_LXT3, "lxt3", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, - {"Phoenix XT clone", ROM_PXXT, "pxxt", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, - {"Juko XT clone", ROM_JUKOPC, "jukopc", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, - {"Tandy 1000", ROM_TANDY, "tandy", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 1, 0, 128, 640, 128, tandy1k_init, &tandy1000_device}, - {"Tandy 1000 HX", ROM_TANDY1000HX, "tandy1000hx", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 1, 0, 256, 640, 128, tandy1k_init, &tandy1000hx_device}, - {"Tandy 1000 SL/2", ROM_TANDY1000SL2, "tandy1000sl2", { "", cpus_8086, "", NULL, "", NULL, "", NULL, "", NULL}, 1, 0, 512, 768, 128, tandy1ksl2_init, NULL}, - {"Amstrad PC1512", ROM_PC1512, "pc1512", { "", cpus_pc1512, "", NULL, "", NULL, "", NULL, "", NULL}, 1, MODEL_AMSTRAD, 512, 640, 128, ams_init, NULL}, - {"Sinclair PC200", ROM_PC200, "pc200", { "", cpus_8086, "", NULL, "", NULL, "", NULL, "", NULL}, 1, MODEL_AMSTRAD, 512, 640, 128, ams_init, NULL}, - {"Euro PC", ROM_EUROPC, "europc", { "", cpus_8086, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 512, 640, 128, europc_init, NULL}, - {"Olivetti M24", ROM_OLIM24, "olivetti_m24", { "", cpus_8086, "", NULL, "", NULL, "", NULL, "", NULL}, 1, MODEL_OLIM24, 128, 640, 128, olim24_init, NULL}, - {"Amstrad PC1640", ROM_PC1640, "pc1640", { "", cpus_8086, "", NULL, "", NULL, "", NULL, "", NULL}, 1, MODEL_AMSTRAD, 640, 640, 0, ams_init, NULL}, - {"Amstrad PC2086", ROM_PC2086, "pc2086", { "", cpus_8086, "", NULL, "", NULL, "", NULL, "", NULL}, 1, MODEL_AMSTRAD, 640, 640, 0, ams_init, NULL}, - {"Amstrad PC3086", ROM_PC3086, "pc3086", { "", cpus_8086, "", NULL, "", NULL, "", NULL, "", NULL}, 1, MODEL_AMSTRAD, 640, 640, 0, ams_init, NULL}, - {"IBM AT", ROM_IBMAT, "ibmat", { "", cpus_ibmat, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT, 1, 16, 1, at_init, NULL}, - {"Compaq Portable II", ROM_PORTABLEII, "portableii", { "", cpus_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT, 1, 15, 1, at_init, NULL}, - {"Compaq Portable III", ROM_PORTABLEIII, "portableiii", { "", cpus_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT, 1, 15, 1, at_init, NULL}, - {"Commodore PC 30 III", ROM_CMDPC30, "cmdpc30", { "", cpus_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 16, 1, at_init, NULL}, - {"AMI 286 clone", ROM_AMI286, "ami286", { "", cpus_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 16, 1, at_neat_init, NULL}, - {"Award 286 clone", ROM_AWARD286, "award286", { "", cpus_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 16, 1, at_scat_init, NULL}, - {"DELL System 200", ROM_DELL200, "dells200", { "", cpus_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT, 1, 16, 1, at_init, NULL}, - {"Hyundai Super-286TR", ROM_SUPER286TR, "super286tr", { "", cpus_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT, 1, 16, 1, at_scat_init, NULL}, - {"Samsung SPC-4200P", ROM_SPC4200P, "spc4200p", { "", cpus_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT, 1, 16, 1, at_scat_init, NULL}, - {"IBM PS/1 model 2011", ROM_IBMPS1_2011, "ibmps1es", { "", cpus_ps1_m2011, "", NULL, "", NULL, "", NULL, "", NULL}, 1, MODEL_AT | MODEL_PS2 | MODEL_PS2_HDD, 1, 16, 1, ps1_m2011_init, NULL}, - {"IBM PS/2 Model 30-286", ROM_IBMPS2_M30_286, "ibmps2_m30_286", { "", cpus_ps2_m30_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_PS2_HDD, 1, 16, 1, ps2_m30_286_init, NULL}, - {"IBM PS/1 model 2121", ROM_IBMPS1_2121, "ibmps1_2121", { "Intel", cpus_i386SX, "AMD", cpus_Am386SX, "Cyrix", cpus_486SLC, "", NULL, "", NULL}, 1, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 16, 1, ps1_m2121_init, NULL}, - {"IBM PS/1 m.2121 + ISA", ROM_IBMPS1_2121_ISA, "ibmps1_2121_isa", { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 16, 1, ps1_m2121_init, NULL}, - {"Compaq Deskpro 386", ROM_DESKPRO_386, "dekspro386", { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC, "", NULL, "", NULL}, 0, MODEL_AT, 1, 15, 1, deskpro386_init, NULL}, - {"Compaq Portable III 386", ROM_PORTABLEIII386, "portableiii386", { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC, "", NULL, "", NULL}, 0, MODEL_AT, 1, 15, 1, at_init, NULL}, - {"DTK 386SX clone", ROM_DTK386, "dtk386", { "Intel", cpus_i386SX, "AMD", cpus_Am386SX, "Cyrix", cpus_486SLC, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 16, 1, at_neat_init, NULL}, - {"Amstrad MegaPC", ROM_MEGAPC, "megapc", { "Intel", cpus_i386SX, "AMD", cpus_Am386SX, "Cyrix", cpus_486SLC, "", NULL, "", NULL}, 1, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 16, 1, at_wd76c10_init, NULL}, - {"AMI 386SX clone", ROM_AMI386SX, "ami386", { "Intel", cpus_i386SX, "AMD", cpus_Am386SX, "Cyrix", cpus_486SLC, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 256, 1, at_headland_init, NULL}, + {"IBM PC", ROM_IBMPC, "ibmpc", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, + {"IBM XT", ROM_IBMXT, "ibmxt", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, + {"Compaq Portable", ROM_PORTABLE, "portable", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 128, 640, 128, xt_init, NULL}, + {"IBM PCjr", ROM_IBMPCJR, "ibmpcjr", { "", cpus_pcjr, "", NULL, "", NULL, "", NULL, "", NULL}, 1, 0, 128, 640, 128, pcjr_init, &pcjr_device}, + {"Generic XT clone", ROM_GENXT, "genxt", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, + {"AMI XT clone", ROM_AMIXT, "amixt", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, + {"DTK XT clone", ROM_DTKXT, "dtk", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, + {"VTech Laser Turbo XT", ROM_LTXT, "ltxt", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, + {"VTech Laser XT3", ROM_LXT3, "lxt3", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, + {"Phoenix XT clone", ROM_PXXT, "pxxt", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, + {"Juko XT clone", ROM_JUKOPC, "jukopc", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, + {"Tandy 1000", ROM_TANDY, "tandy", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 1, 0, 128, 640, 128, tandy1k_init, &tandy1000_device}, + {"Tandy 1000 HX", ROM_TANDY1000HX, "tandy1000hx", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 1, 0, 256, 640, 128, tandy1k_init, &tandy1000hx_device}, + {"Tandy 1000 SL/2", ROM_TANDY1000SL2, "tandy1000sl2", { "", cpus_8086, "", NULL, "", NULL, "", NULL, "", NULL}, 1, 0, 512, 768, 128, tandy1ksl2_init, NULL}, + {"Amstrad PC1512", ROM_PC1512, "pc1512", { "", cpus_pc1512, "", NULL, "", NULL, "", NULL, "", NULL}, 1, MODEL_AMSTRAD, 512, 640, 128, ams_init, NULL}, + {"Sinclair PC200", ROM_PC200, "pc200", { "", cpus_8086, "", NULL, "", NULL, "", NULL, "", NULL}, 1, MODEL_AMSTRAD, 512, 640, 128, ams_init, NULL}, + {"Euro PC", ROM_EUROPC, "europc", { "", cpus_8086, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 512, 640, 128, europc_init, NULL}, + {"Olivetti M24", ROM_OLIM24, "olivetti_m24", { "", cpus_8086, "", NULL, "", NULL, "", NULL, "", NULL}, 1, MODEL_OLIM24, 128, 640, 128, olim24_init, NULL}, + {"Amstrad PC1640", ROM_PC1640, "pc1640", { "", cpus_8086, "", NULL, "", NULL, "", NULL, "", NULL}, 1, MODEL_AMSTRAD, 640, 640, 0, ams_init, NULL}, + {"Amstrad PC2086", ROM_PC2086, "pc2086", { "", cpus_8086, "", NULL, "", NULL, "", NULL, "", NULL}, 1, MODEL_AMSTRAD, 640, 640, 0, ams_init, NULL}, + {"Amstrad PC3086", ROM_PC3086, "pc3086", { "", cpus_8086, "", NULL, "", NULL, "", NULL, "", NULL}, 1, MODEL_AMSTRAD, 640, 640, 0, ams_init, NULL}, + {"IBM AT", ROM_IBMAT, "ibmat", { "", cpus_ibmat, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT, 1, 16, 1, ibm_at_init, NULL}, + {"Compaq Portable II", ROM_PORTABLEII, "portableii", { "", cpus_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT, 1, 15, 1, at_init, NULL}, + {"Compaq Portable III", ROM_PORTABLEIII, "portableiii", { "", cpus_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT, 1, 15, 1, at_init, NULL}, + {"Commodore PC 30 III", ROM_CMDPC30, "cmdpc30", { "", cpus_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 16, 1, at_ide_init, NULL}, + {"AMI 286 clone", ROM_AMI286, "ami286", { "", cpus_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 16, 1, at_neat_init, NULL}, + {"Award 286 clone", ROM_AWARD286, "award286", { "", cpus_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 16, 1, at_scat_init, NULL}, + {"DELL System 200", ROM_DELL200, "dells200", { "", cpus_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT, 1, 16, 1, at_init, NULL}, + {"Hyundai Super-286TR", ROM_SUPER286TR, "super286tr", { "", cpus_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT, 1, 16, 1, at_scat_init, NULL}, + {"Samsung SPC-4200P", ROM_SPC4200P, "spc4200p", { "", cpus_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT, 1, 16, 1, at_scat_init, NULL}, + {"IBM PS/1 model 2011", ROM_IBMPS1_2011, "ibmps1es", { "", cpus_ps1_m2011, "", NULL, "", NULL, "", NULL, "", NULL}, 1, MODEL_AT | MODEL_PS2 | MODEL_PS2_HDD, 1, 16, 1, ps1_m2011_init, NULL}, + {"IBM PS/2 Model 30-286", ROM_IBMPS2_M30_286, "ibmps2_m30_286", { "", cpus_ps2_m30_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_PS2_HDD, 1, 16, 1, ps2_m30_286_init, NULL}, + {"IBM PS/2 Model 50", ROM_IBMPS2_M50, "ibmps2_m50", { "", cpus_ps2_m30_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_PS2_HDD | MODEL_MCA, 1, 16, 1, ps2_model_50_init, NULL}, + {"IBM PS/1 model 2121", ROM_IBMPS1_2121, "ibmps1_2121", { "Intel", cpus_i386SX, "AMD", cpus_Am386SX, "Cyrix", cpus_486SLC, "", NULL, "", NULL}, 1, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 16, 1, ps1_m2121_init, NULL}, + {"IBM PS/1 m.2121 + ISA", ROM_IBMPS1_2121_ISA, "ibmps1_2121_isa", { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 16, 1, ps1_m2121_init, NULL}, + {"IBM PS/2 Model 55SX", ROM_IBMPS2_M55SX, "ibmps2_m55sx", { "Intel", cpus_i386SX, "AMD", cpus_Am386SX, "Cyrix", cpus_486SLC, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_PS2_HDD | MODEL_MCA, 1, 8, 1, ps2_model_55sx_init, NULL}, + {"Compaq Deskpro 386", ROM_DESKPRO_386, "dekspro386", { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC, "", NULL, "", NULL}, 0, MODEL_AT, 1, 15, 1, deskpro386_init, NULL}, + {"Compaq Portable III 386", ROM_PORTABLEIII386, "portableiii386", { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC, "", NULL, "", NULL}, 0, MODEL_AT, 1, 15, 1, at_init, NULL}, + {"DTK 386SX clone", ROM_DTK386, "dtk386", { "Intel", cpus_i386SX, "AMD", cpus_Am386SX, "Cyrix", cpus_486SLC, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 16, 1, at_neat_init, NULL}, + {"Amstrad MegaPC", ROM_MEGAPC, "megapc", { "Intel", cpus_i386SX, "AMD", cpus_Am386SX, "Cyrix", cpus_486SLC, "", NULL, "", NULL}, 1, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 16, 1, at_wd76c10_init, NULL}, + {"AMI 386SX clone", ROM_AMI386SX, "ami386", { "Intel", cpus_i386SX, "AMD", cpus_Am386SX, "Cyrix", cpus_486SLC, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 64, 1, at_headland_init, NULL}, + {"IBM PS/2 Model 80", ROM_IBMPS2_M80, "ibmps2_m80", { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_PS2_HDD | MODEL_MCA, 1, 12, 1, ps2_model_80_init, NULL}, /* The MegaPC manual says 386DX model of the Amstrad PC70386 exists, but Sarah Walker just *had* to remove 386DX CPU's from some boards. */ - {"Amstrad MegaPC 386DX", ROM_MEGAPCDX, "megapcdx", { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC, "", NULL, "", NULL}, 1, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 16, 1, at_wd76c10_init, NULL}, - {"MR 386DX clone", ROM_MR386DX_OPTI495, "mr386dx", { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 256, 1, at_opti495_init, NULL}, - {"AMI 386DX clone", ROM_AMI386DX_OPTI495, "ami386dx", { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 256, 1, at_opti495_init, NULL}, - {"AMI 486 clone", ROM_AMI486, "ami486", { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 256, 1, at_ali1429_init, NULL}, - {"AMI WinBIOS 486", ROM_WIN486, "win486", { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 256, 1, at_ali1429_init, NULL}, - {"DTK PKM-0038S E-2", ROM_DTK486, "dtk486", { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 256, 1, at_dtk486_init, NULL}, - {"Award SiS 496/497", ROM_SIS496, "sis496", { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 256, 1, at_sis496_init, NULL}, - {"Rise Computer R418", ROM_R418, "r418", { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 256, 1, at_r418_init, NULL}, - {"Intel Premiere/PCI", ROM_REVENGE, "revenge", { "Intel", cpus_Pentium5V, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 128, 1, at_batman_init, NULL}, - {"Micro Star 586MC1", ROM_586MC1, "586mc1", { "Intel", cpus_Pentium5V50, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 128, 1, at_586mc1_init, NULL}, - {"Intel Premiere/PCI II", ROM_PLATO, "plato", { "Intel", cpus_PentiumS5, "IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 128, 1, at_plato_init, NULL}, - {"Intel Advanced/EV", ROM_ENDEAVOR, "endeavor", { "Intel", cpus_PentiumS5, "IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 128, 1, at_endeavor_init, NULL}, - {"Intel Advanced/ZP", ROM_ZAPPA, "zappa", { "Intel", cpus_PentiumS5, "IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 128, 1, at_endeavor_init, NULL}, - {"PC Partner MB500N", ROM_MB500N, "mb500n", { "Intel", cpus_PentiumS5, "IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 128, 1, at_mb500n_init, NULL}, - {"Intel Advanced/ATX", ROM_THOR, "thor", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 512, 1, at_endeavor_init, NULL}, - {"MR Intel Advanced/ATX", ROM_MRTHOR, "mrthor", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 512, 1, at_endeavor_init, NULL}, - {"ASUS P/I-P54TP4XE", ROM_P54TP4XE, "p54tp4xe", { "Intel", cpus_PentiumS5, "IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 512, 1, at_p54tp4xe_init, NULL}, - {"Acer M3a", ROM_ACERM3A, "acerm3a", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 512, 1, at_acerm3a_init, NULL}, - {"Acer V35N", ROM_ACERV35N, "acerv3n", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 512, 1, at_acerv35n_init, NULL}, - {"ASUS P/I-P55T2P4", ROM_P55T2P4, "p55r2p4", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 512, 1, at_p55t2p4_init, NULL}, - {"Award 430VX PCI", ROM_430VX, "430vx", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 256, 1, at_i430vx_init, NULL}, - {"Epox P55-VA", ROM_P55VA, "p55va", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 256, 1, at_p55va_init, NULL}, - {"ASUS P/I-P55TVP4", ROM_P55TVP4, "p55tvp4", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 256, 1, at_p55tvp4_init, NULL}, - {"Award 440FX PCI", ROM_440FX, "440fx", { "Intel", cpus_PentiumPro, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 1024, 1, at_i440fx_init, NULL}, + {"Amstrad MegaPC 386DX", ROM_MEGAPCDX, "megapcdx", { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC, "", NULL, "", NULL}, 1, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 16, 1, at_wd76c10_init, NULL}, + {"MR 386DX clone", ROM_MR386DX_OPTI495, "mr386dx", { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 64, 1, at_opti495_init, NULL}, + {"AMI 386DX clone", ROM_AMI386DX_OPTI495, "ami386dx", { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 64, 1, at_opti495_init, NULL}, + {"AMI 486 clone", ROM_AMI486, "ami486", { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 64, 1, at_ali1429_init, NULL}, + {"AMI WinBIOS 486", ROM_WIN486, "win486", { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 64, 1, at_ali1429_init, NULL}, + {"DTK PKM-0038S E-2", ROM_DTK486, "dtk486", { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 64, 1, at_dtk486_init, NULL}, + {"Award SiS 496/497", ROM_SIS496, "sis496", { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE | MODEL_PCI, 1, 64, 1, at_sis496_init, NULL}, + {"Rise Computer R418", ROM_R418, "r418", { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE | MODEL_PCI, 1, 64, 1, at_r418_init, NULL}, + {"Intel Premiere/PCI", ROM_REVENGE, "revenge", { "Intel", cpus_Pentium5V, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 128, 1, at_batman_init, NULL}, + {"Micro Star 586MC1", ROM_586MC1, "586mc1", { "Intel", cpus_Pentium5V50, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE | MODEL_PCI, 1, 128, 1, at_586mc1_init, NULL}, + {"Intel Premiere/PCI II", ROM_PLATO, "plato", { "Intel", cpus_PentiumS5, "IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 128, 1, at_plato_init, NULL}, + {"Intel Advanced/EV", ROM_ENDEAVOR, "endeavor", { "Intel", cpus_PentiumS5, "IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 128, 1, at_endeavor_init, NULL}, + {"Intel Advanced/ZP", ROM_ZAPPA, "zappa", { "Intel", cpus_PentiumS5, "IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 128, 1, at_endeavor_init, NULL}, + {"PC Partner MB500N", ROM_MB500N, "mb500n", { "Intel", cpus_PentiumS5, "IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 128, 1, at_mb500n_init, NULL}, + {"Intel Advanced/ATX", ROM_THOR, "thor", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 512, 1, at_endeavor_init, NULL}, + {"MR Intel Advanced/ATX", ROM_MRTHOR, "mrthor", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 512, 1, at_endeavor_init, NULL}, + {"ASUS P/I-P54TP4XE", ROM_P54TP4XE, "p54tp4xe", { "Intel", cpus_PentiumS5, "IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 512, 1, at_p54tp4xe_init, NULL}, + {"AOpen AP53", ROM_AP53, "ap53", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 512, 1, at_ap53_init, NULL}, + {"ASUS P/I-P55T2S", ROM_P55T2S, "p55t2s", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 512, 1, at_p55t2s_init, NULL}, + {"Acer M3a", ROM_ACERM3A, "acerm3a", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 512, 1, at_acerm3a_init, NULL}, + {"Acer V35N", ROM_ACERV35N, "acerv3n", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 512, 1, at_acerv35n_init, NULL}, + {"ASUS P/I-P55T2P4", ROM_P55T2P4, "p55r2p4", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 512, 1, at_p55t2p4_init, NULL}, + {"Award 430VX PCI", ROM_430VX, "430vx", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 256, 1, at_i430vx_init, NULL}, + {"Epox P55-VA", ROM_P55VA, "p55va", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 256, 1, at_p55va_init, NULL}, + {"ASUS P/I-P55TVP4", ROM_P55TVP4, "p55tvp4", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 256, 1, at_p55tvp4_init, NULL}, + {"Tyan Titan-Pro AT", ROM_440FX, "440fx", { "Intel", cpus_PentiumPro, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 1024, 1, at_i440fx_init, NULL}, + {"Tyan Titan-Pro ATX", ROM_S1668, "tpatx", { "Intel", cpus_PentiumPro, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 1024, 1, at_s1668_init, NULL}, {"", -1, "", {"", 0, "", 0, "", 0}, 0,0,0, 0} }; @@ -204,6 +215,11 @@ int model_getromset() return models[model].id; } +int model_getromset_ex(int m) +{ + return models[m].id; +} + int model_getmodel(int romset) { int c = 0; @@ -252,21 +268,34 @@ void common_init() { dma_init(); fdc_add(); - lpt_init(); + if (lpt_enabled) + { + lpt_init(); + } pic_init(); pit_init(); - serial1_init(0x3f8, 4); - serial2_init(0x2f8, 3); + if (serial_enabled[0]) + { + serial1_init(0x3f8, 4); + } + if (serial_enabled[1]) + { + serial2_init(0x2f8, 3); + } } void xt_init() { common_init(); mem_add_bios(); - pit_set_out_func(1, pit_refresh_timer_xt); + pit_set_out_func(&pit, 1, pit_refresh_timer_xt); keyboard_xt_init(); nmi_init(); if (joystick_type != 7) device_add(&gameport_device); + if (bugger_enabled) + { + bugger_init(); + } } void pcjr_init() @@ -275,8 +304,11 @@ void pcjr_init() fdc_add_pcjr(); pic_init(); pit_init(); - pit_set_out_func(0, pit_irq0_timer_pcjr); - serial1_init(0x2f8, 3); + pit_set_out_func(&pit, 0, pit_irq0_timer_pcjr); + if (serial_enabled[0]) + { + serial1_init(0x2f8, 3); + } keyboard_pcjr_init(); device_add(&sn76489_device); nmi_mask = 0x80; @@ -299,7 +331,6 @@ void tandy1k_init() } void tandy1ksl2_init() { -// TANDY = 1; common_init(); mem_add_bios(); keyboard_tandy_init(); @@ -348,14 +379,27 @@ void at_init() { AT = 1; common_init(); - lpt2_remove(); + if (lpt_enabled) + { + lpt2_remove(); + } mem_add_bios(); - pit_set_out_func(1, pit_refresh_timer_at); + pit_set_out_func(&pit, 1, pit_refresh_timer_at); dma16_init(); keyboard_at_init(); nvr_init(); pic2_init(); if (joystick_type != 7) device_add(&gameport_device); + if (bugger_enabled) + { + bugger_init(); + } +} + +void ibm_at_init() +{ + at_init(); + mem_remap_top_384k(); } void at_ide_init() @@ -375,12 +419,12 @@ void ps1_common_init() AT = 1; common_init(); mem_add_bios(); - pit_set_out_func(1, pit_refresh_timer_at); + pit_set_out_func(&pit, 1, pit_refresh_timer_at); dma16_init(); - if (romset == ROM_IBMPS1_2011) - device_add(&xtide_ps2_device); - else - ide_init(); + if (romset != ROM_IBMPS1_2011) + { + ide_init(); + } keyboard_at_init(); nvr_init(); pic2_init(); @@ -408,9 +452,8 @@ void ps2_m30_286_init() AT = 1; common_init(); mem_add_bios(); - pit_set_out_func(1, pit_refresh_timer_at); + pit_set_out_func(&pit, 1, pit_refresh_timer_at); dma16_init(); - device_add(&xtide_ps2_device); keyboard_at_init(); nvr_init(); pic2_init(); @@ -419,6 +462,41 @@ void ps2_m30_286_init() fdc_set_ps1(); } +static void ps2_common_init() +{ + AT = 1; + common_init(); + mem_add_bios(); + dma16_init(); + ps2_dma_init(); + ide_init(); + keyboard_at_init(); + keyboard_at_init_ps2(); + mouse_ps2_init(); + nvr_init(); + pic2_init(); + + pit_ps2_init(); +} + +void ps2_model_50_init() +{ + ps2_common_init(); + ps2_mca_board_model_50_init(); +} + +void ps2_model_55sx_init() +{ + ps2_common_init(); + ps2_mca_board_model_55sx_init(); +} + +void ps2_model_80_init() +{ + ps2_common_init(); + ps2_mca_board_model_80_type2_init(); +} + void at_neat_init() { at_ide_init(); @@ -564,14 +642,6 @@ void at_endeavor_init() device_add(&intel_flash_bxt_ami_device); } -#if 0 -void at_marl_init() -{ - at_advanced_common_init(); - // device_add(&intel_flash_100bxt_ami_device); -} -#endif - void at_mb500n_init() { at_ide_init(); @@ -607,6 +677,32 @@ void at_p54tp4xe_init() device_add(&intel_flash_bxt_device); } +void at_ap53_init() +{ + at_ide_init(); + memregs_init(); + powermate_memregs_init(); + pci_init(PCI_CONFIG_TYPE_1, 0xd, 0x10); + i430hx_init(); + piix3_init(7); + fdc37c669_init(); + acerm3a_io_init(); + device_add(&intel_flash_bxt_device); +} + +void at_p55t2s_init() +{ + at_ide_init(); + memregs_init(); + powermate_memregs_init(); + pci_init(PCI_CONFIG_TYPE_1, 0xd, 0x10); + i430hx_init(); + piix3_init(7); + pc87306_init(); + acerm3a_io_init(); + device_add(&intel_flash_bxt_device); +} + void at_acerm3a_init() { at_ide_init(); @@ -688,9 +784,20 @@ void at_i440fx_init() device_add(&intel_flash_bxt_device); } +void at_s1668_init() +{ + at_ide_init(); + memregs_init(); + pci_init(PCI_CONFIG_TYPE_1, 0xd, 0x10); + i440fx_init(); + piix3_init(7); + fdc37c665_init(); + device_add(&intel_flash_bxt_device); +} + void model_init() { - pclog("Initting as %s\n", model_getname()); + pclog("Initializing as %s\n", model_getname()); AMSTRAD = AT = PCI = TANDY = 0; io_init(); diff --git a/src/model.h b/src/model.h index 9a627a3d1..bfdc19077 100644 --- a/src/model.h +++ b/src/model.h @@ -1,15 +1,17 @@ /* Copyright holders: Sarah Walker, Tohka see COPYING for more details */ -#define MODEL_AT 1 -#define MODEL_PS2 2 -#define MODEL_AMSTRAD 4 -#define MODEL_OLIM24 8 -#define MODEL_HAS_IDE 16 -#define MODEL_NEC 32 -#define MODEL_FUJITSU 64 -#define MODEL_RM 128 -#define MODEL_PS2_HDD 256 +#define MODEL_AT 1 +#define MODEL_PS2 2 +#define MODEL_AMSTRAD 4 +#define MODEL_OLIM24 8 +#define MODEL_HAS_IDE 16 +#define MODEL_MCA 32 +#define MODEL_PCI 64 +#define MODEL_PS2_HDD 128 +#define MODEL_NEC 256 +#define MODEL_FUJITSU 512 +#define MODEL_RM 1024 typedef struct { @@ -41,3 +43,4 @@ char *model_get_internal_name(); int model_get_model_from_internal_name(char *s); void model_init(); struct device_t *model_getdevice(int model); +int model_getromset_ex(int m); diff --git a/src/mouse.c b/src/mouse.c index 467dde2e9..9fb10ccf2 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -1,50 +1,108 @@ #include "ibm.h" #include "mouse.h" -#include "amstrad.h" -#include "mouse_ps2.h" #include "mouse_serial.h" +#ifdef INPORT_MOUSE +# include "mouse_inport.h" +#endif +#include "mouse_ps2.h" +#include "mouse_bus.h" +#include "amstrad.h" #include "keyboard_olim24.h" -static mouse_t *mouse_list[] = -{ - &mouse_serial_microsoft, - &mouse_ps2_2_button, - &mouse_intellimouse, - &mouse_amstrad, - &mouse_olim24, - NULL + +#ifndef INPORTMOUSE +static mouse_t mouse_notimp = { + "Microsoft InPort Mouse", + "msinport", + MOUSE_TYPE_INPORT, + NULL, NULL, NULL +}; +#endif + + +static mouse_t *mouse_list[] = { + &mouse_serial_microsoft, /* 0 Microsoft Serial Mouse */ +#ifdef INPORTMOUSE + &mouse_inport, /* 1 Microsoft InPort Bus Mouse */ +#else + &mouse_notimp, /* 1 (not implemented) */ +#endif + &mouse_ps2_2_button, /* 2 PS/2 Mouse 2-button */ + &mouse_bus, /* 3 Logitech Bus Mouse 2-button */ + &mouse_intellimouse, /* 4 PS/2 Intellimouse 3-button */ + &mouse_amstrad, /* 5 Amstrad PC System Mouse */ + &mouse_olim24, /* 6 Olivetti M24 System Mouse */ +#if 0 + &mouse_msystems, /* 7 Mouse Systems */ + &mouse_genius, /* 8 Genius Bus Mouse */ +#endif + NULL }; static mouse_t *cur_mouse; static void *mouse_p; int mouse_type = 0; -void mouse_emu_init() + +void mouse_emu_init(void) { - cur_mouse = mouse_list[mouse_type]; - mouse_p = cur_mouse->init(); + cur_mouse = mouse_list[mouse_type]; + mouse_p = cur_mouse->init(); } -void mouse_emu_close() + +void mouse_emu_close(void) { - if (cur_mouse) - cur_mouse->close(mouse_p); - cur_mouse = NULL; + if (cur_mouse) + cur_mouse->close(mouse_p); + cur_mouse = NULL; } + void mouse_poll(int x, int y, int z, int b) { - if (cur_mouse) - cur_mouse->poll(x, y, z, b, mouse_p); + if (cur_mouse) + cur_mouse->poll(x, y, z, b, mouse_p); } + char *mouse_get_name(int mouse) { - if (!mouse_list[mouse]) - return NULL; - return mouse_list[mouse]->name; + if (!mouse_list[mouse]) + return(NULL); + return(mouse_list[mouse]->name); } + + +char *mouse_get_internal_name(int mouse) +{ + return(mouse_list[mouse]->internal_name); +} + + +int mouse_get_from_internal_name(char *s) +{ + int c = 0; + + while (mouse_list[c] != NULL) + { + if (!strcmp(mouse_list[c]->internal_name, s)) + return(c); + c++; + } + + return(0); +} + + int mouse_get_type(int mouse) { - return mouse_list[mouse]->type; + return(mouse_list[mouse]->type); +} + + +/* Return number of MOUSE types we know about. */ +int mouse_get_ndev(void) +{ + return(sizeof(mouse_list)/sizeof(mouse_t *) - 1); } diff --git a/src/mouse.h b/src/mouse.h index c91cf25ff..701d5de9a 100644 --- a/src/mouse.h +++ b/src/mouse.h @@ -1,26 +1,42 @@ -void mouse_emu_init(); -void mouse_emu_close(); -void mouse_poll(int x, int y, int z, int b); +#ifndef MOUSE_H +# define MOUSE_H -char *mouse_get_name(int mouse); -int mouse_get_type(int mouse); -#define MOUSE_TYPE_SERIAL 0 -#define MOUSE_TYPE_PS2 1 -#define MOUSE_TYPE_AMSTRAD 2 -#define MOUSE_TYPE_OLIM24 3 +#define MOUSE_TYPE_SERIAL 0 /* Serial Mouse */ +#define MOUSE_TYPE_INPORT 1 /* Microsoft InPort Bus Mouse */ +#define MOUSE_TYPE_PS2 2 /* IBM PS/2 series Bus Mouse */ +#define MOUSE_TYPE_BUS 3 /* Logitech/ATI Bus Mouse */ +#define MOUSE_TYPE_PS2_MS 4 +#define MOUSE_TYPE_AMSTRAD 5 /* Amstrad PC system mouse */ +#define MOUSE_TYPE_OLIM24 6 /* Olivetti M24 system mouse */ +#define MOUSE_TYPE_MSYSTEMS 7 /* Mouse Systems mouse */ +#define MOUSE_TYPE_GENIUS 8 /* Genius Bus Mouse */ -#define MOUSE_TYPE_IF_MASK 3 +#define MOUSE_TYPE_MASK 0x0f +#define MOUSE_TYPE_3BUTTON (1<<7) /* device has 3+ buttons */ -#define MOUSE_TYPE_3BUTTON (1 << 31) -typedef struct -{ - char name[80]; - void *(*init)(); - void (*close)(void *p); - uint8_t (*poll)(int x, int y, int z, int b, void *p); - int type; +typedef struct { + char name[80]; + char internal_name[24]; + int type; + void *(*init)(void); + void (*close)(void *p); + uint8_t (*poll)(int x, int y, int z, int b, void *p); } mouse_t; -extern int mouse_type; + +extern int mouse_type; + + +extern void mouse_emu_init(void); +extern void mouse_emu_close(void); +extern void mouse_poll(int x, int y, int z, int b); +extern char *mouse_get_name(int mouse); +extern char *mouse_get_internal_name(int mouse); +extern int mouse_get_from_internal_name(char *s); +extern int mouse_get_type(int mouse); +extern int mouse_get_ndev(void); + + +#endif /*MOUSE_H*/ diff --git a/src/mouse_bus.c b/src/mouse_bus.c new file mode 100644 index 000000000..19ddb98cb --- /dev/null +++ b/src/mouse_bus.c @@ -0,0 +1,444 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Implementation of Bus Mouse devices. + * + * These mice devices were made by both Microsoft (InPort) and + * Logitech. Sadly, they did not use the same I/O protocol, but + * they were close enough to fit into a single implementation. + * + * Although the Minix driver blindly took IRQ5, the board seems + * to be able to tell the driver what IRQ it is set for. When + * testing on MS-DOS (6.22), the 'mouse.exe' driver did not want + * to start, and only after disassembling it and inspecting the + * code it was discovered that driver actually does use the IRQ + * reporting feature. In a really, really weird way, too: it + * sets up the board, and then reads the CTRL register which is + * supposed to return that IRQ value. Depending on whether or + * not the FREEZE bit is set, it has to return either the two's + * complemented (negated) value, or (if clear) just the value. + * The mouse.com driver reads both values 10,000 times, and + * then makes up its mind. Maybe an effort to 'debounce' the + * reading of the DIP switches? Oh-well. + * + * Based on an early driver for MINIX 1.5. + * Based on the 86Box PS/2 mouse driver as a framework. + * + * NOTE: Still have to add the code for the MS InPort mouse, which + * is very similar. Almost done, but not ready for release. + * + * Version: @(#)mouse_bus.c 1.0.3 2017/04/22 + * + * Author: Fred N. van Kempen, + * Copyright 1989-2017 Fred N. van Kempen. + */ +#include +#include +#include "ibm.h" +#include "io.h" +#include "pic.h" +#include "mouse.h" +#include "mouse_bus.h" +#include "plat-mouse.h" + + +#define ENABLE_3BTN 1 /* enable 3-button mode */ + + +/* Register definitions (based on Logitech info.) */ +#define LTMOUSE_DATA 0 /* DATA register */ +#define LTMOUSE_MAGIC 1 /* signature magic register */ +# define MAGIC_BYTE1 0xa5 /* most drivers use this */ +# define MAGIC_BYTE2 0x5a /* some drivers use this */ +# define MAGIC_MSBYTE1 0xde /* indicates MS InPort */ +# define MAGIC_MSBYTE2 0xad +#define LTMOUSE_CTRL 2 /* CTRL register */ +# define CTRL_FREEZE 0x80 /* do not sample when set */ +# define CTRL_RD_Y_HI 0x60 /* plus FREEZE */ +# define CTRL_RD_Y_LO 0x40 /* plus FREEZE */ +# define CTRL_RD_X_HI 0x20 /* plus FREEZE */ +# define CTRL_RD_X_LO 0x00 /* plus FREEZE */ +# define CTRL_RD_MASK 0x60 +# define CTRL_IDISABLE 0x10 +# define CTRL_IENABLE 0x00 +# define CTRL_DFLT (CTRL_IDISABLE) +#define LTMOUSE_CONFIG 3 /* CONFIG register */ +# define CONFIG_DFLT 0x91 /* 8255 controller config */ + +#define MSMOUSE_CTRL 0 /* CTRL register */ +#define MSMOUSE_DATA 1 /* DATA register */ +#define MSMOUSE_MAGIC 2 /* MAGIC register */ +#define MSMOUSE_CONFIG 3 /* CONFIG register */ + + +/* Our mouse device. */ +typedef struct { + uint16_t port; /* I/O port range start */ + uint16_t portlen; /* length of I/O port range */ + int8_t irq; /* IRQ channel to use */ + uint8_t flags; /* device flags */ + + uint8_t r_magic; /* MAGIC register */ + uint8_t r_ctrl; /* CONTROL register (WR) */ + uint8_t r_intr; /* INTSTAT register (RO) */ + uint8_t r_conf; /* CONFIG register */ + + int8_t x, y; /* current mouse status */ + uint8_t but; +} mouse_bus_t; +#define MOUSE_ENABLED 0x80 /* device is enabled for use */ +#define MOUSE_LOGITECH 0x40 /* running as Logitech mode */ +#define MOUSE_CMDFLAG 0x01 /* next wr is a command (MS) */ + + +/* Handle a write to the control register. */ +static void +wctrl(mouse_bus_t *ms, uint8_t val) +{ + uint8_t b = (ms->r_ctrl ^ val); + + if (b & CTRL_FREEZE) { + /* Hold the sampling while we do something. */ + if (! (val & CTRL_FREEZE)) { + /* Reset current state. */ + ms->x = ms->y = 0; + if (ms->but) /* allow one more POLL for button-release */ + ms->but = 0x80; + } + } + + if (b & CTRL_IDISABLE) { + /* Disable or enable interrupts. */ + /* (we don't do anything for that here..) */ + } + + /* Save new register value. */ + ms->r_ctrl = val; +} + + +/* Handle a WRITE operation to one of our registers. */ +static void +busmouse_write(uint16_t port, uint8_t val, void *priv) +{ + mouse_bus_t *ms = (mouse_bus_t *)priv; + +#if 0 + pclog("BUSMOUSE: write(%d,%02x)\n", port-ms->port, val); +#endif + + switch (port-ms->port) { + case LTMOUSE_DATA: /* [00] data register */ + break; + + case LTMOUSE_MAGIC: /* [01] magic data register */ + if (val == MAGIC_BYTE1 || val == MAGIC_BYTE2) { + ms->flags |= MOUSE_LOGITECH; + ms->r_magic = val; + } + break; + + case LTMOUSE_CTRL: /* [02] control register */ + wctrl(ms, val); + break; + + case LTMOUSE_CONFIG: /* [03] config register */ + ms->r_conf = val; + break; + + default: + break; + } +} + + +/* Handle a READ from a Microsoft-mode register. */ +static uint8_t +ms_read(mouse_bus_t *ms, uint16_t port) +{ + uint8_t r = 0xff; + + switch (port) { + case MSMOUSE_CTRL: /* [00] control register */ + r = ms->r_ctrl; + break; + + case MSMOUSE_DATA: /* [01] data register */ + break; + + case MSMOUSE_MAGIC: /* [02] magic data register */ + /* + * Drivers for the InPort controllers usually start + * by reading this register. If they find 0xDE here, + * they will continue their probe, otherwise no go. + */ + r = ms->r_magic; + + /* For the InPort, switch magic bytes. */ + if (ms->r_magic == MAGIC_MSBYTE1) + ms->r_magic = MAGIC_MSBYTE2; + else + ms->r_magic = MAGIC_MSBYTE1; + break; + + case MSMOUSE_CONFIG: /* [03] config register */ + r = ms->r_conf; + break; + + default: + break; + } + +#if 0 + pclog("BUSMOUSE: msread(%d): %02x\n", port, r); +#endif + + return(r); +} + + +/* Handle a READ from a LOGITECH-mode register. */ +static uint8_t +lt_read(mouse_bus_t *ms, uint16_t port) +{ + uint8_t r = 0xff; + + switch (port) { + case LTMOUSE_DATA: /* [00] data register */ + if (! (ms->r_ctrl & CTRL_FREEZE)) { + r = 0x00; + } else switch(ms->r_ctrl & CTRL_RD_MASK) { + case CTRL_RD_X_LO: /* X, low bits */ + /* + * Some drivers expect the buttons to + * be in this byte. Others want it in + * the Y-LO byte. --FvK + */ + r = 0x07; + if (ms->but & 0x01) /*LEFT*/ + r &= ~0x04; + if (ms->but & 0x02) /*RIGHT*/ + r &= ~0x01; +#if ENABLE_3BTN + if (ms->but & 0x04) /*MIDDLE*/ + r &= ~0x02; +#endif + r <<= 5; + r |= (ms->x & 0x0f); + break; + + case CTRL_RD_X_HI: /* X, high bits */ + r = (ms->x >> 4) & 0x0f; + break; + + case CTRL_RD_Y_LO: /* Y, low bits */ + r = (ms->y & 0x0f); + break; + + case CTRL_RD_Y_HI: /* Y, high bits */ + /* + * Some drivers expect the buttons to + * be in this byte. Others want it in + * the X-LO byte. --FvK + */ + r = 0x07; + if (ms->but & 0x01) /*LEFT*/ + r &= ~0x04; + if (ms->but & 0x02) /*RIGHT*/ + r &= ~0x01; +#if ENABLE_3BTN + if (ms->but & 0x04) /*MIDDLE*/ + r &= ~0x02; +#endif + r <<= 5; + r |= (ms->y >> 4) & 0x0f; + break; + } + break; + + case LTMOUSE_MAGIC: /* [01] magic data register */ + /* + * Logitech drivers start out by blasting their magic + * value (0xA5) into this register, and then read it + * back to see if that worked. If it did (and we do + * support this) the controller is assumed to be a + * Logitech-protocol one, and not InPort. + */ + r = ms->r_magic; + break; + + case LTMOUSE_CTRL: /* [02] control register */ + /* + * This is the weird stuff mentioned in the file header + * above. Microsoft's "mouse.exe" does some whacky stuff + * to extract the configured IRQ channel from the board. + * + * First, it reads the current value, and then re-reads + * it another 10,000 (yes, really) times. It keeps track + * of whether or not the data has changed, most likely + * to de-bounce reading of a DIP switch for example. This + * first value is assumed to be the 2's complement of the + * actual IRQ value. + * Next, it does this a second time, but now with the + * IDISABLE bit clear (so, interrupts enabled), which is + * our cue to return the regular (not complemented) value + * to them. + * + * Since we have to fake the initial value and the settling + * of the data a bit later on, we first return a bunch of + * invalid ("random") data, and then the real value. + * + * Yes, this is weird. --FvK + */ + if (ms->r_intr++ < 250) + /* Still settling, return invalid data. */ + r = (ms->r_ctrl&CTRL_IDISABLE)?0xff:0x00; + else { + /* OK, all good, return correct data. */ + r = (ms->r_ctrl&CTRL_IDISABLE)?-ms->irq:ms->irq; + ms->r_intr = 0; + } + break; + + case LTMOUSE_CONFIG: /* [03] config register */ + r = ms->r_conf; + break; + + default: + break; + } + +#if 0 + pclog("BUSMOUSE: ltread(%d): %02x\n", port, r); +#endif + + return(r); +} + + +/* Handle a READ operation from one of our registers. */ +static uint8_t +busmouse_read(uint16_t port, void *priv) +{ + mouse_bus_t *ms = (mouse_bus_t *)priv; + uint8_t r; + + if (ms->flags & MOUSE_LOGITECH) + r = lt_read(ms, port - ms->port); + else + r = ms_read(ms, port - ms->port); + + return(r); +} + + +/* The emulator calls us with an update on the host mouse device. */ +static uint8_t +busmouse_poll(int x, int y, int z, int b, void *priv) +{ + mouse_bus_t *ms = (mouse_bus_t *)priv; + +#if 0 + pclog("BUSMOUSE: poll(%d,%d,%d, %02x)\n", x, y, z, b); +#endif + + /* Return early if nothing to do. */ + if (!x && !y && !z && (ms->but == b)) return(1); + + /* If we are not interested, return. */ + if (!(ms->flags & MOUSE_ENABLED) || + (ms->r_ctrl & CTRL_FREEZE)) return(0); + + /* Add the delta to our state. */ + x += ms->x; + if (x > 127) + x = 127; + if (x < -128) + x = -128; + ms->x = (int8_t)x; + + y += ms->y; + if (y > 127) + y = 127; + if (y < -128) + y = -128; + ms->y = (int8_t)y; + + ms->but = b; + + /* All set, generate an interrupt. */ + if (! (ms->r_ctrl & CTRL_IDISABLE)) + picint(1 << ms->irq); + + return(0); +} + + +/* Release all resources held by the device. */ +static void +busmouse_close(void *priv) +{ + mouse_bus_t *ms = (mouse_bus_t *)priv; + + /* Release our I/O range. */ + io_removehandler(ms->port, ms->portlen, + busmouse_read, NULL, NULL, busmouse_write, NULL, NULL, + ms); + + free(ms); +} + + +/* Initialize the device for use by the user. */ +static void * +busmouse_init(void) +{ + mouse_bus_t *ms; + + ms = (mouse_bus_t *)malloc(sizeof(mouse_bus_t)); + memset(ms, 0x00, sizeof(mouse_bus_t)); + ms->port = BUSMOUSE_PORT; + ms->portlen = BUSMOUSE_PORTLEN; +#if BUSMOUSE_IRQ + ms->irq = BUSMOUSE_IRQ; +#else + ms->irq = -1; +#endif + + pclog("Logitech/Microsoft Bus Mouse, I/O=%04x, IRQ=%d\n", + ms->port, ms->irq); + /* Initialize registers. */ + ms->r_magic = MAGIC_MSBYTE1; + ms->r_conf = CONFIG_DFLT; + ms->r_ctrl = CTRL_DFLT; + + /* + * Technically this is not possible, but we fake that we + * did a power-up initialization with default config as + * set in the "conf" register. Emulators rock! --FvK + */ + ms->flags = MOUSE_ENABLED; + + /* Request an I/O range. */ + io_sethandler(ms->port, ms->portlen, + busmouse_read, NULL, NULL, busmouse_write, NULL, NULL, + ms); + + /* Return our private data to the I/O layer. */ + return(ms); +} + + +mouse_t mouse_bus = { + "Bus Mouse", + "msbus", + MOUSE_TYPE_BUS, + busmouse_init, + busmouse_close, + busmouse_poll +}; diff --git a/src/mouse_bus.h b/src/mouse_bus.h new file mode 100644 index 000000000..24eeb50ff --- /dev/null +++ b/src/mouse_bus.h @@ -0,0 +1,34 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Implementation of Bus Mouse devices. + * + * These mice devices were made by both Microsoft (InPort) and + * Logitech. Sadly, they did not use the same I/O protocol, but + * they were close enough to fit into a single implementation. + * + * Definitions for the Bus Mouse driver. + * + * Version: @(#)mouse_bus.h 1.0.3 2017/04/22 + * + * Author: Fred N. van Kempen, + * Copyright 1989-2017 Fred N. van Kempen. + */ +#ifndef MOUSE_BUS_H +# define MOUSE_BUS_H + + +#define BUSMOUSE_PORT 0x023c +#define BUSMOUSE_PORTLEN 4 +#define BUSMOUSE_IRQ 5 + + +extern mouse_t mouse_bus; + + +#endif /*MOUSE_BUS_H*/ diff --git a/src/mouse_ps2.c b/src/mouse_ps2.c index 15d2019f9..fa9eda980 100644 --- a/src/mouse_ps2.c +++ b/src/mouse_ps2.c @@ -1,3 +1,4 @@ +#include #include "ibm.h" #include "keyboard_at.h" #include "mouse.h" @@ -148,16 +149,16 @@ void mouse_ps2_write(uint8_t val, void *p) } } -void mouse_ps2_poll(int x, int y, int z, int b, void *p) +uint8_t mouse_ps2_poll(int x, int y, int z, int b, void *p) { mouse_ps2_t *mouse = (mouse_ps2_t *)p; uint8_t packet[3] = {0x08, 0, 0}; if (!x && !y && !z && b == mouse->b) - return; + return(0xff); if (!mouse_scan) - return; + return(0xff); mouse->x += x; mouse->y -= y; @@ -200,6 +201,8 @@ void mouse_ps2_poll(int x, int y, int z, int b, void *p) mouse->x = mouse->y = mouse->z = 0; } + + return(0); } void *mouse_ps2_init() @@ -237,16 +240,18 @@ void mouse_ps2_close(void *p) mouse_t mouse_ps2_2_button = { "2-button mouse (PS/2)", + "ps2", + MOUSE_TYPE_PS2, mouse_ps2_init, mouse_ps2_close, - mouse_ps2_poll, - MOUSE_TYPE_PS2 + mouse_ps2_poll }; mouse_t mouse_intellimouse = { "Microsoft Intellimouse (PS/2)", + "intellimouse", + MOUSE_TYPE_PS2 | MOUSE_TYPE_3BUTTON, mouse_intellimouse_init, mouse_ps2_close, - mouse_ps2_poll, - MOUSE_TYPE_PS2 | MOUSE_TYPE_3BUTTON + mouse_ps2_poll }; diff --git a/src/mouse_ps2.h b/src/mouse_ps2.h index 645e3cf73..b25cae5f2 100644 --- a/src/mouse_ps2.h +++ b/src/mouse_ps2.h @@ -1,2 +1,4 @@ extern mouse_t mouse_ps2_2_button; extern mouse_t mouse_intellimouse; + +extern void *mouse_ps2_init(); diff --git a/src/mouse_serial.c b/src/mouse_serial.c index f05e64d9e..84e85a673 100644 --- a/src/mouse_serial.c +++ b/src/mouse_serial.c @@ -1,98 +1,117 @@ +#include #include "ibm.h" #include "mouse.h" #include "pic.h" #include "serial.h" #include "timer.h" -typedef struct mouse_serial_t -{ - int mousepos, mousedelay; - int oldb; - SERIAL *serial; + +typedef struct mouse_serial_t { + int pos, + delay; + int oldb; + SERIAL *serial; } mouse_serial_t; -void mouse_serial_poll(int x, int y, int z, int b, void *p) + +static void +sermouse_rcr(SERIAL *serial, void *priv) { - mouse_serial_t *mouse = (mouse_serial_t *)p; - SERIAL *serial = mouse->serial; - uint8_t mousedat[3]; - - if (!(serial->ier & 1)) - return; - if (!x && !y && b == mouse->oldb) - return; - - mouse->oldb = b; - if (x>127) x=127; - if (y>127) y=127; - if (x<-128) x=-128; - if (y<-128) y=-128; - - /*Use Microsoft format*/ - mousedat[0]=0x40; - mousedat[0]|=(((y>>6)&3)<<2); - mousedat[0]|=((x>>6)&3); - if (b&1) mousedat[0]|=0x20; - if (b&2) mousedat[0]|=0x10; - mousedat[1]=x&0x3F; - mousedat[2]=y&0x3F; + mouse_serial_t *ms = (mouse_serial_t *)priv; - if (!(serial->mctrl & 0x10)) - { -// pclog("Serial data %02X %02X %02X\n", mousedat[0], mousedat[1], mousedat[2]); - serial_write_fifo(mouse->serial, mousedat[0]); - serial_write_fifo(mouse->serial, mousedat[1]); - serial_write_fifo(mouse->serial, mousedat[2]); - } + ms->pos = -1; + ms->delay = 5000 * (1 << TIMER_SHIFT); } -void mouse_serial_rcr(SERIAL *serial, void *p) -{ - mouse_serial_t *mouse = (mouse_serial_t *)p; - - mouse->mousepos = -1; - mouse->mousedelay = 5000 * (1 << TIMER_SHIFT); -} - -void mousecallback(void *p) -{ - mouse_serial_t *mouse = (mouse_serial_t *)p; - mouse->mousedelay = 0; - if (mouse->mousepos == -1) - { - mouse->mousepos = 0; - serial_write_fifo(mouse->serial, 'M'); - } +static void +sermouse_timer(void *priv) +{ + mouse_serial_t *ms = (mouse_serial_t *)priv; + + ms->delay = 0; + if (ms->pos == -1) { + ms->pos = 0; + serial_write_fifo(ms->serial, 'M'); + } } -void *mouse_serial_init() -{ - mouse_serial_t *mouse = (mouse_t *)malloc(sizeof(mouse_serial_t)); - memset(mouse, 0, sizeof(mouse_serial_t)); - mouse->serial = &serial1; - serial1.rcr_callback = mouse_serial_rcr; - serial1.rcr_callback_p = mouse; - timer_add(mousecallback, &mouse->mousedelay, &mouse->mousedelay, mouse); - - return mouse; +static uint8_t +sermouse_poll(int x, int y, int z, int b, void *priv) +{ + mouse_serial_t *ms = (mouse_serial_t *)priv; + SERIAL *sp = ms->serial; + uint8_t mousedat[3]; + + if (!(sp->ier & 1)) return(1); + + if (!x && !y && b == ms->oldb) return(1); + + ms->oldb = b; + if (x>127) x = 127; + if (y>127) y = 127; + if (x<-128) x = -128; + if (y<-128) y = -128; + + /* Use Microsoft format. */ + mousedat[0] = 0x40; + mousedat[0] |= (((y>>6)&3)<<2); + mousedat[0] |= ((x>>6)&3); + if (b&1) mousedat[0] |= 0x20; + if (b&2) mousedat[0] |= 0x10; + mousedat[1] = x & 0x3F; + mousedat[2] = y & 0x3F; + + /* FIXME: we should check in serial_write_fifo, not here! --FvK */ + if (! (sp->mctrl & 0x10)) { +#if 0 + pclog("Serial data %02X %02X %02X\n", + mousedat[0], mousedat[1], mousedat[2]); +#endif + serial_write_fifo(ms->serial, mousedat[0]); + serial_write_fifo(ms->serial, mousedat[1]); + serial_write_fifo(ms->serial, mousedat[2]); + } + + return(0); } -void mouse_serial_close(void *p) + +static void * +sermouse_init(void) { - mouse_serial_t *mouse = (mouse_serial_t *)p; - - free(mouse); - - serial1.rcr_callback = NULL; + mouse_serial_t *ms = (mouse_serial_t *)malloc(sizeof(mouse_serial_t)); + memset(ms, 0x00, sizeof(mouse_serial_t)); + + /* Attach a serial port to the mouse. */ + ms->serial = &serial1; + serial1.rcr_callback = sermouse_rcr; + serial1.rcr_callback_p = ms; + + timer_add(sermouse_timer, &ms->delay, &ms->delay, ms); + + return(ms); } -mouse_t mouse_serial_microsoft = + +static void +sermouse_close(void *priv) { - "Microsoft 2-button mouse (serial)", - mouse_serial_init, - mouse_serial_close, - mouse_serial_poll, - MOUSE_TYPE_SERIAL + mouse_serial_t *ms = (mouse_serial_t *)priv; + + /* Detach serial port from the mouse. */ + serial1.rcr_callback = NULL; + + free(ms); +} + + +mouse_t mouse_serial_microsoft = { + "Microsoft 2-button mouse (serial)", + "msserial", + MOUSE_TYPE_SERIAL, + sermouse_init, + sermouse_close, + sermouse_poll }; diff --git a/src/ne2000.c b/src/ne2000.c index 3f5006123..9bcad3036 100644 --- a/src/ne2000.c +++ b/src/ne2000.c @@ -1,22 +1,21 @@ /* Copyright holders: Peter Grehan, SA1988, Tenshi see COPYING for more details */ -///////////////////////////////////////////////////////////////////////// -// $Id: ne2k.cc,v 1.56.2.1 2004/02/02 22:37:22 cbothamy Exp $ -///////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2002 MandrakeSoft S.A. -// -// MandrakeSoft S.A. -// 43, rue d'Aboukir -// 75002 Paris - France -// http://www.linux-mandrake.com/ -// http://www.mandrakesoft.com/ -// +/* + $Id: ne2k.cc,v 1.56.2.1 2004/02/02 22:37:22 cbothamy Exp $ +*/ +/* + Copyright (C) 2002 MandrakeSoft S.A. -// Peter Grehan (grehan@iprg.nokia.com) coded all of this -// NE2000/ether stuff. -//#include "vl.h" + MandrakeSoft S.A. + 43, rue d'Aboukir + 75002 Paris - France + http://www.linux-mandrake.com/ + http://www.mandrakesoft.com/ +*/ + +/* Peter Grehan (grehan@iprg.nokia.com) coded all of this + NE2000/ether stuff. */ #include #include #include @@ -29,6 +28,7 @@ #include "ibm.h" #include "device.h" +#include "disc_random.h" #include "config.h" #include "nethandler.h" @@ -43,24 +43,25 @@ #include "pic.h" #include "timer.h" -//THIS IS THE DEFAULT MAC ADDRESS .... so it wont place nice with multiple VMs. YET. +/* THIS IS THE DEFAULT MAC ADDRESS .... so it wont place nice with multiple VMs. YET. */ uint8_t maclocal[6] = {0xac, 0xde, 0x48, 0x88, 0xbb, 0xaa}; +uint8_t maclocal_pci[6] = {0xac, 0xde, 0x48, 0x88, 0xbb, 0xaa}; -#define NETBLOCKING 0 //we won't block our pcap +#define NETBLOCKING 0 /* we won't block our pcap */ pcap_t *net_pcap; queueADT slirpq; int net_slirp_inited=0; -int net_is_pcap=0; //and pretend pcap is dead. +int net_is_pcap=0; /* and pretend pcap is dead. */ int fizz=0; void slirp_tic(); #define BX_RESET_HARDWARE 0 #define BX_RESET_SOFTWARE 1 -//Never completely fill the ne2k ring so that we never -// hit the unclear completely full buffer condition. +/* Never completely fill the ne2k ring so that we never + hit the unclear completely full buffer condition. */ #define BX_NE2K_NEVER_FULL_RING (1) #define BX_NE2K_MEMSIZ (32*1024) @@ -71,151 +72,145 @@ uint8_t rtl8029as_eeprom[128]; typedef struct ne2000_t { - // - // ne2k register state + /* ne2k register state */ - // - // Page 0 - // - // Command Register - 00h read/write + /* Page 0 */ + + /* Command Register - 00h read/write */ struct CR_t { - int stop; // STP - Software Reset command - int start; // START - start the NIC - int tx_packet; // TXP - initiate packet transmission - uint8_t rdma_cmd; // RD0,RD1,RD2 - Remote DMA command - uint8_t pgsel; // PS0,PS1 - Page select + int stop; /* STP - Software Reset command */ + int start; /* START - start the NIC */ + int tx_packet; /* TXP - initiate packet transmission */ + uint8_t rdma_cmd; /* RD0,RD1,RD2 - Remote DMA command */ + uint8_t pgsel; /* PS0,PS1 - Page select */ } CR; - // Interrupt Status Register - 07h read/write + /* Interrupt Status Register - 07h read/write */ struct ISR_t { - int pkt_rx; // PRX - packet received with no errors - int pkt_tx; // PTX - packet transmitted with no errors - int rx_err; // RXE - packet received with 1 or more errors - int tx_err; // TXE - packet tx'd " " " " " - int overwrite; // OVW - rx buffer resources exhausted - int cnt_oflow; // CNT - network tally counter MSB's set - int rdma_done; // RDC - remote DMA complete - int reset; // RST - reset status + int pkt_rx; /* PRX - packet received with no errors */ + int pkt_tx; /* PTX - packet transmitted with no errors */ + int rx_err; /* RXE - packet received with 1 or more errors */ + int tx_err; /* TXE - packet tx'd " " " " " */ + int overwrite; /* OVW - rx buffer resources exhausted */ + int cnt_oflow; /* CNT - network tally counter MSB's set */ + int rdma_done; /* RDC - remote DMA complete */ + int reset; /* RST - reset status */ } ISR; - // Interrupt Mask Register - 0fh write + /* Interrupt Mask Register - 0fh write */ struct IMR_t { - int rx_inte; // PRXE - packet rx interrupt enable - int tx_inte; // PTXE - packet tx interrput enable - int rxerr_inte; // RXEE - rx error interrupt enable - int txerr_inte; // TXEE - tx error interrupt enable - int overw_inte; // OVWE - overwrite warn int enable - int cofl_inte; // CNTE - counter o'flow int enable - int rdma_inte; // RDCE - remote DMA complete int enable - int reserved; // D7 - reserved + int rx_inte; /* PRXE - packet rx interrupt enable */ + int tx_inte; /* PTXE - packet tx interrput enable */ + int rxerr_inte; /* RXEE - rx error interrupt enable */ + int txerr_inte; /* TXEE - tx error interrupt enable */ + int overw_inte; /* OVWE - overwrite warn int enable */ + int cofl_inte; /* CNTE - counter o'flow int enable */ + int rdma_inte; /* RDCE - remote DMA complete int enable */ + int reserved; /* D7 - reserved */ } IMR; - // Data Configuration Register - 0eh write + /* Data Configuration Register - 0eh write */ struct DCR_t { - int wdsize; // WTS - 8/16-bit select - int endian; // BOS - byte-order select - int longaddr; // LAS - long-address select - int loop; // LS - loopback select - int auto_rx; // AR - auto-remove rx packets with remote DMA - uint8_t fifo_size; // FT0,FT1 - fifo threshold + int wdsize; /* WTS - 8/16-bit select */ + int endian; /* BOS - byte-order select */ + int longaddr; /* LAS - long-address select */ + int loop; /* LS - loopback select */ + int auto_rx; /* AR - auto-remove rx packets with remote DMA */ + uint8_t fifo_size; /* FT0,FT1 - fifo threshold */ } DCR; - // Transmit Configuration Register - 0dh write + /* Transmit Configuration Register - 0dh write */ struct TCR_t { - int crc_disable; // CRC - inhibit tx CRC - uint8_t loop_cntl; // LB0,LB1 - loopback control - int ext_stoptx; // ATD - allow tx disable by external mcast - int coll_prio; // OFST - backoff algorithm select - uint8_t reserved; // D5,D6,D7 - reserved + int crc_disable; /* CRC - inhibit tx CRC */ + uint8_t loop_cntl; /* LB0,LB1 - loopback control */ + int ext_stoptx; /* ATD - allow tx disable by external mcast */ + int coll_prio; /* OFST - backoff algorithm select */ + uint8_t reserved; /* D5,D6,D7 - reserved */ } TCR; - // Transmit Status Register - 04h read + /* Transmit Status Register - 04h read */ struct TSR_t { - int tx_ok; // PTX - tx complete without error - int reserved; // D1 - reserved - int collided; // COL - tx collided >= 1 times - int aborted; // ABT - aborted due to excessive collisions - int no_carrier; // CRS - carrier-sense lost - int fifo_ur; // FU - FIFO underrun - int cd_hbeat; // CDH - no tx cd-heartbeat from transceiver - int ow_coll; // OWC - out-of-window collision + int tx_ok; /* PTX - tx complete without error */ + int reserved; /* D1 - reserved */ + int collided; /* COL - tx collided >= 1 times */ + int aborted; /* ABT - aborted due to excessive collisions */ + int no_carrier; /* CRS - carrier-sense lost */ + int fifo_ur; /* FU - FIFO underrun */ + int cd_hbeat; /* CDH - no tx cd-heartbeat from transceiver */ + int ow_coll; /* OWC - out-of-window collision */ } TSR; - // Receive Configuration Register - 0ch write + /* Receive Configuration Register - 0ch write */ struct RCR_t { - int errors_ok; // SEP - accept pkts with rx errors - int runts_ok; // AR - accept < 64-byte runts - int broadcast; // AB - accept eth broadcast address - int multicast; // AM - check mcast hash array - int promisc; // PRO - accept all packets - int monitor; // MON - check pkts, but don't rx - uint8_t reserved; // D6,D7 - reserved + int errors_ok; /* SEP - accept pkts with rx errors */ + int runts_ok; /* AR - accept < 64-byte runts */ + int broadcast; /* AB - accept eth broadcast address */ + int multicast; /* AM - check mcast hash array */ + int promisc; /* PRO - accept all packets */ + int monitor; /* MON - check pkts, but don't rx */ + uint8_t reserved; /* D6,D7 - reserved */ } RCR; - // Receive Status Register - 0ch read + /* Receive Status Register - 0ch read */ struct RSR_t { - int rx_ok; // PRX - rx complete without error - int bad_crc; // CRC - Bad CRC detected - int bad_falign; // FAE - frame alignment error - int fifo_or; // FO - FIFO overrun - int rx_missed; // MPA - missed packet error - int rx_mbit; // PHY - unicast or mcast/bcast address match - int rx_disabled; // DIS - set when in monitor mode - int deferred; // DFR - collision active + int rx_ok; /* PRX - rx complete without error */ + int bad_crc; /* CRC - Bad CRC detected */ + int bad_falign; /* FAE - frame alignment error */ + int fifo_or; /* FO - FIFO overrun */ + int rx_missed; /* MPA - missed packet error */ + int rx_mbit; /* PHY - unicast or mcast/bcast address match */ + int rx_disabled; /* DIS - set when in monitor mode */ + int deferred; /* DFR - collision active */ } RSR; - uint16_t local_dma; // 01,02h read ; current local DMA addr - uint8_t page_start; // 01h write ; page start register - uint8_t page_stop; // 02h write ; page stop register - uint8_t bound_ptr; // 03h read/write ; boundary pointer - uint8_t tx_page_start; // 04h write ; transmit page start register - uint8_t num_coll; // 05h read ; number-of-collisions register - uint16_t tx_bytes; // 05,06h write ; transmit byte-count register - uint8_t fifo; // 06h read ; FIFO - uint16_t remote_dma; // 08,09h read ; current remote DMA addr - uint16_t remote_start; // 08,09h write ; remote start address register - uint16_t remote_bytes; // 0a,0bh write ; remote byte-count register - uint8_t tallycnt_0; // 0dh read ; tally counter 0 (frame align errors) - uint8_t tallycnt_1; // 0eh read ; tally counter 1 (CRC errors) - uint8_t tallycnt_2; // 0fh read ; tally counter 2 (missed pkt errors) + uint16_t local_dma; /* 01,02h read ; current local DMA addr */ + uint8_t page_start; /* 01h write ; page start register */ + uint8_t page_stop; /* 02h write ; page stop register */ + uint8_t bound_ptr; /* 03h read/write ; boundary pointer */ + uint8_t tx_page_start; /* 04h write ; transmit page start register */ + uint8_t num_coll; /* 05h read ; number-of-collisions register */ + uint16_t tx_bytes; /* 05,06h write ; transmit byte-count register */ + uint8_t fifo; /* 06h read ; FIFO */ + uint16_t remote_dma; /* 08,09h read ; current remote DMA addr */ + uint16_t remote_start; /* 08,09h write ; remote start address register */ + uint16_t remote_bytes; /* 0a,0bh write ; remote byte-count register */ + uint8_t tallycnt_0; /* 0dh read ; tally counter 0 (frame align errors) */ + uint8_t tallycnt_1; /* 0eh read ; tally counter 1 (CRC errors) */ + uint8_t tallycnt_2; /* 0fh read ; tally counter 2 (missed pkt errors) */ - // - // Page 1 - // - // Command Register 00h (repeated) - // - uint8_t physaddr[6]; // 01-06h read/write ; MAC address - uint8_t curr_page; // 07h read/write ; current page register - uint8_t mchash[8]; // 08-0fh read/write ; multicast hash array + /* Page 1 */ - // - // Page 2 - diagnostic use only - // - // Command Register 00h (repeated) - // - // Page Start Register 01h read (repeated) - // Page Stop Register 02h read (repeated) - // Current Local DMA Address 01,02h write (repeated) - // Transmit Page start address 04h read (repeated) - // Receive Configuration Register 0ch read (repeated) - // Transmit Configuration Register 0dh read (repeated) - // Data Configuration Register 0eh read (repeated) - // Interrupt Mask Register 0fh read (repeated) - // - uint8_t rempkt_ptr; // 03h read/write ; remote next-packet pointer - uint8_t localpkt_ptr; // 05h read/write ; local next-packet pointer - uint16_t address_cnt; // 06,07h read/write ; address counter + /* Command Register 00h (repeated) */ - // - // Page 3 - should never be modified. - // + uint8_t physaddr[6]; /* 01-06h read/write ; MAC address */ + uint8_t curr_page; /* 07h read/write ; current page register */ + uint8_t mchash[8]; /* 08-0fh read/write ; multicast hash array */ - // Novell ASIC state - uint8_t macaddr[32]; // ASIC ROM'd MAC address, even bytes - uint8_t mem[BX_NE2K_MEMSIZ]; // on-chip packet memory + /* Page 2 - diagnostic use only */ - // ne2k internal state + /* Command Register 00h (repeated) */ + + /* Page Start Register 01h read (repeated) + Page Stop Register 02h read (repeated) + Current Local DMA Address 01,02h write (repeated) + Transmit Page start address 04h read (repeated) + Receive Configuration Register 0ch read (repeated) + Transmit Configuration Register 0dh read (repeated) + Data Configuration Register 0eh read (repeated) + Interrupt Mask Register 0fh read (repeated) + */ + uint8_t rempkt_ptr; /* 03h read/write ; remote next-packet pointer */ + uint8_t localpkt_ptr; /* 05h read/write ; local next-packet pointer */ + uint16_t address_cnt; /* 06,07h read/write ; address counter */ + + /* Page 3 - should never be modified. */ + + /* Novell ASIC state */ + uint8_t macaddr[32]; /* ASIC ROM'd MAC address, even bytes */ + uint8_t mem[BX_NE2K_MEMSIZ]; /* on-chip packet memory */ + + /* ne2k internal state */ uint32_t base_address; int base_irq; int tx_timer_index; @@ -248,14 +243,85 @@ void ne2000_log(const char *format, ...) #endif } +static uint8_t *ne2000_mac() +{ + if (network_card_current == 2) + { + return maclocal_pci; + } + else + { + return maclocal; + } +} + +void ne2000_generate_maclocal(int mac) +{ + maclocal[0] = 0x00; /* 00:00:1B (NE2000 ISA vendor prefix). */ + maclocal[1] = 0x00; + maclocal[2] = 0x1B; + + if (mac & 0xff000000) + { + /* Generating new MAC. */ + maclocal[3] = disc_random_generate(); + maclocal[4] = disc_random_generate(); + maclocal[5] = disc_random_generate(); + } + else + { + maclocal[3] = (mac >> 16) & 0xff; + maclocal[4] = (mac >> 8) & 0xff; + maclocal[5] = mac & 0xff; + } +} + +void ne2000_generate_maclocal_pci(int mac) +{ + maclocal_pci[0] = 0x00; /* 00:20:18 (RTL 8029AS PCI vendor prefix). */ + maclocal_pci[1] = 0x20; + maclocal_pci[2] = 0x18; + + if (mac & 0xff000000) + { + /* Generating new MAC. */ + maclocal_pci[3] = disc_random_generate(); + maclocal_pci[4] = disc_random_generate(); + maclocal_pci[5] = disc_random_generate(); + } + else + { + maclocal_pci[3] = (mac >> 16) & 0xff; + maclocal_pci[4] = (mac >> 8) & 0xff; + maclocal_pci[5] = mac & 0xff; + } +} + +int net2000_get_maclocal() +{ + int temp; + temp = (((int) maclocal[3]) << 16); + temp |= (((int) maclocal[4]) << 8); + temp |= ((int) maclocal[5]); + return temp; +} + +int net2000_get_maclocal_pci() +{ + int temp; + temp = (((int) maclocal_pci[3]) << 16); + temp |= (((int) maclocal_pci[4]) << 8); + temp |= ((int) maclocal_pci[5]); + return temp; +} + static void ne2000_setirq(ne2000_t *ne2000, int irq) { ne2000->base_irq = irq; } -// -// reset - restore state to power-up, cancelling all i/o -// +/* reset - restore state to power-up, cancelling all i/o */ + static void ne2000_reset(void *p, int reset) { ne2000_t *ne2000 = (ne2000_t *)p; @@ -263,7 +329,7 @@ static void ne2000_reset(void *p, int reset) ne2000_log("ne2000 reset\n"); - // Initialise the mac address area by doubling the physical address + /* Initialise the mac address area by doubling the physical address */ ne2000->macaddr[0] = ne2000->physaddr[0]; ne2000->macaddr[1] = ne2000->physaddr[0]; ne2000->macaddr[2] = ne2000->physaddr[1]; @@ -277,20 +343,19 @@ static void ne2000_reset(void *p, int reset) ne2000->macaddr[10] = ne2000->physaddr[5]; ne2000->macaddr[11] = ne2000->physaddr[5]; - // ne2k signature + /* ne2k signature */ for (i = 12; i < 32; i++) { ne2000->macaddr[i] = 0x57; } - // Zero out registers and memory + /* Zero out registers and memory */ memset( & ne2000->CR, 0, sizeof(ne2000->CR) ); memset( & ne2000->ISR, 0, sizeof(ne2000->ISR)); memset( & ne2000->IMR, 0, sizeof(ne2000->IMR)); memset( & ne2000->DCR, 0, sizeof(ne2000->DCR)); memset( & ne2000->TCR, 0, sizeof(ne2000->TCR)); memset( & ne2000->TSR, 0, sizeof(ne2000->TSR)); - // memset( & ne2000->RCR, 0, sizeof(ne2000->RCR)); memset( & ne2000->RSR, 0, sizeof(ne2000->RSR)); ne2000->tx_timer_active = 0; ne2000->local_dma = 0; @@ -316,7 +381,7 @@ static void ne2000_reset(void *p, int reset) memset( & ne2000->mem, 0, sizeof(ne2000->mem)); - // Set power-up conditions + /* Set power-up conditions */ ne2000->CR.stop = 1; ne2000->CR.rdma_cmd = 4; ne2000->ISR.reset = 1; @@ -327,10 +392,9 @@ static void ne2000_reset(void *p, int reset) #include "bswap.h" -// -// read_cr/write_cr - utility routines for handling reads/writes to -// the Command Register -// +/* read_cr/write_cr - utility routines for handling reads/writes to + the Command Register */ + uint32_t ne2000_read_cr(ne2000_t *ne2000) { uint32_t val; @@ -348,14 +412,14 @@ void ne2000_write_cr(ne2000_t *ne2000, uint32_t value) { ne2000_log("%s: wrote 0x%02x to CR\n", (network_card_current == 1) ? "NE2000" : "RTL8029AS", value); - // Validate remote-DMA + /* Validate remote-DMA */ if ((value & 0x38) == 0x00) { ne2000_log("CR write - invalid rDMA value 0\n"); value |= 0x20; /* dma_cmd == 4 is a safe default */ } - // Check for s/w reset + /* Check for s/w reset */ if (value & 0x01) { ne2000->ISR.reset = 1; @@ -366,8 +430,8 @@ void ne2000_write_cr(ne2000_t *ne2000, uint32_t value) ne2000->CR.rdma_cmd = (value & 0x38) >> 3; - // If start command issued, the RST bit in the ISR - // must be cleared + /* If start command issued, the RST bit in the ISR */ + /* must be cleared */ if ((value & 0x02) && !ne2000->CR.start) { ne2000->ISR.reset = 0; @@ -376,16 +440,16 @@ void ne2000_write_cr(ne2000_t *ne2000, uint32_t value) ne2000->CR.start = ((value & 0x02) == 0x02); ne2000->CR.pgsel = (value & 0xc0) >> 6; - // Check for send-packet command + /* Check for send-packet command */ if (ne2000->CR.rdma_cmd == 3) { - // Set up DMA read from receive ring + /* Set up DMA read from receive ring */ ne2000->remote_start = ne2000->remote_dma = ne2000->bound_ptr * 256; ne2000->remote_bytes = (uint16_t) ne2000_chipmem_read(ne2000, ne2000->bound_ptr * 256 + 2, 2); ne2000_log("Sending buffer #x%x length %d\n", ne2000->remote_start, ne2000->remote_bytes); } - // Check for start-tx + /* Check for start-tx */ if ((value & 0x04) && ne2000->TCR.loop_cntl) { if (ne2000->TCR.loop_cntl != 1) @@ -413,7 +477,7 @@ void ne2000_write_cr(ne2000_t *ne2000, uint32_t value) ne2000_log("CR write - tx start, tx bytes == 0\n"); } - // Send the packet to the system driver + /* Send the packet to the system driver */ ne2000->CR.tx_packet = 1; if(!net_is_pcap) { @@ -426,7 +490,7 @@ void ne2000_write_cr(ne2000_t *ne2000, uint32_t value) ne2000_log("ne2000 pcap sending packet\n"); } - // some more debug + /* some more debug */ if (ne2000->tx_timer_active) { ne2000_log("CR write, tx timer still active\n"); @@ -435,9 +499,9 @@ void ne2000_write_cr(ne2000_t *ne2000, uint32_t value) ne2000_tx_event(ne2000, value); } - // Linux probes for an interrupt by setting up a remote-DMA read - // of 0 bytes with remote-DMA completion interrupts enabled. - // Detect this here + /* Linux probes for an interrupt by setting up a remote-DMA read + of 0 bytes with remote-DMA completion interrupts enabled. + Detect this here */ if (ne2000->CR.rdma_cmd == 0x01 && ne2000->CR.start && ne2000->remote_bytes == 0) @@ -454,14 +518,13 @@ void ne2000_write_cr(ne2000_t *ne2000, uint32_t value) } } -// -// chipmem_read/chipmem_write - access the 64K private RAM. -// The ne2000 memory is accessed through the data port of -// the asic (offset 0) after setting up a remote-DMA transfer. -// Both byte and word accesses are allowed. -// The first 16 bytes contains the MAC address at even locations, -// and there is 16K of buffer memory starting at 16K -// +/* chipmem_read/chipmem_write - access the 64K private RAM. + The ne2000 memory is accessed through the data port of + the asic (offset 0) after setting up a remote-DMA transfer. + Both byte and word accesses are allowed. + The first 16 bytes contains the MAC address at even locations, + and there is 16K of buffer memory starting at 16K +*/ uint32_t ne2000_chipmem_read(ne2000_t *ne2000, uint32_t address, unsigned int io_len) { @@ -472,7 +535,7 @@ uint32_t ne2000_chipmem_read(ne2000_t *ne2000, uint32_t address, unsigned int io ne2000_log("unaligned chipmem word read\n"); } - // ROM'd MAC address + /* ROM'd MAC address */ if ((address >=0) && (address <= 31)) { retval = ne2000->macaddr[address % 32]; @@ -517,8 +580,10 @@ uint32_t ne2000_chipmem_read(ne2000_t *ne2000, uint32_t address, unsigned int io } else { - return (0xff); + return 0xff; } + + return 0xffff; } void ne2000_chipmem_write(ne2000_t *ne2000, uint32_t address, uint32_t value, unsigned io_len) @@ -547,28 +612,27 @@ void ne2000_chipmem_write(ne2000_t *ne2000, uint32_t address, uint32_t value, un } } -// -// asic_read/asic_write - This is the high 16 bytes of i/o space -// (the lower 16 bytes is for the DS8390). Only two locations -// are used: offset 0, which is used for data transfer, and -// offset 0xf, which is used to reset the device. -// The data transfer port is used to as 'external' DMA to the -// DS8390. The chip has to have the DMA registers set up, and -// after that, insw/outsw instructions can be used to move -// the appropriate number of bytes to/from the device. -// +/* asic_read/asic_write - This is the high 16 bytes of i/o space + (the lower 16 bytes is for the DS8390). Only two locations + are used: offset 0, which is used for data transfer, and + offset 0xf, which is used to reset the device. + The data transfer port is used to as 'external' DMA to the + DS8390. The chip has to have the DMA registers set up, and + after that, insw/outsw instructions can be used to move + the appropriate number of bytes to/from the device. +*/ uint32_t ne2000_asic_read(ne2000_t *ne2000, uint32_t offset, unsigned int io_len) { uint32_t retval = 0; switch (offset) { - case 0x0: // Data register - // - // A read remote-DMA command must have been issued, - // and the source-address and length registers must - // have been initialised. - // + case 0x0: /* Data register */ + + /* A read remote-DMA command must have been issued, + and the source-address and length registers must + have been initialised. */ + if (io_len > ne2000->remote_bytes) { ne2000_log("dma read underrun iolen=%d remote_bytes=%d\n",io_len,ne2000->remote_bytes); @@ -576,11 +640,11 @@ uint32_t ne2000_asic_read(ne2000_t *ne2000, uint32_t offset, unsigned int io_len ne2000_log("%s read DMA: addr=%4x remote_bytes=%d\n",(network_card_current == 1) ? "NE2000" : "RTL8029AS",ne2000->remote_dma,ne2000->remote_bytes); retval = ne2000_chipmem_read(ne2000, ne2000->remote_dma, io_len); - // - // The 8390 bumps the address and decreases the byte count - // by the selected word size after every access, not by - // the amount of data requested by the host (io_len). - // + + /* The 8390 bumps the address and decreases the byte count + by the selected word size after every access, not by + the amount of data requested by the host (io_len). */ + if (io_len == 4) { ne2000->remote_dma += io_len; @@ -595,7 +659,7 @@ uint32_t ne2000_asic_read(ne2000_t *ne2000, uint32_t offset, unsigned int io_len ne2000->remote_dma = ne2000->page_start << 8; } - // keep s.remote_bytes from underflowing + /* keep s.remote_bytes from underflowing */ if (ne2000->remote_bytes > ne2000->DCR.wdsize) { if (io_len == 4) @@ -612,7 +676,7 @@ uint32_t ne2000_asic_read(ne2000_t *ne2000, uint32_t offset, unsigned int io_len ne2000->remote_bytes = 0; } - // If all bytes have been written, signal remote-DMA complete + /* If all bytes have been written, signal remote-DMA complete */ if (ne2000->remote_bytes == 0) { ne2000->ISR.rdma_done = 1; @@ -623,7 +687,7 @@ uint32_t ne2000_asic_read(ne2000_t *ne2000, uint32_t offset, unsigned int io_len } break; - case 0xf: // Reset register + case 0xf: /* Reset register */ ne2000_reset(ne2000, BX_RESET_SOFTWARE); break; @@ -640,7 +704,7 @@ void ne2000_asic_write(ne2000_t *ne2000, uint32_t offset, uint32_t value, unsign ne2000_log("%s: asic write addr=0x%02x, value=0x%04x\n", (network_card_current == 1) ? "NE2000" : "RTL8029AS",(unsigned) offset, (unsigned) value); switch (offset) { - case 0x0: // Data register - see asic_read for a description + case 0x0: /* Data register - see asic_read for a description */ if ((io_len > 1) && (ne2000->DCR.wdsize == 0)) { ne2000_log("dma write length %d on byte mode operation\n", io_len); @@ -680,7 +744,7 @@ void ne2000_asic_write(ne2000_t *ne2000, uint32_t offset, uint32_t value, unsign ne2000->remote_bytes = 0; } - // If all bytes have been written, signal remote-DMA complete + /* If all bytes have been written, signal remote-DMA complete */ if (ne2000->remote_bytes == 0) { ne2000->ISR.rdma_done = 1; @@ -691,20 +755,19 @@ void ne2000_asic_write(ne2000_t *ne2000, uint32_t offset, uint32_t value, unsign } break; - case 0xf: // Reset register - // end of reset pulse + case 0xf: /* Reset register */ + /* end of reset pulse */ break; - default: // this is invalid, but happens under win95 device detection + default: /* this is invalid, but happens under win95 device detection */ ne2000_log("asic write invalid address %04x, ignoring\n", (unsigned) offset); break; } } -// -// page0_read/page0_write - These routines handle reads/writes to -// the 'zeroth' page of the DS8390 register file -// +/* page0_read/page0_write - These routines handle reads/writes to + the 'zeroth' page of the DS8390 register file */ + uint32_t ne2000_page0_read(ne2000_t *ne2000, uint32_t offset, unsigned int io_len) { uint8_t value = 0; @@ -717,19 +780,19 @@ uint32_t ne2000_page0_read(ne2000_t *ne2000, uint32_t offset, unsigned int io_le switch (offset) { - case 0x1: // CLDA0 + case 0x1: /* CLDA0 */ value = (ne2000->local_dma & 0xff); break; - case 0x2: // CLDA1 + case 0x2: /* CLDA1 */ value = (ne2000->local_dma >> 8); break; - case 0x3: // BNRY + case 0x3: /* BNRY */ value = ne2000->bound_ptr; break; - case 0x4: // TSR + case 0x4: /* TSR */ value = ((ne2000->TSR.ow_coll << 7) | (ne2000->TSR.cd_hbeat << 6) | (ne2000->TSR.fifo_ur << 5) | @@ -739,17 +802,17 @@ uint32_t ne2000_page0_read(ne2000_t *ne2000, uint32_t offset, unsigned int io_le (ne2000->TSR.tx_ok)); break; - case 0x5: // NCR + case 0x5: /* NCR */ value = ne2000->num_coll; break; - case 0x6: // FIFO - // reading FIFO is only valid in loopback mode + case 0x6: /* FIFO */ + /* reading FIFO is only valid in loopback mode */ ne2000_log("reading FIFO not supported yet\n"); value = ne2000->fifo; break; - case 0x7: // ISR + case 0x7: /* ISR */ value = ((ne2000->ISR.reset << 7) | (ne2000->ISR.rdma_done << 6) | (ne2000->ISR.cnt_oflow << 5) | @@ -760,15 +823,15 @@ uint32_t ne2000_page0_read(ne2000_t *ne2000, uint32_t offset, unsigned int io_le (ne2000->ISR.pkt_rx)); break; - case 0x8: // CRDA0 + case 0x8: /* CRDA0 */ value = (ne2000->remote_dma & 0xff); break; - case 0x9: // CRDA1 + case 0x9: /* CRDA1 */ value = (ne2000->remote_dma >> 8); break; - case 0xa: // reserved / RTL8029ID0 + case 0xa: /* reserved / RTL8029ID0 */ if (network_card_current == 2) { value = 0x50; @@ -780,7 +843,7 @@ uint32_t ne2000_page0_read(ne2000_t *ne2000, uint32_t offset, unsigned int io_le } break; - case 0xb: // reserved / RTL8029ID1 + case 0xb: /* reserved / RTL8029ID1 */ if (network_card_current == 2) { value = 0x43; @@ -792,7 +855,7 @@ uint32_t ne2000_page0_read(ne2000_t *ne2000, uint32_t offset, unsigned int io_le } break; - case 0xc: // RSR + case 0xc: /* RSR */ value = ((ne2000->RSR.deferred << 7) | (ne2000->RSR.rx_disabled << 6) | (ne2000->RSR.rx_mbit << 5) | @@ -803,15 +866,15 @@ uint32_t ne2000_page0_read(ne2000_t *ne2000, uint32_t offset, unsigned int io_le (ne2000->RSR.rx_ok)); break; - case 0xd: // CNTR0 + case 0xd: /* CNTR0 */ value = ne2000->tallycnt_0; break; - case 0xe: // CNTR1 + case 0xe: /* CNTR1 */ value = ne2000->tallycnt_1; break; - case 0xf: // CNTR2 + case 0xf: /* CNTR2 */ value = ne2000->tallycnt_2; break; @@ -828,9 +891,9 @@ void ne2000_page0_write(ne2000_t *ne2000, uint32_t offset, uint32_t value, unsig { uint8_t value2; - // It appears to be a common practice to use outw on page0 regs... + /* It appears to be a common practice to use outw on page0 regs... */ - // break up outw into two outb's + /* break up outw into two outb's */ if (io_len == 2) { ne2000_page0_write(ne2000, offset, (value & 0xff), 1); @@ -845,37 +908,37 @@ void ne2000_page0_write(ne2000_t *ne2000, uint32_t offset, uint32_t value, unsig switch (offset) { - case 0x1: // PSTART + case 0x1: /* PSTART */ ne2000->page_start = value; break; - case 0x2: // PSTOP + case 0x2: /* PSTOP */ ne2000->page_stop = value; break; - case 0x3: // BNRY + case 0x3: /* BNRY */ ne2000->bound_ptr = value; break; - case 0x4: // TPSR + case 0x4: /* TPSR */ ne2000->tx_page_start = value; break; - case 0x5: // TBCR0 - // Clear out low byte and re-insert + case 0x5: /* TBCR0 */ + /* Clear out low byte and re-insert */ ne2000->tx_bytes &= 0xff00; ne2000->tx_bytes |= (value & 0xff); break; - case 0x6: // TBCR1 - // Clear out high byte and re-insert + case 0x6: /* TBCR1 */ + /* Clear out high byte and re-insert */ ne2000->tx_bytes &= 0x00ff; ne2000->tx_bytes |= ((value & 0xff) << 8); break; - case 0x7: // ISR - value &= 0x7f; // clear RST bit - status-only bit - // All other values are cleared iff the ISR bit is 1 + case 0x7: /* ISR */ + value &= 0x7f; /* clear RST bit - status-only bit */ + /* All other values are cleared iff the ISR bit is 1 */ ne2000->ISR.pkt_rx &= ~((int)((value & 0x01) == 0x01)); ne2000->ISR.pkt_tx &= ~((int)((value & 0x02) == 0x02)); ne2000->ISR.rx_err &= ~((int)((value & 0x04) == 0x04)); @@ -903,40 +966,40 @@ void ne2000_page0_write(ne2000_t *ne2000, uint32_t offset, uint32_t value, unsig } break; - case 0x8: // RSAR0 - // Clear out low byte and re-insert + case 0x8: /* RSAR0 */ + /* Clear out low byte and re-insert */ ne2000->remote_start &= 0xff00; ne2000->remote_start |= (value & 0xff); ne2000->remote_dma = ne2000->remote_start; break; - case 0x9: // RSAR1 - // Clear out high byte and re-insert + case 0x9: /* RSAR1 */ + /* Clear out high byte and re-insert */ ne2000->remote_start &= 0x00ff; ne2000->remote_start |= ((value & 0xff) << 8); ne2000->remote_dma = ne2000->remote_start; break; - case 0xa: // RBCR0 - // Clear out low byte and re-insert + case 0xa: /* RBCR0 */ + /* Clear out low byte and re-insert */ ne2000->remote_bytes &= 0xff00; ne2000->remote_bytes |= (value & 0xff); break; - case 0xb: // RBCR1 - // Clear out high byte and re-insert + case 0xb: /* RBCR1 */ + /* Clear out high byte and re-insert */ ne2000->remote_bytes &= 0x00ff; ne2000->remote_bytes |= ((value & 0xff) << 8); break; - case 0xc: // RCR - // Check if the reserved bits are set + case 0xc: /* RCR */ + /* Check if the reserved bits are set */ if (value & 0xc0) { ne2000_log("RCR write, reserved bits set\n"); } - // Set all other bit-fields + /* Set all other bit-fields */ ne2000->RCR.errors_ok = ((value & 0x01) == 0x01); ne2000->RCR.runts_ok = ((value & 0x02) == 0x02); ne2000->RCR.broadcast = ((value & 0x04) == 0x04); @@ -944,21 +1007,21 @@ void ne2000_page0_write(ne2000_t *ne2000, uint32_t offset, uint32_t value, unsig ne2000->RCR.promisc = ((value & 0x10) == 0x10); ne2000->RCR.monitor = ((value & 0x20) == 0x20); - // Monitor bit is a little suspicious... + /* Monitor bit is a little suspicious... */ if (value & 0x20) { ne2000_log("RCR write, monitor bit set!\n"); } break; - case 0xd: // TCR - // Check reserved bits + case 0xd: /* TCR */ + /* Check reserved bits */ if (value & 0xe0) { ne2000_log("TCR write, reserved bits set\n"); } - // Test loop mode (not supported) + /* Test loop mode (not supported) */ if (value & 0x06) { ne2000->TCR.loop_cntl = (value & 0x6) >> 1; @@ -969,30 +1032,30 @@ void ne2000_page0_write(ne2000_t *ne2000, uint32_t offset, uint32_t value, unsig ne2000->TCR.loop_cntl = 0; } - // Inhibit-CRC not supported. + /* Inhibit-CRC not supported. */ if (value & 0x01) { ne2000_log("TCR write, inhibit-CRC not supported\n"); } - // Auto-transmit disable very suspicious + /* Auto-transmit disable very suspicious */ if (value & 0x08) { ne2000_log("TCR write, auto transmit disable not supported\n"); } - // Allow collision-offset to be set, although not used + /* Allow collision-offset to be set, although not used */ ne2000->TCR.coll_prio = ((value & 0x08) == 0x08); break; - case 0xe: // DCR - // the loopback mode is not suppported yet + case 0xe: /* DCR */ + /* the loopback mode is not suppported yet */ if (!(value & 0x08)) { ne2000_log("DCR write, loopback mode selected\n"); } - // It is questionable to set longaddr and auto_rx, since they - // aren't supported on the ne2000. Print a warning and continue + /* It is questionable to set longaddr and auto_rx, since they + aren't supported on the ne2000. Print a warning and continue */ if (value & 0x04) { ne2000_log("DCR write - LAS set ???\n"); @@ -1002,23 +1065,23 @@ void ne2000_page0_write(ne2000_t *ne2000, uint32_t offset, uint32_t value, unsig ne2000_log("DCR write - AR set ???\n"); } - // Set other values. + /* Set other values. */ ne2000->DCR.wdsize = ((value & 0x01) == 0x01); ne2000->DCR.endian = ((value & 0x02) == 0x02); - ne2000->DCR.longaddr = ((value & 0x04) == 0x04); // illegal ? + ne2000->DCR.longaddr = ((value & 0x04) == 0x04); /* illegal ? */ ne2000->DCR.loop = ((value & 0x08) == 0x08); - ne2000->DCR.auto_rx = ((value & 0x10) == 0x10); // also illegal ? + ne2000->DCR.auto_rx = ((value & 0x10) == 0x10); /* also illegal ? */ ne2000->DCR.fifo_size = (value & 0x50) >> 5; break; - case 0xf: // IMR - // Check for reserved bit + case 0xf: /* IMR */ + /* Check for reserved bit */ if (value & 0x80) { ne2000_log("IMR write, reserved bit set\n"); } - // Set other values + /* Set other values */ ne2000->IMR.rx_inte = ((value & 0x01) == 0x01); ne2000->IMR.tx_inte = ((value & 0x02) == 0x02); ne2000->IMR.rxerr_inte = ((value & 0x04) == 0x04); @@ -1049,17 +1112,16 @@ void ne2000_page0_write(ne2000_t *ne2000, uint32_t offset, uint32_t value, unsig } } -// -// page1_read/page1_write - These routines handle reads/writes to -// the first page of the DS8390 register file -// +/* page1_read/page1_write - These routines handle reads/writes to + the first page of the DS8390 register file */ + uint32_t ne2000_page1_read(ne2000_t *ne2000, uint32_t offset, unsigned int io_len) { ne2000_log("page 1 read from register 0x%02x, len=%u\n", offset, io_len); switch (offset) { - case 0x1: // PAR0-5 + case 0x1: /* PAR0-5 */ case 0x2: case 0x3: case 0x4: @@ -1067,11 +1129,11 @@ uint32_t ne2000_page1_read(ne2000_t *ne2000, uint32_t offset, unsigned int io_le case 0x6: return (ne2000->physaddr[offset - 1]); - case 0x7: // CURR + case 0x7: /* CURR */ ne2000_log("returning current page: 0x%02x\n", (ne2000->curr_page)); return (ne2000->curr_page); - case 0x8: // MAR0-7 + case 0x8: /* MAR0-7 */ case 0x9: case 0xa: case 0xb: @@ -1093,7 +1155,7 @@ void ne2000_page1_write(ne2000_t *ne2000, uint32_t offset, uint32_t value, unsig switch (offset) { - case 0x1: // PAR0-5 + case 0x1: /* PAR0-5 */ case 0x2: case 0x3: case 0x4: @@ -1106,11 +1168,11 @@ void ne2000_page1_write(ne2000_t *ne2000, uint32_t offset, uint32_t value, unsig } break; - case 0x7: // CURR + case 0x7: /* CURR */ ne2000->curr_page = value; break; - case 0x8: // MAR0-7 + case 0x8: /* MAR0-7 */ case 0x9: case 0xa: case 0xb: @@ -1127,45 +1189,44 @@ void ne2000_page1_write(ne2000_t *ne2000, uint32_t offset, uint32_t value, unsig } } -// -// page2_read/page2_write - These routines handle reads/writes to -// the second page of the DS8390 register file -// +/* page2_read/page2_write - These routines handle reads/writes to + the second page of the DS8390 register file */ + uint32_t ne2000_page2_read(ne2000_t *ne2000, uint32_t offset, unsigned int io_len) { ne2000_log("page 2 read from register 0x%02x, len=%u\n", offset, io_len); switch (offset) { - case 0x1: // PSTART + case 0x1: /* PSTART */ return (ne2000->page_start); - case 0x2: // PSTOP + case 0x2: /* PSTOP */ return (ne2000->page_stop); - case 0x3: // Remote Next-packet pointer + case 0x3: /* Remote Next-packet pointer */ return (ne2000->rempkt_ptr); - case 0x4: // TPSR + case 0x4: /* TPSR */ return (ne2000->tx_page_start); - case 0x5: // Local Next-packet pointer + case 0x5: /* Local Next-packet pointer */ return (ne2000->localpkt_ptr); - case 0x6: // Address counter (upper) + case 0x6: /* Address counter (upper) */ return (ne2000->address_cnt >> 8); - case 0x7: // Address counter (lower) + case 0x7: /* Address counter (lower) */ return (ne2000->address_cnt & 0xff); - case 0x8: // Reserved + case 0x8: /* Reserved */ case 0x9: case 0xa: case 0xb: ne2000_log("reserved read - page 2, register 0x%02x\n", offset); return (0xff); - case 0xc: // RCR + case 0xc: /* RCR */ return ((ne2000->RCR.monitor << 5) | (ne2000->RCR.promisc << 4) | (ne2000->RCR.multicast << 3) | @@ -1173,13 +1234,13 @@ uint32_t ne2000_page2_read(ne2000_t *ne2000, uint32_t offset, unsigned int io_le (ne2000->RCR.runts_ok << 1) | (ne2000->RCR.errors_ok)); - case 0xd: // TCR + case 0xd: /* TCR */ return ((ne2000->TCR.coll_prio << 4) | (ne2000->TCR.ext_stoptx << 3) | ((ne2000->TCR.loop_cntl & 0x3) << 1) | (ne2000->TCR.crc_disable)); - case 0xe: // DCR + case 0xe: /* DCR */ return (((ne2000->DCR.fifo_size & 0x3) << 5) | (ne2000->DCR.auto_rx << 4) | (ne2000->DCR.loop << 3) | @@ -1187,7 +1248,7 @@ uint32_t ne2000_page2_read(ne2000_t *ne2000, uint32_t offset, unsigned int io_le (ne2000->DCR.endian << 1) | (ne2000->DCR.wdsize)); - case 0xf: // IMR + case 0xf: /* IMR */ return ((ne2000->IMR.rdma_inte << 6) | (ne2000->IMR.cofl_inte << 5) | (ne2000->IMR.overw_inte << 4) | @@ -1206,26 +1267,26 @@ uint32_t ne2000_page2_read(ne2000_t *ne2000, uint32_t offset, unsigned int io_le void ne2000_page2_write(ne2000_t *ne2000, uint32_t offset, uint32_t value, unsigned io_len) { - // Maybe all writes here should be BX_PANIC()'d, since they - // affect internal operation, but let them through for now - // and print a warning. + /* Maybe all writes here should be BX_PANIC()'d, since they + affect internal operation, but let them through for now + and print a warning. */ ne2000_log("page 2 write to register 0x%02x, len=%u, value=0x%04x\n", offset, io_len, value); switch (offset) { - case 0x1: // CLDA0 - // Clear out low byte and re-insert + case 0x1: /* CLDA0 */ + /* Clear out low byte and re-insert */ ne2000->local_dma &= 0xff00; ne2000->local_dma |= (value & 0xff); break; - case 0x2: // CLDA1 - // Clear out high byte and re-insert + case 0x2: /* CLDA1 */ + /* Clear out high byte and re-insert */ ne2000->local_dma &= 0x00ff; ne2000->local_dma |= ((value & 0xff) << 8); break; - case 0x3: // Remote Next-pkt pointer + case 0x3: /* Remote Next-pkt pointer */ ne2000->rempkt_ptr = value; break; @@ -1233,18 +1294,18 @@ void ne2000_page2_write(ne2000_t *ne2000, uint32_t offset, uint32_t value, unsig ne2000_log("page 2 write to reserved register 0x04\n"); break; - case 0x5: // Local Next-packet pointer + case 0x5: /* Local Next-packet pointer */ ne2000->localpkt_ptr = value; break; - case 0x6: // Address counter (upper) - // Clear out high byte and re-insert + case 0x6: /* Address counter (upper) */ + /* Clear out high byte and re-insert */ ne2000->address_cnt &= 0x00ff; ne2000->address_cnt |= ((value & 0xff) << 8); break; - case 0x7: // Address counter (lower) - // Clear out low byte and re-insert + case 0x7: /* Address counter (lower) */ + /* Clear out low byte and re-insert */ ne2000->address_cnt &= 0xff00; ne2000->address_cnt |= (value & 0xff); break; @@ -1266,20 +1327,19 @@ void ne2000_page2_write(ne2000_t *ne2000, uint32_t offset, uint32_t value, unsig } } -// -// page3_read/page3_write - writes to this page are illegal -// +/* page3_read/page3_write - writes to this page are illegal */ + uint32_t ne2000_page3_read(ne2000_t *ne2000, uint32_t offset, unsigned int io_len) { if (network_card_current == 2) { switch (offset) { - case 0x3: // CONFIG0 + case 0x3: /* CONFIG0 */ return (0); - case 0x5: // CONFIG2 + case 0x5: /* CONFIG2 */ return (0x40); - case 0x6: // CONFIG3 + case 0x6: /* CONFIG3 */ return (0x40); default: ne2000_log("page 3 read register 0x%02x attempted\n", offset); @@ -1307,7 +1367,7 @@ void ne2000_tx_event(void *p, uint32_t val) ne2000->CR.tx_packet = 0; ne2000->TSR.tx_ok = 1; ne2000->ISR.pkt_tx = 1; - // Generate an interrupt if not masked + /* Generate an interrupt if not masked */ if (ne2000->IMR.tx_inte) { picint(1 << ne2000->base_irq); @@ -1315,17 +1375,17 @@ void ne2000_tx_event(void *p, uint32_t val) ne2000->tx_timer_active = 0; } -// -// read_handler/read - i/o 'catcher' function called from BOCHS -// mainline when the CPU attempts a read in the i/o space registered -// by this ne2000 instance -// +/* read_handler/read - i/o 'catcher' function called from BOCHS + mainline when the CPU attempts a read in the i/o space registered + by this ne2000 instance */ + uint32_t ne2000_read(ne2000_t *ne2000, uint32_t address, unsigned io_len) { - ne2000_log("%s: read addr %x, len %d\n", (network_card_current == 1) ? "NE2000" : "RTL8029AS", address, io_len); uint32_t retval = 0; int offset = address - ne2000->base_address; + ne2000_log("%s: read addr %x, len %d\n", (network_card_current == 1) ? "NE2000" : "RTL8029AS", address, io_len); + if (offset >= 0x10) { retval = ne2000_asic_read(ne2000, offset - 0x10, io_len); @@ -1365,15 +1425,15 @@ uint32_t ne2000_read(ne2000_t *ne2000, uint32_t address, unsigned io_len) void ne2000_write(ne2000_t *ne2000, uint32_t address, uint32_t value, unsigned io_len) { - ne2000_log("%s: write addr %x, value %x len %d\n", (network_card_current == 1) ? "NE2000" : "RTL8029AS", address, value, io_len); int offset = address - ne2000->base_address; - // - // The high 16 bytes of i/o space are for the ne2000 asic - - // the low 16 bytes are for the DS8390, with the current - // page being selected by the PS0,PS1 registers in the - // command register - // + ne2000_log("%s: write addr %x, value %x len %d\n", (network_card_current == 1) ? "NE2000" : "RTL8029AS", address, value, io_len); + + /* The high 16 bytes of i/o space are for the ne2000 asic - + the low 16 bytes are for the DS8390, with the current + page being selected by the PS0,PS1 registers in the + command register */ + if (offset >= 0x10) { ne2000_asic_write(ne2000, offset - 0x10, value, io_len); @@ -1453,7 +1513,6 @@ void ne2000_rx_frame(void *p, const void *buf, int io_len) int pages; int avail; int idx; - int wrapped; int nextpage; uint8_t pkthdr[4]; uint8_t *pktbuf = (uint8_t *) buf; @@ -1473,8 +1532,8 @@ void ne2000_rx_frame(void *p, const void *buf, int io_len) return; } - // Add the pkt header + CRC to the length, and work - // out how many 256-byte pages the frame would occupy + /* Add the pkt header + CRC to the length, and work + out how many 256-byte pages the frame would occupy */ pages = (io_len + 4 + 4 + 255)/256; if (ne2000->curr_page < ne2000->bound_ptr) @@ -1484,12 +1543,11 @@ void ne2000_rx_frame(void *p, const void *buf, int io_len) else { avail = (ne2000->page_stop - ne2000->page_start) - (ne2000->curr_page - ne2000->bound_ptr); - wrapped = 1; } - // Avoid getting into a buffer overflow condition by not attempting - // to do partial receives. The emulation to handle this condition - // seems particularly painful. + /* Avoid getting into a buffer overflow condition by not attempting + to do partial receives. The emulation to handle this condition + seems particularly painful. */ if ((avail < pages) #if BX_NE2K_NEVER_FULL_RING || (avail == pages) @@ -1505,18 +1563,18 @@ void ne2000_rx_frame(void *p, const void *buf, int io_len) ne2000_log("rejected small packet, length %d\n", io_len); return; } - // some computers don't care... + /* some computers don't care... */ if (io_len < 60) { io_len=60; } - // Do address filtering if not in promiscuous mode + /* Do address filtering if not in promiscuous mode */ if (! ne2000->RCR.promisc) { /* Received. */ mac_cmp32[0] = *(uint32_t *) (buf); - mac_cmp16[0] = *(uint16_t *) (buf+4); + mac_cmp16[0] = *(uint16_t *) (((uint8_t *) buf) + 4); /* Local. */ mac_cmp32[1] = *(uint32_t *) (bcast_addr); mac_cmp16[1] = *(uint16_t *) (bcast_addr+4); @@ -1557,19 +1615,19 @@ void ne2000_rx_frame(void *p, const void *buf, int io_len) nextpage -= ne2000->page_stop - ne2000->page_start; } - // Setup packet header - pkthdr[0] = 0; // rx status - old behavior - pkthdr[0] = 1; // Probably better to set it all the time - // rather than set it to 0, which is clearly wrong. + /* Setup packet header */ + pkthdr[0] = 0; /* rx status - old behavior + pkthdr[0] = 1; /* Probably better to set it all the time + rather than set it to 0, which is clearly wrong. */ if (pktbuf[0] & 0x01) { - pkthdr[0] |= 0x20; // rx status += multicast packet + pkthdr[0] |= 0x20; /* rx status += multicast packet */ } - pkthdr[1] = nextpage; // ptr to next packet - pkthdr[2] = (io_len + 4) & 0xff; // length-low - pkthdr[3] = (io_len + 4) >> 8; // length-hi + pkthdr[1] = nextpage; /* ptr to next packet */ + pkthdr[2] = (io_len + 4) & 0xff; /* length-low */ + pkthdr[3] = (io_len + 4) >> 8; /* length-hi */ - // copy into buffer, update curpage, and signal interrupt if config'd + /* copy into buffer, update curpage, and signal interrupt if config'd */ startptr = & ne2000->mem[ne2000->curr_page * 256 - BX_NE2K_MEMSTART]; if ((nextpage > ne2000->curr_page) || ((ne2000->curr_page + pages) == ne2000->page_stop)) { @@ -1660,7 +1718,6 @@ void ne2000_poller(void *p) uint32_t mac_cmp32[2]; uint16_t mac_cmp16[2]; - int res; if (!net_is_pcap) { while(QueuePeek(slirpq) > 0) @@ -1680,7 +1737,7 @@ void ne2000_poller(void *p) { fizz=0;slirp_tic(); } - }//end slirp + } /* end slirp */ else if (net_is_pcap && (net_pcap != NULL)) { if((ne2000->DCR.loop == 0) || (ne2000->TCR.loop_cntl != 0)) @@ -1696,11 +1753,10 @@ void ne2000_poller(void *p) mac_cmp32[0] = *(uint32_t *) (data+6); mac_cmp16[0] = *(uint16_t *) (data+10); /* Local. */ - mac_cmp32[1] = *(uint32_t *) (maclocal); - mac_cmp16[1] = *(uint16_t *) (maclocal+4); + mac_cmp32[1] = *(uint32_t *) (ne2000_mac()); + mac_cmp16[1] = *(uint16_t *) (ne2000_mac() + 4); if ((mac_cmp32[0] != mac_cmp32[1]) || (mac_cmp16[0] != mac_cmp16[1])) { - // ne2000_log("ne2000 pcap received a frame %d bytes\n",h.caplen); ne2000_rx_frame(ne2000,data,h.caplen); } } @@ -1757,9 +1813,6 @@ void ne2000_io_remove(int16_t addr, ne2000_t *ne2000) uint8_t ne2000_pci_read(int func, int addr, void *p) { - ne2000_t *ne2000 = (ne2000_t *) p; - - // ne2000_log("NE2000 PCI read %08X\n", addr); switch (addr) { case 0x00: @@ -1827,7 +1880,6 @@ void ne2000_update_bios(ne2000_t *ne2000) { int reg_bios_enable; - // reg_bios_enable = ne2000_pci_regs[0x30]; reg_bios_enable = 1; /* PCI BIOS stuff, just enable_disable. */ @@ -1940,8 +1992,7 @@ static char errbuf[32768]; void *ne2000_init() { int rc; - int config_net_type; - int net_type; + int config_net_type; int irq; int pcap_device_available = 0; int is_rtl8029as = 0; @@ -1993,7 +2044,7 @@ void *ne2000_init() ne2000_io_set(ne2000->base_address, ne2000); - memcpy(ne2000->physaddr, maclocal, 6); + memcpy(ne2000->physaddr, ne2000_mac(), 6); if (!disable_netbios) { @@ -2030,7 +2081,6 @@ void *ne2000_init() bios_addr = 0xD0000; } - // ne2000_pci_regs[0x3C] = ide_ter_enabled ? 11 : 10; ne2000_pci_regs[0x3C] = irq; pclog("RTL8029AS IRQ: %i\n", ne2000_pci_regs[0x3C]); ne2000_pci_regs[0x3D] = 1; @@ -2047,7 +2097,7 @@ void *ne2000_init() ne2000_log("ne2000 %s init 0x%X %d\tnet_is_pcap is %d\n",is_rtl8029as ? "pci" : "isa",ne2000->base_address,device_get_config_int("irq"),net_is_pcap); - //need a switch statment for more network types. + /* need a switch statment for more network types. */ if (!net_is_pcap) { initialize_slirp: @@ -2093,10 +2143,10 @@ initialize_pcap: { ne2000_log("ne2000 pcap_open_live error on %s!\n",config_get_string(NULL,"pcap_device","whatever the ethernet is")); net_is_pcap=0; - return(ne2000); // YUCK!!! + return(ne2000); /* YUCK!!! */ } - //Time to check that we are in non-blocking mode. + /* Time to check that we are in non-blocking mode. */ rc=pcap_getnonblock(net_pcap,errbuf); ne2000_log("ne2000 pcap is currently in %s mode\n",rc? "non-blocking":"blocking"); switch(rc) @@ -2105,7 +2155,7 @@ initialize_pcap: ne2000_log("ne2000 Setting interface to non-blocking mode.."); rc = pcap_setnonblock(net_pcap,1,errbuf); if (rc==0) - { // no errors! + { /* no errors! */ ne2000_log(".."); rc=pcap_getnonblock(net_pcap,errbuf); if(rc == 1) @@ -2118,7 +2168,7 @@ initialize_pcap: ne2000_log("\tunable to set pcap into non-blocking mode!\nContinuining without pcap.\n"); net_is_pcap=0; } - } // end set nonblock + } /* end set nonblock */ else { ne2000_log("There was an unexpected error of [%s]\n\nexiting.\n",errbuf);net_is_pcap=0;} @@ -2138,10 +2188,10 @@ initialize_pcap: char filter_exp[255]; ne2000_log("ne2000 Building packet filter..."); sprintf(filter_exp,"( ((ether dst ff:ff:ff:ff:ff:ff) or (ether dst %02x:%02x:%02x:%02x:%02x:%02x)) and not (ether src %02x:%02x:%02x:%02x:%02x:%02x) )", \ - maclocal[0], maclocal[1], maclocal[2], maclocal[3], maclocal[4], maclocal[5],\ - maclocal[0], maclocal[1], maclocal[2], maclocal[3], maclocal[4], maclocal[5]); + ne2000_mac()[0], ne2000_mac()[1], ne2000_mac()[2], ne2000_mac()[3], ne2000_mac()[4], ne2000_mac()[5],\ + ne2000_mac()[0], ne2000_mac()[1], ne2000_mac()[2], ne2000_mac()[3], ne2000_mac()[4], ne2000_mac()[5]); - //I'm doing a MAC level filter so TCP/IP doesn't matter. + /* I'm doing a MAC level filter so TCP/IP doesn't matter. */ if (pcap_compile(net_pcap, &fp, filter_exp, 0, 0xffffffff) == -1) { ne2000_log("\nne2000 Couldn't compile filter\n"); @@ -2152,7 +2202,7 @@ initialize_pcap: if (pcap_setfilter(net_pcap, &fp) == -1) { ne2000_log("\nError installing pcap filter.\n"); - }//end of set_filter failure + } /* end of set_filter failure */ else { ne2000_log("...!\n"); @@ -2166,7 +2216,7 @@ initialize_pcap: goto initialize_slirp; } ne2000_log("ne2000 net_is_pcap is %d and net_pcap is %x\n",net_is_pcap,net_pcap); - } // end pcap setup + } /* end pcap setup */ ne2000_log("ne2000 is_pcap %d\n", net_is_pcap); return ne2000; @@ -2196,199 +2246,120 @@ void ne2000_close(void *p) static device_config_t ne2000_config[] = { { - .name = "addr", - .description = "Address", - .type = CONFIG_BINARY, - .type = CONFIG_SELECTION, - .selection = + "addr", "Address", CONFIG_SELECTION, "", 0x300, { { - .description = "0x280", - .value = 0x280 + "0x280", 0x280 }, { - .description = "0x300", - .value = 0x300 + "0x300", 0x300 }, { - .description = "0x320", - .value = 0x320 + "0x320", 0x320 }, { - .description = "0x340", - .value = 0x340 + "0x340", 0x340 }, { - .description = "0x360", - .value = 0x360 + "0x360", 0x360 }, { - .description = "0x380", - .value = 0x380 + "0x380", 0x380 }, { - .description = "" + "" } }, - .default_int = 0x300 }, { - .name = "irq", - .description = "IRQ", - .type = CONFIG_SELECTION, - .selection = + "irq", "IRQ", CONFIG_SELECTION, "", 10, { { - .description = "IRQ 3", - .value = 3 + "IRQ 3", 3 }, { - .description = "IRQ 5", - .value = 5 + "IRQ 5", 5 }, { - .description = "IRQ 7", - .value = 7 + "IRQ 7", 7 }, { - .description = "IRQ 10", - .value = 10 + "IRQ 10", 10 }, { - .description = "IRQ 11", - .value = 11 + "IRQ 11", 11 }, { - .description = "" + "" } }, - .default_int = 10 }, { - .name = "net_type", - .description = "Network type", - .type = CONFIG_BINARY, - .type = CONFIG_SELECTION, - .selection = + "net_type", "Network type", CONFIG_SELECTION, "", 0, { { - .description = "PCap", - .value = 0 + "PCap", 0 }, { - .description = "SLiRP", - .value = 1 + "SLiRP", 1 }, { - .description = "" + "" } }, - .default_int = 0 }, { - .name = "disable_netbios", - .description = "Network bios", - .type = CONFIG_BINARY, - .type = CONFIG_SELECTION, - .selection = - { - { - .description = "Enabled", - .value = 0 - }, - { - .description = "Disabled", - .value = 1 - }, - { - .description = "" - } - }, - .default_int = 0 + "disable_netbios", "Disable network BIOS", CONFIG_BINARY, "", 0 }, { - .type = -1 + "", "", -1 } }; static device_config_t rtl8029as_config[] = { { - .name = "irq", - .description = "IRQ", - .type = CONFIG_SELECTION, - .selection = + "irq", "IRQ", CONFIG_SELECTION, "", 10, { { - .description = "IRQ 3", - .value = 3 + "IRQ 3", 3 }, { - .description = "IRQ 5", - .value = 5 + "IRQ 5", 5 }, { - .description = "IRQ 7", - .value = 7 + "IRQ 7", 7 }, { - .description = "IRQ 10", - .value = 10 + "IRQ 10", 10 }, { - .description = "IRQ 11", - .value = 11 + "IRQ 11", 11 }, { - .description = "" + "" } }, - .default_int = 10 }, { - .name = "net_type", - .description = "Network type", - .type = CONFIG_BINARY, - .type = CONFIG_SELECTION, - .selection = + "net_type", "Network type", CONFIG_SELECTION, "", 0, { { - .description = "PCap", - .value = 0 + "PCap", 0 }, { - .description = "SLiRP", - .value = 1 + "SLiRP", 1 }, { - .description = "" + "" } }, - .default_int = 0 }, { - .name = "disable_netbios", - .description = "Network bios", - .type = CONFIG_BINARY, - .type = CONFIG_SELECTION, - .selection = - { - { - .description = "Enabled", - .value = 0 - }, - { - .description = "Disabled", - .value = 1 - }, - { - .description = "" - } - }, - .default_int = 0 + "disable_netbios", "Disable network BIOS", CONFIG_BINARY, "", 0 }, { - .type = -1 + "", "", -1 } }; @@ -2418,7 +2389,7 @@ device_t rtl8029as_device = rtl8029as_config }; -//SLIRP stuff +/* SLIRP stuff */ int slirp_can_output(void) { return net_slirp_inited; @@ -2434,9 +2405,9 @@ void slirp_output (const unsigned char *pkt, int pkt_len) ne2000_log("ne2000 slirp_output %d @%d\n",pkt_len,p); } -// Instead of calling this and crashing some times -// or experencing jitter, this is called by the -// 60Hz clock which seems to do the job. +/* Instead of calling this and crashing some times + or experencing jitter, this is called by the + 60Hz clock which seems to do the job. */ void slirp_tic() { int ret2,nfds; @@ -2450,7 +2421,7 @@ void slirp_tic() FD_ZERO(&rfds); FD_ZERO(&wfds); FD_ZERO(&xfds); - timeout=slirp_select_fill(&nfds,&rfds,&wfds,&xfds); // this can crash + timeout=slirp_select_fill(&nfds,&rfds,&wfds,&xfds); /* this can crash */ if(timeout<0) { @@ -2458,13 +2429,12 @@ void slirp_tic() } tv.tv_sec=0; - tv.tv_usec = timeout; // basilisk default 10000 + tv.tv_usec = timeout; /* basilisk default 10000 */ ret2 = select(nfds + 1, &rfds, &wfds, &xfds, &tv); if(ret2>=0) { slirp_select_poll(&rfds, &wfds, &xfds); } - //ne2000_log("ne2000 slirp_tic()\n"); - } // end if slirp inited + } /* end if slirp inited */ } diff --git a/src/ne2000.h b/src/ne2000.h index 53af3f72f..218685e88 100644 --- a/src/ne2000.h +++ b/src/ne2000.h @@ -1,5 +1,10 @@ /* Copyright holders: SA1988 see COPYING for more details */ +void ne2000_generate_maclocal(int mac); +void ne2000_generate_maclocal_pci(int mac); +int net2000_get_maclocal(); +int net2000_get_maclocal_pci(); + extern device_t ne2000_device; extern device_t rtl8029as_device; diff --git a/src/nethandler.c b/src/nethandler.c index eec4934bf..c399964c6 100644 --- a/src/nethandler.c +++ b/src/nethandler.c @@ -1,8 +1,8 @@ /* Copyright holders: Sarah Walker, Tenshi see COPYING for more details */ -#include #include +#include #include #include #include @@ -31,7 +31,7 @@ static NETWORK_CARD network_cards[] = {"None", "none", NULL}, {"Novell NE2000", "ne2k", &ne2000_device}, {"Realtek RTL8029AS", "ne2kpci", &rtl8029as_device}, - {"", NULL} + {"", "", NULL} }; int network_card_available(int card) @@ -96,94 +96,28 @@ static int vlan_handlers_num; static int vlan_poller_time = 0; void vlan_handler(void (*poller)(void *p), void *p) -//void vlan_handler(int (*can_receive)(void *p), void (*receive)(void *p, const uint8_t *buf, int size), void *p) { - /* vlan_handlers[vlan_handlers_num].can_receive = can_receive; */ vlan_handlers[vlan_handlers_num].poller = poller; vlan_handlers[vlan_handlers_num].priv = p; vlan_handlers_num++; } -static thread_t *network_thread_h; -static event_t *network_event; - -static int network_thread_initialized = 0; -static int network_thread_enable = 0; - static void network_thread(void *param) { int c; - // pclog("Network thread\n"); - - // while(1) - // { - // pclog("Waiting...\n"); - // thread_wait_event(network_event, -1); - - // pclog("Processing\n"); - - for (c = 0; c < vlan_handlers_num; c++) - vlan_handlers[c].poller(vlan_handlers[c].priv); - // } -} - -void network_thread_init() -{ -#if 0 - pclog("network_thread_init()\n"); - - if (network_card_current) + for (c = 0; c < vlan_handlers_num; c++) { - pclog("Thread enabled...\n"); - - network_event = thread_create_event(); - network_thread_h = thread_create(network_thread, NULL); + vlan_handlers[c].poller(vlan_handlers[c].priv); } - - network_thread_enable = network_card_current ? 1 : 0; - network_thread_initialized = 1; -#endif -} - -void network_thread_reset() -{ -#if 0 - if(!network_thread_initialized) - { - network_thread_init(); - return; - } - - pclog("network_thread_reset()\n"); - if (network_card_current && !network_thread_enable) - { - pclog("Thread enabled (disabled before...\n"); - network_event = thread_create_event(); - network_thread_h = thread_create(network_thread, NULL); - } - else if (!network_card_current && network_thread_enable) - { - pclog("Thread disabled (enabled before...\n"); - thread_destroy_event(network_event); - thread_kill(network_thread_h); - network_thread_h = NULL; - } - - network_thread_enable = network_card_current ? 1 : 0; -#endif } void vlan_poller(void *priv) { - int c; - vlan_poller_time += (int)((double)TIMER_USEC * (1000000.0 / 8.0 / 3000.0)); - if (/*network_thread_enable && */ vlan_handlers_num) + if (vlan_handlers_num) { - // pclog("Setting thread event...\n"); - // thread_set_event(network_event); network_thread(priv); } } diff --git a/src/nethandler.h b/src/nethandler.h index 477ecbd81..623dec93b 100644 --- a/src/nethandler.h +++ b/src/nethandler.h @@ -3,7 +3,6 @@ */ #include -//void vlan_handler(int (*can_receive)(void *p), void (*receive)(void *p, const uint8_t *buf, int size), void *p); void vlan_handler(void (*poller)(void *p), void *p); extern int network_card_current; @@ -15,6 +14,7 @@ int network_card_has_config(int card); char *network_card_get_internal_name(int card); int network_card_get_from_internal_name(char *s); void network_card_init(); +void vlan_reset(); void initpcap(); void closepcap(); diff --git a/src/nmi.c b/src/nmi.c index 0e7abdc04..a6ca4480e 100644 --- a/src/nmi.c +++ b/src/nmi.c @@ -2,6 +2,7 @@ see COPYING for more details */ #include "ibm.h" +#include "io.h" #include "nmi.h" int nmi_mask; diff --git a/src/nvr.c b/src/nvr.c index 4fea45468..76c42e7d0 100644 --- a/src/nvr.c +++ b/src/nvr.c @@ -8,7 +8,7 @@ int oldromset; int nvrmask=63; -uint8_t nvrram[128]; +char nvrram[128]; int nvraddr; int nvr_dosave = 0; @@ -41,14 +41,12 @@ void nvr_rtc(void *p) } c = 1 << ((nvrram[RTC_REGA] & RTC_RS) - 1); rtctime += (int)(RTCCONST * c * (1 << TIMER_SHIFT)); -// pclog("RTCtime now %f\n",rtctime); nvrram[RTC_REGC] |= RTC_PF; if (nvrram[RTC_REGB] & RTC_PIE) { nvrram[RTC_REGC] |= RTC_IRQF; if (AMSTRAD) picint(2); else picint(0x100); -// pclog("RTC int\n"); } } @@ -91,8 +89,6 @@ void nvr_update_end(void *p) else picint(0x100); } } - -// pclog("RTC onesec\n"); nvr_update_end_count = 0; } @@ -117,12 +113,10 @@ void nvr_onesec(void *p) void writenvr(uint16_t addr, uint8_t val, void *priv) { int c, old; -// printf("Write NVR %03X %02X %02X %04X:%04X %i\n",addr,nvraddr,val,cs>>4,pc,ins); if (addr&1) { if (nvraddr==RTC_REGC || nvraddr==RTC_REGD) return; /* Registers C and D are read-only. There's no reason to continue. */ -// if (nvraddr == 0x33) pclog("NVRWRITE33 %02X %04X:%04X %i\n",val,CS,pc,ins); if (nvraddr > RTC_REGD && nvrram[nvraddr] != val) nvr_dosave = 1; @@ -131,7 +125,6 @@ void writenvr(uint16_t addr, uint8_t val, void *priv) if (nvraddr == RTC_REGA) { -// pclog("NVR rate %i\n",val&0xF); if (val & RTC_RS) { c = 1 << ((val & RTC_RS) - 1); @@ -170,7 +163,6 @@ void writenvr(uint16_t addr, uint8_t val, void *priv) uint8_t readnvr(uint16_t addr, void *priv) { uint8_t temp; -// printf("Read NVR %03X %02X %02X %04X:%04X\n",addr,nvraddr,nvrram[nvraddr],cs>>4,pc); if (addr&1) { if (nvraddr == RTC_REGA) @@ -185,8 +177,6 @@ uint8_t readnvr(uint16_t addr, void *priv) nvrram[RTC_REGC] = 0; return temp; } -// if (AMIBIOS && nvraddr==0x36) return 0; -// if (nvraddr==0xA) nvrram[0xA]^=0x80; return nvrram[nvraddr]; } return nvraddr; @@ -210,6 +200,9 @@ void loadnvr() case ROM_IBMPS1_2121: f = romfopen(nvr_concat("ibmps1_2121.nvr"), "rb"); nvrmask = 127; break; case ROM_IBMPS1_2121_ISA: f = romfopen(nvr_concat("ibmps1_2121_isa.nvr"), "rb"); nvrmask = 127; break; case ROM_IBMPS2_M30_286: f = romfopen(nvr_concat("ibmps2_m30_286.nvr"), "rb"); nvrmask = 127; break; + case ROM_IBMPS2_M50: f = romfopen("nvr/ibmps2_m50.nvr", "rb"); break; + case ROM_IBMPS2_M55SX: f = romfopen("nvr/ibmps2_m55sx.nvr", "rb"); break; + case ROM_IBMPS2_M80: f = romfopen("nvr/ibmps2_m80.nvr", "rb"); break; case ROM_CMDPC30: f = romfopen(nvr_concat("cmdpc30.nvr"), "rb"); nvrmask = 127; break; case ROM_PORTABLEII: f = romfopen(nvr_concat("portableii.nvr"), "rb"); break; case ROM_PORTABLEIII: f = romfopen(nvr_concat("portableiii.nvr"), "rb"); break; @@ -245,6 +238,8 @@ void loadnvr() case ROM_POWERMATE_V: f = romfopen(nvr_concat("powermate_v.nvr"), "rb"); nvrmask = 127; break; #endif case ROM_P54TP4XE: f = romfopen(nvr_concat("p54tp4xe.nvr"), "rb"); nvrmask = 127; break; + case ROM_AP53: f = romfopen(nvr_concat("ap53.nvr"), "rb"); nvrmask = 127; break; + case ROM_P55T2S: f = romfopen(nvr_concat("p55t2s.nvr"), "rb"); nvrmask = 127; break; case ROM_ACERM3A: f = romfopen(nvr_concat("acerm3a.nvr"), "rb"); nvrmask = 127; break; case ROM_ACERV35N: f = romfopen(nvr_concat("acerv35n.nvr"), "rb"); nvrmask = 127; break; case ROM_P55VA: f = romfopen(nvr_concat("p55va.nvr"), "rb"); nvrmask = 127; break; @@ -260,6 +255,7 @@ void loadnvr() #if 0 case ROM_CMDPC60: f = romfopen(nvr_concat("cmdpc60.nvr"), "rb"); nvrmask = 127; break; #endif + case ROM_S1668: f = romfopen(nvr_concat("tpatx.nvr"), "rb"); nvrmask = 127; break; default: return; } if (!f) @@ -301,6 +297,9 @@ void savenvr() case ROM_IBMPS1_2121: f = romfopen(nvr_concat("ibmps1_2121.nvr"), "wb"); break; case ROM_IBMPS1_2121_ISA: f = romfopen(nvr_concat("ibmps1_2121_isa.nvr"), "wb"); break; case ROM_IBMPS2_M30_286: f = romfopen(nvr_concat("ibmps2_m30_286.nvr"), "wb"); break; + case ROM_IBMPS2_M50: f = romfopen("nvr/ibmps2_m50.nvr", "wb"); break; + case ROM_IBMPS2_M55SX: f = romfopen("nvr/ibmps2_m55sx.nvr", "wb"); break; + case ROM_IBMPS2_M80: f = romfopen("nvr/ibmps2_m80.nvr", "wb"); break; case ROM_CMDPC30: f = romfopen(nvr_concat("cmdpc30.nvr"), "wb"); break; case ROM_PORTABLEII: f = romfopen(nvr_concat("portableii.nvr"), "wb"); break; case ROM_PORTABLEIII: f = romfopen(nvr_concat("portableiii.nvr"), "wb"); break; @@ -336,6 +335,8 @@ void savenvr() case ROM_POWERMATE_V: f = romfopen(nvr_concat("powermate_v.nvr"), "wb"); break; #endif case ROM_P54TP4XE: f = romfopen(nvr_concat("p54tp4xe.nvr"), "wb"); break; + case ROM_AP53: f = romfopen(nvr_concat("ap53.nvr"), "wb"); break; + case ROM_P55T2S: f = romfopen(nvr_concat("p55t2s.nvr"), "wb"); break; case ROM_ACERM3A: f = romfopen(nvr_concat("acerm3a.nvr"), "wb"); break; case ROM_ACERV35N: f = romfopen(nvr_concat("acerv35n.nvr"), "wb"); break; case ROM_P55VA: f = romfopen(nvr_concat("p55va.nvr"), "wb"); break; @@ -351,6 +352,7 @@ void savenvr() #if 0 case ROM_CMDPC60: f = romfopen(nvr_concat("cmdpc60.nvr"), "wb"); break; #endif + case ROM_S1668: f = romfopen(nvr_concat("tpatx.nvr"), "wb"); break; default: return; } fwrite(nvrram,128,1,f); diff --git a/src/nvr.h b/src/nvr.h index a333db555..069a476a7 100644 --- a/src/nvr.h +++ b/src/nvr.h @@ -9,3 +9,7 @@ extern int nvr_dosave; void time_get(char *nvrram); +void nvr_recalc(); + +void loadnvr(); +void savenvr(); diff --git a/src/opti495.c b/src/opti495.c index c173c5be3..2567782bd 100644 --- a/src/opti495.c +++ b/src/opti495.c @@ -29,13 +29,10 @@ static void opti495_write(uint16_t addr, uint8_t val, void *p) { shadowbios = !(val & 0x80); shadowbios_write = val & 0x80; - //pclog("shadowbios %i %02x\n", shadowbios, val); if (shadowbios) mem_set_mem_state(0xf0000, 0x10000, MEM_READ_INTERNAL | MEM_WRITE_DISABLED); else mem_set_mem_state(0xf0000, 0x10000, MEM_READ_EXTERNAL | MEM_WRITE_INTERNAL); -// if (shadowbios) -// fatal("Here\n"); } } break; @@ -47,7 +44,6 @@ static uint8_t opti495_read(uint16_t addr, void *p) switch (addr) { case 0x24: - //printf("Read OPTI reg %02X\n",optireg); if (optireg>=0x20 && optireg<=0x2C) return optiregs[optireg-0x20]; break; } diff --git a/src/pc.c b/src/pc.c index 1b46fcba9..2c9f891ad 100644 --- a/src/pc.c +++ b/src/pc.c @@ -5,21 +5,28 @@ #include #include +#include "86box.h" +#include "ibm.h" +#include "device.h" + #ifndef __unix #define BITMAP WINDOWS_BITMAP #include #undef BITMAP #include "win.h" +#include "win-language.h" #endif -#include "86box.h" -#include "ibm.h" -#include "device.h" - #include "ali1429.h" #include "cdrom.h" #include "cdrom-ioctl.h" #include "disc.h" +#include "disc_86f.h" +#include "disc_fdi.h" +#include "disc_imd.h" +#include "disc_img.h" +#include "disc_random.h" +#include "disc_td0.h" #include "mem.h" #include "x86_ops.h" #include "codegen.h" @@ -32,25 +39,30 @@ #include "fdd.h" #include "gameport.h" #include "sound_gus.h" -#include "buslogic.h" +#include "ide.h" #include "cdrom.h" #include "scsi.h" -#include "ide.h" #include "keyboard.h" #include "keyboard_at.h" +#include "mem.h" #include "model.h" #include "mouse.h" +#include "ne2000.h" +#include "nethandler.h" #include "nvr.h" #include "pic.h" #include "pit.h" #include "plat-joystick.h" +#include "plat-midi.h" #include "plat-mouse.h" +#include "plat-keyboard.h" #include "serial.h" #include "sound.h" #include "sound_cms.h" #include "sound_dbopl.h" #include "sound_opl.h" #include "sound_sb.h" +#include "sound_speaker.h" #include "sound_ssi2001.h" #include "timer.h" #include "vid_voodoo.h" @@ -68,6 +80,7 @@ int path_len; int window_w, window_h, window_x, window_y, window_remember; +int dump_on_exit = 0; int start_in_fullscreen = 0; int CPUID; @@ -90,7 +103,6 @@ int atfullspeed; void saveconfig(); int infocus; int mousecapture; -// FILE *pclogf; void pclog(const char *format, ...) { #ifndef RELEASE_BUILD @@ -153,10 +165,10 @@ void fatal(const char *format, ...) { *newline = 0; } - MessageBox(ghwnd, msg, "86Box fatal error", MB_OK + MB_ICONERROR); + msgbox_fatal(ghwnd, msg); #endif dumppic(); - dumpregs(); + dumpregs(1); fflush(stdout); exit(-1); } @@ -167,15 +179,12 @@ int pollmouse_delay = 2; void pollmouse() { int x, y, z; -// return; pollmouse_delay--; if (pollmouse_delay) return; pollmouse_delay = 2; mouse_poll_host(); mouse_get_mickeys(&x, &y, &z); - if (mouse_poll) - mouse_poll(x, y, z, mouse_buttons); -// if (mousecapture) position_mouse(64,64); + mouse_poll(x, y, z, mouse_buttons); } /*PC1512 languages - @@ -238,22 +247,17 @@ void pc_reset() { cpu_set(); resetx86(); - //timer_reset(); dma_reset(); fdc_reset(); pic_reset(); - pit_reset(); serial_reset(); if (AT) setpitclock(models[model].cpu[cpu_manufacturer].cpus[cpu].rspeed); else setpitclock(14318184.0); - -// sb_reset(); ali1429_reset(); -// video_init(); } #undef printf void initpc(int argc, char *argv[]) @@ -262,7 +266,6 @@ void initpc(int argc, char *argv[]) char *config_file = NULL; int c, i; FILE *ff; -// allegro_init(); get_executable_name(pcempath,511); pclog("executable_name = %s\n", pcempath); p=get_filename(pcempath); @@ -275,13 +278,10 @@ void initpc(int argc, char *argv[]) { printf("PCem command line options :\n\n"); printf("--config file.cfg - use given config file as initial configuration\n"); + printf("--dump - always dump memory on exit\n"); printf("--fullscreen - start in fullscreen mode\n"); exit(-1); } - else if (!strcasecmp(argv[c], "--fullscreen")) - { - start_in_fullscreen = 1; - } else if (!strcasecmp(argv[c], "--config")) { if ((c+1) == argc) @@ -289,6 +289,21 @@ void initpc(int argc, char *argv[]) config_file = argv[c+1]; c++; } + else if (!strcasecmp(argv[c], "--dump")) + { + dump_on_exit = 1; + } + else if (!strcasecmp(argv[c], "--fullscreen")) + { + start_in_fullscreen = 1; + } + else if (!strcasecmp(argv[c], "--test")) + { + /* some (undocumented) test function here.. */ + + /* .. and then exit. */ + exit(0); + } } keyboard_init(); @@ -303,6 +318,8 @@ void initpc(int argc, char *argv[]) { append_filename(config_file_default, pcempath, config_file, 511); } + + disc_random_init(); loadconfig(config_file); pclog("Config loaded\n"); @@ -312,7 +329,6 @@ void initpc(int argc, char *argv[]) joystick_init(); cpuspeed2=(AT)?2:1; -// cpuspeed2=cpuspeed; atfullspeed=0; initvideo(); @@ -369,44 +385,24 @@ void initpc(int argc, char *argv[]) td0_init(); imd_init(); -#if 0 - if (network_card_current != 0) - { - vlan_reset(); //NETWORK - } - network_card_init(network_card_current); - network_thread_init(); -#endif - disc_load(0, discfns[0]); disc_load(1, discfns[1]); disc_load(2, discfns[2]); disc_load(3, discfns[3]); - //loadfont(); loadnvr(); sound_init(); resetide(); - if (buslogic_enabled) - { - device_add(&BuslogicDevice); - } + scsi_card_init(); - pit_reset(); -/* if (romset==ROM_AMI386 || romset==ROM_AMI486) */fullspeed(); + fullspeed(); ali1429_reset(); -// CPUID=(is486 && (cpuspeed==7 || cpuspeed>=9)); -// pclog("Init - CPUID %i %i\n",CPUID,cpuspeed); shadowbios=0; for (i = 0; i < CDROM_NUM; i++) { - if (cdrom_drives[i].host_drive == 0) - { - cdrom_null_reset(i); - } - else + if (cdrom_drives[i].host_drive != 0) { if (cdrom_drives[i].host_drive == 200) { @@ -423,9 +419,6 @@ void initpc(int argc, char *argv[]) void resetpc() { pc_reset(); -// cpuspeed2=(AT)?2:1; -// atfullspeed=0; -///* if (romset==ROM_AMI386 || romset==ROM_AMI486) */fullspeed(); shadowbios=0; } @@ -477,7 +470,6 @@ void resetpchard() model_init(); mouse_emu_init(); - // mem_add_bios(); video_init(); speaker_init(); @@ -496,10 +488,9 @@ void resetpchard() if (network_card_current != 0) { - vlan_reset(); //NETWORK + vlan_reset(); /* NETWORK */ } network_card_init(network_card_current); - network_thread_reset(); for (i = 0; i < CDROM_NUM; i++) { @@ -510,10 +501,7 @@ void resetpchard() } resetide(); - if (buslogic_enabled) - { - device_add(&BuslogicDevice); - } + scsi_card_init(); sound_card_init(sound_card_current); if (GUS) @@ -529,10 +517,6 @@ void resetpchard() loadnvr(); -// cpuspeed2 = (AT)?2:1; -// atfullspeed = 0; -// setpitclock(models[model].cpu[cpu_manufacturer].cpus[cpu].rspeed); - shadowbios = 0; ali1429_reset(); @@ -540,15 +524,9 @@ void resetpchard() cpu_cache_int_enabled = cpu_cache_ext_enabled = 0; -// output=3; - for (i = 0; i < CDROM_NUM; i++) { - if (cdrom_drives[i].host_drive == 0) - { - cdrom_null_reset(i); - } - else + if (cdrom_drives[i].host_drive != 0) { if (cdrom_drives[i].host_drive == 200) { @@ -597,22 +575,24 @@ void runpc() exec386(models[model].cpu[cpu_manufacturer].cpus[cpu].rspeed / 100); } else if (AT) + { exec386(models[model].cpu[cpu_manufacturer].cpus[cpu].rspeed / 100); + } else + { execx86(models[model].cpu[cpu_manufacturer].cpus[cpu].rspeed / 100); + } keyboard_poll_host(); keyboard_process(); -// checkkeys(); pollmouse(); if (joystick_type != 7) joystick_poll(); - endblit(); + endblit(); framecountx++; framecount++; if (framecountx>=100) { - // pclog("onesec\n"); framecountx=0; mips=(float)insc/1000000.0f; insc=0; @@ -673,8 +653,6 @@ void fullspeed() setpitclock(models[model].cpu[cpu_manufacturer].cpus[cpu].rspeed); else setpitclock(14318184.0); -// if (is386) setpitclock(clocks[2][cpuspeed2][0]); -// else setpitclock(clocks[AT?1:0][cpuspeed2][0]); } atfullspeed=1; nvr_recalc(); @@ -696,16 +674,12 @@ void closepc() { cdrom_drives[i].handler->exit(i); } -// ioctl_close(); dumppic(); -// output=7; -// setpitclock(clocks[0][0][0]); -// while (1) runpc(); disc_close(0); disc_close(1); disc_close(2); disc_close(3); - dumpregs(); + dumpregs(0); closevideo(); device_close_all(); midi_close(); @@ -729,6 +703,7 @@ void loadconfig(char *fn) int c, d; char s[512]; char *p; + char temps[512]; if (!fn) config_load(config_file_default); @@ -739,9 +714,15 @@ void loadconfig(char *fn) GUS = config_get_int(NULL, "gus", 0); SSI2001 = config_get_int(NULL, "ssi2001", 0); voodoo_enabled = config_get_int(NULL, "voodoo", 0); - buslogic_enabled = config_get_int(NULL, "buslogic", 0); - //network + /* SCSI */ + p = (char *)config_get_string(NULL, "scsicard", ""); + if (p) + scsi_card_current = scsi_card_get_from_internal_name(p); + else + scsi_card_current = 0; + + /* network */ ethif = config_get_int(NULL, "netinterface", 1); if (ethif >= inum) inum = ethif + 1; @@ -750,6 +731,8 @@ void loadconfig(char *fn) network_card_current = network_card_get_from_internal_name(p); else network_card_current = 0; + ne2000_generate_maclocal(config_get_int(NULL, "maclocal", -1)); + ne2000_generate_maclocal_pci(config_get_int(NULL, "maclocal_pci", -1)); p = (char *)config_get_string(NULL, "model", ""); if (p) @@ -778,29 +761,22 @@ void loadconfig(char *fn) sound_card_current = sound_card_get_from_internal_name(p); else sound_card_current = 0; + + mem_size = config_get_int(NULL, "mem_size", 4096); + if (mem_size < ((models[model].flags & MODEL_AT) ? models[model].min_ram*1024 : models[model].min_ram)) + mem_size = ((models[model].flags & MODEL_AT) ? models[model].min_ram*1024 : models[model].min_ram); - // d86f_unregister(0); - // d86f_unregister(1); - - p = (char *)config_get_string(NULL, "disc_a", ""); - if (p) strcpy(discfns[0], p); - else strcpy(discfns[0], ""); - ui_writeprot[0] = config_get_int(NULL, "disc_a_writeprot", 0); - - p = (char *)config_get_string(NULL, "disc_b", ""); - if (p) strcpy(discfns[1], p); - else strcpy(discfns[1], ""); - ui_writeprot[1] = config_get_int(NULL, "disc_b_writeprot", 0); - - p = (char *)config_get_string(NULL, "disc_3", ""); - if (p) strcpy(discfns[2], p); - else strcpy(discfns[2], ""); - ui_writeprot[2] = config_get_int(NULL, "disc_3_writeprot", 0); - - p = (char *)config_get_string(NULL, "disc_4", ""); - if (p) strcpy(discfns[3], p); - else strcpy(discfns[3], ""); - ui_writeprot[3] = config_get_int(NULL, "disc_4_writeprot", 0); + for (c = 0; c < FDD_NUM; c++) + { + sprintf(temps, "fdd_%02i_type", c + 1); + fdd_set_type(c, config_get_int(NULL, temps, (c < 2) ? 2 : 0)); + sprintf(temps, "fdd_%02i_fn", c + 1); + p = (char *)config_get_string(NULL, temps, ""); + if (p) strcpy(discfns[c], p); + else strcpy(discfns[c], ""); + sprintf(temps, "fdd_%02i_writeprot", c + 1); + ui_writeprot[c] = config_get_int(NULL, temps, 0); + } p = (char *)config_get_string(NULL, "hdd_controller", ""); if (p) @@ -808,130 +784,72 @@ void loadconfig(char *fn) else strncpy(hdd_controller_name, "none", sizeof(hdd_controller_name)-1); - mem_size = config_get_int(NULL, "mem_size", 4096); - if (mem_size < ((models[model].flags & MODEL_AT) ? models[model].min_ram*1024 : models[model].min_ram)) - mem_size = ((models[model].flags & MODEL_AT) ? models[model].min_ram*1024 : models[model].min_ram); + memset(temps, 0, 512); + for (c = 2; c < 4; c++) + { + sprintf(temps, "ide_%02i_enable", c + 1); + ide_enable[c] = config_get_int(NULL, temps, 0); + sprintf(temps, "ide_%02i_irq", c + 1); + ide_irq[c] = config_get_int(NULL, temps, 8 + c); + } - cdrom_drives[0].host_drive = config_get_int(NULL, "cdrom_1_host_drive", 0); - cdrom_drives[0].prev_host_drive = cdrom_drives[0].host_drive; - cdrom_drives[0].enabled = config_get_int(NULL, "cdrom_1_enabled", 0); - cdrom_drives[0].sound_on = config_get_int(NULL, "cdrom_1_sound_on", 1); - cdrom_drives[0].bus_type = config_get_int(NULL, "cdrom_1_bus_type", 0); - cdrom_drives[0].atapi_dma = config_get_int(NULL, "cdrom_1_atapi_dma", 1); - cdrom_drives[0].ide_channel = config_get_int(NULL, "cdrom_1_ide_channel", 2); - cdrom_drives[0].scsi_device_id = config_get_int(NULL, "cdrom_1_scsi_device_id", 2); - cdrom_drives[0].scsi_device_lun = config_get_int(NULL, "cdrom_1_scsi_device_lun", 0); + memset(temps, 0, 512); + for (c = 0; c < HDC_NUM; c++) + { + sprintf(temps, "hdd_%02i_sectors", c + 1); + hdc[c].spt = config_get_int(NULL, temps, 0); + sprintf(temps, "hdd_%02i_heads", c + 1); + hdc[c].hpc = config_get_int(NULL, temps, 0); + sprintf(temps, "hdd_%02i_cylinders", c + 1); + hdc[c].tracks = config_get_int(NULL, temps, 0); + sprintf(temps, "hdd_%02i_bus_type", c + 1); + hdc[c].bus = config_get_int(NULL, temps, 0); + sprintf(temps, "hdd_%02i_mfm_channel", c + 1); + hdc[c].mfm_channel = config_get_int(NULL, temps, 0); + sprintf(temps, "hdd_%02i_ide_channel", c + 1); + hdc[c].ide_channel = config_get_int(NULL, temps, 0); + sprintf(temps, "hdd_%02i_scsi_device_id", c + 1); + hdc[c].scsi_id = config_get_int(NULL, temps, (c < 7) ? c : ((c < 15) ? (c + 1) : 15)); + sprintf(temps, "hdd_%02i_scsi_device_lun", c + 1); + hdc[c].scsi_lun = config_get_int(NULL, temps, 0); + sprintf(temps, "hdd_%02i_fn", c + 1); + p = (char *)config_get_string(NULL, temps, ""); + if (p) strcpy(hdd_fn[c], p); + else strcpy(hdd_fn[c], ""); + } - p = (char *)config_get_string(NULL, "cdrom_1_iso_path", ""); - if (p) strcpy(cdrom_iso[0].iso_path, p); - else strcpy(cdrom_iso[0].iso_path, ""); + memset(temps, 0, 512); + for (c = 0; c < CDROM_NUM; c++) + { + sprintf(temps, "cdrom_%02i_host_drive", c + 1); + cdrom_drives[c].host_drive = config_get_int(NULL, temps, 0); + cdrom_drives[c].prev_host_drive = cdrom_drives[c].host_drive; + sprintf(temps, "cdrom_%02i_enabled", c + 1); + cdrom_drives[c].enabled = config_get_int(NULL, temps, 0); + sprintf(temps, "cdrom_%02i_sound_on", c + 1); + cdrom_drives[c].sound_on = config_get_int(NULL, temps, 1); + sprintf(temps, "cdrom_%02i_bus_type", c + 1); + cdrom_drives[c].bus_type = config_get_int(NULL, temps, 0); + sprintf(temps, "cdrom_%02i_atapi_dma", c + 1); + cdrom_drives[c].atapi_dma = config_get_int(NULL, temps, 0); + sprintf(temps, "cdrom_%02i_ide_channel", c + 1); + cdrom_drives[c].ide_channel = config_get_int(NULL, temps, 2); + sprintf(temps, "cdrom_%02i_scsi_device_id", c + 1); + cdrom_drives[c].scsi_device_id = config_get_int(NULL, temps, c + 2); + sprintf(temps, "cdrom_%02i_scsi_device_lun", c + 1); + cdrom_drives[c].scsi_device_lun = config_get_int(NULL, temps, 0); - cdrom_drives[1].host_drive = config_get_int(NULL, "cdrom_2_host_drive", 0); - cdrom_drives[1].prev_host_drive = cdrom_drives[1].host_drive; - cdrom_drives[1].enabled = config_get_int(NULL, "cdrom_2_enabled", 0); - cdrom_drives[1].sound_on = config_get_int(NULL, "cdrom_2_sound_on", 1); - cdrom_drives[1].bus_type = config_get_int(NULL, "cdrom_2_bus_type", 0); - cdrom_drives[1].atapi_dma = config_get_int(NULL, "cdrom_2_atapi_dma", 1); - cdrom_drives[1].ide_channel = config_get_int(NULL, "cdrom_2_ide_channel", 3); - cdrom_drives[1].scsi_device_id = config_get_int(NULL, "cdrom_2_scsi_device_id", 3); - cdrom_drives[1].scsi_device_lun = config_get_int(NULL, "cdrom_2_scsi_device_lun", 0); - - p = (char *)config_get_string(NULL, "cdrom_2_iso_path", ""); - if (p) strcpy(cdrom_iso[1].iso_path, p); - else strcpy(cdrom_iso[1].iso_path, ""); - - cdrom_drives[2].host_drive = config_get_int(NULL, "cdrom_3_host_drive", 0); - cdrom_drives[2].prev_host_drive = cdrom_drives[2].host_drive; - cdrom_drives[2].enabled = config_get_int(NULL, "cdrom_3_enabled", 0); - cdrom_drives[2].sound_on = config_get_int(NULL, "cdrom_3_sound_on", 1); - cdrom_drives[2].bus_type = config_get_int(NULL, "cdrom_3_bus_type", 0); - cdrom_drives[2].atapi_dma = config_get_int(NULL, "cdrom_3_atapi_dma", 1); - cdrom_drives[2].ide_channel = config_get_int(NULL, "cdrom_3_ide_channel", 4); - cdrom_drives[2].scsi_device_id = config_get_int(NULL, "cdrom_3_scsi_device_id", 4); - cdrom_drives[2].scsi_device_lun = config_get_int(NULL, "cdrom_3_scsi_device_lun", 0); - - p = (char *)config_get_string(NULL, "cdrom_3_iso_path", ""); - if (p) strcpy(cdrom_iso[2].iso_path, p); - else strcpy(cdrom_iso[2].iso_path, ""); - - cdrom_drives[3].host_drive = config_get_int(NULL, "cdrom_4_host_drive", 0); - cdrom_drives[3].prev_host_drive = cdrom_drives[3].host_drive; - cdrom_drives[3].enabled = config_get_int(NULL, "cdrom_4_enabled", 0); - cdrom_drives[3].sound_on = config_get_int(NULL, "cdrom_4_sound_on", 1); - cdrom_drives[3].bus_type = config_get_int(NULL, "cdrom_4_bus_type", 0); - cdrom_drives[3].atapi_dma = config_get_int(NULL, "cdrom_4_atapi_dma", 1); - cdrom_drives[3].ide_channel = config_get_int(NULL, "cdrom_4_ide_channel", 5); - cdrom_drives[3].scsi_device_id = config_get_int(NULL, "cdrom_4_scsi_device_id", 5); - cdrom_drives[3].scsi_device_lun = config_get_int(NULL, "cdrom_4_scsi_device_lun", 0); - - p = (char *)config_get_string(NULL, "cdrom_4_iso_path", ""); - if (p) strcpy(cdrom_iso[3].iso_path, p); - else strcpy(cdrom_iso[3].iso_path, ""); + sprintf(temps, "cdrom_%02i_iso_path", c + 1); + p = (char *)config_get_string(NULL, temps, ""); + if (p) strcpy(cdrom_iso[c].iso_path, p); + else strcpy(cdrom_iso[c].iso_path, ""); + } vid_resize = config_get_int(NULL, "vid_resize", 0); vid_api = config_get_int(NULL, "vid_api", 0); video_fullscreen_scale = config_get_int(NULL, "video_fullscreen_scale", 0); video_fullscreen_first = config_get_int(NULL, "video_fullscreen_first", 1); - hdc[0].spt = config_get_int(NULL, "hdc_sectors", 0); - hdc[0].hpc = config_get_int(NULL, "hdc_heads", 0); - hdc[0].tracks = config_get_int(NULL, "hdc_cylinders", 0); - p = (char *)config_get_string(NULL, "hdc_fn", ""); - if (p) strcpy(ide_fn[0], p); - else strcpy(ide_fn[0], ""); - hdc[1].spt = config_get_int(NULL, "hdd_sectors", 0); - hdc[1].hpc = config_get_int(NULL, "hdd_heads", 0); - hdc[1].tracks = config_get_int(NULL, "hdd_cylinders", 0); - p = (char *)config_get_string(NULL, "hdd_fn", ""); - if (p) strcpy(ide_fn[1], p); - else strcpy(ide_fn[1], ""); - hdc[2].spt = config_get_int(NULL, "hde_sectors", 0); - hdc[2].hpc = config_get_int(NULL, "hde_heads", 0); - hdc[2].tracks = config_get_int(NULL, "hde_cylinders", 0); - p = (char *)config_get_string(NULL, "hde_fn", ""); - if (p) strcpy(ide_fn[2], p); - else strcpy(ide_fn[2], ""); - hdc[3].spt = config_get_int(NULL, "hdf_sectors", 0); - hdc[3].hpc = config_get_int(NULL, "hdf_heads", 0); - hdc[3].tracks = config_get_int(NULL, "hdf_cylinders", 0); - p = (char *)config_get_string(NULL, "hdf_fn", ""); - if (p) strcpy(ide_fn[3], p); - else strcpy(ide_fn[3], ""); - hdc[4].spt = config_get_int(NULL, "hdg_sectors", 0); - hdc[4].hpc = config_get_int(NULL, "hdg_heads", 0); - hdc[4].tracks = config_get_int(NULL, "hdg_cylinders", 0); - p = (char *)config_get_string(NULL, "hdg_fn", ""); - if (p) strcpy(ide_fn[4], p); - else strcpy(ide_fn[4], ""); - hdc[5].spt = config_get_int(NULL, "hdh_sectors", 0); - hdc[5].hpc = config_get_int(NULL, "hdh_heads", 0); - hdc[5].tracks = config_get_int(NULL, "hdh_cylinders", 0); - p = (char *)config_get_string(NULL, "hdh_fn", ""); - if (p) strcpy(ide_fn[5], p); - else strcpy(ide_fn[5], ""); - hdc[6].spt = config_get_int(NULL, "hdi_sectors", 0); - hdc[6].hpc = config_get_int(NULL, "hdi_heads", 0); - hdc[6].tracks = config_get_int(NULL, "hdi_cylinders", 0); - p = (char *)config_get_string(NULL, "hdi_fn", ""); - if (p) strcpy(ide_fn[6], p); - else strcpy(ide_fn[6], ""); - hdc[7].spt = config_get_int(NULL, "hdj_sectors", 0); - hdc[7].hpc = config_get_int(NULL, "hdj_heads", 0); - hdc[7].tracks = config_get_int(NULL, "hdj_cylinders", 0); - p = (char *)config_get_string(NULL, "hdj_fn", ""); - if (p) strcpy(ide_fn[7], p); - else strcpy(ide_fn[7], ""); - - ide_enable[2] = config_get_int(NULL, "ide_ter_enable", 0); - ide_irq[2] = config_get_int(NULL, "ide_ter_irq", 10); - ide_enable[3] = config_get_int(NULL, "ide_qua_enable", 0); - ide_irq[3] = config_get_int(NULL, "ide_qua_irq", 11); - - fdd_set_type(0, config_get_int(NULL, "drive_a_type", 1)); - fdd_set_type(1, config_get_int(NULL, "drive_b_type", 1)); - fdd_set_type(2, config_get_int(NULL, "drive_3_type", 1)); - fdd_set_type(3, config_get_int(NULL, "drive_4_type", 1)); - force_43 = config_get_int(NULL, "force_43", 0); scale = config_get_int(NULL, "scale", 1); enable_overscan = config_get_int(NULL, "enable_overscan", 0); @@ -947,7 +865,11 @@ void loadconfig(char *fn) window_remember = config_get_int(NULL, "window_remember", 0); joystick_type = config_get_int(NULL, "joystick_type", 0); - mouse_type = config_get_int(NULL, "mouse_type", 0); + p = (char *)config_get_string(NULL, "mouse_type", ""); + if (p) + mouse_type = mouse_get_from_internal_name(p); + else + mouse_type = 0; enable_xtide = config_get_int(NULL, "enable_xtide", 1); enable_external_fpu = config_get_int(NULL, "enable_external_fpu", 0); @@ -993,6 +915,11 @@ void loadconfig(char *fn) } path_len = strlen(nvr_path); + + serial_enabled[0] = config_get_int(NULL, "serial1_enabled", 1); + serial_enabled[1] = config_get_int(NULL, "serial2_enabled", 1); + lpt_enabled = config_get_int(NULL, "lpt_enabled", 1); + bugger_enabled = config_get_int(NULL, "bugger_enabled", 0); } char *nvr_concat(char *to_concat) @@ -1006,14 +933,19 @@ void saveconfig() { int c, d; + char temps[512]; + config_set_int(NULL, "gameblaster", GAMEBLASTER); config_set_int(NULL, "gus", GUS); config_set_int(NULL, "ssi2001", SSI2001); config_set_int(NULL, "voodoo", voodoo_enabled); - config_set_int(NULL, "buslogic", buslogic_enabled); + + config_set_string(NULL, "scsicard", scsi_card_get_internal_name(scsi_card_current)); config_set_int(NULL, "netinterface", ethif); config_set_string(NULL, "netcard", network_card_get_internal_name(network_card_current)); + config_set_int(NULL, "maclocal", net2000_get_maclocal()); + config_set_int(NULL, "maclocal_pci", net2000_get_maclocal_pci()); config_set_string(NULL, "model", model_get_internal_name()); config_set_int(NULL, "cpu_manufacturer", cpu_manufacturer); @@ -1026,109 +958,82 @@ void saveconfig() config_set_string(NULL, "sndcard", sound_card_get_internal_name(sound_card_current)); config_set_int(NULL, "cpu_speed", cpuspeed); config_set_int(NULL, "has_fpu", hasfpu); - config_set_string(NULL, "disc_a", discfns[0]); - config_set_int(NULL, "disc_a_writeprot", ui_writeprot[0]); - config_set_string(NULL, "disc_b", discfns[1]); - config_set_int(NULL, "disc_b_writeprot", ui_writeprot[1]); - config_set_string(NULL, "disc_3", discfns[2]); - config_set_int(NULL, "disc_3_writeprot", ui_writeprot[2]); - config_set_string(NULL, "disc_4", discfns[3]); - config_set_int(NULL, "disc_4_writeprot", ui_writeprot[3]); - config_set_string(NULL, "hdd_controller", hdd_controller_name); config_set_int(NULL, "mem_size", mem_size); - config_set_int(NULL, "cdrom_1_host_drive", cdrom_drives[0].host_drive); - config_set_int(NULL, "cdrom_1_enabled", cdrom_drives[0].enabled); - config_set_int(NULL, "cdrom_1_sound_on", cdrom_drives[0].sound_on); - config_set_int(NULL, "cdrom_1_bus_type", cdrom_drives[0].bus_type); - config_set_int(NULL, "cdrom_1_atapi_dma", cdrom_drives[0].atapi_dma); - config_set_int(NULL, "cdrom_1_ide_channel", cdrom_drives[0].ide_channel); - config_set_int(NULL, "cdrom_1_scsi_device_id", cdrom_drives[0].scsi_device_id); - config_set_int(NULL, "cdrom_1_scsi_device_lun", cdrom_drives[0].scsi_device_lun); + memset(temps, 0, 512); + for (c = 0; c < FDD_NUM; c++) + { + sprintf(temps, "fdd_%02i_type", c + 1); + config_set_int(NULL, temps, fdd_get_type(c)); + sprintf(temps, "fdd_%02i_fn", c + 1); + config_set_string(NULL, temps, discfns[c]); + sprintf(temps, "fdd_%02i_writeprot", c + 1); + config_set_int(NULL, temps, ui_writeprot[c]); + } - config_set_string(NULL, "cdrom_1_iso_path", cdrom_iso[0].iso_path); + config_set_string(NULL, "hdd_controller", hdd_controller_name); - config_set_int(NULL, "cdrom_2_host_drive", cdrom_drives[1].host_drive); - config_set_int(NULL, "cdrom_2_enabled", cdrom_drives[1].enabled); - config_set_int(NULL, "cdrom_2_sound_on", cdrom_drives[1].sound_on); - config_set_int(NULL, "cdrom_2_bus_type", cdrom_drives[1].bus_type); - config_set_int(NULL, "cdrom_2_ide_channel", cdrom_drives[1].ide_channel); - config_set_int(NULL, "cdrom_2_atapi_dma", cdrom_drives[1].atapi_dma); - config_set_int(NULL, "cdrom_2_scsi_device_id", cdrom_drives[1].scsi_device_id); - config_set_int(NULL, "cdrom_2_scsi_device_lun", cdrom_drives[1].scsi_device_lun); + memset(temps, 0, 512); + for (c = 2; c < 4; c++) + { + sprintf(temps, "ide_%02i_enable", c + 1); + config_set_int(NULL, temps, ide_enable[c]); + sprintf(temps, "ide_%02i_irq", c + 1); + config_set_int(NULL, temps, ide_irq[c]); + } - config_set_string(NULL, "cdrom_2_iso_path", cdrom_iso[1].iso_path); + memset(temps, 0, 512); + for (c = 0; c < HDC_NUM; c++) + { + sprintf(temps, "hdd_%02i_sectors", c + 1); + config_set_int(NULL, temps, hdc[c].spt); + sprintf(temps, "hdd_%02i_heads", c + 1); + config_set_int(NULL, temps, hdc[c].hpc); + sprintf(temps, "hdd_%02i_cylinders", c + 1); + config_set_int(NULL, temps, hdc[c].tracks); + sprintf(temps, "hdd_%02i_bus_type", c + 1); + config_set_int(NULL, temps, hdc[c].bus); + sprintf(temps, "hdd_%02i_mfm_channel", c + 1); + config_set_int(NULL, temps, hdc[c].mfm_channel); + sprintf(temps, "hdd_%02i_ide_channel", c + 1); + config_set_int(NULL, temps, hdc[c].ide_channel); + sprintf(temps, "hdd_%02i_scsi_device_id", c + 1); + config_set_int(NULL, temps, hdc[c].scsi_id); + sprintf(temps, "hdd_%02i_scsi_device_lun", c + 1); + config_set_int(NULL, temps, hdc[c].scsi_lun); + sprintf(temps, "hdd_%02i_fn", c + 1); + config_set_string(NULL, temps, hdd_fn[c]); + } - config_set_int(NULL, "cdrom_3_host_drive", cdrom_drives[2].host_drive); - config_set_int(NULL, "cdrom_3_enabled", cdrom_drives[2].enabled); - config_set_int(NULL, "cdrom_3_sound_on", cdrom_drives[2].sound_on); - config_set_int(NULL, "cdrom_3_bus_type", cdrom_drives[2].bus_type); - config_set_int(NULL, "cdrom_3_atapi_dma", cdrom_drives[2].atapi_dma); - config_set_int(NULL, "cdrom_3_ide_channel", cdrom_drives[2].ide_channel); - config_set_int(NULL, "cdrom_3_scsi_device_id", cdrom_drives[2].scsi_device_id); - config_set_int(NULL, "cdrom_3_scsi_device_lun", cdrom_drives[2].scsi_device_lun); + memset(temps, 0, 512); + for (c = 0; c < CDROM_NUM; c++) + { + sprintf(temps, "cdrom_%02i_host_drive", c + 1); + config_set_int(NULL, temps, cdrom_drives[c].host_drive); + sprintf(temps, "cdrom_%02i_enabled", c + 1); + config_set_int(NULL, temps, cdrom_drives[c].enabled); + sprintf(temps, "cdrom_%02i_sound_on", c + 1); + config_set_int(NULL, temps, cdrom_drives[c].sound_on); + sprintf(temps, "cdrom_%02i_bus_type", c + 1); + config_set_int(NULL, temps, cdrom_drives[c].bus_type); + sprintf(temps, "cdrom_%02i_atapi_dma", c + 1); + config_set_int(NULL, temps, cdrom_drives[c].atapi_dma); + sprintf(temps, "cdrom_%02i_ide_channel", c + 1); + config_set_int(NULL, temps, cdrom_drives[c].ide_channel); + sprintf(temps, "cdrom_%02i_scsi_device_id", c + 1); + config_set_int(NULL, temps, cdrom_drives[c].scsi_device_id); + sprintf(temps, "cdrom_%02i_scsi_device_lun", c + 1); + config_set_int(NULL, temps, cdrom_drives[c].scsi_device_lun); - config_set_string(NULL, "cdrom_3_iso_path", cdrom_iso[2].iso_path); - - config_set_int(NULL, "cdrom_4_host_drive", cdrom_drives[3].host_drive); - config_set_int(NULL, "cdrom_4_enabled", cdrom_drives[3].enabled); - config_set_int(NULL, "cdrom_4_sound_on", cdrom_drives[3].sound_on); - config_set_int(NULL, "cdrom_4_bus_type", cdrom_drives[3].bus_type); - config_set_int(NULL, "cdrom_4_atapi_dma", cdrom_drives[3].atapi_dma); - config_set_int(NULL, "cdrom_4_ide_channel", cdrom_drives[3].ide_channel); - config_set_int(NULL, "cdrom_4_scsi_device_id", cdrom_drives[3].scsi_device_id); - config_set_int(NULL, "cdrom_4_scsi_device_lun", cdrom_drives[3].scsi_device_lun); - - config_set_string(NULL, "cdrom_4_iso_path", cdrom_iso[3].iso_path); + sprintf(temps, "cdrom_%02i_iso_path", c + 1); + config_set_string(NULL, temps, cdrom_iso[c].iso_path); + } config_set_int(NULL, "vid_resize", vid_resize); config_set_int(NULL, "vid_api", vid_api); config_set_int(NULL, "video_fullscreen_scale", video_fullscreen_scale); config_set_int(NULL, "video_fullscreen_first", video_fullscreen_first); - - config_set_int(NULL, "hdc_sectors", hdc[0].spt); - config_set_int(NULL, "hdc_heads", hdc[0].hpc); - config_set_int(NULL, "hdc_cylinders", hdc[0].tracks); - config_set_string(NULL, "hdc_fn", ide_fn[0]); - config_set_int(NULL, "hdd_sectors", hdc[1].spt); - config_set_int(NULL, "hdd_heads", hdc[1].hpc); - config_set_int(NULL, "hdd_cylinders", hdc[1].tracks); - config_set_string(NULL, "hdd_fn", ide_fn[1]); - config_set_int(NULL, "hde_sectors", hdc[2].spt); - config_set_int(NULL, "hde_heads", hdc[2].hpc); - config_set_int(NULL, "hde_cylinders", hdc[2].tracks); - config_set_string(NULL, "hde_fn", ide_fn[2]); - config_set_int(NULL, "hdf_sectors", hdc[3].spt); - config_set_int(NULL, "hdf_heads", hdc[3].hpc); - config_set_int(NULL, "hdf_cylinders", hdc[3].tracks); - config_set_string(NULL, "hdf_fn", ide_fn[3]); - config_set_int(NULL, "hdg_sectors", hdc[4].spt); - config_set_int(NULL, "hdg_heads", hdc[4].hpc); - config_set_int(NULL, "hdg_cylinders", hdc[4].tracks); - config_set_string(NULL, "hdg_fn", ide_fn[4]); - config_set_int(NULL, "hdh_sectors", hdc[5].spt); - config_set_int(NULL, "hdh_heads", hdc[5].hpc); - config_set_int(NULL, "hdh_cylinders", hdc[5].tracks); - config_set_string(NULL, "hdh_fn", ide_fn[5]); - config_set_int(NULL, "hdi_sectors", hdc[6].spt); - config_set_int(NULL, "hdi_heads", hdc[6].hpc); - config_set_int(NULL, "hdi_cylinders", hdc[6].tracks); - config_set_string(NULL, "hdi_fn", ide_fn[6]); - config_set_int(NULL, "hdj_sectors", hdc[7].spt); - config_set_int(NULL, "hdj_heads", hdc[7].hpc); - config_set_int(NULL, "hdj_cylinders", hdc[7].tracks); - config_set_string(NULL, "hdj_fn", ide_fn[7]); - - config_set_int(NULL, "ide_ter_enable", ide_enable[2]); - config_set_int(NULL, "ide_ter_irq", ide_irq[2]); - config_set_int(NULL, "ide_qua_enable", ide_enable[3]); - config_set_int(NULL, "ide_qua_irq", ide_irq[3]); - - config_set_int(NULL, "drive_a_type", fdd_get_type(0)); - config_set_int(NULL, "drive_b_type", fdd_get_type(1)); - config_set_int(NULL, "drive_3_type", fdd_get_type(2)); - config_set_int(NULL, "drive_4_type", fdd_get_type(3)); config_set_int(NULL, "force_43", force_43); config_set_int(NULL, "scale", scale); @@ -1139,7 +1044,7 @@ void saveconfig() config_set_int(NULL, "opl3_type", opl3_type); config_set_int(NULL, "joystick_type", joystick_type); - config_set_int(NULL, "mouse_type", mouse_type); + config_set_string(NULL, "mouse_type", mouse_get_internal_name(mouse_type)); config_set_int(NULL, "enable_xtide", enable_xtide); config_set_int(NULL, "enable_external_fpu", enable_external_fpu); @@ -1178,6 +1083,11 @@ void saveconfig() config_set_int(NULL, "window_x", window_x); config_set_int(NULL, "window_y", window_y); config_set_int(NULL, "window_remember", window_remember); + + config_set_int(NULL, "serial1_enabled", serial_enabled[0]); + config_set_int(NULL, "serial2_enabled", serial_enabled[1]); + config_set_int(NULL, "lpt_enabled", lpt_enabled); + config_set_int(NULL, "bugger_enabled", bugger_enabled); config_save(config_file_default); } diff --git a/src/pc.rc b/src/pc.rc deleted file mode 100644 index bf041602e..000000000 --- a/src/pc.rc +++ /dev/null @@ -1,713 +0,0 @@ -/* Copyright holders: Sarah Walker, Tenshi - see COPYING for more details -*/ -#include -#include "resources.h" - -#ifndef UPDOWN_CLASS -#define UPDOWN_CLASS L"msctls_updown32" -#endif - -MainMenu MENU DISCARDABLE -BEGIN - POPUP "&File" - BEGIN - MENUITEM "&Hard Reset", IDM_FILE_HRESET - MENUITEM "&Ctrl+Alt+Del\tCtrl+F12",IDM_FILE_RESET_CAD - MENUITEM "E&xit", IDM_FILE_EXIT - END - POPUP "&Disc" - BEGIN - MENUITEM "Change FDD& 1...", IDM_DISC_1 - MENUITEM "Change FDD 1 (&Write-protected)...", IDM_DISC_1_WP - MENUITEM "&Eject FDD 1", IDM_EJECT_1 - MENUITEM SEPARATOR - MENUITEM "Change FDD &2...", IDM_DISC_2 - MENUITEM "Change FDD 2 (W&rite-protected)...", IDM_DISC_2_WP - MENUITEM "E&ject FDD 2", IDM_EJECT_2 - MENUITEM SEPARATOR - MENUITEM "Change FDD &3...", IDM_DISC_3 - MENUITEM "Change FDD 3 (W&rite-protected)...", IDM_DISC_3_WP - MENUITEM "E&ject FDD 3", IDM_EJECT_3 - MENUITEM SEPARATOR - MENUITEM "Change FDD &4...", IDM_DISC_4 - MENUITEM "Change FDD 4 (W&rite-protected)...", IDM_DISC_4_WP - MENUITEM "E&ject FDD 4", IDM_EJECT_4 - MENUITEM SEPARATOR - MENUITEM "&Configure hard discs...",IDM_HDCONF - POPUP "C&D-ROM 1" - BEGIN - MENUITEM "&Enabled", IDM_CDROM_1_ENABLED - MENUITEM "S&ound enabled", IDM_CDROM_1_SOUND_ON - MENUITEM SEPARATOR - MENUITEM "&SCSI", IDM_CDROM_1_SCSI - MENUITEM "Atapi &DMA enabled", IDM_CDROM_1_DMA - MENUITEM SEPARATOR - MENUITEM "E&mpty",IDM_CDROM_1_EMPTY - MENUITEM "&Reload previous disc",IDM_CDROM_1_RELOAD - MENUITEM SEPARATOR - POPUP "&IDE channel..." - BEGIN - MENUITEM "&C:",IDM_CDROM_1_C - MENUITEM "&D:",IDM_CDROM_1_D - MENUITEM "&E:",IDM_CDROM_1_E - MENUITEM "&F:",IDM_CDROM_1_F - MENUITEM "&G:",IDM_CDROM_1_G - MENUITEM "&H:",IDM_CDROM_1_H - MENUITEM "&I:",IDM_CDROM_1_I - MENUITEM "&J:",IDM_CDROM_1_J - END - MENUITEM SEPARATOR - POPUP "S&CSI ID..." - BEGIN - MENUITEM "&0",IDM_CDROM_1_0 - MENUITEM "&1",IDM_CDROM_1_1 - MENUITEM "&2",IDM_CDROM_1_2 - MENUITEM "&3",IDM_CDROM_1_3 - MENUITEM "&4",IDM_CDROM_1_4 - MENUITEM "&5",IDM_CDROM_1_5 - MENUITEM "&6",IDM_CDROM_1_6 - MENUITEM "&8",IDM_CDROM_1_8 - MENUITEM "&9",IDM_CDROM_1_9 - MENUITEM "10",IDM_CDROM_1_10 - MENUITEM "11",IDM_CDROM_1_11 - MENUITEM "12",IDM_CDROM_1_12 - MENUITEM "13",IDM_CDROM_1_13 - MENUITEM "14",IDM_CDROM_1_14 - MENUITEM "15",IDM_CDROM_1_15 - END - POPUP "SCSI &LUN..." - BEGIN - MENUITEM "&0",IDM_CDROM_1_LUN_0 - MENUITEM "&1",IDM_CDROM_1_LUN_1 - MENUITEM "&2",IDM_CDROM_1_LUN_2 - MENUITEM "&3",IDM_CDROM_1_LUN_3 - MENUITEM "&4",IDM_CDROM_1_LUN_4 - MENUITEM "&5",IDM_CDROM_1_LUN_5 - MENUITEM "&6",IDM_CDROM_1_LUN_6 - MENUITEM "&7",IDM_CDROM_1_LUN_7 - END - MENUITEM SEPARATOR - MENUITEM "&ISO...",IDM_CDROM_1_ISO - END - POPUP "CD-&ROM 2" - BEGIN - MENUITEM "&Enabled", IDM_CDROM_2_ENABLED - MENUITEM "S&ound enabled", IDM_CDROM_2_SOUND_ON - MENUITEM SEPARATOR - MENUITEM "&SCSI", IDM_CDROM_2_SCSI - MENUITEM "Atapi &DMA enabled", IDM_CDROM_2_DMA - MENUITEM SEPARATOR - MENUITEM "E&mpty",IDM_CDROM_2_EMPTY - MENUITEM "&Reload previous disc",IDM_CDROM_2_RELOAD - MENUITEM SEPARATOR - POPUP "&IDE channel..." - BEGIN - MENUITEM "&C:",IDM_CDROM_2_C - MENUITEM "&D:",IDM_CDROM_2_D - MENUITEM "&E:",IDM_CDROM_2_E - MENUITEM "&F:",IDM_CDROM_2_F - MENUITEM "&G:",IDM_CDROM_2_G - MENUITEM "&H:",IDM_CDROM_2_H - MENUITEM "&I:",IDM_CDROM_2_I - MENUITEM "&J:",IDM_CDROM_2_J - END - MENUITEM SEPARATOR - POPUP "S&CSI ID..." - BEGIN - MENUITEM "&0",IDM_CDROM_2_0 - MENUITEM "&1",IDM_CDROM_2_1 - MENUITEM "&2",IDM_CDROM_2_2 - MENUITEM "&3",IDM_CDROM_2_3 - MENUITEM "&4",IDM_CDROM_2_4 - MENUITEM "&5",IDM_CDROM_2_5 - MENUITEM "&6",IDM_CDROM_2_6 - MENUITEM "&8",IDM_CDROM_2_8 - MENUITEM "&9",IDM_CDROM_2_9 - MENUITEM "10",IDM_CDROM_2_10 - MENUITEM "11",IDM_CDROM_2_11 - MENUITEM "12",IDM_CDROM_2_12 - MENUITEM "13",IDM_CDROM_2_13 - MENUITEM "14",IDM_CDROM_2_14 - MENUITEM "15",IDM_CDROM_2_15 - END - POPUP "SCSI &LUN..." - BEGIN - MENUITEM "&0",IDM_CDROM_2_LUN_0 - MENUITEM "&1",IDM_CDROM_2_LUN_1 - MENUITEM "&2",IDM_CDROM_2_LUN_2 - MENUITEM "&3",IDM_CDROM_2_LUN_3 - MENUITEM "&4",IDM_CDROM_2_LUN_4 - MENUITEM "&5",IDM_CDROM_2_LUN_5 - MENUITEM "&6",IDM_CDROM_2_LUN_6 - MENUITEM "&7",IDM_CDROM_2_LUN_7 - END - MENUITEM SEPARATOR - MENUITEM "&ISO...",IDM_CDROM_2_ISO - END - POPUP "CD-R&OM 3" - BEGIN - MENUITEM "&Enabled", IDM_CDROM_3_ENABLED - MENUITEM "S&ound enabled", IDM_CDROM_3_SOUND_ON - MENUITEM SEPARATOR - MENUITEM "&SCSI", IDM_CDROM_3_SCSI - MENUITEM "Atapi &DMA enabled", IDM_CDROM_3_DMA - MENUITEM SEPARATOR - MENUITEM "E&mpty",IDM_CDROM_3_EMPTY - MENUITEM "&Reload previous disc",IDM_CDROM_3_RELOAD - MENUITEM SEPARATOR - POPUP "&IDE channel..." - BEGIN - MENUITEM "&C:",IDM_CDROM_3_C - MENUITEM "&D:",IDM_CDROM_3_D - MENUITEM "&E:",IDM_CDROM_3_E - MENUITEM "&F:",IDM_CDROM_3_F - MENUITEM "&G:",IDM_CDROM_3_G - MENUITEM "&H:",IDM_CDROM_3_H - MENUITEM "&I:",IDM_CDROM_3_I - MENUITEM "&J:",IDM_CDROM_3_J - END - MENUITEM SEPARATOR - POPUP "S&CSI ID..." - BEGIN - MENUITEM "&0",IDM_CDROM_3_0 - MENUITEM "&1",IDM_CDROM_3_1 - MENUITEM "&2",IDM_CDROM_3_2 - MENUITEM "&3",IDM_CDROM_3_3 - MENUITEM "&4",IDM_CDROM_3_4 - MENUITEM "&5",IDM_CDROM_3_5 - MENUITEM "&6",IDM_CDROM_3_6 - MENUITEM "&8",IDM_CDROM_3_8 - MENUITEM "&9",IDM_CDROM_3_9 - MENUITEM "10",IDM_CDROM_3_10 - MENUITEM "11",IDM_CDROM_3_11 - MENUITEM "12",IDM_CDROM_3_12 - MENUITEM "13",IDM_CDROM_3_13 - MENUITEM "14",IDM_CDROM_3_14 - MENUITEM "15",IDM_CDROM_3_15 - END - POPUP "SCSI &LUN..." - BEGIN - MENUITEM "&0",IDM_CDROM_3_LUN_0 - MENUITEM "&1",IDM_CDROM_3_LUN_1 - MENUITEM "&2",IDM_CDROM_3_LUN_2 - MENUITEM "&3",IDM_CDROM_3_LUN_3 - MENUITEM "&4",IDM_CDROM_3_LUN_4 - MENUITEM "&5",IDM_CDROM_3_LUN_5 - MENUITEM "&6",IDM_CDROM_3_LUN_6 - MENUITEM "&7",IDM_CDROM_3_LUN_7 - END - MENUITEM SEPARATOR - MENUITEM "&ISO...",IDM_CDROM_3_ISO - END - POPUP "CD-RO&M 4" - BEGIN - MENUITEM "&Enabled", IDM_CDROM_4_ENABLED - MENUITEM "S&ound enabled", IDM_CDROM_4_SOUND_ON - MENUITEM SEPARATOR - MENUITEM "&SCSI", IDM_CDROM_4_SCSI - MENUITEM "Atapi &DMA enabled", IDM_CDROM_4_DMA - MENUITEM SEPARATOR - MENUITEM "E&mpty",IDM_CDROM_4_EMPTY - MENUITEM "&Reload previous disc",IDM_CDROM_4_RELOAD - MENUITEM SEPARATOR - POPUP "&IDE channel..." - BEGIN - MENUITEM "&C:",IDM_CDROM_4_C - MENUITEM "&D:",IDM_CDROM_4_D - MENUITEM "&E:",IDM_CDROM_4_E - MENUITEM "&F:",IDM_CDROM_4_F - MENUITEM "&G:",IDM_CDROM_4_G - MENUITEM "&H:",IDM_CDROM_4_H - MENUITEM "&I:",IDM_CDROM_4_I - MENUITEM "&J:",IDM_CDROM_4_J - END - MENUITEM SEPARATOR - POPUP "S&CSI ID..." - BEGIN - MENUITEM "&0",IDM_CDROM_4_0 - MENUITEM "&1",IDM_CDROM_4_1 - MENUITEM "&2",IDM_CDROM_4_2 - MENUITEM "&3",IDM_CDROM_4_3 - MENUITEM "&4",IDM_CDROM_4_4 - MENUITEM "&5",IDM_CDROM_4_5 - MENUITEM "&6",IDM_CDROM_4_6 - MENUITEM "&8",IDM_CDROM_4_8 - MENUITEM "&9",IDM_CDROM_4_9 - MENUITEM "10",IDM_CDROM_4_10 - MENUITEM "11",IDM_CDROM_4_11 - MENUITEM "12",IDM_CDROM_4_12 - MENUITEM "13",IDM_CDROM_4_13 - MENUITEM "14",IDM_CDROM_4_14 - MENUITEM "15",IDM_CDROM_4_15 - END - POPUP "SCSI &LUN..." - BEGIN - MENUITEM "&0",IDM_CDROM_4_LUN_0 - MENUITEM "&1",IDM_CDROM_4_LUN_1 - MENUITEM "&2",IDM_CDROM_4_LUN_2 - MENUITEM "&3",IDM_CDROM_4_LUN_3 - MENUITEM "&4",IDM_CDROM_4_LUN_4 - MENUITEM "&5",IDM_CDROM_4_LUN_5 - MENUITEM "&6",IDM_CDROM_4_LUN_6 - MENUITEM "&7",IDM_CDROM_4_LUN_7 - END - MENUITEM SEPARATOR - MENUITEM "&ISO...",IDM_CDROM_4_ISO - END - POPUP "E&xtra IDE controllers" - BEGIN - POPUP "&Tertiary IDE controller" - BEGIN - MENUITEM "&Enabled",IDM_IDE_TER_ENABLED - MENUITEM SEPARATOR - MENUITEM "&9",IDM_IDE_TER_IRQ9 - MENUITEM "1&0",IDM_IDE_TER_IRQ10 - MENUITEM "1&1",IDM_IDE_TER_IRQ11 - MENUITEM "1&2",IDM_IDE_TER_IRQ12 - MENUITEM "1&4",IDM_IDE_TER_IRQ14 - MENUITEM "1&5",IDM_IDE_TER_IRQ15 - END - POPUP "&Quaternary IDE controller" - BEGIN - MENUITEM "&Enabled",IDM_IDE_QUA_ENABLED - MENUITEM SEPARATOR - MENUITEM "&9",IDM_IDE_QUA_IRQ9 - MENUITEM "1&0",IDM_IDE_QUA_IRQ10 - MENUITEM "1&1",IDM_IDE_QUA_IRQ11 - MENUITEM "1&2",IDM_IDE_QUA_IRQ12 - MENUITEM "1&4",IDM_IDE_QUA_IRQ14 - MENUITEM "1&5",IDM_IDE_QUA_IRQ15 - END - END - END - POPUP "&Settings" - BEGIN - MENUITEM "&Configure...", IDM_CONFIG - MENUITEM SEPARATOR - MENUITEM "&Load configuration...", IDM_CONFIG_LOAD - MENUITEM "&Save configuration...", IDM_CONFIG_SAVE - MENUITEM SEPARATOR - MENUITEM "Use &Nuked OPL for OPL 3...", IDM_USE_NUKEDOPL - MENUITEM SEPARATOR - POPUP "&Video" - BEGIN - MENUITEM "&Resizeable window",IDM_VID_RESIZE - MENUITEM "R&emember size && position",IDM_VID_REMEMBER - MENUITEM SEPARATOR - MENUITEM "D&isc activity flash", IDM_VID_FLASH - MENUITEM SEPARATOR - MENUITEM "&DirectDraw", IDM_VID_DDRAW - MENUITEM "Direct&3D 9", IDM_VID_D3D - MENUITEM SEPARATOR - POPUP "&Window scale factor" - BEGIN - MENUITEM "&0.5x", IDM_VID_SCALE_1X - MENUITEM "&1x", IDM_VID_SCALE_2X - MENUITEM "1.&5x", IDM_VID_SCALE_3X - MENUITEM "&2x", IDM_VID_SCALE_4X - END - MENUITEM SEPARATOR - MENUITEM "&Fullscreen", IDM_VID_FULLSCREEN - POPUP "Fullscreen &stretch mode" - BEGIN - MENUITEM "&Full screen stretch", IDM_VID_FS_FULL - MENUITEM "&4:3", IDM_VID_FS_43 - MENUITEM "&Square pixels", IDM_VID_FS_SQ - MENUITEM "&Integer scale", IDM_VID_FS_INT - END - MENUITEM "&Inverted VGA monitor", IDM_VID_INVERT - MENUITEM SEPARATOR - MENUITEM "F&orce 4:3 display ratio", IDM_VID_FORCE43 - MENUITEM "E&GA/(S)VGA overscan", IDM_VID_OVERSCAN - MENUITEM SEPARATOR - MENUITEM "Take s&creenshot\tCtrl+F11", IDM_VID_SCREENSHOT - END - MENUITEM "&Status", IDM_STATUS -#ifdef ENABLE_LOG_TOGGLES -#if defined ENABLE_BUSLOGIC_LOG || defined ENABLE_CDROM_LOG || defined ENABLE_D86F_LOG || defined ENABLE_FDC_LOG || defined ENABLE_IDE_LOG || defined ENABLE_NE2000_LOG - MENUITEM SEPARATOR -#endif -#ifdef ENABLE_BUSLOGIC_LOG - MENUITEM "Enable BusLogic logs\tCtrl+F4", IDM_LOG_BUSLOGIC -#endif -#ifdef ENABLE_CDROM_LOG - MENUITEM "Enable CD-ROM logs\tCtrl+F5", IDM_LOG_CDROM -#endif -#ifdef ENABLE_D86F_LOG - MENUITEM "Enable floppy (86F) logs\tCtrl+F6", IDM_LOG_D86F -#endif -#ifdef ENABLE_FDC_LOG - MENUITEM "Enable floppy controller logs\tCtrl+F7", IDM_LOG_FDC -#endif -#ifdef ENABLE_IDE_LOG - MENUITEM "Enable IDE logs\tCtrl+F8", IDM_LOG_IDE -#endif -#ifdef ENABLE_NE2000_LOG - MENUITEM "Enable NE2000 logs\tCtrl+F9", IDM_LOG_NE2000 -#endif -#endif -#ifdef ENABLE_LOG_BREAKPOINT - MENUITEM SEPARATOR - MENUITEM "&Log breakpoint\tCtrl+F10", IDM_LOG_BREAKPOINT -#endif - END -END - -MainAccel ACCELERATORS -BEGIN -#ifdef ENABLE_LOG_TOGGLES -#ifdef ENABLE_BUSLOGIC_LOG - VK_F4, IDM_LOG_BUSLOGIC, CONTROL, VIRTKEY -#endif -#ifdef ENABLE_CDROM_LOG - VK_F5, IDM_LOG_CDROM, CONTROL, VIRTKEY -#endif -#ifdef ENABLE_D86F_LOG - VK_F6, IDM_LOG_D86F, CONTROL, VIRTKEY -#endif -#ifdef ENABLE_FDC_LOG - VK_F7, IDM_LOG_FDC, CONTROL, VIRTKEY -#endif -#ifdef ENABLE_IDE_LOG - VK_F8, IDM_LOG_IDE, CONTROL, VIRTKEY -#endif -#ifdef ENABLE_NE2000_LOG - VK_F9, IDM_LOG_NE2000, CONTROL, VIRTKEY -#endif -#endif -#ifdef ENABLE_LOG_BREAKPOINT - VK_F10, IDM_LOG_BREAKPOINT, CONTROL, VIRTKEY -#endif - VK_F11, IDM_VID_SCREENSHOT, CONTROL, VIRTKEY - VK_F12, IDM_FILE_RESET_CAD, CONTROL, VIRTKEY -END - -ConfigureDlg DIALOGEX 0, 0, 252+40, 236+100 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Configure 86Box" -FONT 9, "Segoe UI" -BEGIN - DEFPUSHBUTTON "OK",IDOK,64,312,50,14, WS_TABSTOP - PUSHBUTTON "Cancel",IDCANCEL,128,312,50,14, WS_TABSTOP - COMBOBOX IDC_COMBO1,62,16,157,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Configure", IDC_CONFIGUREMOD, 224, 16, 40, 14, WS_TABSTOP - COMBOBOX IDC_COMBOVID,62,36,157,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Configure", IDC_CONFIGUREVID, 224, 36, 40, 14, WS_TABSTOP - COMBOBOX IDC_COMBOCPUM,62,56,57,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBO3,62,76,102,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Dynamic Recompiler",IDC_CHECKDYNAREC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,169,76,99,10 - CONTROL "Enable 287/387 FPU",IDC_CHECKFPU,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,169,96,99,10 - COMBOBOX IDC_COMBOWS, 62,96,57,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBOSPD,162,56,57,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBOSND,62,116,157,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Configure", IDC_CONFIGURESND, 224, 116, 40, 14, WS_TABSTOP - EDITTEXT IDC_MEMTEXT, 62, 136, 36, 14, ES_AUTOHSCROLL | ES_NUMBER - CONTROL "", IDC_MEMSPIN, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_SETBUDDYINT, 98, 136, 12, 14 - LTEXT "MB", IDC_TEXT_MB, 98, 136, 10, 10 - CONTROL "CMS / Game Blaster",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,212,102,10 - CONTROL "Gravis Ultrasound",IDC_CHECKGUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,228,102,10 - - CONTROL "Innovation SSI-2001",IDC_CHECKSSI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,212,102,10 - CONTROL "En. XTIDE",IDC_CHECKXTIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,224,212,40,10 - CONTROL "SCSI Controller",IDC_CHECKBUSLOGIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,228,102,10 - PUSHBUTTON "Configure", IDC_CONFIGUREBUSLOGIC, 224, 228, 40, 14, WS_TABSTOP - - CONTROL "Enable time sync",IDC_CHECKSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,244,102,10 - CONTROL "Voodoo Graphics",IDC_CHECKVOODOO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,244,102,10 - PUSHBUTTON "Configure", IDC_CONFIGUREVOODOO, 224, 244, 40, 14, WS_TABSTOP - - LTEXT "Mouse :",IDC_STATIC,15,260,40,10 - COMBOBOX IDC_COMBOMOUSE,62,260,157,120,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - - LTEXT "Joystick :",IDC_STATIC,15,280,40,10 - COMBOBOX IDC_COMBOJOY,62,280,157,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - DEFPUSHBUTTON "Joystick 1...",IDC_JOY1,16,296,50,14, WS_TABSTOP - PUSHBUTTON "Joystick 2...",IDC_JOY2,80,296,50,14, WS_TABSTOP - DEFPUSHBUTTON "Joystick 3...",IDC_JOY3,144,296,50,14, WS_TABSTOP - PUSHBUTTON "Joystick 4...",IDC_JOY4,208,296,50,14, WS_TABSTOP - - LTEXT "Machine :",IDC_STATIC,15,16,40,10 - LTEXT "Video :",IDC_STATIC,15,36,34,10 - LTEXT "CPU type :",IDC_STATIC,15,56,34,10 - LTEXT "CPU :",IDC_STATIC,15,76,34,10 - LTEXT "Waitstates :",IDC_STATIC,15,96,40,10 - LTEXT "Vid.speed:",IDC_STATIC,125,56,34,10 - LTEXT "Sound card :",IDC_STATIC,15,116,40,10 - LTEXT "Network :",IDC_STATIC,125,136,34,10 - COMBOBOX IDC_COMBONET,162,136,57,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Configure", IDC_CONFIGURENET, 224, 136, 40, 14, WS_TABSTOP - LTEXT "Memory :",IDC_STATIC,15,136,40,10 - LTEXT "HDD :",IDC_STATIC,15,156,40,10 - COMBOBOX IDC_COMBOHDD, 62,156,157,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "FDD 1 :",IDC_STATIC,15,176,40,10 - LTEXT "FDD 2 :",IDC_STATIC,125,176,40,10 - COMBOBOX IDC_COMBODR1,62,176,57,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBODR2,162,176,57,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "FDD 3 :",IDC_STATIC,15,196,40,10 - LTEXT "FDD 4 :",IDC_STATIC,125,196,40,10 - COMBOBOX IDC_COMBODR3,62,196,57,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBODR4,162,196,57,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP -END - -HdConfDlg DIALOGEX 0, 0, 270, DLG_HEIGHT - STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU - CAPTION "Configure Hard Discs" - FONT 9, "Segoe UI" - BEGIN - DEFPUSHBUTTON "OK",IDOK,31+12,CMD_BASE,50,14 - PUSHBUTTON "Cancel",IDCANCEL,101+12,CMD_BASE,50,14 - - LTEXT "C:",IDC_STATIC,7,C_BASE+2,27,10 - EDITTEXT IDC_EDIT_C_FN, 7+16, C_BASE, 120, 12, WS_DISABLED - PUSHBUTTON "...",IDC_CFILE,7 + 136, C_BASE, 16, 14 - PUSHBUTTON "New",IDC_CNEW,7 + 152, C_BASE, 24, 14 - PUSHBUTTON "Eject", IDC_EJECTC, 7 + 176, C_BASE, 24, 14 - EDITTEXT IDC_EDIT_C_SPT,15,C_BASE+16,16,12, WS_DISABLED - EDITTEXT IDC_EDIT_C_HPC,48,C_BASE+16,16,12, WS_DISABLED - EDITTEXT IDC_EDIT_C_CYL,81,C_BASE+16,28,12, WS_DISABLED - LTEXT "S:",IDC_STATIC,7,C_BASE+18,8,12 - LTEXT "H:",IDC_STATIC,40,C_BASE+18,8,12 - LTEXT "C:",IDC_STATIC,73,C_BASE+18,8,12 - LTEXT "", IDC_TEXT_C_SIZE, 118, C_BASE+18, 89, 12 - - LTEXT "D:",IDC_STATIC,7,D_BASE+2,27,10 - EDITTEXT IDC_EDIT_D_FN, 7+16, D_BASE, 120, 12, WS_DISABLED - PUSHBUTTON "...",IDC_DFILE,7 + 136, D_BASE, 16, 14 - PUSHBUTTON "New",IDC_DNEW,7 + 152, D_BASE, 24, 14 - PUSHBUTTON "Eject", IDC_EJECTD, 7 + 176, D_BASE, 24, 14 - EDITTEXT IDC_EDIT_D_SPT,15,D_BASE+16,16,12, WS_DISABLED - EDITTEXT IDC_EDIT_D_HPC,48,D_BASE+16,16,12, WS_DISABLED - EDITTEXT IDC_EDIT_D_CYL,81,D_BASE+16,28,12, WS_DISABLED - LTEXT "S:",IDC_STATIC,7,D_BASE+18,8,12 - LTEXT "H:",IDC_STATIC,40,D_BASE+18,8,12 - LTEXT "C:",IDC_STATIC,73,D_BASE+18,8,12 - LTEXT "", IDC_TEXT_D_SIZE, 118, D_BASE+18, 89, 12 - - LTEXT "E:",IDC_STATIC,7,E_BASE+2,27,10 - EDITTEXT IDC_EDIT_E_FN, 7+16, E_BASE, 120, 12, WS_DISABLED - PUSHBUTTON "...",IDC_EFILE,7 + 136, E_BASE, 16, 14 - PUSHBUTTON "New",IDC_ENEW,7 + 152, E_BASE, 24, 14 - PUSHBUTTON "Eject", IDC_EJECTE, 7 + 176, E_BASE, 24, 14 - EDITTEXT IDC_EDIT_E_SPT,15,E_BASE+16,16,12, WS_DISABLED - EDITTEXT IDC_EDIT_E_HPC,48,E_BASE+16,16,12, WS_DISABLED - EDITTEXT IDC_EDIT_E_CYL,81,E_BASE+16,28,12, WS_DISABLED - LTEXT "S:",IDC_STATIC,7,E_BASE+18,8,12 - LTEXT "H:",IDC_STATIC,40,E_BASE+18,8,12 - LTEXT "C:",IDC_STATIC,73,E_BASE+18,8,12 - LTEXT "", IDC_TEXT_E_SIZE, 118, E_BASE+18, 89, 12 - - LTEXT "F:",IDC_STATIC,7,F_BASE+2,27,10 - EDITTEXT IDC_EDIT_F_FN, 7+16, F_BASE, 120, 12, WS_DISABLED - PUSHBUTTON "...",IDC_FFILE,7 + 136, F_BASE, 16, 14 - PUSHBUTTON "New",IDC_FNEW,7 + 152, F_BASE, 24, 14 - PUSHBUTTON "Eject", IDC_EJECTF, 7 + 176, F_BASE, 24, 14 - EDITTEXT IDC_EDIT_F_SPT,15,F_BASE+16,16,12, WS_DISABLED - EDITTEXT IDC_EDIT_F_HPC,48,F_BASE+16,16,12, WS_DISABLED - EDITTEXT IDC_EDIT_F_CYL,81,F_BASE+16,28,12, WS_DISABLED - LTEXT "S:",IDC_STATIC,7,F_BASE+18,8,12 - LTEXT "H:",IDC_STATIC,40,F_BASE+18,8,12 - LTEXT "C:",IDC_STATIC,73,F_BASE+18,8,12 - LTEXT "", IDC_TEXT_F_SIZE, 118, F_BASE+18, 89, 12 - - LTEXT "G:",IDC_STATIC,7,G_BASE+2,27,10 - EDITTEXT IDC_EDIT_G_FN, 7+16, G_BASE, 120, 12, WS_DISABLED - PUSHBUTTON "...",IDC_GFILE,7 + 136, G_BASE, 16, 14 - PUSHBUTTON "New",IDC_GNEW,7 + 152, G_BASE, 24, 14 - PUSHBUTTON "Eject", IDC_EJECTG, 7 + 176, G_BASE, 24, 14 - EDITTEXT IDC_EDIT_G_SPT,15,G_BASE+16,16,12, WS_DISABLED - EDITTEXT IDC_EDIT_G_HPC,48,G_BASE+16,16,12, WS_DISABLED - EDITTEXT IDC_EDIT_G_CYL,81,G_BASE+16,28,12, WS_DISABLED - LTEXT "S:",IDC_STATIC,7,G_BASE+18,8,12 - LTEXT "H:",IDC_STATIC,40,G_BASE+18,8,12 - LTEXT "C:",IDC_STATIC,73,G_BASE+18,8,12 - LTEXT "", IDC_TEXT_G_SIZE, 118, G_BASE+18, 89, 12 - - LTEXT "H:",IDC_STATIC,7,H_BASE+2,27,10 - EDITTEXT IDC_EDIT_H_FN, 7+16, H_BASE, 120, 12, WS_DISABLED - PUSHBUTTON "...",IDC_HFILE,7 + 136, H_BASE, 16, 14 - PUSHBUTTON "New",IDC_HNEW,7 + 152, H_BASE, 24, 14 - PUSHBUTTON "Eject", IDC_EJECTH, 7 + 176, H_BASE, 24, 14 - EDITTEXT IDC_EDIT_H_SPT,15,H_BASE+16,16,12, WS_DISABLED - EDITTEXT IDC_EDIT_H_HPC,48,H_BASE+16,16,12, WS_DISABLED - EDITTEXT IDC_EDIT_H_CYL,81,H_BASE+16,28,12, WS_DISABLED - LTEXT "S:",IDC_STATIC,7,H_BASE+18,8,12 - LTEXT "H:",IDC_STATIC,40,H_BASE+18,8,12 - LTEXT "C:",IDC_STATIC,73,H_BASE+18,8,12 - LTEXT "", IDC_TEXT_H_SIZE, 118, H_BASE+18, 89, 12 - - LTEXT "I:",IDC_STATIC,7,I_BASE+2,27,10 - EDITTEXT IDC_EDIT_I_FN, 7+16, I_BASE, 120, 12, WS_DISABLED - PUSHBUTTON "...",IDC_IFILE,7 + 136, I_BASE, 16, 14 - PUSHBUTTON "New",IDC_INEW,7 + 152, I_BASE, 24, 14 - PUSHBUTTON "Eject", IDC_EJECTI, 7 + 176, I_BASE, 24, 14 - EDITTEXT IDC_EDIT_I_SPT,15,I_BASE+16,16,12, WS_DISABLED - EDITTEXT IDC_EDIT_I_HPC,48,I_BASE+16,16,12, WS_DISABLED - EDITTEXT IDC_EDIT_I_CYL,81,I_BASE+16,28,12, WS_DISABLED - LTEXT "S:",IDC_STATIC,7,I_BASE+18,8,12 - LTEXT "H:",IDC_STATIC,40,I_BASE+18,8,12 - LTEXT "C:",IDC_STATIC,73,I_BASE+18,8,12 - LTEXT "", IDC_TEXT_I_SIZE, 118, I_BASE+18, 89, 12 - - LTEXT "J:",IDC_STATIC,7,J_BASE+2,27,10 - EDITTEXT IDC_EDIT_J_FN, 7+16, J_BASE, 120, 12, WS_DISABLED - PUSHBUTTON "...",IDC_JFILE,7 + 136, J_BASE, 16, 14 - PUSHBUTTON "New",IDC_JNEW,7 + 152, J_BASE, 24, 14 - PUSHBUTTON "Eject", IDC_EJECTJ, 7 + 176, J_BASE, 24, 14 - EDITTEXT IDC_EDIT_J_SPT,15,J_BASE+16,16,12, WS_DISABLED - EDITTEXT IDC_EDIT_J_HPC,48,J_BASE+16,16,12, WS_DISABLED - EDITTEXT IDC_EDIT_J_CYL,81,J_BASE+16,28,12, WS_DISABLED - LTEXT "S:",IDC_STATIC,7,J_BASE+18,8,12 - LTEXT "H:",IDC_STATIC,40,J_BASE+18,8,12 - LTEXT "C:",IDC_STATIC,73,J_BASE+18,8,12 - LTEXT "", IDC_TEXT_J_SIZE, 118, J_BASE+18, 89, 12 - -END - -HdNewDlg DIALOGEX 0, 0, 216, 86 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "New Hard Disc" -FONT 9, "Segoe UI" -BEGIN - DEFPUSHBUTTON "OK",IDOK,31,66,50,14 - PUSHBUTTON "Cancel",IDCANCEL,101,66,50,14 - - EDITTEXT IDC_EDITC, 7, 6, 187, 12 - PUSHBUTTON "...",IDC_CFILE,7 + 187, 6, 16, 14 - - EDITTEXT IDC_EDIT1,36,22,16,12 - EDITTEXT IDC_EDIT2,94,22,16,12 - EDITTEXT IDC_EDIT3,152,22,28,12 - EDITTEXT IDC_EDIT4,36,38,28,12 - COMBOBOX IDC_COMBOHDT,117,38,93,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Sectors:",IDC_STATIC,7,23,27,10 - LTEXT "Heads:",IDC_STATIC,63,23,29,8 - LTEXT "Cylinders:",IDC_STATIC,120,23,32,12 - LTEXT "Size:",IDC_STATIC,7,39,17,8 - LTEXT "MB",IDC_STATIC,68,39,10,8 - LTEXT "Type:",IDC_STATIC,94,39,17,8 -END - -HdSizeDlg DIALOGEX 0, 0, 216, 86 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Hard disc parameters" -FONT 9, "Segoe UI" -BEGIN - DEFPUSHBUTTON "OK",IDOK,31,66,50,14 - PUSHBUTTON "Cancel",IDCANCEL,101,66,50,14 - - LTEXT "Initial settings are based on file size (header if HDI)",IDC_STATIC,7,6,200,10 - - EDITTEXT IDC_EDIT1,36,22,16,12 - EDITTEXT IDC_EDIT2,94,22,16,12 - EDITTEXT IDC_EDIT3,152,22,28,12 - EDITTEXT IDC_EDIT4,36,38,28,12 - COMBOBOX IDC_COMBOHDT,117,38,93,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Sectors:",IDC_STATIC,7,23,27,10 - LTEXT "Heads:",IDC_STATIC,63,23,29,8 - LTEXT "Cylinders:",IDC_STATIC,120,23,32,12 - LTEXT "Size:",IDC_STATIC,7,39,17,8 - LTEXT "MB",IDC_STATIC,68,39,10,8 - LTEXT "Type:",IDC_STATIC,94,39,17,8 -END - -HdConfDlgMfm DIALOGEX 0, 0, 210, 172 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Configure Hard Discs" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "OK",IDOK,31+12,152,50,14 - PUSHBUTTON "Cancel",IDCANCEL,101+12,152,50,14 - - LTEXT "C:",IDC_STATIC,7,6,27,10 - EDITTEXT IDC_EDIT_C_FN, 7, 22, 136, 12, WS_DISABLED - PUSHBUTTON "...",IDC_CFILE,7 + 136, 22, 16, 14 - PUSHBUTTON "New",IDC_CNEW,7 + 136 + 16, 22, 24, 14 - PUSHBUTTON "Eject", IDC_EJECTC, 7 + 136 + 16 + 24, 22, 24, 14 - - EDITTEXT IDC_EDIT_C_SPT,36,38,16,12, WS_DISABLED - EDITTEXT IDC_EDIT_C_HPC,94,38,16,12, WS_DISABLED - EDITTEXT IDC_EDIT_C_CYL,152,38,28,12, WS_DISABLED - LTEXT "Sectors:",IDC_STATIC,7,38,27,10 - LTEXT "Heads:",IDC_STATIC,63,38,29,8 - LTEXT "Cylinders:",IDC_STATIC,120,38,32,12 - LTEXT "", IDC_TEXT_C_SIZE, 7, 54, 136, 12 - - LTEXT "D:",IDC_STATIC,7,76,27,10 - EDITTEXT IDC_EDIT_D_FN, 7, 92, 136, 12, WS_DISABLED - PUSHBUTTON "...",IDC_DFILE,7 + 136, 92, 16, 14 - PUSHBUTTON "New",IDC_DNEW,7 + 136 + 16, 92, 24, 14 - PUSHBUTTON "Eject", IDC_EJECTD, 7 + 136 + 16 + 24, 92, 24, 14 - - EDITTEXT IDC_EDIT_D_SPT,36,108,16,12, WS_DISABLED - EDITTEXT IDC_EDIT_D_HPC,94,108,16,12, WS_DISABLED - EDITTEXT IDC_EDIT_D_CYL,152,108,28,12, WS_DISABLED - LTEXT "Sectors:",IDC_STATIC,7,108,27,10 - LTEXT "Heads:",IDC_STATIC,63,108,29,8 - LTEXT "Cylinders:",IDC_STATIC,120,108,32,12 - LTEXT "", IDC_TEXT_D_SIZE, 7, 124, 136, 12 -END - -HdNewDlgMfm DIALOGEX 0, 0, 186, 102 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "New Hard Disc" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "OK",IDOK,31,82,50,14 - PUSHBUTTON "Cancel",IDCANCEL,101,82,50,14 - - EDITTEXT IDC_EDITC, 7, 6, 136, 12 - PUSHBUTTON "...",IDC_CFILE,7 + 136, 6, 16, 14 - - EDITTEXT IDC_EDIT1,36,22,16,12 - EDITTEXT IDC_EDIT2,94,22,16,12 - EDITTEXT IDC_EDIT3,152,22,28,12 - LTEXT "Sectors:",IDC_STATIC,7,22,27,10 - LTEXT "Heads:",IDC_STATIC,63,22,29,8 - LTEXT "Cylinders:",IDC_STATIC,120,22,32,12 - LTEXT "", IDC_TEXT1, 7, 38, 136, 12 - - COMBOBOX IDC_HDTYPE, 7,54,172,120,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - -END - -HdSizeDlgMfm DIALOGEX 0, 0, 186, 102 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Hard disc parameters" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "OK",IDOK,31,82,50,14 - PUSHBUTTON "Cancel",IDCANCEL,101,82,50,14 - - LTEXT "Initial settings are based on file size",IDC_STATIC,7,6,170,10 - - EDITTEXT IDC_EDIT1,36,22,16,12 - EDITTEXT IDC_EDIT2,94,22,16,12 - EDITTEXT IDC_EDIT3,152,22,28,12 - LTEXT "Sectors:",IDC_STATIC,7,22,27,10 - LTEXT "Heads:",IDC_STATIC,63,22,29,8 - LTEXT "Cylinders:",IDC_STATIC,120,22,32,12 - LTEXT "", IDC_TEXT1, 7, 38, 136, 12 - - COMBOBOX IDC_HDTYPE, 7,54,172,120,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - -END - -StatusDlg DIALOGEX 0,0,186,186+20+180 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Status" -FONT 9, "Segoe UI" -BEGIN - LTEXT "1",IDC_STEXT_DEVICE,16,16,180,1000 - LTEXT "1",IDC_STEXT1,16,186,180,1000 -END - -1 24 "86Box.manifest" - -#ifdef RELEASE_BUILD -/* Icon by Devcore - https://commons.wikimedia.org/wiki/File:Icon_PC_256x256.png */ -100 ICON "86Box-RB.ico" -#else -/* Icon by Devcore - https://commons.wikimedia.org/wiki/File:Icon_PC2_256x256.png */ -100 ICON "86Box.ico" -#endif diff --git a/src/pc87306.c b/src/pc87306.c index e3e930117..b62ea642c 100644 --- a/src/pc87306.c +++ b/src/pc87306.c @@ -11,25 +11,23 @@ #include "disc.h" #include "fdc.h" #include "fdd.h" +#include "ide.h" #include "io.h" #include "lpt.h" #include "serial.h" #include "pc87306.h" -static int pc87306_locked; static int pc87306_curreg; static uint8_t pc87306_regs[29]; static uint8_t pc87306_gpio[2] = {0xFF, 0xFB}; static uint8_t tries; static uint16_t lpt_port; -static int power_down = 0; void pc87306_gpio_remove(); void pc87306_gpio_init(); void pc87306_gpio_write(uint16_t port, uint8_t val, void *priv) { - // pclog("GPIO: Writing %02X on port: %04X\n", val, port); pc87306_gpio[port & 1] = val; } @@ -49,7 +47,6 @@ uint8_t uart1_int() { uint8_t temp; temp = ((pc87306_regs[1] >> 2) & 1) ? 3 : 4; /* 0 = COM1 (IRQ 4), 1 = COM2 (IRQ 3), 2 = COM3 (IRQ 4), 3 = COM4 (IRQ 3) */ - // pclog("UART 1 set to IRQ %i\n", (pc87306_regs[0x1C] & 1) ? uart_int1() : temp); return (pc87306_regs[0x1C] & 1) ? uart_int1() : temp; } @@ -57,7 +54,6 @@ uint8_t uart2_int() { uint8_t temp; temp = ((pc87306_regs[1] >> 4) & 1) ? 3 : 4; /* 0 = COM1 (IRQ 4), 1 = COM2 (IRQ 3), 2 = COM3 (IRQ 4), 3 = COM4 (IRQ 3) */ - // pclog("UART 2 set to IRQ %i\n", (pc87306_regs[0x1C] & 1) ? uart_int2() : temp); return (pc87306_regs[0x1C] & 1) ? uart_int2() : temp; } @@ -148,15 +144,14 @@ void serial2_handler() void pc87306_write(uint16_t port, uint8_t val, void *priv) { uint8_t index; - index = (port & 1) ? 0 : 1; - int temp; uint8_t valxor; - // pclog("pc87306_write : port=%04x reg %02X = %02X locked=%i\n", port, pc87306_curreg, val, pc87306_locked); + uint16_t or_value; + + index = (port & 1) ? 0 : 1; if (index) { pc87306_curreg = val & 0x1f; - // pclog("Register set to: %02X\n", val); tries = 0; return; } @@ -184,7 +179,6 @@ void pc87306_write(uint16_t port, uint8_t val, void *priv) { pc87306_gpio_remove(); } - // pclog("Register %02X set to: %02X (was: %02X)\n", pc87306_curreg, val, pc87306_regs[pc87306_curreg]); pc87306_regs[pc87306_curreg] = val; goto process_value; } @@ -201,7 +195,6 @@ process_value: switch(pc87306_curreg) { case 0: - // pclog("Register 0\n"); if (valxor & 1) { lpt1_remove(); @@ -227,7 +220,7 @@ process_value: serial2_handler(); } } - if ((valxor & 8) || (valxor & 0x20)) + if (valxor & 0x28) { fdc_remove(); if (val & 8) @@ -235,6 +228,24 @@ process_value: fdc_set_base((val & 0x20) ? 0x370 : 0x3f0, 0); } } + if (valxor & 0xc0) + { + ide_pri_disable(); + if (val & 0x80) + { + or_value = 0; + } + else + { + or_value = 0x80; + } + ide_set_base(0, 0x170 | or_value); + ide_set_side(0, 0x376 | or_value); + if (val & 0x40) + { + ide_pri_enable_ex(); + } + } break; case 1: @@ -276,7 +287,6 @@ process_value: { if (val & 1) { - // pclog("Powering down functions...\n"); lpt1_remove(); serial1_remove(); serial2_remove(); @@ -284,7 +294,6 @@ process_value: } else { - // pclog("Powering up functions...\n"); if (pc87306_regs[0] & 1) { lpt1_handler(); @@ -307,7 +316,6 @@ process_value: case 9: if (valxor & 0x44) { - // pclog("Setting DENSEL polarity to: %i (before: %i)\n", (val & 0x40 ? 1 : 0), fdc_get_densel_polarity()); fdc_update_enh_mode((val & 4) ? 1 : 0); fdc_update_densel_polarity((val & 0x40) ? 1 : 0); } @@ -366,13 +374,11 @@ process_value: uint8_t pc87306_gpio_read(uint16_t port, void *priv) { - // pclog("Read GPIO on port: %04X (%04X:%04X)\n", port, CS, cpu_state.pc); return pc87306_gpio[port & 1]; } uint8_t pc87306_read(uint16_t port, void *priv) { - // pclog("pc87306_read : port=%04x reg %02X locked=%i\n", port, pc87306_curreg, pc87306_locked); uint8_t index; index = (port & 1) ? 0 : 1; @@ -380,24 +386,20 @@ uint8_t pc87306_read(uint16_t port, void *priv) if (index) { - // pclog("PC87306: Read value %02X at the index register\n", pc87306_curreg & 0x1f); return pc87306_curreg & 0x1f; } else { if (pc87306_curreg >= 28) { - // pclog("PC87306: Read invalid at data register, index %02X\n", pc87306_curreg); return 0xff; } else if (pc87306_curreg == 8) { - // pclog("PC87306: Read ID at data register, index 08 (%04X:%04X)\n", CS, cpu_state.pc); return 0x70; } else { - // pclog("PC87306: Read value %02X at data register, index %02X\n", pc87306_regs[pc87306_curreg], pc87306_curreg); return pc87306_regs[pc87306_curreg]; } } diff --git a/src/pci.c b/src/pci.c index 7a2b3cbd0..73b056118 100644 --- a/src/pci.c +++ b/src/pci.c @@ -23,7 +23,6 @@ void pci_cf8_write(uint16_t port, uint32_t val, void *p) pci_card = (val >> 11) & 31; pci_bus = (val >> 16) & 0xff; pci_enable = (val >> 31) & 1; - // pclog("PCI card selected: %i\n", pci_card); } uint32_t pci_cf8_read(uint16_t port, void *p) @@ -33,15 +32,12 @@ uint32_t pci_cf8_read(uint16_t port, void *p) void pci_write(uint16_t port, uint8_t val, void *priv) { - // pclog("pci_write: port=%04x val=%02x %08x:%08x\n", port, val, cs, cpu_state.pc); switch (port) { case 0xcfc: case 0xcfd: case 0xcfe: case 0xcff: if (!pci_enable) return; - - // pclog("PCI write bus %i card %i func %i index %02X val %02X %04X:%04X\n", pci_bus, pci_card, pci_func, pci_index | (port & 3), val, CS, cpu_state.pc); - + if (!pci_bus && pci_card_write[pci_card]) pci_card_write[pci_card](pci_func, pci_index | (port & 3), val, pci_priv[pci_card]); @@ -51,19 +47,19 @@ void pci_write(uint16_t port, uint8_t val, void *priv) uint8_t pci_read(uint16_t port, void *priv) { - // pclog("pci_read: port=%04x %08x:%08x\n", port, cs, cpu_state.pc); switch (port) { case 0xcfc: case 0xcfd: case 0xcfe: case 0xcff: if (!pci_enable) return 0xff; - // pclog("PCI read bus %i card %i func %i index %02X\n", pci_bus, pci_card, pci_func, pci_index | (port & 3)); - if (!pci_bus && pci_card_read[pci_card]) return pci_card_read[pci_card](pci_func, pci_index | (port & 3), pci_priv[pci_card]); return 0xff; + + default: + return 0xff; } } @@ -72,7 +68,6 @@ uint8_t pci_type2_read(uint16_t port, void *priv); void pci_type2_write(uint16_t port, uint8_t val, void *priv) { -// pclog("pci_type2_write: port=%04x val=%02x %08x:%08x\n", port, val, cs, pc); if (port == 0xcf8) { pci_func = (val >> 1) & 7; @@ -91,8 +86,6 @@ void pci_type2_write(uint16_t port, uint8_t val, void *priv) pci_card = (port >> 8) & 0xf; pci_index = port & 0xff; - // pclog("PCI write bus %i card %i func %i index %02X val %02X %04X:%04X\n", pci_bus, pci_card, pci_func, pci_index | (port & 3), val, CS, cpu_state.pc); - if (!pci_bus && pci_card_write[pci_card]) pci_card_write[pci_card](pci_func, pci_index | (port & 3), val, pci_priv[pci_card]); } @@ -100,7 +93,6 @@ void pci_type2_write(uint16_t port, uint8_t val, void *priv) uint8_t pci_type2_read(uint16_t port, void *priv) { -// pclog("pci_type2_read: port=%04x %08x:%08x\n", port, cs, pc); if (port == 0xcf8) { return pci_key | (pci_func << 1); @@ -114,8 +106,6 @@ uint8_t pci_type2_read(uint16_t port, void *priv) pci_card = (port >> 8) & 0xf; pci_index = port & 0xff; - // pclog("PCI read bus %i card %i func %i index %02X %04X:%04X\n", pci_bus, pci_card, pci_func, pci_index | (port & 3), CS, cpu_state.pc); - if (!pci_bus && pci_card_write[pci_card]) return pci_card_read[pci_card](pci_func, pci_index | (port & 3), pci_priv[pci_card]); } @@ -140,7 +130,11 @@ void pci_init(int type, int min_card, int max_card) } for (c = 0; c < 32; c++) - pci_card_read[c] = pci_card_write[c] = pci_priv[c] = NULL; + { + pci_card_read[c] = NULL; + pci_card_write[c] = NULL; + pci_priv[c] = NULL; + } pci_min_card = min_card; pci_max_card = max_card; @@ -164,7 +158,6 @@ void pci_add(uint8_t (*read)(int func, int addr, void *priv), void (*write)(int pci_card_read[c] = read; pci_card_write[c] = write; pci_priv[c] = priv; - // pclog("PCI device added to card: %i\n", c); return; } } diff --git a/src/pic.c b/src/pic.c index 96cca37ac..128089924 100644 --- a/src/pic.c +++ b/src/pic.c @@ -1,6 +1,7 @@ #include "ibm.h" #include "io.h" #include "pic.h" +#include "pit.h" int output; int intclear; @@ -56,7 +57,6 @@ void pic_update_mask(uint8_t *mask, uint8_t ins) if (ins & (1 << c)) { *mask = 0xff << c; - // pclog("Mask is: %02X\n", *mask); return; } } @@ -88,21 +88,16 @@ static void pic_autoeoi() void pic_write(uint16_t addr, uint8_t val, void *priv) { int c; - // if (addr&1) pclog("Write PIC %04X %02X %04X(%06X):%04X\n",addr,val,CS,cs,cpu_state.pc); if (addr&1) { - // pclog("PIC ICW is: %i\n", pic.icw); switch (pic.icw) { case 0: /*OCW1*/ -// printf("Write mask %02X %04X:%04X\n",val,CS,pc); pic.mask=val; pic_updatepending(); break; case 1: /*ICW2*/ pic.vector=val&0xF8; - // printf("PIC vector now %02X\n",pic.vector); - // output=1; if (pic.icw1&2) pic.icw=3; else pic.icw=2; break; @@ -112,7 +107,6 @@ void pic_write(uint16_t addr, uint8_t val, void *priv) break; case 3: /*ICW4*/ pic.icw4 = val; - // pclog("ICW4 = %02x\n", val); pic.icw=0; break; } @@ -121,7 +115,6 @@ void pic_write(uint16_t addr, uint8_t val, void *priv) { if (val&16) /*ICW1*/ { - // pclog("ICW1 = %02x\n", val); pic.mask = 0; pic.mask2=0; pic.icw=1; @@ -131,10 +124,8 @@ void pic_write(uint16_t addr, uint8_t val, void *priv) } else if (!(val&8)) /*OCW2*/ { -// printf("Clear ints - %02X %02X\n",pic.ins,val); if ((val&0xE0)==0x60) { -// pclog("Specific EOI - %02X %i\n",pic.ins,1<<(val&7)); pic.ins&=~(1<<(val&7)); pic_update_mask(&pic.mask2, pic.ins); if (AT) @@ -142,8 +133,6 @@ void pic_write(uint16_t addr, uint8_t val, void *priv) if ((val&7) == 2 && (pic2.pend&~pic2.mask)&~pic2.mask2) pic.pend |= (1 << 2); } -// pic.pend&=(1<<(val&7)); -// if ((val&7)==1) pollkeywaiting(); pic_updatepending(); } else @@ -164,10 +153,8 @@ void pic_write(uint16_t addr, uint8_t val, void *priv) if (c==1 && keywaiting) { intclear&=~1; -// pollkeywaiting(); } pic_updatepending(); -// pclog("Generic EOI - Cleared int %i\n",c); return; } } @@ -175,9 +162,8 @@ void pic_write(uint16_t addr, uint8_t val, void *priv) } else /*OCW3*/ { - // if (val&4) fatal("PIC1 write OCW3 4 %02X\n",val); if (val&2) pic.read=(val&1); - if (val&0x40) { } //fatal("PIC 1 write OCW3 40 %02X\n",val); + if (val&0x40) { } } } } @@ -186,7 +172,6 @@ uint8_t pic_read(uint16_t addr, void *priv) { if (addr&1) { /*pclog("Read PIC mask %02X\n",pic.mask);*/ return pic.mask; } if (pic.read) { /*pclog("Read PIC ins %02X\n",pic.ins);*/ return pic.ins | (pic2.ins ? 4 : 0); } -// pclog("Read PIC pend %02X %08X\n",pic.pend,EDX); return pic.pend; } @@ -215,19 +200,16 @@ static void pic2_autoeoi() void pic2_write(uint16_t addr, uint8_t val, void *priv) { int c; -// pclog("Write PIC2 %04X %02X %04X:%04X %i\n",addr,val,CS,pc,ins); if (addr&1) { switch (pic2.icw) { case 0: /*OCW1*/ -// printf("PIC2 Write mask %02X %04X:%04X\n",val,CS,pc); pic2.mask=val; pic_updatepending(); break; case 1: /*ICW2*/ pic2.vector=val&0xF8; -// pclog("PIC2 vector %02X\n", val & 0xf8); if (pic2.icw1&2) pic2.icw=3; else pic2.icw=2; break; @@ -301,18 +283,14 @@ void clearpic() { pic.pend=pic.ins=0; pic_updatepending(); -// pclog("Clear PIC\n"); } int pic_current[16]; void picint(uint16_t num) { - int old_pend = pic_intpending; if (AT && (num == (1 << 2))) num = 1 << 9; -// pclog("picint : %04X\n", num); -// if (num == 0x10) pclog("PICINT 10\n"); if (num>0xFF) { if (!AT) @@ -348,7 +326,6 @@ void picintlevel(uint16_t num) c = 9; num = 1 << 9; } -// pclog("INTLEVEL %04X %i\n", num, c); if (!pic_current[c]) { pic_current[c]=1; @@ -379,7 +356,6 @@ void picintc(uint16_t num) c = 9; num = 1 << 9; } -// pclog("INTC %04X %i\n", num, c); pic_current[c]=0; if (num > 0xff) @@ -411,7 +387,10 @@ uint8_t picinterrupt() pic.pend &= ~(1 << c); pic.ins |= (1 << c); pic_update_mask(&pic.mask2, pic.ins); + pic_updatepending(); + if (!c) + pit_set_gate(&pit2, 0, 0); if (pic.icw4 & 0x02) pic_autoeoi(); @@ -445,7 +424,6 @@ uint8_t picinterrupt() pic2.ins |= (1 << c); pic_update_mask(&pic2.mask2, pic2.ins); - // pic.pend &= ~(1 << c); pic.ins |= (1 << 2); /*Cascade IRQ*/ pic_update_mask(&pic.mask2, pic.ins); diff --git a/src/pic.h b/src/pic.h index 419315c5f..74660941a 100644 --- a/src/pic.h +++ b/src/pic.h @@ -7,3 +7,4 @@ void picintlevel(uint16_t num); void picintc(uint16_t num); uint8_t picinterrupt(); void picclear(int num); +void dumppic(); diff --git a/src/piix.c b/src/piix.c index d4af9b4f1..2cb81a739 100644 --- a/src/piix.c +++ b/src/piix.c @@ -9,6 +9,7 @@ #include #include "ibm.h" +#include "dma.h" #include "ide.h" #include "io.h" #include "mem.h" @@ -27,13 +28,11 @@ static uint8_t card_piix[256], card_piix_ide[256]; void piix_write(int func, int addr, uint8_t val, void *priv) { uint16_t old_base = (card_piix_ide[0x20] & 0xf0) | (card_piix_ide[0x21] << 8); -// pclog("piix_write: func=%d addr=%02x val=%02x %04x:%08x\n", func, addr, val, CS, cpu_state.pc); if (func > 1) return; if (func == 1) /*IDE*/ { - // pclog("piix_write (IDE): func=%d addr=%02x val=%02x %04x:%08x\n", func, addr, val, CS, cpu_state.pc); switch (addr) { case 0x04: @@ -41,7 +40,6 @@ void piix_write(int func, int addr, uint8_t val, void *priv) break; case 0x07: card_piix_ide[0x07] = val & 0x3e; - // card_piix_ide[0x07] = (card_piix_ide[0x07] & ~0x38) | (val & 0x38); break; case 0x0d: card_piix_ide[0x0d] = val; @@ -91,7 +89,6 @@ void piix_write(int func, int addr, uint8_t val, void *priv) io_sethandler(base, 0x10, piix_bus_master_read, NULL, NULL, piix_bus_master_write, NULL, NULL, NULL); } } - // pclog("PIIX write %02X %02X\n", addr, val); } else { @@ -141,14 +138,11 @@ void piix_write(int func, int addr, uint8_t val, void *priv) uint8_t piix_read(int func, int addr, void *priv) { -// pclog("piix_read: func=%d addr=%02x %04x:%08x\n", func, addr, CS, pc); if (func > 1) return 0xff; if (func == 1) /*IDE*/ { - // pclog("PIIX IDE read %02X %02X\n", addr, card_piix_ide[addr]); - if (addr == 4) { return (card_piix_ide[addr] & 5) | 2; @@ -316,6 +310,8 @@ uint8_t piix_read(int func, int addr, void *priv) else return card_piix[addr]; } + + return 0; } struct @@ -334,13 +330,11 @@ static void piix_bus_master_next_addr(int channel) piix_busmaster[channel].count = (*(uint32_t *)(&ram[piix_busmaster[channel].ptr_cur + 4])) & 0xfffe; piix_busmaster[channel].eot = (*(uint32_t *)(&ram[piix_busmaster[channel].ptr_cur + 4])) >> 31; piix_busmaster[channel].ptr_cur += 8; -// pclog("New DMA settings on channel %i - Addr %08X Count %04X EOT %i\n", channel, piix_busmaster[channel].addr, piix_busmaster[channel].count, piix_busmaster[channel].eot); } void piix_bus_master_write(uint16_t port, uint8_t val, void *priv) { int channel = (port & 8) ? 1 : 0; -// pclog("PIIX Bus Master write %04X %02X %04x:%08x\n", port, val, CS, pc); switch (port & 7) { case 0: @@ -381,7 +375,6 @@ void piix_bus_master_write(uint16_t port, uint8_t val, void *priv) uint8_t piix_bus_master_read(uint16_t port, void *priv) { int channel = (port & 8) ? 1 : 0; -// pclog("PIIX Bus Master read %04X %04x:%08x\n", port, CS, pc); switch (port & 7) { case 0: @@ -419,7 +412,6 @@ int piix_bus_master_dma_read_ex(int channel, uint8_t *data) mem_invalidate_range(piix_busmaster[channel].addr, piix_busmaster[channel].addr + piix_busmaster[channel].count - 1); - // pclog("Transferring special - %i bytes\n", piix_busmaster[channel].count); memcpy(&ram[piix_busmaster[channel].addr], data, piix_busmaster[channel].count); transferred += piix_busmaster[channel].count; piix_busmaster[channel].addr += piix_busmaster[channel].count; @@ -428,13 +420,11 @@ int piix_bus_master_dma_read_ex(int channel, uint8_t *data) if (piix_busmaster[channel].eot) /*End of transfer?*/ { - // pclog("DMA on channel %i - transfer over\n", channel); piix_busmaster[channel].status &= ~1; return -1; } else { - // pclog("DMA on channel %i - transfer continuing\n", channel); piix_bus_master_next_addr(channel); } return 0; @@ -458,7 +448,6 @@ int piix_bus_master_dma_read(int channel, uint8_t *data, int transfer_length) if (piix_busmaster[channel].count < (transfer_length - transferred)) { -// pclog("Transferring smaller - %i bytes\n", piix_busmaster[channel].count); memcpy(&ram[piix_busmaster[channel].addr], data + transferred, piix_busmaster[channel].count); transferred += piix_busmaster[channel].count; piix_busmaster[channel].addr += piix_busmaster[channel].count; @@ -467,21 +456,16 @@ int piix_bus_master_dma_read(int channel, uint8_t *data, int transfer_length) } else { -// pclog("Transferring larger - %i bytes\n", transfer_length - transferred); memcpy(&ram[piix_busmaster[channel].addr], data + transferred, transfer_length - transferred); piix_busmaster[channel].addr += (transfer_length - transferred); piix_busmaster[channel].count -= (transfer_length - transferred); transferred += (transfer_length - transferred); } - // pclog("DMA on channel %i - Addr %08X Count %04X EOT %i\n", channel, piix_busmaster[channel].addr, piix_busmaster[channel].count, piix_busmaster[channel].eot); - if (!piix_busmaster[channel].count) { - // pclog("DMA on channel %i - block over\n", channel); if (piix_busmaster[channel].eot) /*End of transfer?*/ { - // pclog("DMA on channel %i - transfer over\n", channel); piix_busmaster[channel].status &= ~1; } else @@ -495,13 +479,9 @@ int piix_bus_master_dma_write(int channel, uint8_t *data, int transfer_length) { int transferred = 0; - // pclog("piix_bus_master_dma_write(%08X, %08X, %08X) on %08X data\n", channel, data, transfer_length, piix_busmaster[channel].count); - if (!(piix_busmaster[channel].status & 1)) return 1; /*DMA disabled*/ - // pclog("DMA not disabled\n"); - while (transferred < transfer_length) { if ((piix_busmaster[channel].count < (transfer_length - transferred)) && piix_busmaster[channel].eot && (transfer_length == 512)) @@ -511,7 +491,6 @@ int piix_bus_master_dma_write(int channel, uint8_t *data, int transfer_length) if (piix_busmaster[channel].count < (transfer_length - transferred)) { -// pclog("Transferring smaller - %i bytes\n", piix_busmaster[channel].count); memcpy(data + transferred, &ram[piix_busmaster[channel].addr], piix_busmaster[channel].count); transferred += piix_busmaster[channel].count; piix_busmaster[channel].addr += piix_busmaster[channel].count; @@ -520,21 +499,16 @@ int piix_bus_master_dma_write(int channel, uint8_t *data, int transfer_length) } else { -// pclog("Transferring larger - %i bytes\n", transfer_length - transferred); memcpy(data + transferred, &ram[piix_busmaster[channel].addr], transfer_length - transferred); piix_busmaster[channel].addr += (transfer_length - transferred); piix_busmaster[channel].count -= (transfer_length - transferred); transferred += (transfer_length - transferred); } -// pclog("DMA on channel %i - Addr %08X Count %04X EOT %i\n", channel, piix_busmaster[channel].addr, piix_busmaster[channel].count, piix_busmaster[channel].eot); - if (!piix_busmaster[channel].count) { -// pclog("DMA on channel %i - block over\n", channel); if (piix_busmaster[channel].eot) /*End of transfer?*/ { -// pclog("DMA on channel %i - transfer over\n", channel); piix_busmaster[channel].status &= ~1; } else @@ -562,12 +536,10 @@ static void rc_write(uint16_t port, uint8_t val, void *priv) { if (reset_reg & 2) { - // pclog("PIIX: Hard reset\n"); resetpchard(); } else { - // pclog("PIIX: Soft reset\n"); if (piix_type == 3) { piix3_reset(); diff --git a/src/piix.h b/src/piix.h index 4953d500e..c86a680ce 100644 --- a/src/piix.h +++ b/src/piix.h @@ -3,3 +3,10 @@ */ void piix_init(int card); void piix3_init(int card); + +uint8_t piix_bus_master_read(uint16_t port, void *priv); +void piix_bus_master_write(uint16_t port, uint8_t val, void *priv); + +int piix_bus_master_get_count(int channel); + +int piix_bus_master_dma_read_ex(int channel, uint8_t *data); diff --git a/src/pit.c b/src/pit.c index b9804eefb..e9e4cb090 100644 --- a/src/pit.c +++ b/src/pit.c @@ -7,16 +7,17 @@ #include "ibm.h" #include "cpu.h" +#include "device.h" #include "dma.h" #include "io.h" #include "pic.h" #include "pit.h" +#include "sound_speaker.h" #include "timer.h" #include "video.h" #include "model.h" /*B0 to 40, two writes to 43, then two reads - value does not change!*/ /*B4 to 40, two writes to 43, then two reads - value _does_ change!*/ -//Tyrian writes 4300 or 17512 int displine; double PITCONST; @@ -26,7 +27,6 @@ float isa_timing, bus_timing; int firsttime=1; void setpitclock(float clock) { -// printf("PIT clock %f\n",clock); cpuclock=clock; PITCONST=clock/1193182.0; CGACONST=(clock/(19687503.0/11.0)); @@ -36,32 +36,33 @@ void setpitclock(float clock) isa_timing = clock/8000000.0; bus_timing = clock/(double)cpu_busspeed; video_updatetiming(); -// pclog("PITCONST=%f CGACONST=%f\n", PITCONST, CGACONST); -// pclog("CPUMULTI=%g\n", ((14318184.0*(double)(1 << TIMER_SHIFT)) / (double)models[model].cpu[cpu_manufacturer].cpus[cpu].rspeed)); xt_cpu_multi = (int)((14318184.0*(double)(1 << TIMER_SHIFT)) / (double)models[model].cpu[cpu_manufacturer].cpus[cpu].rspeed); -// pclog("egacycles %i egacycles2 %i temp %f clock %f\n",egacycles,egacycles2,temp,clock); -/* if (video_recalctimings) - video_recalctimings();*/ RTCCONST=clock/32768.0; TIMER_USEC = (int)((clock / 1000000.0f) * (float)(1 << TIMER_SHIFT)); device_speed_changed(); } -//#define PITCONST (8000000.0/1193000.0) -//#define PITCONST (cpuclock/1193000.0) -void pit_reset() +void pit_reset(PIT *pit) { - memset(&pit,0,sizeof(PIT)); - pit.l[0]=0xFFFF; pit.c[0]=0xFFFF*PITCONST; - pit.l[1]=0xFFFF; pit.c[1]=0xFFFF*PITCONST; - pit.l[2]=0xFFFF; pit.c[2]=0xFFFF*PITCONST; - pit.m[0]=pit.m[1]=pit.m[2]=0; - pit.ctrls[0]=pit.ctrls[1]=pit.ctrls[2]=0; - pit.thit[0]=1; - pit.gate[0] = pit.gate[1] = 1; - pit.gate[2] = 0; - pit.using_timer[0] = pit.using_timer[1] = pit.using_timer[2] = 1; + void (*old_set_out_funcs[3])(int new_out, int old_out); + PIT_nr old_pit_nr[3]; + + memcpy(old_set_out_funcs, pit->set_out_funcs, 3 * sizeof(void *)); + memcpy(old_pit_nr, pit->pit_nr, 3 * sizeof(PIT_nr)); + memset(pit, 0, sizeof(PIT)); + memcpy(pit->set_out_funcs, old_set_out_funcs, 3 * sizeof(void *)); + memcpy(pit->pit_nr, old_pit_nr, 3 * sizeof(PIT_nr)); + + pit->l[0] = 0xFFFF; pit->c[0] = 0xFFFF*PITCONST; + pit->l[1] = 0xFFFF; pit->c[1] = 0xFFFF*PITCONST; + pit->l[2] = 0xFFFF; pit->c[2] = 0xFFFF*PITCONST; + pit->m[0] = pit->m[1] = pit->m[2] = 0; + pit->ctrls[0] = pit->ctrls[1] = pit->ctrls[2] = 0; + pit->thit[0]=1; + pit->gate[0] = pit->gate[1] = 1; + pit->gate[2] = 0; + pit->using_timer[0] = pit->using_timer[1] = pit->using_timer[2] = 1; } void clearpit() @@ -77,210 +78,214 @@ float pit_timer0_freq() return 1193182.0f/(float)0x10000; } -static void (*pit_set_out_funcs[3])(int new_out, int old_out); - -static void pit_set_out(int t, int out) +static void pit_set_out(PIT *pit, int t, int out) { - pit_set_out_funcs[t](out, pit.out[t]); - pit.out[t] = out; + pit->set_out_funcs[t](out, pit->out[t]); + pit->out[t] = out; } -static void pit_load(int t) +static void pit_load(PIT *pit, int t) { - int l = pit.l[t] ? pit.l[t] : 0x10000; + int l = pit->l[t] ? pit->l[t] : 0x10000; timer_process(); - pit.newcount[t] = 0; - pit.disabled[t] = 0; -// pclog("pit_load: t=%i l=%x\n", t, l); - switch (pit.m[t]) + pit->newcount[t] = 0; + pit->disabled[t] = 0; + switch (pit->m[t]) { case 0: /*Interrupt on terminal count*/ - pit.count[t] = l; - pit.c[t] = (int)((l << TIMER_SHIFT) * PITCONST); - pit_set_out(t, 0); - pit.thit[t] = 0; - pit.enabled[t] = pit.gate[t]; + pit->count[t] = l; + pit->c[t] = (int)((l << TIMER_SHIFT) * PITCONST); + pit_set_out(pit, t, 0); + pit->thit[t] = 0; + pit->enabled[t] = pit->gate[t]; break; case 1: /*Hardware retriggerable one-shot*/ - pit.enabled[t] = 1; + pit->enabled[t] = 1; break; case 2: /*Rate generator*/ - if (pit.initial[t]) + if (pit->initial[t]) { - pit.count[t] = l - 1; - pit.c[t] = (int)(((l - 1) << TIMER_SHIFT) * PITCONST); - pit_set_out(t, 1); - pit.thit[t] = 0; + pit->count[t] = l - 1; + pit->c[t] = (int)(((l - 1) << TIMER_SHIFT) * PITCONST); + pit_set_out(pit, t, 1); + pit->thit[t] = 0; } - pit.enabled[t] = pit.gate[t]; + pit->enabled[t] = pit->gate[t]; break; case 3: /*Square wave mode*/ - if (pit.initial[t]) + if (pit->initial[t]) { - pit.count[t] = l; - pit.c[t] = (int)((((l + 1) >> 1) << TIMER_SHIFT) * PITCONST); - pit_set_out(t, 1); - pit.thit[t] = 0; + pit->count[t] = l; + pit->c[t] = (int)((((l + 1) >> 1) << TIMER_SHIFT) * PITCONST); + pit_set_out(pit, t, 1); + pit->thit[t] = 0; } - pit.enabled[t] = pit.gate[t]; -// pclog("pit_load: square wave mode c=%x\n", pit.c[t]); + pit->enabled[t] = pit->gate[t]; break; case 4: /*Software triggered stobe*/ - if (!pit.thit[t] && !pit.initial[t]) - pit.newcount[t] = 1; + if (!pit->thit[t] && !pit->initial[t]) + pit->newcount[t] = 1; else { - pit.count[t] = l; - pit.c[t] = (int)((l << TIMER_SHIFT) * PITCONST); - pit_set_out(t, 0); - pit.thit[t] = 0; + pit->count[t] = l; + pit->c[t] = (int)((l << TIMER_SHIFT) * PITCONST); + pit_set_out(pit, t, 0); + pit->thit[t] = 0; } - pit.enabled[t] = pit.gate[t]; + pit->enabled[t] = pit->gate[t]; break; case 5: /*Hardware triggered stobe*/ - pit.enabled[t] = 1; + pit->enabled[t] = 1; break; } - pit.initial[t] = 0; - pit.running[t] = pit.enabled[t] && pit.using_timer[t] && !pit.disabled[t]; + pit->initial[t] = 0; + pit->running[t] = pit->enabled[t] && pit->using_timer[t] && !pit->disabled[t]; timer_update_outstanding(); -// pclog("pit_load: t=%i running=%i thit=%i enabled=%i m=%i l=%x c=%g gate=%i\n", t, pit.running[t], pit.thit[t], pit.enabled[t], pit.m[t], pit.l[t], pit.c[t], pit.gate[t]); } -void pit_set_gate(int t, int gate) +void pit_set_gate_no_timer(PIT *pit, int t, int gate) { - int l = pit.l[t] ? pit.l[t] : 0x10000; + int l = pit->l[t] ? pit->l[t] : 0x10000; - if (pit.disabled[t]) + if (pit->disabled[t]) { - pit.gate[t] = gate; + pit->gate[t] = gate; return; } - timer_process(); - switch (pit.m[t]) + switch (pit->m[t]) { case 0: /*Interrupt on terminal count*/ case 4: /*Software triggered stobe*/ - pit.enabled[t] = gate; + pit->enabled[t] = gate; break; case 1: /*Hardware retriggerable one-shot*/ case 5: /*Hardware triggered stobe*/ - if (gate && !pit.gate[t]) + if (gate && !pit->gate[t]) { - pit.count[t] = l; - pit.c[t] = (int)((l << TIMER_SHIFT) * PITCONST); - pit_set_out(t, 0); - pit.thit[t] = 0; - pit.enabled[t] = 1; + pit->count[t] = l; + pit->c[t] = (int)((l << TIMER_SHIFT) * PITCONST); + pit_set_out(pit, t, 0); + pit->thit[t] = 0; + pit->enabled[t] = 1; } break; case 2: /*Rate generator*/ - if (gate && !pit.gate[t]) + if (gate && !pit->gate[t]) { - pit.count[t] = l - 1; - pit.c[t] = (int)(((l - 1) << TIMER_SHIFT) * PITCONST); - pit_set_out(t, 1); - pit.thit[t] = 0; + pit->count[t] = l - 1; + pit->c[t] = (int)(((l - 1) << TIMER_SHIFT) * PITCONST); + pit_set_out(pit, t, 1); + pit->thit[t] = 0; } - pit.enabled[t] = gate; + pit->enabled[t] = gate; break; case 3: /*Square wave mode*/ - if (gate && !pit.gate[t]) + if (gate && !pit->gate[t]) { - pit.count[t] = l; - pit.c[t] = (int)((((l + 1) >> 1) << TIMER_SHIFT) * PITCONST); - pit_set_out(t, 1); - pit.thit[t] = 0; + pit->count[t] = l; + pit->c[t] = (int)((((l + 1) >> 1) << TIMER_SHIFT) * PITCONST); + pit_set_out(pit, t, 1); + pit->thit[t] = 0; } - pit.enabled[t] = gate; + pit->enabled[t] = gate; break; } - pit.gate[t] = gate; - pit.running[t] = pit.enabled[t] && pit.using_timer[t] && !pit.disabled[t]; - timer_update_outstanding(); -// pclog("pit_set_gate: t=%i gate=%i\n", t, gate); + pit->gate[t] = gate; + pit->running[t] = pit->enabled[t] && pit->using_timer[t] && !pit->disabled[t]; } -static void pit_over(int t) +void pit_set_gate(PIT *pit, int t, int gate) { - int l = pit.l[t] ? pit.l[t] : 0x10000; - if (pit.disabled[t]) + if (pit->disabled[t]) { - pit.count[t] += 0xffff; - pit.c[t] += (int)((0xffff << TIMER_SHIFT) * PITCONST); + pit->gate[t] = gate; return; } -// if (!t) pclog("pit_over: t=%i l=%x c=%x %i hit=%i\n", t, pit.l[t], pit.c[t], pit.c[t] >> TIMER_SHIFT, pit.thit[t]); - switch (pit.m[t]) + timer_process(); + + pit_set_gate_no_timer(pit, t, gate); + + timer_update_outstanding(); +} + +static void pit_over(PIT *pit, int t) +{ + int l = pit->l[t] ? pit->l[t] : 0x10000; + if (pit->disabled[t]) + { + pit->count[t] += 0xffff; + pit->c[t] += (int)((0xffff << TIMER_SHIFT) * PITCONST); + return; + } + + switch (pit->m[t]) { case 0: /*Interrupt on terminal count*/ case 1: /*Hardware retriggerable one-shot*/ - if (!pit.thit[t]) - pit_set_out(t, 1); - pit.thit[t] = 1; - pit.count[t] += 0xffff; - pit.c[t] += (int)((0xffff << TIMER_SHIFT) * PITCONST); + if (!pit->thit[t]) + pit_set_out(pit, t, 1); + pit->thit[t] = 1; + pit->count[t] += 0xffff; + pit->c[t] += (int)((0xffff << TIMER_SHIFT) * PITCONST); break; case 2: /*Rate generator*/ - pit.count[t] += l; - pit.c[t] += (int)((l << TIMER_SHIFT) * PITCONST); - pit_set_out(t, 0); - pit_set_out(t, 1); + pit->count[t] += l; + pit->c[t] += (int)((l << TIMER_SHIFT) * PITCONST); + pit_set_out(pit, t, 0); + pit_set_out(pit, t, 1); break; case 3: /*Square wave mode*/ - if (pit.out[t]) + if (pit->out[t]) { - pit_set_out(t, 0); - pit.count[t] += (l >> 1); - pit.c[t] += (int)(((l >> 1) << TIMER_SHIFT) * PITCONST); + pit_set_out(pit, t, 0); + pit->count[t] += (l >> 1); + pit->c[t] += (int)(((l >> 1) << TIMER_SHIFT) * PITCONST); } else { - pit_set_out(t, 1); - pit.count[t] += ((l + 1) >> 1); - pit.c[t] = (int)((((l + 1) >> 1) << TIMER_SHIFT) * PITCONST); + pit_set_out(pit, t, 1); + pit->count[t] += ((l + 1) >> 1); + pit->c[t] = (int)((((l + 1) >> 1) << TIMER_SHIFT) * PITCONST); } -// if (!t) pclog("pit_over: square wave mode c=%x %lli %f\n", pit.c[t], tsc, PITCONST); break; case 4: /*Software triggered strove*/ - if (!pit.thit[t]) + if (!pit->thit[t]) { - pit_set_out(t, 0); - pit_set_out(t, 1); + pit_set_out(pit, t, 0); + pit_set_out(pit, t, 1); } - if (pit.newcount[t]) + if (pit->newcount[t]) { - pit.newcount[t] = 0; - pit.count[t] += l; - pit.c[t] += (int)((l << TIMER_SHIFT) * PITCONST); + pit->newcount[t] = 0; + pit->count[t] += l; + pit->c[t] += (int)((l << TIMER_SHIFT) * PITCONST); } else { - pit.thit[t] = 1; - pit.count[t] += 0xffff; - pit.c[t] += (int)((0xffff << TIMER_SHIFT) * PITCONST); + pit->thit[t] = 1; + pit->count[t] += 0xffff; + pit->c[t] += (int)((0xffff << TIMER_SHIFT) * PITCONST); } break; case 5: /*Hardware triggered strove*/ - if (!pit.thit[t]) + if (!pit->thit[t]) { - pit_set_out(t, 0); - pit_set_out(t, 1); + pit_set_out(pit, t, 0); + pit_set_out(pit, t, 1); } - pit.thit[t] = 1; - pit.count[t] += 0xffff; - pit.c[t] += (int)((0xffff << TIMER_SHIFT) * PITCONST); + pit->thit[t] = 1; + pit->count[t] += 0xffff; + pit->c[t] += (int)((0xffff << TIMER_SHIFT) * PITCONST); break; } - pit.running[t] = pit.enabled[t] && pit.using_timer[t] && !pit.disabled[t]; + pit->running[t] = pit->enabled[t] && pit->using_timer[t] && !pit->disabled[t]; } int pit_get_timer_0() { int read = (int)((pit.c[0] + ((1 << TIMER_SHIFT) - 1)) / PITCONST) >> TIMER_SHIFT; -//pclog("pit_get_timer_0: t=%i using_timer=%i m=%i\n", 0, pit.using_timer[0], pit.m[0]); if (pit.m[0] == 2) read++; if (read < 0) @@ -292,33 +297,32 @@ int pit_get_timer_0() return read; } -static int pit_read_timer(int t) +static int pit_read_timer(PIT *pit, int t) { timer_clock(); -// pclog("pit_read_timer: t=%i using_timer=%i m=%i\n", t, pit.using_timer[t], pit.m[t]); - if (pit.using_timer[t]) + if (pit->using_timer[t]) { - int read = (int)((pit.c[t] + ((1 << TIMER_SHIFT) - 1)) / PITCONST) >> TIMER_SHIFT; - if (pit.m[t] == 2) + int read = (int)((pit->c[t] + ((1 << TIMER_SHIFT) - 1)) / PITCONST) >> TIMER_SHIFT; + if (pit->m[t] == 2) read++; if (read < 0) read = 0; if (read > 0x10000) read = 0x10000; - if (pit.m[t] == 3) + if (pit->m[t] == 3) read <<= 1; return read; } - if (pit.m[t] == 2) - return pit.count[t] + 1; - return pit.count[t]; + if (pit->m[t] == 2) + return pit->count[t] + 1; + return pit->count[t]; } -void pit_write(uint16_t addr, uint8_t val, void *priv) +void pit_write(uint16_t addr, uint8_t val, void *p) { + PIT *pit = (PIT *)p; int t; cycles -= (int)PITCONST; -// /*if (val != 0x40) */pclog("Write PIT %04X %02X %04X:%08X %i %i\n",addr,val,CS,pc,ins, pit.gate[0]); switch (addr&3) { @@ -328,234 +332,192 @@ void pit_write(uint16_t addr, uint8_t val, void *priv) if (!(val&0x20)) { if (val & 2) - pit.rl[0] = pit.using_timer[0] ? ((int)(pit.c[0] / PITCONST) >> TIMER_SHIFT) : pit.count[0]; + pit->rl[0] = pit->using_timer[0] ? ((int)(pit->c[0] / PITCONST) >> TIMER_SHIFT) : pit->count[0]; if (val & 4) - pit.rl[1] = pit.using_timer[1] ? ((int)(pit.c[1] / PITCONST) >> TIMER_SHIFT) : pit.count[1]; + pit->rl[1] = pit->using_timer[1] ? ((int)(pit->c[1] / PITCONST) >> TIMER_SHIFT) : pit->count[1]; if (val & 8) - pit.rl[2] = pit.using_timer[2] ? ((int)(pit.c[2] / PITCONST) >> TIMER_SHIFT) : pit.count[2]; + pit->rl[2] = pit->using_timer[2] ? ((int)(pit->c[2] / PITCONST) >> TIMER_SHIFT) : pit->count[2]; } if (!(val & 0x10)) { if (val & 2) { - pit.read_status[0] = (pit.ctrls[0] & 0x3f) | 0x40 | (pit.out[0] ? 0x80 : 0); - pit.do_read_status[0] = 1; + pit->read_status[0] = (pit->ctrls[0] & 0x3f) | 0x40 | (pit->out[0] ? 0x80 : 0); + pit->do_read_status[0] = 1; } if (val & 4) { - pit.read_status[1] = (pit.ctrls[1] & 0x3f) | 0x40 | (pit.out[1] ? 0x80 : 0); - pit.do_read_status[1] = 1; + pit->read_status[1] = (pit->ctrls[1] & 0x3f) | 0x40 | (pit->out[1] ? 0x80 : 0); + pit->do_read_status[1] = 1; } if (val & 8) { - pit.read_status[2] = (pit.ctrls[2] & 0x3f) | 0x40 | (pit.out[2] ? 0x80 : 0); - pit.do_read_status[2] = 1; + pit->read_status[2] = (pit->ctrls[2] & 0x3f) | 0x40 | (pit->out[2] ? 0x80 : 0); + pit->do_read_status[2] = 1; } } return; } t = val >> 6; - pit.ctrl=val; + pit->ctrl=val; if ((val>>7)==3) { - printf("Bad PIT reg select\n"); return; -// dumpregs(); -// exit(-1); } -// printf("CTRL write %02X\n",val); - if (!(pit.ctrl&0x30)) + if (!(pit->ctrl&0x30)) { - pit.rl[t] = pit_read_timer(t); -// pclog("Timer latch %f %04X %04X\n",pit.c[0],pit.rl[0],pit.l[0]); - pit.ctrl |= 0x30; - pit.rereadlatch[t] = 0; - pit.rm[t] = 3; - pit.latched[t] = 1; + pit->rl[t] = pit_read_timer(pit, t); + pit->ctrl |= 0x30; + pit->rereadlatch[t] = 0; + pit->rm[t] = 3; + pit->latched[t] = 1; } else { - pit.ctrls[val>>6] = val; - pit.rm[val>>6]=pit.wm[val>>6]=(pit.ctrl>>4)&3; - pit.m[val>>6]=(val>>1)&7; - if (pit.m[val>>6]>5) - pit.m[val>>6]&=3; - if (!(pit.rm[val>>6])) + pit->ctrls[t] = val; + pit->rm[t]=pit->wm[t]=(pit->ctrl>>4)&3; + pit->m[t]=(val>>1)&7; + if (pit->m[t]>5) + pit->m[t]&=3; + if (!(pit->rm[t])) { - pit.rm[val>>6]=3; - pit.rl[t] = pit_read_timer(t); + pit->rm[t]=3; + pit->rl[t] = pit_read_timer(pit, t); } - pit.rereadlatch[val>>6]=1; - if ((val>>6)==2) ppispeakon=speakon=(pit.m[2]==0)?0:1; - pit.initial[t] = 1; - if (!pit.m[val >> 6]) - pit_set_out(val >> 6, 0); + pit->rereadlatch[t]=1; + if (t == 2) ppispeakon=speakon=(pit->m[2]==0)?0:1; + pit->initial[t] = 1; + if (!pit->m[t]) + pit_set_out(pit, t, 0); else - pit_set_out(val >> 6, 1); - pit.disabled[val >> 6] = 1; -// pclog("ppispeakon %i\n",ppispeakon); + pit_set_out(pit, t, 1); + pit->disabled[t] = 1; } - pit.wp=0; - pit.thit[pit.ctrl>>6]=0; + pit->wp=0; + pit->thit[t]=0; break; case 0: case 1: case 2: /*Timers*/ t=addr&3; -// if (t==2) ppispeakon=speakon=0; -// pclog("Write timer %02X %i\n",pit.ctrls[t],pit.wm[t]); - switch (pit.wm[t]) + switch (pit->wm[t]) { case 1: - pit.l[t]=val; -// pit.thit[t]=0; - pit_load(t); -// pit.c[t]=pit.l[t]*PITCONST; -// if (!t) -// picintc(1); + pit->l[t]=val; + pit_load(pit, t); break; case 2: - pit.l[t]=(val<<8); -// pit.thit[t]=0; - pit_load(t); -// pit.c[t]=pit.l[t]*PITCONST; -// if (!t) -// picintc(1); + pit->l[t]=(val<<8); + pit_load(pit, t); break; case 0: - pit.l[t]&=0xFF; - pit.l[t]|=(val<<8); - pit_load(t); -// pit.c[t]=pit.l[t]*PITCONST; -// pclog("%04X %f\n",pit.l[t],pit.c[t]); -// pit.thit[t]=0; - pit.wm[t]=3; -// if (!t) -// picintc(1); + pit->l[t]&=0xFF; + pit->l[t]|=(val<<8); + pit_load(pit, t); + pit->wm[t]=3; break; case 3: - pit.l[t]&=0xFF00; - pit.l[t]|=val; - pit.wm[t]=0; + pit->l[t]&=0xFF00; + pit->l[t]|=val; + pit->wm[t]=0; break; } - speakval=(((float)pit.l[2]/(float)pit.l[0])*0x4000)-0x2000; -// printf("Speakval now %i\n",speakval); -// if (speakval>0x2000) -// printf("Speaker overflow - %i %i %04X %04X\n",pit.l[0],pit.l[2],pit.l[0],pit.l[2]); + speakval=(((float)pit->l[2]/(float)pit->l[0])*0x4000)-0x2000; if (speakval>0x2000) speakval=0x2000; -/* if (!pit.l[t]) - { - pit.l[t]|=0x10000; - pit.c[t]=pit.l[t]*PITCONST; - }*/ break; } } -uint8_t pit_read(uint16_t addr, void *priv) +uint8_t pit_read(uint16_t addr, void *p) { + PIT *pit = (PIT *)p; int t; uint8_t temp; cycles -= (int)PITCONST; -// printf("Read PIT %04X ",addr); switch (addr&3) { case 0: case 1: case 2: /*Timers*/ t = addr & 3; - if (pit.do_read_status[t]) + if (pit->do_read_status[t]) { - pit.do_read_status[t] = 0; - temp = pit.read_status[t]; + pit->do_read_status[t] = 0; + temp = pit->read_status[t]; break; } - if (pit.rereadlatch[addr & 3] && !pit.latched[addr & 3]) + if (pit->rereadlatch[addr & 3] && !pit->latched[addr & 3]) { - pit.rereadlatch[addr & 3] = 0; - pit.rl[t] = pit_read_timer(t); + pit->rereadlatch[addr & 3] = 0; + pit->rl[t] = pit_read_timer(pit, t); } - switch (pit.rm[addr & 3]) + switch (pit->rm[addr & 3]) { case 0: - temp = pit.rl[addr & 3] >> 8; - pit.rm[addr & 3] = 3; - pit.latched[addr & 3] = 0; - pit.rereadlatch[addr & 3] = 1; + temp = pit->rl[addr & 3] >> 8; + pit->rm[addr & 3] = 3; + pit->latched[addr & 3] = 0; + pit->rereadlatch[addr & 3] = 1; break; case 1: - temp = (pit.rl[addr & 3]) & 0xFF; - pit.latched[addr & 3] = 0; - pit.rereadlatch[addr & 3] = 1; + temp = (pit->rl[addr & 3]) & 0xFF; + pit->latched[addr & 3] = 0; + pit->rereadlatch[addr & 3] = 1; break; case 2: - temp = (pit.rl[addr & 3]) >> 8; - pit.latched[addr & 3] = 0; - pit.rereadlatch[addr & 3] = 1; + temp = (pit->rl[addr & 3]) >> 8; + pit->latched[addr & 3] = 0; + pit->rereadlatch[addr & 3] = 1; break; case 3: - temp = (pit.rl[addr & 3]) & 0xFF; - if (pit.m[addr & 3] & 0x80) - pit.m[addr & 3] &= 7; + temp = (pit->rl[addr & 3]) & 0xFF; + if (pit->m[addr & 3] & 0x80) + pit->m[addr & 3] &= 7; else - pit.rm[addr & 3] = 0; + pit->rm[addr & 3] = 0; break; } break; case 3: /*Control*/ - temp = pit.ctrl; + temp = pit->ctrl; break; } -// pclog("%02X\n", temp); -// printf("%02X %i %i %04X:%04X %i\n",temp,pit.rm[addr&3],pit.wp,cs>>4,pc, ins); return temp; } -void pit_poll() -{ -// printf("Poll pit %f %f %f\n",pit.c[0],pit.c[1],pit.c[2]); - if (pit.c[0] < 1 && pit.running[0]) - pit_over(0); - if (pit.c[1] < 1 && pit.running[1]) - pit_over(1); - if (pit.c[2] < 1 && pit.running[2]) - pit_over(2); -} - void pit_timer_over(void *p) { - int timer = (int) p; -// pclog("pit_timer_over %i\n", timer); - - pit_over(timer); + PIT_nr *pit_nr = (PIT_nr *)p; + PIT *pit = pit_nr->pit; + int timer = pit_nr->nr; + + pit_over(pit, timer); } -void pit_clock(int t) +void pit_clock(PIT *pit, int t) { - if (pit.thit[t] || !pit.enabled[t]) + if (pit->thit[t] || !pit->enabled[t]) return; - if (pit.using_timer[t]) + if (pit->using_timer[t]) return; - pit.count[t] -= (pit.m[t] == 3) ? 2 : 1; - if (!pit.count[t]) - pit_over(t); + pit->count[t] -= (pit->m[t] == 3) ? 2 : 1; + if (!pit->count[t]) + pit_over(pit, t); } -void pit_set_using_timer(int t, int using_timer) +void pit_set_using_timer(PIT *pit, int t, int using_timer) { -// pclog("pit_set_using_timer: t=%i using_timer=%i\n", t, using_timer); timer_process(); - if (pit.using_timer[t] && !using_timer) - pit.count[t] = pit_read_timer(t); - if (!pit.using_timer[t] && using_timer) - pit.c[t] = (int)((pit.count[t] << TIMER_SHIFT) * PITCONST); - pit.using_timer[t] = using_timer; - pit.running[t] = pit.enabled[t] && pit.using_timer[t] && !pit.disabled[t]; + if (pit->using_timer[t] && !using_timer) + pit->count[t] = pit_read_timer(pit, t); + if (!pit->using_timer[t] && using_timer) + pit->c[t] = (int)((pit->count[t] << TIMER_SHIFT) * PITCONST); + pit->using_timer[t] = using_timer; + pit->running[t] = pit->enabled[t] && pit->using_timer[t] && !pit->disabled[t]; timer_update_outstanding(); } -void pit_set_out_func(int t, void (*func)(int new_out, int old_out)) +void pit_set_out_func(PIT *pit, int t, void (*func)(int new_out, int old_out)) { - pit_set_out_funcs[t] = func; + pit->set_out_funcs[t] = func; } void pit_null_timer(int new_out, int old_out) @@ -575,12 +537,25 @@ void pit_irq0_timer_pcjr(int new_out, int old_out) if (new_out && !old_out) { picint(1); - pit_clock(1); + pit_clock(&pit, 1); } if (!new_out) picintc(1); } +void pit_irq0_ps2(int new_out, int old_out) +{ + if (new_out && !old_out) + { + picint(1); + pit_set_gate_no_timer(&pit2, 0, 1); + } + if (!new_out) + picintc(1); + if (!new_out && old_out) + pit_clock(&pit2, 0); +} + void pit_refresh_timer_xt(int new_out, int old_out) { if (new_out && !old_out) @@ -608,18 +583,52 @@ void pit_speaker_timer(int new_out, int old_out) } +void pit_nmi_ps2(int new_out, int old_out) +{ + nmi = new_out; + if (nmi) + nmi_auto_clear = 1; +} + void pit_init() { - io_sethandler(0x0040, 0x0004, pit_read, NULL, NULL, pit_write, NULL, NULL, NULL); + pit_reset(&pit); + + io_sethandler(0x0040, 0x0004, pit_read, NULL, NULL, pit_write, NULL, NULL, &pit); pit.gate[0] = pit.gate[1] = 1; pit.gate[2] = 0; pit.using_timer[0] = pit.using_timer[1] = pit.using_timer[2] = 1; + + pit.pit_nr[0].nr = 0; + pit.pit_nr[1].nr = 1; + pit.pit_nr[2].nr = 2; + pit.pit_nr[0].pit = pit.pit_nr[1].pit = pit.pit_nr[2].pit = &pit; - timer_add(pit_timer_over, &pit.c[0], &pit.running[0], (void *)0); - timer_add(pit_timer_over, &pit.c[1], &pit.running[1], (void *)1); - timer_add(pit_timer_over, &pit.c[2], &pit.running[2], (void *)2); + timer_add(pit_timer_over, &pit.c[0], &pit.running[0], (void *)&pit.pit_nr[0]); + timer_add(pit_timer_over, &pit.c[1], &pit.running[1], (void *)&pit.pit_nr[1]); + timer_add(pit_timer_over, &pit.c[2], &pit.running[2], (void *)&pit.pit_nr[2]); - pit_set_out_func(0, pit_irq0_timer); - pit_set_out_func(1, pit_null_timer); - pit_set_out_func(2, pit_speaker_timer); + pit_set_out_func(&pit, 0, pit_irq0_timer); + pit_set_out_func(&pit, 1, pit_null_timer); + pit_set_out_func(&pit, 2, pit_speaker_timer); +} + +void pit_ps2_init() +{ + pit_reset(&pit2); + + io_sethandler(0x0044, 0x0001, pit_read, NULL, NULL, pit_write, NULL, NULL, &pit2); + io_sethandler(0x0047, 0x0001, pit_read, NULL, NULL, pit_write, NULL, NULL, &pit2); + + pit2.gate[0] = 0; + pit2.using_timer[0] = 0; + pit2.disabled[0] = 1; + + pit2.pit_nr[0].nr = 0; + pit2.pit_nr[0].pit = &pit2; + + timer_add(pit_timer_over, &pit2.c[0], &pit2.running[0], (void *)&pit2.pit_nr[0]); + + pit_set_out_func(&pit, 0, pit_irq0_ps2); + pit_set_out_func(&pit2, 0, pit_nmi_ps2); } diff --git a/src/pit.h b/src/pit.h index 3d5018bd1..a827e9581 100644 --- a/src/pit.h +++ b/src/pit.h @@ -1,10 +1,11 @@ extern double PITCONST; void pit_init(); -void pit_reset(); -void pit_set_gate(int channel, int gate); -void pit_set_using_timer(int t, int using_timer); -void pit_set_out_func(int t, void (*func)(int new_out, int old_out)); -void pit_clock(int t); +void pit_ps2_init(); +void pit_reset(PIT *pit); +void pit_set_gate(PIT *pit, int channel, int gate); +void pit_set_using_timer(PIT *pit, int t, int using_timer); +void pit_set_out_func(PIT *pit, int t, void (*func)(int new_out, int old_out)); +void pit_clock(PIT *pit, int t); void pit_null_timer(int new_out, int old_out); diff --git a/src/plat-midi.h b/src/plat-midi.h index 15b9edafe..f258cdbcb 100644 --- a/src/plat-midi.h +++ b/src/plat-midi.h @@ -4,3 +4,5 @@ void midi_init(); void midi_close(); void midi_write(uint8_t val); +int midi_get_num_devs(); +void midi_get_dev_name(int num, char *s); diff --git a/src/ppi.c b/src/ppi.c index 2d564b90c..0eb9f3a0f 100644 --- a/src/ppi.c +++ b/src/ppi.c @@ -16,7 +16,7 @@ void ppi_reset() { - ppi.pa=0x0;//0x1D; + ppi.pa=0x0; ppi.pb=0x40; } diff --git a/src/ps1.c b/src/ps1.c index 8da00c91a..a9f068bfd 100644 --- a/src/ps1.c +++ b/src/ps1.c @@ -2,10 +2,12 @@ see COPYING for more details */ #include "ibm.h" +#include "io.h" #include "mem.h" #include "ps1.h" #include "rom.h" #include "lpt.h" +#include "serial.h" static rom_t ps1_high_rom; static uint8_t ps1_92, ps1_94, ps1_102, ps1_103, ps1_104, ps1_105, ps1_190; diff --git a/src/ps2.c b/src/ps2.c index 0b6b08424..1b5c4dc06 100644 --- a/src/ps2.c +++ b/src/ps2.c @@ -1,8 +1,10 @@ #include "ibm.h" +#include "io.h" #include "mem.h" #include "ps2.h" #include "rom.h" #include "lpt.h" +#include "serial.h" static uint8_t ps2_92, ps2_94, ps2_102, ps2_103, ps2_104, ps2_105, ps2_190; diff --git a/src/ps2_mca.c b/src/ps2_mca.c new file mode 100644 index 000000000..fd3201ac3 --- /dev/null +++ b/src/ps2_mca.c @@ -0,0 +1,796 @@ +#include "ibm.h" +#include "cpu.h" +#include "device.h" +#include "io.h" +#include "lpt.h" +#include "mca.h" +#include "mem.h" +#include "ps2_mca.h" +#include "ps2_nvr.h" +#include "rom.h" +#include "serial.h" +#include "x86.h" + +static struct +{ + uint8_t adapter_setup; + uint8_t option[4]; + uint8_t pos_vga; + uint8_t setup; + uint8_t sys_ctrl_port_a; + uint8_t subaddr_lo, subaddr_hi; + + uint8_t memory_bank[8]; + + uint8_t io_id; + + mem_mapping_t shadow_mapping; + mem_mapping_t split_mapping; + mem_mapping_t expansion_mapping; + + uint8_t (*planar_read)(uint16_t port); + void (*planar_write)(uint16_t port, uint8_t val); + + uint8_t mem_regs[3]; + + uint32_t split_addr; + + uint8_t mem_pos_regs[8]; +} ps2; + + +static uint8_t ps2_read_shadow_ram(uint32_t addr, void *priv) +{ + addr = (addr & 0x1ffff) + 0xe0000; + return mem_read_ram(addr, priv); +} +static uint16_t ps2_read_shadow_ramw(uint32_t addr, void *priv) +{ + addr = (addr & 0x1ffff) + 0xe0000; + return mem_read_ramw(addr, priv); +} +static uint32_t ps2_read_shadow_raml(uint32_t addr, void *priv) +{ + addr = (addr & 0x1ffff) + 0xe0000; + return mem_read_raml(addr, priv); +} +static void ps2_write_shadow_ram(uint32_t addr, uint8_t val, void *priv) +{ + addr = (addr & 0x1ffff) + 0xe0000; + mem_write_ram(addr, val, priv); +} +static void ps2_write_shadow_ramw(uint32_t addr, uint16_t val, void *priv) +{ + addr = (addr & 0x1ffff) + 0xe0000; + mem_write_ramw(addr, val, priv); +} +static void ps2_write_shadow_raml(uint32_t addr, uint32_t val, void *priv) +{ + addr = (addr & 0x1ffff) + 0xe0000; + mem_write_raml(addr, val, priv); +} + +static uint8_t ps2_read_split_ram(uint32_t addr, void *priv) +{ + addr = (addr & 0x3ffff) + 0xa0000; + return mem_read_ram(addr, priv); +} +static uint16_t ps2_read_split_ramw(uint32_t addr, void *priv) +{ + addr = (addr & 0x3ffff) + 0xa0000; + return mem_read_ramw(addr, priv); +} +static uint32_t ps2_read_split_raml(uint32_t addr, void *priv) +{ + addr = (addr & 0x3ffff) + 0xa0000; + return mem_read_raml(addr, priv); +} +static void ps2_write_split_ram(uint32_t addr, uint8_t val, void *priv) +{ + addr = (addr & 0x3ffff) + 0xa0000; + mem_write_ram(addr, val, priv); +} +static void ps2_write_split_ramw(uint32_t addr, uint16_t val, void *priv) +{ + addr = (addr & 0x3ffff) + 0xa0000; + mem_write_ramw(addr, val, priv); +} +static void ps2_write_split_raml(uint32_t addr, uint32_t val, void *priv) +{ + addr = (addr & 0x3ffff) + 0xa0000; + mem_write_raml(addr, val, priv); +} + + + +#define PS2_SETUP_IO 0x80 +#define PS2_SETUP_VGA 0x20 + +#define PS2_ADAPTER_SETUP 0x08 + +static uint8_t model_50_read(uint16_t port) +{ + switch (port) + { + case 0x100: + return 0xff; + case 0x101: + return 0xfb; + case 0x102: + return ps2.option[0]; + case 0x103: + return ps2.option[1]; + case 0x104: + return ps2.option[2]; + case 0x105: + return ps2.option[3]; + case 0x106: + return ps2.subaddr_lo; + case 0x107: + return ps2.subaddr_hi; + } + return 0xff; +} + +static uint8_t model_55sx_read(uint16_t port) +{ + switch (port) + { + case 0x100: + return 0xff; + case 0x101: + return 0xfb; + case 0x102: + return ps2.option[0]; + case 0x103: + return ps2.option[1]; + case 0x104: + return ps2.memory_bank[ps2.option[3] & 7]; + case 0x105: + return ps2.option[3]; + case 0x106: + return ps2.subaddr_lo; + case 0x107: + return ps2.subaddr_hi; + } + return 0xff; +} + +static uint8_t model_80_read(uint16_t port) +{ + switch (port) + { + case 0x100: + return 0xff; + case 0x101: + return 0xfd; + case 0x102: + return ps2.option[0]; + case 0x103: + return ps2.option[1]; + case 0x104: + return ps2.option[2]; + case 0x105: + return ps2.option[3]; + case 0x106: + return ps2.subaddr_lo; + case 0x107: + return ps2.subaddr_hi; + } + return 0xff; +} + +static void model_50_write(uint16_t port, uint8_t val) +{ + switch (port) + { + case 0x100: + ps2.io_id = val; + break; + case 0x101: + break; + case 0x102: + lpt1_remove(); + serial1_remove(); + if (val & 0x04) + { + if (val & 0x08) + serial1_init(0x3f8, 4); + else + serial1_init(0x2f8, 3); + } + else + serial1_remove(); + if (val & 0x10) + { + switch ((val >> 5) & 3) + { + case 0: + lpt1_init(0x3bc); + break; + case 1: + lpt1_init(0x378); + break; + case 2: + lpt1_init(0x278); + break; + } + } + ps2.option[0] = val; + break; + case 0x103: + ps2.option[1] = val; + break; + case 0x104: + ps2.option[2] = val; + break; + case 0x105: + ps2.option[3] = val; + break; + case 0x106: + ps2.subaddr_lo = val; + break; + case 0x107: + ps2.subaddr_hi = val; + break; + } +} + +static void model_55sx_write(uint16_t port, uint8_t val) +{ + switch (port) + { + case 0x100: + ps2.io_id = val; + break; + case 0x101: + break; + case 0x102: + lpt1_remove(); + serial1_remove(); + if (val & 0x04) + { + if (val & 0x08) + serial1_init(0x3f8, 4); + else + serial1_init(0x2f8, 3); + } + else + serial1_remove(); + if (val & 0x10) + { + switch ((val >> 5) & 3) + { + case 0: + lpt1_init(0x3bc); + break; + case 1: + lpt1_init(0x378); + break; + case 2: + lpt1_init(0x278); + break; + } + } + ps2.option[0] = val; + break; + case 0x103: + ps2.option[1] = val; + break; + case 0x104: + ps2.memory_bank[ps2.option[3] & 7] &= ~0xf; + ps2.memory_bank[ps2.option[3] & 7] |= (val & 0xf); + pclog("Write memory bank %i %02x\n", ps2.option[3] & 7, val); + break; + case 0x105: + pclog("Write POS3 %02x\n", val); + ps2.option[3] = val; + shadowbios = !(val & 0x10); + shadowbios_write = val & 0x10; + + if (shadowbios) + { + mem_set_mem_state(0xe0000, 0x20000, MEM_READ_INTERNAL | MEM_WRITE_DISABLED); + mem_mapping_disable(&ps2.shadow_mapping); + } + else + { + mem_set_mem_state(0xe0000, 0x20000, MEM_READ_EXTERNAL | MEM_WRITE_INTERNAL); + mem_mapping_enable(&ps2.shadow_mapping); + } + + if ((ps2.option[1] & 1) && !(ps2.option[3] & 0x20)) + mem_set_mem_state(mem_size * 1024, 256 * 1024, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL); + else + mem_set_mem_state(mem_size * 1024, 256 * 1024, MEM_READ_EXTERNAL | MEM_WRITE_EXTERNAL); + break; + case 0x106: + ps2.subaddr_lo = val; + break; + case 0x107: + ps2.subaddr_hi = val; + break; + } +} + +static void model_80_write(uint16_t port, uint8_t val) +{ + switch (port) + { + case 0x100: + break; + case 0x101: + break; + case 0x102: + lpt1_remove(); + serial1_remove(); + if (val & 0x04) + { + if (val & 0x08) + serial1_init(0x3f8, 4); + else + serial1_init(0x2f8, 3); + } + else + serial1_remove(); + if (val & 0x10) + { + switch ((val >> 5) & 3) + { + case 0: + lpt1_init(0x3bc); + break; + case 1: + lpt1_init(0x378); + break; + case 2: + lpt1_init(0x278); + break; + } + } + ps2.option[0] = val; + break; + case 0x103: + ps2.option[1] = (ps2.option[1] & 0x0f) | (val & 0xf0); + break; + case 0x104: + ps2.option[2] = val; + break; + case 0x105: + ps2.option[3] = val; + break; + case 0x106: + ps2.subaddr_lo = val; + break; + case 0x107: + ps2.subaddr_hi = val; + break; + } +} + +uint8_t ps2_mca_read(uint16_t port, void *p) +{ + uint8_t temp; + + switch (port) + { + case 0x91: + fatal("Read 91 setup=%02x adapter=%02x\n", ps2.setup, ps2.adapter_setup); + case 0x92: + temp = ps2.sys_ctrl_port_a; + break; + case 0x94: + temp = ps2.setup; + break; + case 0x96: + temp = ps2.adapter_setup | 0x70; + break; + case 0x100: + if (!(ps2.setup & PS2_SETUP_IO)) + temp = ps2.planar_read(port); + else if (!(ps2.setup & PS2_SETUP_VGA)) + temp = 0xfd; + else if (ps2.adapter_setup & PS2_ADAPTER_SETUP) + temp = mca_read(port); + else + temp = 0xff; + break; + case 0x101: + if (!(ps2.setup & PS2_SETUP_IO)) + temp = ps2.planar_read(port); + else if (!(ps2.setup & PS2_SETUP_VGA)) + temp = 0xef; + else if (ps2.adapter_setup & PS2_ADAPTER_SETUP) + temp = mca_read(port); + else + temp = 0xff; + break; + case 0x102: + if (!(ps2.setup & PS2_SETUP_IO)) + temp = ps2.planar_read(port); + else if (!(ps2.setup & PS2_SETUP_VGA)) + temp = ps2.pos_vga; + else if (ps2.adapter_setup & PS2_ADAPTER_SETUP) + temp = mca_read(port); + else + temp = 0xff; + break; + case 0x103: + if (!(ps2.setup & PS2_SETUP_IO)) + temp = ps2.planar_read(port); + else if ((ps2.setup & PS2_SETUP_VGA) && (ps2.adapter_setup & PS2_ADAPTER_SETUP)) + temp = mca_read(port); + else + temp = 0xff; + break; + case 0x104: + if (!(ps2.setup & PS2_SETUP_IO)) + temp = ps2.planar_read(port); + else if ((ps2.setup & PS2_SETUP_VGA) && (ps2.adapter_setup & PS2_ADAPTER_SETUP)) + temp = mca_read(port); + else + temp = 0xff; + break; + case 0x105: + if (!(ps2.setup & PS2_SETUP_IO)) + temp = ps2.planar_read(port); + else if ((ps2.setup & PS2_SETUP_VGA) && (ps2.adapter_setup & PS2_ADAPTER_SETUP)) + temp = mca_read(port); + else + temp = 0xff; + break; + case 0x106: + if (!(ps2.setup & PS2_SETUP_IO)) + temp = ps2.planar_read(port); + else if ((ps2.setup & PS2_SETUP_VGA) && (ps2.adapter_setup & PS2_ADAPTER_SETUP)) + temp = mca_read(port); + else + temp = 0xff; + break; + case 0x107: + if (!(ps2.setup & PS2_SETUP_IO)) + temp = ps2.planar_read(port); + else if ((ps2.setup & PS2_SETUP_VGA) && (ps2.adapter_setup & PS2_ADAPTER_SETUP)) + temp = mca_read(port); + else + temp = 0xff; + break; + + default: + temp = 0xff; + break; + } + + pclog("ps2_read: port=%04x temp=%02x\n", port, temp); + + return temp; +} + +static void ps2_mca_write(uint16_t port, uint8_t val, void *p) +{ + pclog("ps2_write: port=%04x val=%02x %04x:%04x\n", port, val, CS,cpu_state.pc); + + switch (port) + { + case 0x0092: + if ((val & 1) && !(ps2.sys_ctrl_port_a & 1)) + { + softresetx86(); + cpu_set_edx(); + } + ps2.sys_ctrl_port_a = val; + mem_a20_alt = val & 2; + mem_a20_recalc(); + break; + case 0x94: + ps2.setup = val; + break; + case 0x96: + ps2.adapter_setup = val; + mca_set_index(val & 7); + break; + case 0x100: + if (!(ps2.setup & PS2_SETUP_IO)) + ps2.planar_write(port, val); + else if ((ps2.setup & PS2_SETUP_VGA) && (ps2.adapter_setup & PS2_ADAPTER_SETUP)) + mca_write(port, val); + break; + case 0x101: + if (!(ps2.setup & PS2_SETUP_IO)) + ps2.planar_write(port, val); + else if ((ps2.setup & PS2_SETUP_VGA) && (ps2.setup & PS2_SETUP_VGA) && (ps2.adapter_setup & PS2_ADAPTER_SETUP)) + mca_write(port, val); + break; + case 0x102: + if (!(ps2.setup & PS2_SETUP_IO)) + ps2.planar_write(port, val); + else if (!(ps2.setup & PS2_SETUP_VGA)) + ps2.pos_vga = val; + else if (ps2.adapter_setup & PS2_ADAPTER_SETUP) + mca_write(port, val); + break; + case 0x103: + if (!(ps2.setup & PS2_SETUP_IO)) + ps2.planar_write(port, val); + else if (ps2.adapter_setup & PS2_ADAPTER_SETUP) + mca_write(port, val); + break; + case 0x104: + if (!(ps2.setup & PS2_SETUP_IO)) + ps2.planar_write(port, val); + else if (ps2.adapter_setup & PS2_ADAPTER_SETUP) + mca_write(port, val); + break; + case 0x105: + if (!(ps2.setup & PS2_SETUP_IO)) + ps2.planar_write(port, val); + else if (ps2.adapter_setup & PS2_ADAPTER_SETUP) + mca_write(port, val); + break; + case 0x106: + if (!(ps2.setup & PS2_SETUP_IO)) + ps2.planar_write(port, val); + else if (ps2.adapter_setup & PS2_ADAPTER_SETUP) + mca_write(port, val); + break; + case 0x107: + if (!(ps2.setup & PS2_SETUP_IO)) + ps2.planar_write(port, val); + else if (ps2.adapter_setup & PS2_ADAPTER_SETUP) + mca_write(port, val); + break; + } +} + +static void ps2_mca_board_common_init() +{ + io_sethandler(0x0091, 0x0002, ps2_mca_read, NULL, NULL, ps2_mca_write, NULL, NULL, NULL); + io_sethandler(0x0094, 0x0001, ps2_mca_read, NULL, NULL, ps2_mca_write, NULL, NULL, NULL); + io_sethandler(0x0096, 0x0001, ps2_mca_read, NULL, NULL, ps2_mca_write, NULL, NULL, NULL); + io_sethandler(0x0100, 0x0008, ps2_mca_read, NULL, NULL, ps2_mca_write, NULL, NULL, NULL); + + ps2.setup = 0xff; + + lpt1_remove(); + lpt2_remove(); + lpt1_init(0x3bc); + + serial1_remove(); + serial2_remove(); +} + +void ps2_mca_board_model_50_init() +{ + ps2_mca_board_common_init(); + + mem_remap_top_384k(); + mca_init(4); + + ps2.planar_read = model_50_read; + ps2.planar_write = model_50_write; +} + +void ps2_mca_board_model_55sx_init() +{ + ps2_mca_board_common_init(); + + mem_mapping_add(&ps2.shadow_mapping, + (mem_size+256) * 1024, + 128*1024, + ps2_read_shadow_ram, + ps2_read_shadow_ramw, + ps2_read_shadow_raml, + ps2_write_shadow_ram, + ps2_write_shadow_ramw, + ps2_write_shadow_raml, + &ram[0xe0000], + MEM_MAPPING_INTERNAL, + NULL); + + + mem_remap_top_256k(); + ps2.option[3] = 0x10; + + memset(ps2.memory_bank, 0xf0, 8); + switch (mem_size/1024) + { + case 1: + ps2.memory_bank[0] = 0x61; + break; + case 2: + ps2.memory_bank[0] = 0x51; + break; + case 3: + ps2.memory_bank[0] = 0x51; + ps2.memory_bank[1] = 0x61; + break; + case 4: + ps2.memory_bank[0] = 0x51; + ps2.memory_bank[1] = 0x51; + break; + case 5: + ps2.memory_bank[0] = 0x01; + ps2.memory_bank[1] = 0x61; + break; + case 6: + ps2.memory_bank[0] = 0x01; + ps2.memory_bank[1] = 0x51; + break; + case 7: /*Not supported*/ + ps2.memory_bank[0] = 0x01; + ps2.memory_bank[1] = 0x51; + break; + case 8: + ps2.memory_bank[0] = 0x01; + ps2.memory_bank[1] = 0x01; + break; + } + + mca_init(4); + + ps2.planar_read = model_55sx_read; + ps2.planar_write = model_55sx_write; +} + +static void mem_encoding_update() +{ + if (ps2.split_addr >= mem_size*1024) + mem_mapping_disable(&ps2.split_mapping); + + ps2.split_addr = (ps2.mem_regs[0] & 0xf) << 20; + + if (ps2.mem_regs[1] & 2) + mem_set_mem_state(0xe0000, 0x20000, MEM_READ_EXTERNAL | MEM_WRITE_INTERNAL); + else + mem_set_mem_state(0xe0000, 0x20000, MEM_READ_INTERNAL | MEM_WRITE_DISABLED); + + if (!(ps2.mem_regs[1] & 8)) + { + if (ps2.split_addr >= mem_size*1024) + mem_mapping_set_addr(&ps2.split_mapping, ps2.split_addr, 256*1024); + } +} + +static uint8_t mem_encoding_read(uint16_t addr, void *p) +{ + switch (addr) + { + case 0xe0: + return ps2.mem_regs[0]; + case 0xe1: + return ps2.mem_regs[1]; + } + return 0xff; +} +static void mem_encoding_write(uint16_t addr, uint8_t val, void *p) +{ + switch (addr) + { + case 0xe0: + ps2.mem_regs[0] = val; + break; + case 0xe1: + ps2.mem_regs[1] = val; + break; + } + mem_encoding_update(); +} + +static uint8_t ps2_mem_expansion_read(int port, void *p) +{ + return ps2.mem_pos_regs[port & 7]; +} + +static void ps2_mem_expansion_write(int port, uint8_t val, void *p) +{ + if (port < 0x102 || port == 0x104) + return; + + ps2.mem_pos_regs[port & 7] = val; + + if (ps2.mem_pos_regs[2] & 1) + mem_mapping_enable(&ps2.expansion_mapping); + else + mem_mapping_disable(&ps2.expansion_mapping); +} + +void ps2_mca_board_model_80_type2_init() +{ + ps2_mca_board_common_init(); + + mem_remap_top_256k(); + ps2.split_addr = mem_size * 1024; + mca_init(8); + + ps2.planar_read = model_80_read; + ps2.planar_write = model_80_write; + + device_add(&ps2_nvr_device); + + io_sethandler(0x00e0, 0x0002, mem_encoding_read, NULL, NULL, mem_encoding_write, NULL, NULL, NULL); + + ps2.mem_regs[1] = 2; + + switch (mem_size/1024) + { + case 1: + ps2.option[1] = 0x0c; + break; + case 2: + ps2.option[1] = 0x0e; + break; + case 3: + ps2.option[1] = 0x02; + break; + case 4: + default: + ps2.option[1] = 0x0a; + break; + } + + mem_mapping_add(&ps2.split_mapping, + (mem_size+256) * 1024, + 256*1024, + ps2_read_split_ram, + ps2_read_split_ramw, + ps2_read_split_raml, + ps2_write_split_ram, + ps2_write_split_ramw, + ps2_write_split_raml, + &ram[0xa0000], + MEM_MAPPING_INTERNAL, + NULL); + mem_mapping_disable(&ps2.split_mapping); + + if (mem_size > 4096) + { + /* Only 4 MB supported on planar, create a memory expansion card for the rest */ + mem_mapping_set_addr(&ram_high_mapping, 0x100000, 0x300000); + + ps2.mem_pos_regs[0] = 0xff; + ps2.mem_pos_regs[1] = 0xfc; + + switch (mem_size/1024) + { + case 5: + ps2.mem_pos_regs[4] = 0xfc; + break; + case 6: + ps2.mem_pos_regs[4] = 0xfe; + break; + case 7: + ps2.mem_pos_regs[4] = 0xf2; + break; + case 8: + ps2.mem_pos_regs[4] = 0xfa; + break; + case 9: + ps2.mem_pos_regs[4] = 0xca; + break; + case 10: + ps2.mem_pos_regs[4] = 0xea; + break; + case 11: + ps2.mem_pos_regs[4] = 0x2a; + break; + case 12: + ps2.mem_pos_regs[4] = 0xaa; + break; + } + + mca_add(ps2_mem_expansion_read, ps2_mem_expansion_write, NULL); + mem_mapping_add(&ps2.expansion_mapping, + 0x400000, + (mem_size - 4096)*1024, + mem_read_ram, + mem_read_ramw, + mem_read_raml, + mem_write_ram, + mem_write_ramw, + mem_write_raml, + &ram[0x400000], + MEM_MAPPING_INTERNAL, + NULL); + mem_mapping_disable(&ps2.expansion_mapping); + } +} diff --git a/src/ps2_mca.h b/src/ps2_mca.h new file mode 100644 index 000000000..8f242257e --- /dev/null +++ b/src/ps2_mca.h @@ -0,0 +1,3 @@ +void ps2_mca_board_model_50_init(); +void ps2_mca_board_model_55sx_init(); +void ps2_mca_board_model_80_type2_init(); diff --git a/src/ps2_nvr.c b/src/ps2_nvr.c new file mode 100644 index 000000000..917b0e786 --- /dev/null +++ b/src/ps2_nvr.c @@ -0,0 +1,100 @@ +#include +#include "ibm.h" +#include "device.h" +#include "io.h" +#include "ps2_nvr.h" + +typedef struct ps2_nvr_t +{ + int addr; + uint8_t ram[8192]; +} ps2_nvr_t; + +static uint8_t ps2_nvr_read(uint16_t port, void *p) +{ + ps2_nvr_t *nvr = (ps2_nvr_t *)p; + + switch (port) + { + case 0x74: + return nvr->addr & 0xff; + case 0x75: + return nvr->addr >> 8; + case 0x76: + return nvr->ram[nvr->addr]; + } + + return 0xff; +} + +static void ps2_nvr_write(uint16_t port, uint8_t val, void *p) +{ + ps2_nvr_t *nvr = (ps2_nvr_t *)p; + + switch (port) + { + case 0x74: + nvr->addr = (nvr->addr & 0x1f00) | val; + break; + case 0x75: + nvr->addr = (nvr->addr & 0xff) | ((val & 0x1f) << 8); + break; + case 0x76: + nvr->ram[nvr->addr] = val; + break; + } +} + +static void *ps2_nvr_init() +{ + ps2_nvr_t *nvr = (ps2_nvr_t *)malloc(sizeof(ps2_nvr_t)); + FILE *f = NULL; + + memset(nvr, 0, sizeof(ps2_nvr_t)); + + io_sethandler(0x0074, 0x0003, ps2_nvr_read, NULL, NULL, ps2_nvr_write, NULL, NULL, nvr); + + switch (romset) + { + case ROM_IBMPS2_M80: f = romfopen("nvr/ibmps2_m80_sec.nvr", "rb"); break; + } + if (f) + { + fread(nvr->ram, 8192, 1, f); + fclose(f); + } + else + memset(nvr->ram, 0xFF, 8192); + + return nvr; +} + +static void ps2_nvr_close(void *p) +{ + ps2_nvr_t *nvr = (ps2_nvr_t *)p; + FILE *f = NULL; + + switch (romset) + { + case ROM_IBMPS2_M80: f = romfopen("nvr/ibmps2_m80_sec.nvr", "wb"); break; + } + if (f) + { + fwrite(nvr->ram, 8192, 1, f); + fclose(f); + } + + free(nvr); +} + +device_t ps2_nvr_device = +{ + "PS/2 NVRRAM", + 0, + ps2_nvr_init, + ps2_nvr_close, + NULL, + NULL, + NULL, + NULL +}; diff --git a/src/ps2_nvr.h b/src/ps2_nvr.h new file mode 100644 index 000000000..1656c82b0 --- /dev/null +++ b/src/ps2_nvr.h @@ -0,0 +1 @@ +extern device_t ps2_nvr_device; diff --git a/src/resource.h b/src/resource.h new file mode 100644 index 000000000..9bfe518b4 --- /dev/null +++ b/src/resource.h @@ -0,0 +1,425 @@ +/* Copyright holders: Tenshi + see COPYING for more details +*/ + +/* {{NO_DEPENDENCIES}} + Microsoft Developer Studio generated include file. + Used by pc_new2.rc +*/ +#define IDHDCONFIG 3 +#define IDCDCONFIG 4 +#define CONFIGUREDLG_MACHINE 101 +#define CONFIGUREDLG_VIDEO 102 +#define CONFIGUREDLG_INPUT 103 +#define CONFIGUREDLG_SOUND 104 +#define CONFIGUREDLG_PERIPHERALS 105 +#define CONFIGUREDLG_HARD_DISKS 106 +#define CONFIGUREDLG_REMOVABLE_DEVICES 107 +#define ABOUTDLG 108 +#define CONFIGUREDLG_HARD_DISKS_ADD 109 +#define CONFIGUREDLG_MAIN 117 +#define IDC_SETTINGSCATLIST 1004 +#define IDC_LIST_HARD_DISKS 1005 +#define IDC_COMBO_MACHINE 1006 +#define IDC_COMBO_CPU_TYPE 1007 +#define IDC_COMBO_CPU 1008 +#define IDC_COMBO_WS 1009 +#define IDC_CHECK_DYNAREC 1010 +#define IDC_CHECK_FPU 1011 +#define IDC_COMBO_SCSI 1012 +#define IDC_CONFIGURE_SCSI 1013 +#define IDC_COMBO_VIDEO 1014 +#define IDC_COMBO_VIDEO_SPEED 1015 +#define IDC_CHECK_VOODOO 1016 +#define IDC_CHECKCMS 1016 +#define IDC_CONFIGURE_VOODOO 1017 +#define IDC_CHECKNUKEDOPL 1018 +#define IDC_COMBO_JOYSTICK 1018 +#define IDC_CHECK_SYNC 1019 +#define IDC_LIST_FLOPPY_DRIVES 1020 +#define IDC_LIST_CDROM_DRIVES 1021 +#define IDC_CONFIGURE_MACHINE 1022 +#define IDC_COMBO_LANG 1023 +#define IDC_BUTTON_FDD_ADD 1024 +#define IDC_BUTTON_FDD_EDIT 1025 +#define IDC_BUTTON_FDD_REMOVE 1026 +#define IDC_BUTTON_CDROM_ADD 1027 +#define IDC_BUTTON_HDD_ADD_NEW 1027 +#define IDC_BUTTON_CDROM_EDIT 1028 +#define IDC_BUTTON_HDD_ADD 1028 +#define IDC_BUTTON_CDROM_REMOVE 1029 +#define IDC_BUTTON_HDD_REMOVE 1029 +#define IDC_HDIMAGE_NEW 1035 +#define IDC_HD_BUS 1036 +#define IDC_HDIMAGE_EXISTING 1037 +#define IDC_COMBO_HD_BUS 1038 +#define IDC_EDIT_HD_FILE_NAME 1039 +#define IDC_EDIT_HD_CYL 1040 +#define IDC_EDIT_HD_HPC 1041 +#define IDC_EDIT_HD_SPT 1042 +#define IDC_EDIT_HD_SIZE 1043 +#define IDC_COMBO_HD_TYPE 1044 +#define IDC_COMBO_HD_LOCATION 1045 +#define IDC_CHECKGUS 1046 +#define IDC_COMBO_HD_CHANNEL 1047 +#define IDC_COMBO_HD_CHANNEL_IDE 1048 +#define IDC_COMBO_HD_ID 1050 +#define IDC_COMBO_HD_LUN 1051 +#define IDC_CHECKBUGGER 1052 +#define IDC_CHECKSERIAL1 1053 +#define IDC_CHECKPARALLEL 1054 +#define IDC_CHECKSERIAL2 1055 +#define IDC_COMBO_HDC 1068 +#define IDC_COMBO_MOUSE 1069 +#define IDC_COMBO_IDE_TER 1069 +#define IDC_COMBO_IDE_QUA 1070 +#define IDC_COMBO_FD_TYPE 1071 +#define IDC_COMBO_CD_BUS 1072 +#define IDC_COMBO_CD_CHANNEL_IDE 1073 +#define IDC_COMBO_CD_ID 1074 +#define IDC_COMBO_CD_LUN 1075 +#define IDC_CHECK_CDROM_1_AUDIO_ENABLED 1584 +#define IDC_CHECK_CDROM_2_AUDIO_ENABLED 1585 +#define IDC_CHECK_CDROM_3_AUDIO_ENABLED 1586 +#define IDC_CHECK_CDROM_4_AUDIO_ENABLED 1587 +#define IDS_STRING2049 2049 +#define IDS_STRING2050 2050 +#define IDS_STRING2051 2051 +#define IDS_STRING2052 2052 +#define IDS_STRING2053 2053 +#define IDS_STRING2054 2054 +#define IDS_STRING2055 2055 +#define IDS_STRING2056 2056 +#define IDS_STRING2057 2057 +#define IDS_STRING2058 2058 +#define IDS_STRING2059 2059 +#define IDS_STRING2060 2060 +#define IDS_STRING2061 2061 +#define IDS_STRING2062 2062 +#define IDS_STRING2063 2063 +#define IDS_STRING2064 2064 +#define IDS_STRING2065 2065 +#define IDS_STRING2066 2066 +#define IDS_STRING2067 2067 +#define IDS_STRING2068 2068 +#define IDS_STRING2069 2069 +#define IDS_STRING2070 2070 +#define IDS_STRING2071 2071 +#define IDS_STRING2072 2072 +#define IDS_STRING2073 2073 +#define IDS_STRING2074 2074 +#define IDS_STRING2075 2075 +#define IDS_STRING2076 2076 +#define IDS_STRING2077 2077 +#define IDS_STRING2078 2078 +#define IDS_STRING2079 2079 +#define IDM_ABOUT 40001 +#define IDC_ABOUT_ICON 65535 + +#define IDM_DISC_1 40000 +#define IDM_DISC_2 40001 +#define IDM_DISC_3 40002 +#define IDM_DISC_4 40003 +#define IDM_DISC_1_WP 40004 +#define IDM_DISC_2_WP 40005 +#define IDM_DISC_3_WP 40006 +#define IDM_DISC_4_WP 40007 +#define IDM_EJECT_1 40008 +#define IDM_EJECT_2 40009 +#define IDM_EJECT_3 40010 +#define IDM_EJECT_4 40011 + +#define IDM_FILE_RESET 40015 +#define IDM_FILE_HRESET 40016 +#define IDM_FILE_EXIT 40017 +#define IDM_FILE_RESET_CAD 40018 +#define IDM_HDCONF 40019 +#define IDM_CONFIG 40020 +#define IDM_CONFIG_LOAD 40021 +#define IDM_CONFIG_SAVE 40022 +#define IDM_USE_NUKEDOPL 40023 +#define IDM_STATUS 40030 +#define IDM_VID_RESIZE 40050 +#define IDM_VID_REMEMBER 40051 +#define IDM_VID_DDRAW 40060 +#define IDM_VID_D3D 40061 +#define IDM_VID_SCALE_1X 40064 +#define IDM_VID_SCALE_2X 40065 +#define IDM_VID_SCALE_3X 40066 +#define IDM_VID_SCALE_4X 40067 +#define IDM_VID_FULLSCREEN 40070 +#define IDM_VID_FS_FULL 40071 +#define IDM_VID_FS_43 40072 +#define IDM_VID_FS_SQ 40073 +#define IDM_VID_FS_INT 40074 +#define IDM_VID_FORCE43 40075 +#define IDM_VID_OVERSCAN 40076 +#define IDM_VID_FLASH 40077 +#define IDM_VID_SCREENSHOT 40078 +#define IDM_VID_INVERT 40079 + +#define IDM_CDROM_1_MUTE 40128 +#define IDM_CDROM_1_ISO 40144 +#define IDM_CDROM_1_RELOAD 40160 +#define IDM_CDROM_1_EMPTY 40176 +#define IDM_CDROM_1_REAL 40192 +#define IDM_CDROM_2_MUTE 40129 +#define IDM_CDROM_2_ISO 40145 +#define IDM_CDROM_2_RELOAD 40161 +#define IDM_CDROM_2_EMPTY 40177 +#define IDM_CDROM_2_REAL 40193 +#define IDM_CDROM_3_MUTE 40130 +#define IDM_CDROM_3_ISO 40146 +#define IDM_CDROM_3_RELOAD 40162 +#define IDM_CDROM_3_EMPTY 40178 +#define IDM_CDROM_3_REAL 40194 +#define IDM_CDROM_4_MUTE 40131 +#define IDM_CDROM_4_ISO 40147 +#define IDM_CDROM_4_RELOAD 40163 +#define IDM_CDROM_4_EMPTY 40179 +#define IDM_CDROM_4_REAL 40195 + +#define IDM_IDE_TER_ENABLED 44000 +#define IDM_IDE_TER_IRQ9 44009 +#define IDM_IDE_TER_IRQ10 44010 +#define IDM_IDE_TER_IRQ11 44011 +#define IDM_IDE_TER_IRQ12 44012 +#define IDM_IDE_TER_IRQ14 44014 +#define IDM_IDE_TER_IRQ15 44015 +#define IDM_IDE_QUA_ENABLED 44020 +#define IDM_IDE_QUA_IRQ9 44029 +#define IDM_IDE_QUA_IRQ10 44030 +#define IDM_IDE_QUA_IRQ11 44031 +#define IDM_IDE_QUA_IRQ12 44032 +#define IDM_IDE_QUA_IRQ14 44033 +#define IDM_IDE_QUA_IRQ15 44035 + +#ifdef ENABLE_LOG_TOGGLES +#ifdef ENABLE_BUSLOGIC_LOG +#define IDM_LOG_BUSLOGIC 51200 +#endif +#ifdef ENABLE_CDROM_LOG +#define IDM_LOG_CDROM 51201 +#endif +#ifdef ENABLE_D86F_LOG +#define IDM_LOG_D86F 51202 +#endif +#ifdef ENABLE_FDC_LOG +#define IDM_LOG_FDC 51203 +#endif +#ifdef ENABLE_IDE_LOG +#define IDM_LOG_IDE 51204 +#endif +#ifdef ENABLE_NE2000_LOG +#define IDM_LOG_NE2000 51205 +#endif +#endif +#ifdef ENABLE_LOG_BREAKPOINT +#define IDM_LOG_BREAKPOINT 51206 +#endif + +#define IDC_COMBO1 1000 +#define IDC_COMBOVID 1001 +#define IDC_COMBO3 1002 +#define IDC_COMBO4 1003 +#define IDC_COMBO5 1004 +#define IDC_COMBO386 1005 +#define IDC_COMBO486 1006 +#define IDC_COMBOSND 1007 +#define IDC_COMBONET 1008 +#define IDC_COMBOCPUM 1060 +#define IDC_COMBOSPD 1061 +#define IDC_COMBODR1 1062 +#define IDC_COMBODR2 1063 +#define IDC_COMBODR3 1064 +#define IDC_COMBODR4 1065 +#define IDC_COMBOJOY 1066 +#define IDC_COMBOWS 1067 +#define IDC_COMBOMOUSE 1068 +#define IDC_COMBOHDD 1069 +#define IDC_CHECK1 1010 +#define IDC_CHECK2 1011 +#define IDC_CHECK3 1012 +#define IDC_CHECKSSI 1014 +#define IDC_CHECKVOODOO 1015 +#define IDC_CHECKDYNAREC 1016 +#define IDC_CHECKBUSLOGIC 1017 +#define IDC_CHECKSYNC 1024 +#define IDC_CHECKXTIDE 1025 +#define IDC_CHECKFPU 1026 +#define IDC_EDIT1 1030 +#define IDC_EDIT2 1031 +#define IDC_EDIT3 1032 +#define IDC_EDIT4 1033 +#define IDC_EDIT5 1034 +#define IDC_EDIT6 1035 +#define IDC_COMBOHDT 1036 + +#define IDC_EJECTC 1040 +#define IDC_EDITC 1050 +#define IDC_CFILE 1060 +#define IDC_CNEW 1070 +#define IDC_EDIT_C_SPT 1200 +#define IDC_EDIT_C_HPC 1210 +#define IDC_EDIT_C_CYL 1220 +#define IDC_EDIT_C_FN 1230 +#define IDC_TEXT_C_SIZE 1240 + +#define IDC_EJECTD 1041 +#define IDC_EDITD 1051 +#define IDC_DFILE 1061 +#define IDC_DNEW 1071 +#define IDC_EDIT_D_SPT 1201 +#define IDC_EDIT_D_HPC 1211 +#define IDC_EDIT_D_CYL 1221 +#define IDC_EDIT_D_FN 1231 +#define IDC_TEXT_D_SIZE 1241 + +#define IDC_EJECTE 1042 +#define IDC_EDITE 1052 +#define IDC_EFILE 1062 +#define IDC_ENEW 1072 +#define IDC_EDIT_E_SPT 1202 +#define IDC_EDIT_E_HPC 1212 +#define IDC_EDIT_E_CYL 1222 +#define IDC_EDIT_E_FN 1232 +#define IDC_TEXT_E_SIZE 1242 + +#define IDC_EJECTF 1043 +#define IDC_EDITF 1053 +#define IDC_FFILE 1063 +#define IDC_FNEW 1073 +#define IDC_EDIT_F_SPT 1203 +#define IDC_EDIT_F_HPC 1213 +#define IDC_EDIT_F_CYL 1223 +#define IDC_EDIT_F_FN 1233 +#define IDC_TEXT_F_SIZE 1243 + +#define IDC_EJECTG 1044 +#define IDC_EDITG 1054 +#define IDC_GFILE 1064 +#define IDC_GNEW 1074 +#define IDC_EDIT_G_SPT 1204 +#define IDC_EDIT_G_HPC 1214 +#define IDC_EDIT_G_CYL 1224 +#define IDC_EDIT_G_FN 1234 +#define IDC_TEXT_G_SIZE 1244 + +#define IDC_EJECTH 1045 +#define IDC_EDITH 1055 +#define IDC_HFILE 1065 +#define IDC_HNEW 1075 +#define IDC_EDIT_H_SPT 1205 +#define IDC_EDIT_H_HPC 1215 +#define IDC_EDIT_H_CYL 1225 +#define IDC_EDIT_H_FN 1235 +#define IDC_TEXT_H_SIZE 1245 + +#define IDC_EJECTI 1046 +#define IDC_EDITI 1056 +#define IDC_IFILE 1066 +#define IDC_INEW 1076 +#define IDC_EDIT_I_SPT 1206 +#define IDC_EDIT_I_HPC 1216 +#define IDC_EDIT_I_CYL 1226 +#define IDC_EDIT_I_FN 1236 +#define IDC_TEXT_I_SIZE 1246 + +#define IDC_EJECTJ 1047 +#define IDC_EDITJ 1057 +#define IDC_JFILE 1067 +#define IDC_JNEW 1077 +#define IDC_EDIT_J_SPT 1207 +#define IDC_EDIT_J_HPC 1217 +#define IDC_EDIT_J_CYL 1227 +#define IDC_EDIT_J_FN 1237 +#define IDC_TEXT_J_SIZE 1247 + +#define IDC_HDTYPE 1280 + +#define IDC_RENDER 1281 +#define IDC_STATUS 1282 + +#define IDC_MEMSPIN 1100 +#define IDC_MEMTEXT 1101 +#define IDC_STEXT1 1102 +#define IDC_STEXT2 1103 +#define IDC_STEXT3 1104 +#define IDC_STEXT4 1105 +#define IDC_STEXT5 1106 +#define IDC_STEXT6 1107 +#define IDC_STEXT7 1108 +#define IDC_STEXT8 1109 +#define IDC_STEXT_DEVICE 1110 +#define IDC_TEXT_MB 1111 +#define IDC_TEXT1 1115 +#define IDC_TEXT2 1116 + +#define IDC_CONFIGUREVID 1200 +#define IDC_CONFIGURESND 1201 +#define IDC_CONFIGUREVOODOO 1202 +#define IDC_CONFIGUREMOD 1203 +#define IDC_CONFIGURENET 1204 +#define IDC_CONFIGUREBUSLOGIC 1205 +#define IDC_JOY1 1210 +#define IDC_JOY2 1211 +#define IDC_JOY3 1212 +#define IDC_JOY4 1213 + +#define IDC_CONFIG_BASE 1200 + +#define WM_RESETD3D WM_USER +#define WM_LEAVEFULLSCREEN WM_USER + 1 + +#define C_BASE 6 +#define D_BASE 44 +#define E_BASE 82 +#define F_BASE 120 +#define G_BASE 158 +#define H_BASE 196 +#define I_BASE 234 +#define J_BASE 272 +#define CMD_BASE 314 +#define DLG_HEIGHT 346 + +#define IDC_CHECK_CDROM_1_ENABLED 1536 +#define IDC_COMBO_CDROM_1_BUS 1544 +#define IDC_COMBO_CDROM_1_CHANNEL 1552 +#define IDC_CHECK_CDROM_1_DMA_ENABLED 1560 +#define IDC_COMBO_CDROM_1_SCSI_ID 1568 +#define IDC_COMBO_CDROM_1_SCSI_LUN 1576 + +#define IDC_CHECK_CDROM_2_ENABLED 1537 +#define IDC_COMBO_CDROM_2_BUS 1545 +#define IDC_COMBO_CDROM_2_CHANNEL 1553 +#define IDC_CHECK_CDROM_2_DMA_ENABLED 1561 +#define IDC_COMBO_CDROM_2_SCSI_ID 1569 +#define IDC_COMBO_CDROM_2_SCSI_LUN 1577 + +#define IDC_CHECK_CDROM_3_ENABLED 1538 +#define IDC_COMBO_CDROM_3_BUS 1546 +#define IDC_COMBO_CDROM_3_CHANNEL 1554 +#define IDC_CHECK_CDROM_3_DMA_ENABLED 1562 +#define IDC_COMBO_CDROM_3_SCSI_ID 1570 +#define IDC_COMBO_CDROM_3_SCSI_LUN 1578 + +#define IDC_CHECK_CDROM_4_ENABLED 1539 +#define IDC_COMBO_CDROM_4_BUS 1547 +#define IDC_COMBO_CDROM_4_CHANNEL 1555 +#define IDC_CHECK_CDROM_4_DMA_ENABLED 1563 +#define IDC_COMBO_CDROM_4_SCSI_ID 1571 +#define IDC_COMBO_CDROM_4_SCSI_LUN 1579 + +#define IDC_STATIC 1792 + +/* Next default values for new objects */ + +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 110 +#define _APS_NEXT_COMMAND_VALUE 40002 +#define _APS_NEXT_CONTROL_VALUE 1055 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/resources.h b/src/resources.h deleted file mode 100644 index 4df7017c2..000000000 --- a/src/resources.h +++ /dev/null @@ -1,399 +0,0 @@ -/* Copyright holders: Sarah Walker, Tenshi - see COPYING for more details -*/ -#define IDM_FILE_RESET 40000 -#define IDM_FILE_HRESET 40001 -#define IDM_FILE_EXIT 40002 -#define IDM_FILE_RESET_CAD 40003 -#define IDM_DISC_1 40010 -#define IDM_DISC_2 40011 -#define IDM_EJECT_1 40012 -#define IDM_EJECT_2 40013 -#define IDM_HDCONF 40014 -#define IDM_DISC_1_WP 40015 -#define IDM_DISC_2_WP 40016 -#define IDM_CONFIG 40020 -#define IDM_CONFIG_LOAD 40021 -#define IDM_CONFIG_SAVE 40022 -#define IDM_USE_NUKEDOPL 40023 -#define IDM_STATUS 40030 -#define IDM_VID_RESIZE 40050 -#define IDM_VID_REMEMBER 40051 -#define IDM_VID_DDRAW 40060 -#define IDM_VID_D3D 40061 -#define IDM_VID_SCALE_1X 40064 -#define IDM_VID_SCALE_2X 40065 -#define IDM_VID_SCALE_3X 40066 -#define IDM_VID_SCALE_4X 40067 -#define IDM_VID_FULLSCREEN 40070 -#define IDM_VID_FS_FULL 40071 -#define IDM_VID_FS_43 40072 -#define IDM_VID_FS_SQ 40073 -#define IDM_VID_FS_INT 40074 -#define IDM_VID_FORCE43 40075 -#define IDM_VID_OVERSCAN 40076 -#define IDM_VID_FLASH 40077 -#define IDM_VID_SCREENSHOT 40078 -#define IDM_VID_INVERT 40079 -#define IDM_DISC_3 40081 -#define IDM_DISC_4 40082 -#define IDM_EJECT_3 40083 -#define IDM_EJECT_4 40084 -#define IDM_DISC_3_WP 40085 -#define IDM_DISC_4_WP 40086 -#define IDM_CDROM_1_ISO 40100 -#define IDM_CDROM_1_RELOAD 40101 -#define IDM_CDROM_1_EMPTY 40200 -#define IDM_CDROM_1_REAL 40200 -#define IDM_CDROM_1_ENABLED 40300 -#define IDM_CDROM_1_SOUND_ON 40400 -#define IDM_CDROM_1_SCSI 40500 -#define IDM_CDROM_1_DMA 40501 -#define IDM_CDROM_1_C 40600 -#define IDM_CDROM_1_D 40601 -#define IDM_CDROM_1_E 40602 -#define IDM_CDROM_1_F 40603 -#define IDM_CDROM_1_G 40604 -#define IDM_CDROM_1_H 40605 -#define IDM_CDROM_1_I 40606 -#define IDM_CDROM_1_J 40607 -#define IDM_CDROM_1_0 40700 -#define IDM_CDROM_1_1 40701 -#define IDM_CDROM_1_2 40702 -#define IDM_CDROM_1_3 40703 -#define IDM_CDROM_1_4 40704 -#define IDM_CDROM_1_5 40705 -#define IDM_CDROM_1_6 40706 -#define IDM_CDROM_1_8 40708 -#define IDM_CDROM_1_9 40709 -#define IDM_CDROM_1_10 40710 -#define IDM_CDROM_1_11 40711 -#define IDM_CDROM_1_12 40712 -#define IDM_CDROM_1_13 40713 -#define IDM_CDROM_1_14 40714 -#define IDM_CDROM_1_15 40715 -#define IDM_CDROM_1_LUN_0 40800 -#define IDM_CDROM_1_LUN_1 40801 -#define IDM_CDROM_1_LUN_2 40802 -#define IDM_CDROM_1_LUN_3 40803 -#define IDM_CDROM_1_LUN_4 40804 -#define IDM_CDROM_1_LUN_5 40805 -#define IDM_CDROM_1_LUN_6 40806 -#define IDM_CDROM_1_LUN_7 40807 -#define IDM_CDROM_2_ISO 41100 -#define IDM_CDROM_2_RELOAD 41101 -#define IDM_CDROM_2_EMPTY 41200 -#define IDM_CDROM_2_REAL 41200 -#define IDM_CDROM_2_ENABLED 41300 -#define IDM_CDROM_2_SOUND_ON 41400 -#define IDM_CDROM_2_SCSI 41500 -#define IDM_CDROM_2_DMA 41501 -#define IDM_CDROM_2_C 41600 -#define IDM_CDROM_2_D 41601 -#define IDM_CDROM_2_E 41602 -#define IDM_CDROM_2_F 41603 -#define IDM_CDROM_2_G 41604 -#define IDM_CDROM_2_H 41605 -#define IDM_CDROM_2_I 41606 -#define IDM_CDROM_2_J 41607 -#define IDM_CDROM_2_0 41700 -#define IDM_CDROM_2_1 41701 -#define IDM_CDROM_2_2 41702 -#define IDM_CDROM_2_3 41703 -#define IDM_CDROM_2_4 41704 -#define IDM_CDROM_2_5 41705 -#define IDM_CDROM_2_6 41706 -#define IDM_CDROM_2_8 41708 -#define IDM_CDROM_2_9 41709 -#define IDM_CDROM_2_10 41710 -#define IDM_CDROM_2_11 41711 -#define IDM_CDROM_2_12 41712 -#define IDM_CDROM_2_13 41713 -#define IDM_CDROM_2_14 41714 -#define IDM_CDROM_2_15 41715 -#define IDM_CDROM_2_LUN_0 41800 -#define IDM_CDROM_2_LUN_1 41801 -#define IDM_CDROM_2_LUN_2 41802 -#define IDM_CDROM_2_LUN_3 41803 -#define IDM_CDROM_2_LUN_4 41804 -#define IDM_CDROM_2_LUN_5 41805 -#define IDM_CDROM_2_LUN_6 41806 -#define IDM_CDROM_2_LUN_7 41807 -#define IDM_CDROM_3_ISO 42100 -#define IDM_CDROM_3_RELOAD 42101 -#define IDM_CDROM_3_EMPTY 42200 -#define IDM_CDROM_3_REAL 42200 -#define IDM_CDROM_3_ENABLED 42300 -#define IDM_CDROM_3_SOUND_ON 42400 -#define IDM_CDROM_3_SCSI 42500 -#define IDM_CDROM_3_DMA 42501 -#define IDM_CDROM_3_C 42600 -#define IDM_CDROM_3_D 42601 -#define IDM_CDROM_3_E 42602 -#define IDM_CDROM_3_F 42603 -#define IDM_CDROM_3_G 42604 -#define IDM_CDROM_3_H 42605 -#define IDM_CDROM_3_I 42606 -#define IDM_CDROM_3_J 42607 -#define IDM_CDROM_3_0 42700 -#define IDM_CDROM_3_1 42701 -#define IDM_CDROM_3_2 42702 -#define IDM_CDROM_3_3 42703 -#define IDM_CDROM_3_4 42704 -#define IDM_CDROM_3_5 42705 -#define IDM_CDROM_3_6 42706 -#define IDM_CDROM_3_8 42708 -#define IDM_CDROM_3_9 42709 -#define IDM_CDROM_3_10 42710 -#define IDM_CDROM_3_11 42711 -#define IDM_CDROM_3_12 42712 -#define IDM_CDROM_3_13 42713 -#define IDM_CDROM_3_14 42714 -#define IDM_CDROM_3_15 42715 -#define IDM_CDROM_3_LUN_0 42800 -#define IDM_CDROM_3_LUN_1 42801 -#define IDM_CDROM_3_LUN_2 42802 -#define IDM_CDROM_3_LUN_3 42803 -#define IDM_CDROM_3_LUN_4 42804 -#define IDM_CDROM_3_LUN_5 42805 -#define IDM_CDROM_3_LUN_6 42806 -#define IDM_CDROM_3_LUN_7 42807 -#define IDM_CDROM_4_ISO 43100 -#define IDM_CDROM_4_RELOAD 43101 -#define IDM_CDROM_4_EMPTY 43200 -#define IDM_CDROM_4_REAL 43200 -#define IDM_CDROM_4_ENABLED 43300 -#define IDM_CDROM_4_SOUND_ON 43400 -#define IDM_CDROM_4_SCSI 43500 -#define IDM_CDROM_4_DMA 43501 -#define IDM_CDROM_4_C 43600 -#define IDM_CDROM_4_D 43601 -#define IDM_CDROM_4_E 43602 -#define IDM_CDROM_4_F 43603 -#define IDM_CDROM_4_G 43604 -#define IDM_CDROM_4_H 43605 -#define IDM_CDROM_4_I 43606 -#define IDM_CDROM_4_J 43607 -#define IDM_CDROM_4_0 43700 -#define IDM_CDROM_4_1 43701 -#define IDM_CDROM_4_2 43702 -#define IDM_CDROM_4_3 43703 -#define IDM_CDROM_4_4 43704 -#define IDM_CDROM_4_5 43705 -#define IDM_CDROM_4_6 43706 -#define IDM_CDROM_4_8 43708 -#define IDM_CDROM_4_9 43709 -#define IDM_CDROM_4_10 43710 -#define IDM_CDROM_4_11 43711 -#define IDM_CDROM_4_12 43712 -#define IDM_CDROM_4_13 43713 -#define IDM_CDROM_4_14 43714 -#define IDM_CDROM_4_15 43715 -#define IDM_CDROM_4_LUN_0 43800 -#define IDM_CDROM_4_LUN_1 43801 -#define IDM_CDROM_4_LUN_2 43802 -#define IDM_CDROM_4_LUN_3 43803 -#define IDM_CDROM_4_LUN_4 43804 -#define IDM_CDROM_4_LUN_5 43805 -#define IDM_CDROM_4_LUN_6 43806 -#define IDM_CDROM_4_LUN_7 43807 -#define IDM_IDE_TER_ENABLED 44000 -#define IDM_IDE_TER_IRQ9 44009 -#define IDM_IDE_TER_IRQ10 44010 -#define IDM_IDE_TER_IRQ11 44011 -#define IDM_IDE_TER_IRQ12 44012 -#define IDM_IDE_TER_IRQ14 44014 -#define IDM_IDE_TER_IRQ15 44015 -#define IDM_IDE_QUA_ENABLED 44020 -#define IDM_IDE_QUA_IRQ9 44029 -#define IDM_IDE_QUA_IRQ10 44030 -#define IDM_IDE_QUA_IRQ11 44031 -#define IDM_IDE_QUA_IRQ12 44032 -#define IDM_IDE_QUA_IRQ14 44033 -#define IDM_IDE_QUA_IRQ15 44035 -#ifdef ENABLE_LOG_TOGGLES -#ifdef ENABLE_BUSLOGIC_LOG -#define IDM_LOG_BUSLOGIC 51200 -#endif -#ifdef ENABLE_CDROM_LOG -#define IDM_LOG_CDROM 51201 -#endif -#ifdef ENABLE_D86F_LOG -#define IDM_LOG_D86F 51202 -#endif -#ifdef ENABLE_FDC_LOG -#define IDM_LOG_FDC 51203 -#endif -#ifdef ENABLE_IDE_LOG -#define IDM_LOG_IDE 51204 -#endif -#ifdef ENABLE_NE2000_LOG -#define IDM_LOG_NE2000 51205 -#endif -#endif -#ifdef ENABLE_LOG_BREAKPOINT -#define IDM_LOG_BREAKPOINT 51206 -#endif - -#define IDC_COMBO1 1000 -#define IDC_COMBOVID 1001 -#define IDC_COMBO3 1002 -#define IDC_COMBO4 1003 -#define IDC_COMBO5 1004 -#define IDC_COMBO386 1005 -#define IDC_COMBO486 1006 -#define IDC_COMBOSND 1007 -#define IDC_COMBONET 1008 -#define IDC_COMBOCPUM 1060 -#define IDC_COMBOSPD 1061 -#define IDC_COMBODR1 1062 -#define IDC_COMBODR2 1063 -#define IDC_COMBOJOY 1064 -#define IDC_COMBOWS 1065 -#define IDC_COMBOMOUSE 1066 -#define IDC_COMBOHDD 1067 -#define IDC_COMBODR3 1068 -#define IDC_COMBODR4 1069 -#define IDC_CHECK1 1010 -#define IDC_CHECK2 1011 -#define IDC_CHECK3 1012 -#define IDC_CHECKGUS 1013 -#define IDC_CHECKSSI 1014 -#define IDC_CHECKVOODOO 1015 -#define IDC_CHECKDYNAREC 1016 -#define IDC_CHECKBUSLOGIC 1017 -#define IDC_STATIC 1020 -#define IDC_CHECKSYNC 1024 -#define IDC_CHECKXTIDE 1025 -#define IDC_CHECKFPU 1026 -#define IDC_EDIT1 1030 -#define IDC_EDIT2 1031 -#define IDC_EDIT3 1032 -#define IDC_EDIT4 1033 -#define IDC_EDIT5 1034 -#define IDC_EDIT6 1035 -#define IDC_COMBOHDT 1036 - -#define IDC_EJECTC 1040 -#define IDC_EDITC 1050 -#define IDC_CFILE 1060 -#define IDC_CNEW 1070 -#define IDC_EDIT_C_SPT 1200 -#define IDC_EDIT_C_HPC 1210 -#define IDC_EDIT_C_CYL 1220 -#define IDC_EDIT_C_FN 1230 -#define IDC_TEXT_C_SIZE 1240 - -#define IDC_EJECTD 1041 -#define IDC_EDITD 1051 -#define IDC_DFILE 1061 -#define IDC_DNEW 1071 -#define IDC_EDIT_D_SPT 1201 -#define IDC_EDIT_D_HPC 1211 -#define IDC_EDIT_D_CYL 1221 -#define IDC_EDIT_D_FN 1231 -#define IDC_TEXT_D_SIZE 1241 - -#define IDC_EJECTE 1042 -#define IDC_EDITE 1052 -#define IDC_EFILE 1062 -#define IDC_ENEW 1072 -#define IDC_EDIT_E_SPT 1202 -#define IDC_EDIT_E_HPC 1212 -#define IDC_EDIT_E_CYL 1222 -#define IDC_EDIT_E_FN 1232 -#define IDC_TEXT_E_SIZE 1242 - -#define IDC_EJECTF 1043 -#define IDC_EDITF 1053 -#define IDC_FFILE 1063 -#define IDC_FNEW 1073 -#define IDC_EDIT_F_SPT 1203 -#define IDC_EDIT_F_HPC 1213 -#define IDC_EDIT_F_CYL 1223 -#define IDC_EDIT_F_FN 1233 -#define IDC_TEXT_F_SIZE 1243 - -#define IDC_EJECTG 1044 -#define IDC_EDITG 1054 -#define IDC_GFILE 1064 -#define IDC_GNEW 1074 -#define IDC_EDIT_G_SPT 1204 -#define IDC_EDIT_G_HPC 1214 -#define IDC_EDIT_G_CYL 1224 -#define IDC_EDIT_G_FN 1234 -#define IDC_TEXT_G_SIZE 1244 - -#define IDC_EJECTH 1045 -#define IDC_EDITH 1055 -#define IDC_HFILE 1065 -#define IDC_HNEW 1075 -#define IDC_EDIT_H_SPT 1205 -#define IDC_EDIT_H_HPC 1215 -#define IDC_EDIT_H_CYL 1225 -#define IDC_EDIT_H_FN 1235 -#define IDC_TEXT_H_SIZE 1245 - -#define IDC_EJECTI 1046 -#define IDC_EDITI 1056 -#define IDC_IFILE 1066 -#define IDC_INEW 1076 -#define IDC_EDIT_I_SPT 1206 -#define IDC_EDIT_I_HPC 1216 -#define IDC_EDIT_I_CYL 1226 -#define IDC_EDIT_I_FN 1236 -#define IDC_TEXT_I_SIZE 1246 - -#define IDC_EJECTJ 1047 -#define IDC_EDITJ 1057 -#define IDC_JFILE 1067 -#define IDC_JNEW 1077 -#define IDC_EDIT_J_SPT 1207 -#define IDC_EDIT_J_HPC 1217 -#define IDC_EDIT_J_CYL 1227 -#define IDC_EDIT_J_FN 1237 -#define IDC_TEXT_J_SIZE 1247 - -#define IDC_HDTYPE 1280 - -#define IDC_MEMSPIN 1100 -#define IDC_MEMTEXT 1101 -#define IDC_STEXT1 1102 -#define IDC_STEXT2 1103 -#define IDC_STEXT3 1104 -#define IDC_STEXT4 1105 -#define IDC_STEXT5 1106 -#define IDC_STEXT6 1107 -#define IDC_STEXT7 1108 -#define IDC_STEXT8 1109 -#define IDC_STEXT_DEVICE 1110 -#define IDC_TEXT_MB 1111 -#define IDC_TEXT1 1115 -#define IDC_TEXT2 1116 - -#define IDC_CONFIGUREVID 1200 -#define IDC_CONFIGURESND 1201 -#define IDC_CONFIGUREVOODOO 1202 -#define IDC_CONFIGUREMOD 1203 -#define IDC_CONFIGURENET 1204 -#define IDC_CONFIGUREBUSLOGIC 1205 -#define IDC_JOY1 1210 -#define IDC_JOY2 1211 -#define IDC_JOY3 1212 -#define IDC_JOY4 1213 - -#define IDC_CONFIG_BASE 1200 - -#define WM_RESETD3D WM_USER -#define WM_LEAVEFULLSCREEN WM_USER + 1 - -#define C_BASE 6 -#define D_BASE 44 -#define E_BASE 82 -#define F_BASE 120 -#define G_BASE 158 -#define H_BASE 196 -#define I_BASE 234 -#define J_BASE 272 -#define CMD_BASE 314 -#define DLG_HEIGHT 346 diff --git a/src/rom.c b/src/rom.c index 66549ad79..60475aac8 100644 --- a/src/rom.c +++ b/src/rom.c @@ -3,10 +3,12 @@ */ #include #include +#include "config.h" #include "ibm.h" #include "mem.h" #include "rom.h" + FILE *romfopen(char *fn, char *mode) { char s[512]; @@ -16,6 +18,7 @@ FILE *romfopen(char *fn, char *mode) return fopen(s, mode); } + int rom_present(char *fn) { FILE *f; @@ -33,25 +36,40 @@ int rom_present(char *fn) return 0; } + static uint8_t rom_read(uint32_t addr, void *p) { rom_t *rom = (rom_t *)p; -// pclog("rom_read : %08x %08x %02x\n", addr, rom->mask, rom->rom[addr & rom->mask]); +#ifdef ROM_TRACE + if (rom->mapping.base==ROM_TRACE) + pclog("ROM: read byte from BIOS at %06lX\n", addr); +#endif return rom->rom[addr & rom->mask]; } + + uint16_t rom_readw(uint32_t addr, void *p) { rom_t *rom = (rom_t *)p; -// pclog("rom_readw: %08x %08x %04x\n", addr, rom->mask, *(uint16_t *)&rom->rom[addr & rom->mask]); +#ifdef ROM_TRACE + if (rom->mapping.base==ROM_TRACE) + pclog("ROM: read word from BIOS at %06lX\n", addr); +#endif return *(uint16_t *)&rom->rom[addr & rom->mask]; } + + uint32_t rom_readl(uint32_t addr, void *p) { rom_t *rom = (rom_t *)p; -// pclog("rom_readl: %08x %08x %08x\n", addr, rom->mask, *(uint32_t *)&rom->rom[addr & rom->mask]); +#ifdef ROM_TRACE + if (rom->mapping.base==ROM_TRACE) + pclog("ROM: read long from BIOS at %06lX\n", addr); +#endif return *(uint32_t *)&rom->rom[addr & rom->mask]; } + int rom_init(rom_t *rom, char *fn, uint32_t address, int size, int mask, int file_offset, uint32_t flags) { FILE *f = romfopen(fn, "rb"); @@ -82,6 +100,7 @@ int rom_init(rom_t *rom, char *fn, uint32_t address, int size, int mask, int fil return 0; } + int rom_init_interleaved(rom_t *rom, char *fn_low, char *fn_high, uint32_t address, int size, int mask, int file_offset, uint32_t flags) { FILE *f_low = romfopen(fn_low, "rb"); diff --git a/src/rtc.c b/src/rtc.c index eba9bfd53..323a36c6c 100644 --- a/src/rtc.c +++ b/src/rtc.c @@ -26,9 +26,6 @@ struct int year; } internal_clock; -/* When the RTC was last updated */ -static time_t rtc_set_time = 0; - /* Table for days in each month */ static int rtc_days_in_month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; @@ -45,7 +42,7 @@ static int rtc_is_leap(int org_year) static int rtc_get_days(int org_month, int org_year) { if (org_month != 2) - return rtc_days_in_month[org_month]; + return rtc_days_in_month[org_month - 1]; else return rtc_is_leap(org_year) ? 29 : 28; } diff --git a/src/rtc.h b/src/rtc.h index a287e389f..78718143b 100644 --- a/src/rtc.h +++ b/src/rtc.h @@ -24,7 +24,7 @@ enum RTC_ADDR #define RTC_CENTURY 0x32 /* When the 12-hour format is selected, the higher-order bit of the hours byte represents PM when it is logic 1. */ -#define RTC_AMPM 0b10000000 +#define RTC_AMPM 0x80 /* Register A bitflags */ enum RTC_RA_BITS @@ -41,14 +41,14 @@ enum RTC_RA_BITS Table 3 lists the periodic interrupt rates and the square wave frequencies that can be chosen with the RS bits. These four read/write bits are not affected by !RESET. */ - RTC_RS = 0b1111, + RTC_RS = 0xF, /* DV0 These three bits are used to turn the oscillator on or off and to reset the countdown chain. A pattern of 010 is the only combination of bits that turn the oscillator on and allow the RTC to keep time. A pattern of 11x enables the oscillator but holds the countdown chain in reset. The next update occurs at 500ms after a pattern of 010 is written to DV0, DV1, and DV2. */ - RTC_DV0 = 0b1110000, + RTC_DV0 = 0x70, /* Update-In-Progress (UIP) This bit is a status flag that can be monitored. When the UIP bit is a 1, the update transfer occurs soon. @@ -56,7 +56,7 @@ enum RTC_RA_BITS The time, calendar, and alarm information in RAM is fully available for access when the UIP bit is 0. The UIP bit is read-only and is not affected by !RESET. Writing the SET bit in Register B to a 1 inhibits any update transfer and clears the UIP status bit. */ - RTC_UIP = 0b10000000 + RTC_UIP = 0x80 }; /* Register B bitflags */ @@ -70,51 +70,51 @@ enum RTC_RB_BITS When DSE is enabled, the internal logic test for the first/last Sunday condition at midnight. If the DSE bit is not set when the test occurs, the daylight saving function does not operate correctly. These adjustments do not occur when the DSE bit is 0. This bit is not affected by internal functions or !RESET. */ - RTC_DSE = 0b1, + RTC_DSE = 0x1, /* 24/12 The 24/12 control bit establishes the format of the hours byte. A 1 indicates the 24-hour mode and a 0 indicates the 12-hour mode. This bit is read/write and is not affected by internal functions or !RESET. */ - RTC_2412 = 0b10, + RTC_2412 = 0x2, /* Data Mode (DM) This bit indicates whether time and calendar information is in binary or BCD format. The DM bit is set by the program to the appropriate format and can be read as required. This bit is not modified by internal functions or !RESET. A 1 in DM signifies binary data, while a 0 in DM specifies BCD data. */ - RTC_DM = 0b100, + RTC_DM = 0x4, /* Square-Wave Enable (SQWE) When this bit is set to 1, a square-wave signal at the frequency set by the rate-selection bits RS3-RS0 is driven out on the SQW pin. When the SQWE bit is set to 0, the SQW pin is held low. SQWE is a read/write bit and is cleared by !RESET. SQWE is low if disabled, and is high impedance when VCC is below VPF. SQWE is cleared to 0 on !RESET. */ - RTC_SQWE = 0b1000, + RTC_SQWE = 0x8, /* Update-Ended Interrupt Enable (UIE) This bit is a read/write bit that enables the update-end flag (UF) bit in Register C to assert !IRQ. The !RESET pin going low or the SET bit going high clears the UIE bit. The internal functions of the device do not affect the UIE bit, but is cleared to 0 on !RESET. */ - RTC_UIE = 0b10000, + RTC_UIE = 0x10, /* Alarm Interrupt Enable (AIE) This bit is a read/write bit that, when set to 1, permits the alarm flag (AF) bit in Register C to assert !IRQ. An alarm interrupt occurs for each second that the three time bytes equal the three alarm bytes, including a don't-care alarm code of binary 11XXXXXX. The AF bit does not initiate the !IRQ signal when the AIE bit is set to 0. The internal functions of the device do not affect the AIE bit, but is cleared to 0 on !RESET. */ - RTC_AIE = 0b100000, + RTC_AIE = 0x20, /* Periodic Interrupt Enable (PIE) The PIE bit is a read/write bit that allows the periodic interrupt flag (PF) bit in Register C to drive the !IRQ pin low. When the PIE bit is set to 1, periodic interrupts are generated by driving the !IRQ pin low at a rate specified by the RS3-RS0 bits of Register A. A 0 in the PIE bit blocks the !IRQ output from being driven by a periodic interrupt, but the PF bit is still set at the periodic rate. PIE is not modified by any internal device functions, but is cleared to 0 on !RESET. */ - RTC_PIE = 0b1000000, + RTC_PIE = 0x40, /* SET When the SET bit is 0, the update transfer functions normally by advancing the counts once per second. When the SET bit is written to 1, any update transfer is inhibited, and the program can initialize the time and calendar bytes without an update occurring in the midst of initializing. Read cycles can be executed in a similar manner. SET is a read/write bit and is not affected by !RESET or internal functions of the device. */ - RTC_SET = 0b10000000 + RTC_SET = 0x80 }; /* Register C bitflags */ @@ -123,23 +123,23 @@ enum RTC_RC_BITS /* Unused These bits are unused in Register C. These bits always read 0 and cannot be written. */ - RTC_RC = 0b1111, + RTC_RC = 0xF, /* Update-Ended Interrupt Flag (UF) This bit is set after each update cycle. When the UIE bit is set to 1, the 1 in UF causes the IRQF bit to be a 1, which asserts the !IRQ pin. This bit can be cleared by reading Register C or with a !RESET. */ - RTC_UF = 0b10000, + RTC_UF = 0x10, /* Alarm Interrupt Flag (AF) A 1 in the AF bit indicates that the current time has matched the alarm time. If the AIE bit is also 1, the !IRQ pin goes low and a 1 appears in the IRQF bit. This bit can be cleared by reading Register C or with a !RESET. */ - RTC_AF = 0b100000, + RTC_AF = 0x20, /* Periodic Interrupt Flag (PF) This bit is read-only and is set to 1 when an edge is detected on the selected tap of the divider chain. The RS3 through RS0 bits establish the periodic rate. PF is set to 1 independent of the state of the PIE bit. When both PF and PIE are 1s, the !IRQ signal is active and sets the IRQF bit. This bit can be cleared by reading Register C or with a !RESET. */ - RTC_PF = 0b1000000, + RTC_PF = 0x40, /* Interrupt Request Flag (IRQF) The interrupt request flag (IRQF) is set to a 1 when one or more of the following are true: @@ -149,7 +149,7 @@ enum RTC_RC_BITS Any time the IRQF bit is a 1, the !IRQ pin is driven low. All flag bits are cleared after Register C is read by the program or when the !RESET pin is low. */ - RTC_IRQF = 0b10000000 + RTC_IRQF = 0x80 }; /* Register D bitflags */ @@ -158,13 +158,13 @@ enum RTC_RD_BITS /* Unused The remaining bits of Register D are not usable. They cannot be written and they always read 0. */ - RTC_RD = 0b1111111, + RTC_RD = 0x7F, /* Valid RAM and Time (VRT) This bit indicates the condition of the battery connected to the VBAT pin. This bit is not writeable and should always be 1 when read. If a 0 is ever present, an exhausted internal lithium energy source is indicated and both the contents of the RTC data and RAM data are questionable. This bit is unaffected by !RESET. */ - RTC_VRT = 0b10000000 + RTC_VRT = 0x80 }; void rtc_tick(); diff --git a/src/scat.c b/src/scat.c index fad281b65..4759d0270 100644 --- a/src/scat.c +++ b/src/scat.c @@ -11,7 +11,6 @@ static uint8_t scat_regs[256]; static int scat_index; static uint8_t scat_port_92 = 0; static uint8_t scat_ems_reg_2xA = 0; -static mem_mapping_t scat_mapping[32]; static mem_mapping_t scat_high_mapping[16]; static scat_t scat_stat[32]; static uint32_t scat_xms_bound; @@ -20,7 +19,7 @@ static mem_mapping_t scat_512k_clip_mapping; void scat_shadow_state_update() { - int i, val, val2; + int i, val; for (i = 0; i < 24; i++) { @@ -48,8 +47,8 @@ void scat_shadow_state_update() { val |= ((scat_regs[SCAT_SHADOW_RAM_ENABLE_1 + (i >> 3)] >> (i & 7)) & 1) ? MEM_WRITE_INTERNAL : MEM_WRITE_EXTERNAL; } - mem_set_mem_state((i + 40) << 14, 0x4000, val); } + mem_set_mem_state((i + 40) << 14, 0x4000, val); } flushmmucache(); @@ -131,7 +130,6 @@ void scat_set_xms_bound(uint8_t val) uint32_t get_scat_addr(uint32_t addr, scat_t *p) { - uint32_t addr2 = addr; if (p && (scat_regs[SCAT_EMS_CONTROL] & 0x80) && (p->regs_2x9 & 0x80)) { addr = (addr & 0x3fff) | (((p->regs_2x9 & 3) << 8) | p->regs_2x8) << 14; @@ -164,7 +162,7 @@ void scat_write(uint16_t port, uint8_t val, void *priv) scat_reg_valid = 1; break; case SCAT_POWER_MANAGEMENT: - val &= 0x40; // TODO - Only use AUX parity disable bit for this version. Other bits should be implemented later. + val &= 0x40; /* TODO - Only use AUX parity disable bit for this version. Other bits should be implemented later. */ scat_reg_valid = 1; break; case SCAT_DRAM_CONFIGURATION: @@ -345,7 +343,7 @@ uint8_t scat_read(uint16_t port, void *priv) switch (scat_index) { case SCAT_MISCELLANEOUS_STATUS: - val = (scat_regs[scat_index] & 0xbf) | ((scat_port_92 & 2) << 5); + val = (scat_regs[scat_index] & 0xbf) | ((mem_a20_key & 2) << 5); break; default: val = scat_regs[scat_index]; @@ -508,7 +506,7 @@ void scat_init() scat_stat[i].regs_2x9 = 0x03; } - // TODO - Only normal CPU accessing address FF0000 to FFFFFF mapped to ROM. Normal CPU accessing address FC0000 to FEFFFF map to ROM should be implemented later. + /* TODO - Only normal CPU accessing address FF0000 to FFFFFF mapped to ROM. Normal CPU accessing address FC0000 to FEFFFF map to ROM should be implemented later. */ for (i = 12; i < 16; i++) { mem_mapping_add(&scat_high_mapping[i], (i << 14) + 0xFC0000, 0x04000, mem_read_bios, mem_read_biosw, mem_read_biosl, mem_write_null, mem_write_nullw, mem_write_nulll, rom + (i << 14), 0, NULL); @@ -519,11 +517,11 @@ void scat_init() mem_mapping_add(&scat_shadowram_mapping, 0x100000, 0x60000, mem_read_scatems, mem_read_scatemsw, mem_read_scatemsl, mem_write_scatems, mem_write_scatemsw, mem_write_scatemsl, ram + 0xA0000, MEM_MAPPING_INTERNAL, NULL); } - // Need to RAM 512kb clipping emulation if only 256KB or 64KB modules installed in memory bank. - // TODO - 512KB clipping should be applied all RAM refer. + /* Need to RAM 512kb clipping emulation if only 256KB or 64KB modules installed in memory bank. + TODO - 512KB clipping should be applied all RAM refer. */ mem_mapping_add(&scat_512k_clip_mapping, 0x80000, 0x20000, mem_read_scatems, mem_read_scatemsw, mem_read_scatemsl, mem_write_scatems, mem_write_scatemsw, mem_write_scatemsl, ram, MEM_MAPPING_INTERNAL, NULL); mem_mapping_disable(&scat_512k_clip_mapping); - // --- + /* --- */ scat_set_xms_bound(0); scat_shadow_state_update(); diff --git a/src/scsi.c b/src/scsi.c index 6a3c5746e..3dbefdf37 100644 --- a/src/scsi.c +++ b/src/scsi.c @@ -7,23 +7,108 @@ #include "86box.h" #include "ibm.h" #include "device.h" - #include "cdrom.h" #include "scsi.h" - #include "timer.h" +#include "scsi_buslogic.h" -uint8_t SCSIPhase = SCSI_PHASE_BUS_FREE; -uint8_t SCSIStatus = SCSI_STATUS_OK; -uint8_t scsi_cdrom_id = 3; /*common setting*/ +uint8_t SCSIPhase = SCSI_PHASE_BUS_FREE; +uint8_t SCSIStatus = SCSI_STATUS_OK; +uint8_t scsi_cdrom_id = 3; /*common setting*/ +char scsi_fn[SCSI_NUM][512]; +uint16_t scsi_hd_location[SCSI_NUM]; -//Initialization function for the SCSI layer +int scsi_card_current = 0; +int scsi_card_last = 0; + + +typedef struct { + char name[64]; + char internal_name[32]; + device_t *device; +} SCSI_CARD; + + +static SCSI_CARD scsi_cards[] = { + { "None", "none", NULL }, + { "Adaptec AHA-1540B", "aha1540b", &aha1540b_device }, + { "Adaptec AHA-1542CF", "aha1542cf", &aha1542cf_device }, + { "BusLogic BT-542B", "bt542b", &buslogic_device }, + { "BusLogic BT-958D PCI", "bt958d", &buslogic_pci_device }, + { "", "", NULL } +}; + + +int scsi_card_available(int card) +{ + if (scsi_cards[card].device) + return(device_available(scsi_cards[card].device)); + + return(1); +} + + +char *scsi_card_getname(int card) +{ + return(scsi_cards[card].name); +} + + +device_t *scsi_card_getdevice(int card) +{ + return(scsi_cards[card].device); +} + + +int scsi_card_has_config(int card) +{ + if (! scsi_cards[card].device) return(0); + + return(scsi_cards[card].device->config ? 1 : 0); +} + + +char *scsi_card_get_internal_name(int card) +{ + return(scsi_cards[card].internal_name); +} + + +int scsi_card_get_from_internal_name(char *s) +{ + int c = 0; + + while (strlen(scsi_cards[c].internal_name)) { + if (!strcmp(scsi_cards[c].internal_name, s)) + return(c); + c++; + } + + return(0); +} + + +void scsi_card_init() +{ + if (scsi_cards[scsi_card_current].device) + device_add(scsi_cards[scsi_card_current].device); + + scsi_card_last = scsi_card_current; +} + + +/* Initialization function for the SCSI layer */ void SCSIReset(uint8_t id, uint8_t lun) { - uint8_t cdrom_id = scsi_cdrom_drives[id][lun]; + uint8_t cdrom_id = scsi_cdrom_drives[id][lun]; + uint8_t hdc_id = scsi_hard_disks[id][lun]; - if (buslogic_scsi_drive_is_cdrom(id, lun)) + if (hdc_id != 0xff) { + scsi_hd_reset(cdrom_id); + SCSIDevices[id][lun].LunType = SCSI_HDD; + } else { + if (cdrom_id != 0xff) { cdrom_reset(cdrom_id); SCSIDevices[id][lun].LunType = SCSI_CDROM; @@ -32,4 +117,5 @@ void SCSIReset(uint8_t id, uint8_t lun) { SCSIDevices[id][lun].LunType = SCSI_NONE; } + } } diff --git a/src/scsi.h b/src/scsi.h index 3a441af95..ba0334f57 100644 --- a/src/scsi.h +++ b/src/scsi.h @@ -4,8 +4,6 @@ #ifndef __SCSI_H__ #define __SCSI_H__ -//#include "scattergather.h" - #include "timer.h" #define SCSI_TIME (5 * 100 * (1 << TIMER_SHIFT)) @@ -15,6 +13,7 @@ #define GPCMD_REZERO_UNIT 0x01 #define GPCMD_REQUEST_SENSE 0x03 #define GPCMD_READ_6 0x08 +#define GPCMD_WRITE_6 0x0a #define GPCMD_SEEK_6 0x0b #define GPCMD_INQUIRY 0x12 #define GPCMD_VERIFY_6 0x13 @@ -24,6 +23,7 @@ #define GPCMD_PREVENT_REMOVAL 0x1e #define GPCMD_READ_CDROM_CAPACITY 0x25 #define GPCMD_READ_10 0x28 +#define GPCMD_WRITE_10 0x2a #define GPCMD_SEEK_10 0x2b #define GPCMD_VERIFY_10 0x2f #define GPCMD_READ_SUBCHANNEL 0x42 @@ -42,6 +42,7 @@ #define GPCMD_MODE_SENSE_10 0x5a #define GPCMD_PLAY_AUDIO_12 0xa5 #define GPCMD_READ_12 0xa8 +#define GPCMD_WRITE_12 0xaa #define GPCMD_READ_DVD_STRUCTURE 0xad /* For reading. */ #define GPCMD_VERIFY_12 0xaf #define GPCMD_PLAY_CD_OLD 0xb4 @@ -206,7 +207,7 @@ extern int cd_status; extern int prev_status; #define SCSI_NONE 0 -#define SCSI_HDD 1 /*not present yet*/ +#define SCSI_HDD 1 #define SCSI_CDROM 2 #define MSFtoLBA(m,s,f) ((((m*60)+s)*75)+f) @@ -238,10 +239,30 @@ void SCSICDROM_Insert(); int cdrom_add_error_and_subchannel(uint8_t *b, int real_sector_type); int cdrom_LBAtoMSF_accurate(); -// int cdrom_read_data(uint8_t *buffer); int mode_select_init(uint8_t command, uint16_t pl_length, uint8_t do_save); int mode_select_terminate(int force); int mode_select_write(uint8_t val); +extern int scsi_card_current; + +int scsi_card_available(int card); +char *scsi_card_getname(int card); +struct device_t *scsi_card_getdevice(int card); +int scsi_card_has_config(int card); +char *scsi_card_get_internal_name(int card); +int scsi_card_get_from_internal_name(char *s); +void scsi_card_init(); + +extern uint8_t scsi_hard_disks[16][8]; + +int scsi_hd_err_stat_to_scsi(uint8_t id); +int scsi_hd_phase_to_scsi(uint8_t id); +int find_hdc_for_scsi_id(uint8_t scsi_id, uint8_t scsi_lun); +void build_scsi_hd_map(); +void scsi_hd_reset(uint8_t id); +void scsi_hd_request_sense_for_scsi(uint8_t id, uint8_t *buffer, uint8_t alloc_length); +void scsi_hd_command(uint8_t id, uint8_t *cdb); +void scsi_hd_callback(uint8_t id); + #endif \ No newline at end of file diff --git a/src/scsi_aha154x.c b/src/scsi_aha154x.c new file mode 100644 index 000000000..fd89a1cc5 --- /dev/null +++ b/src/scsi_aha154x.c @@ -0,0 +1,407 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Implementation of several low-level support functions for + * the AHA-154x series of ISA Host Adapters made by Adaptec. + * These functions implement the support needed by the ROM BIOS + * of these cards. + * + * Version: @(#)aha154x.c 1.0.4 2017/04/21 + * + * Author: Fred N. van Kempen, + * Copyright 2017 Fred N. van Kempen. + */ +#include +#include +#include +#include "ibm.h" +#include "mem.h" +#include "rom.h" +#include "device.h" +#include "scsi_buslogic.h" + + +#define AHA AHA154xCF /* set desired card type */ +#define AHA154xB 1 /* AHA-154x Rev.B */ +#define AHA154xC 2 /* AHA-154x Rev.C */ +#define AHA154xCF 3 /* AHA-154x Rev.CF */ +#define AHA154xCP 4 /* AHA-154x Rev.CP */ + + +#if AHA == AHA154xB +# define ROMFILE "roms/adaptec/aha1540b310.bin" +# define AHA_BID 'A' /* AHA-154x B */ +#endif + +#if AHA == AHA154xC +# define ROMFILE "roms/adaptec/aha1542c101.bin" +# define AHA_BID 'D' /* AHA-154x C */ +# define ROM_FWHIGH 0x0022 /* firmware version (hi/lo) */ +# define ROM_SHRAM 0x3F80 /* shadow RAM address base */ +# define ROM_SHRAMSZ 128 /* size of shadow RAM */ +# define ROM_IOADDR 0x3F7E /* [2:0] idx into addr table */ +# define EEP_SIZE 32 /* 32 bytes of storage */ +#endif + +#if AHA == AHA154xCF +# define ROMFILE "roms/adaptec/aha1542cf201.bin" +# define AHA_BID 'E' /* AHA-154x CF */ +# define ROM_FWHIGH 0x0022 /* firmware version (hi/lo) */ +# define ROM_SHRAM 0x3F80 /* shadow RAM address base */ +# define ROM_SHRAMSZ 128 /* size of shadow RAM */ +# define ROM_IOADDR 0x3F7E /* [2:0] idx into addr table */ +# define EEP_SIZE 32 /* 32 bytes of storage */ +#endif + +#if AHA == AHA154xCP +# define ROMFILE "roms/adaptec/aha1542cp102.bin" +# define AHA_BID 'F' /* AHA-154x CP */ +# define ROM_FWHIGH 0x0055 /* firmware version (hi/lo) */ +# define ROM_SHRAM 0x3F80 /* shadow RAM address base */ +# define ROM_SHRAMSZ 128 /* size of shadow RAM */ +# define ROM_IOADDR 0x3F7E /* [2:0] idx into addr table */ +# define EEP_SIZE 32 /* 32 bytes of storage */ +#endif + +#define ROM_SIZE 16384 /* one ROM is 16K */ + + +/* EEPROM map and bit definitions. */ +#define EE0_HOSTID 0x07 /* EE(0) [2:0] */ +#define EE0_ALTFLOP 0x80 /* EE(0) [7] FDC at 370h */ +#define EE1_IRQCH 0x07 /* EE(1) [3:0] */ +#define EE1_DMACH 0x70 /* EE(1) [7:4] */ +#define EE2_RMVOK 0x01 /* EE(2) [0] Support removable disks */ +#define EE2_HABIOS 0x02 /* EE(2) [1] HA Bios Space Reserved */ +#define EE2_INT19 0x04 /* EE(2) [2] HA Bios Controls INT19 */ +#define EE2_DYNSCAN 0x08 /* EE(2) [3] Dynamically scan bus */ +#define EE2_TWODRV 0x10 /* EE(2) [4] Allow more than 2 drives */ +#define EE2_SEEKRET 0x20 /* EE(2) [5] Immediate return on seek */ +#define EE2_EXT1G 0x80 /* EE(2) [7] Extended Translation >1GB */ +#define EE3_SPEED 0x00 /* EE(3) [7:0] DMA Speed */ +#define SPEED_33 0xFF +#define SPEED_50 0x00 +#define SPEED_56 0x04 +#define SPEED_67 0x01 +#define SPEED_80 0x02 +#define SPEED_10 0x03 +#define EE4_FLOPTOK 0x80 /* EE(4) [7] Support Flopticals */ +#define EE6_PARITY 0x01 /* EE(6) [0] parity check enable */ +#define EE6_TERM 0x02 /* EE(6) [1] host term enable */ +#define EE6_RSTBUS 0x04 /* EE(6) [2] reset SCSI bus on boot */ +#define EEE_SYNC 0x01 /* EE(E) [0] Enable Sync Negotiation */ +#define EEE_DISCON 0x02 /* EE(E) [1] Enable Disconnection */ +#define EEE_FAST 0x04 /* EE(E) [2] Enable FAST SCSI */ +#define EEE_START 0x08 /* EE(E) [3] Enable Start Unit */ + + +static rom_t aha_bios; /* active ROM */ +static uint8_t *aha_rom1; /* main BIOS */ +static uint8_t *aha_rom2; /* SCSI-Select */ +#ifdef EEP_SIZE +static uint8_t aha_eep[EEP_SIZE]; /* EEPROM storage */ +#endif +static uint16_t aha_ports[] = { + 0x0330, 0x0334, 0x0230, 0x0234, + 0x0130, 0x0134, 0x0000, 0x0000 +}; + + +/* + * Write data to the BIOS space. + * + * AHA-1542C's and up have a feature where they map a 128-byte + * RAM space into the ROM BIOS' address space, and then use it + * as working memory. This function implements the writing to + * that memory. + * + * We enable/disable this memory through AHA command 0x24. + */ +static void +aha_mem_write(uint32_t addr, uint8_t val, void *priv) +{ + rom_t *rom = (rom_t *)priv; + +#if 0 + pclog("AHA1542x: writing to BIOS space, %06lX, val %02x\n", addr, val); + pclog(" called from %04X:%04X\n", CS, cpu_state.pc); +#endif + if ((addr & rom->mask) >= 0x3F80) + rom->rom[addr & rom->mask] = val; +} + + +static uint8_t +aha_mem_read(uint32_t addr, void *priv) +{ + rom_t *rom = (rom_t *)priv; + + return(rom->rom[addr & rom->mask]); +} + + +static uint16_t +aha_mem_readw(uint32_t addr, void *priv) +{ + rom_t *rom = (rom_t *)priv; + + return(*(uint16_t *)&rom->rom[addr & rom->mask]); +} + + +static uint32_t +aha_mem_readl(uint32_t addr, void *priv) +{ + rom_t *rom = (rom_t *)priv; + + return(*(uint32_t *)&rom->rom[addr & rom->mask]); +} + + +#ifdef ROM_IOADDR +/* + * Patch the ROM BIOS image for stuff Adaptec deliberately + * made hard to understand. Well, maybe not, maybe it was + * their way of handling issues like these at the time.. + * + * Patch 1: emulate the I/O ADDR SW setting by patching a + * byte in the BIOS that indicates the I/O ADDR + * switch setting on the board. + */ +static void +aha_patch(uint8_t *romptr, uint16_t ioaddr) +{ + int i; + + /* Look up the I/O address in the table. */ + for (i=0; i<8; i++) + if (aha_ports[i] == ioaddr) break; + if (i == 8) { + pclog("AHA154x: bad news, invalid I/O address %04x selected!\n", + ioaddr); + return; + } + romptr[ROM_IOADDR] = (unsigned char)i; +} +#endif + + +/* Initialize AHA-154xNN-specific stuff. */ +void +aha154x_init(uint16_t ioaddr, uint32_t memaddr, aha_info *aha) +{ + uint32_t bios_size; + uint32_t bios_addr; + uint32_t bios_mask; + char *bios_path; + uint32_t temp; + FILE *f; + + /* Set BIOS load address. */ + bios_addr = memaddr; + bios_path = ROMFILE; + pclog("AHA154x: loading BIOS from '%s'\n", bios_path); + + /* Open the BIOS image file and make sure it exists. */ + if ((f = fopen(bios_path, "rb")) == NULL) { + pclog("AHA154x: BIOS ROM not found!\n"); + return; + } + + /* + * Manually load and process the ROM image. + * + * We *could* use the system "rom_init" function here, but for + * this special case, we can't: we may need WRITE access to the + * memory later on. + */ + (void)fseek(f, 0L, SEEK_END); + temp = ftell(f); + (void)fseek(f, 0L, SEEK_SET); + + /* Load first chunk of BIOS (which is the main BIOS, aka ROM1.) */ + aha_rom1 = malloc(ROM_SIZE); + (void)fread(aha_rom1, ROM_SIZE, 1, f); + temp -= ROM_SIZE; + if (temp > 0) { + aha_rom2 = malloc(ROM_SIZE); + (void)fread(aha_rom2, ROM_SIZE, 1, f); + temp -= ROM_SIZE; + } else { + aha_rom2 = NULL; + } + if (temp != 0) { + pclog("AHA154x: BIOS ROM size invalid!\n"); + free(aha_rom1); + if (aha_rom2 != NULL) + free(aha_rom2); + (void)fclose(f); + return; + } + temp = ftell(f); + if (temp > ROM_SIZE) + temp = ROM_SIZE; + (void)fclose(f); + + /* Adjust BIOS size in chunks of 2K, as per BIOS spec. */ + bios_size = 0x10000; + if (temp <= 0x8000) + bios_size = 0x8000; + if (temp <= 0x4000) + bios_size = 0x4000; + if (temp <= 0x2000) + bios_size = 0x2000; + bios_mask = (bios_size - 1); + pclog("AHA154x: BIOS at 0x%06lX, size %lu, mask %08lx\n", + bios_addr, bios_size, bios_mask); + + /* Initialize the ROM entry for this BIOS. */ + memset(&aha_bios, 0x00, sizeof(rom_t)); + + /* Enable ROM1 into the memory map. */ + aha_bios.rom = aha_rom1; + + /* Set up an address mask for this memory. */ + aha_bios.mask = bios_mask; + + /* Map this system into the memory map. */ + mem_mapping_add(&aha_bios.mapping, bios_addr, bios_size, + aha_mem_read, aha_mem_readw, aha_mem_readl, + aha_mem_write, NULL, NULL, + aha_bios.rom, MEM_MAPPING_EXTERNAL, &aha_bios); + +#ifdef ROM_IOADDR + /* Patch the ROM BIOS image to work with us. */ + aha_patch(aha_bios.rom, ioaddr); +#endif + +#if ROM_FWHIGH + /* Read firmware version from the BIOS. */ + aha->fwh = aha_bios.rom[ROM_FWHIGH]; + aha->fwl = aha_bios.rom[ROM_FWHIGH+1]; +#else + /* Fake BIOS firmware version. */ + aha->fwh = '1'; + aha->fwl = '0'; +#endif + aha->bid = AHA_BID; + + /* + * Do a checksum on the ROM. + * The BIOS ROMs on the 154xC(F) boards will always fail + * the checksum, because they are incomplete: on the real + * boards, a shadow RAM and some other (config) registers + * are mapped into its space. It is assumed that boards + * have logic that automatically generate a "fixup" byte + * at the end of the data to 'make up' for this. + * + * We emulated some of those in the patch routine, so now + * it is time to "fix up" the BIOS image so that the main + * (system) BIOS considers it valid. + */ +again: + bios_mask = 0; + for (temp=0; temp<16384; temp++) + bios_mask += aha_bios.rom[temp]; + bios_mask &= 0xff; + if (bios_mask != 0x00) { + pclog("AHA154x: fixing BIOS checksum (%02x) ..\n", bios_mask); + aha_bios.rom[temp-1] += (256 - bios_mask); + goto again; + } + + /* Enable the memory. */ + mem_mapping_enable(&aha_bios.mapping); + mem_mapping_set_addr(&aha_bios.mapping, bios_addr, bios_size); + +#ifdef EEP_SIZE + /* Initialize the on-board EEPROM. */ + memset(aha_eep, 0x00, EEP_SIZE); + aha_eep[0] = 7; /* SCSI ID 7 */ + aha_eep[1] = 15-9; /* IRQ15 */ + aha_eep[1] |= (6<<4); /* DMA6 */ + aha_eep[2] = (EE2_HABIOS | /* BIOS Space Reserved */ + EE2_SEEKRET); /* Immediate return on seek */ + aha_eep[3] = SPEED_50; /* speed 5.0 MB/s */ + aha_eep[6] = (EE6_TERM | /* host term enable */ + EE6_RSTBUS); /* reset SCSI bus on boot */ +#endif +} + + +/* Mess with the AHA-154xCF's Shadow RAM. */ +uint8_t +aha154x_shram(uint8_t cmd) +{ +#ifdef ROM_SHRAM + switch(cmd) { + case 0x00: /* disable, make it look like ROM */ + memset(&aha_bios.rom[ROM_SHRAM], 0xFF, ROM_SHRAMSZ); + break; + + case 0x02: /* clear it */ + memset(&aha_bios.rom[ROM_SHRAM], 0x00, ROM_SHRAMSZ); + break; + + case 0x03: /* enable, clear for use */ + memset(&aha_bios.rom[ROM_SHRAM], 0x00, ROM_SHRAMSZ); + break; + } +#endif + + /* Firmware expects 04 status. */ + return(0x04); +} + + +uint8_t +aha154x_eeprom(uint8_t cmd,uint8_t arg,uint8_t len,uint8_t off,uint8_t *bufp) +{ + uint8_t r = 0xff; + + pclog("AHA154x: EEPROM cmd=%02x, arg=%02x len=%d, off=%02x\n", + cmd, arg, len, off); + +#ifdef EEP_SIZE + if ((off+len) > EEP_SIZE) return(r); /* no can do.. */ + + if (cmd == 0x22) { + /* Write data to the EEPROM. */ + memcpy(&aha_eep[off], bufp, len); + r = 0; + } + + if (cmd == 0x23) { + /* Read data from the EEPROM. */ + memcpy(bufp, &aha_eep[off], len); + r = len; + } +#endif + + return(r); +} + + +uint8_t +aha154x_memory(uint8_t cmd) +{ + uint8_t r = 0xff; + + pclog("AHA154x: MEMORY cmd=%02x\n", cmd); + + if (cmd == 0x27) { + /* Enable the mapper, so, set ROM2 active. */ + aha_bios.rom = aha_rom2; + } + if (cmd == 0x26) { + /* Disable the mapper, so, set ROM1 active. */ + aha_bios.rom = aha_rom1; + } + + return(0); +} diff --git a/src/scsi_buslogic.c b/src/scsi_buslogic.c new file mode 100644 index 000000000..9675cfe88 --- /dev/null +++ b/src/scsi_buslogic.c @@ -0,0 +1,2800 @@ +/* Copyright holders: SA1988 + see COPYING for more details +*/ +/*Buslogic SCSI emulation (including Adaptec 154x ISA software backward compatibility) and the Adaptec 154x itself*/ + +/* Emulated SCSI controllers: + 0 - Adaptec AHA-154xB ISA; + 1 - Adaptec AHA-154xCF ISA; + 2 - BusLogic BT-542B ISA; + 3 - BusLogic BT-958 PCI (but BT-542B ISA on non-PCI machines). */ + +#include +#include +#include +#include +#include +#include "ibm.h" +#include "device.h" +#include "io.h" +#include "mem.h" +#include "rom.h" +#include "dma.h" +#include "pic.h" +#include "pci.h" +#include "timer.h" +#include "scsi.h" +#include "cdrom.h" +#include "scsi_buslogic.h" + + +#define BUSLOGIC_RESET_DURATION_NS UINT64_C(50000000) + + +#pragma pack(push,1) +typedef struct { + uint8_t hi; + uint8_t mid; + uint8_t lo; +} addr24; +#pragma pack(pop) + +#define ADDR_TO_U32(x) (((x).hi<<16)|((x).mid<<8)|((x).lo&0xFF)) +#define U32_TO_ADDR(a,x) do {(a).hi=(x)>>16;(a).mid=(x)>>8;(a).lo=(x)&0xFF;}while(0) + + +/* + * Host Adapter I/O ports. + * + * READ Port x+0: STATUS + * WRITE Port x+0: CONTROL + * + * READ Port x+1: DATA + * WRITE Port x+1: COMMAND + * + * READ Port x+2: INTERRUPT STATUS + * WRITE Port x+2: (undefined?) + * + * R/W Port x+3: (undefined) + */ + +/* WRITE CONTROL commands. */ +#define CTRL_HRST 0x80 /* Hard reset */ +#define CTRL_SRST 0x40 /* Soft reset */ +#define CTRL_IRST 0x20 /* interrupt reset */ +#define CTRL_SCRST 0x10 /* SCSI bus reset */ + +/* READ STATUS. */ +#define STAT_STST 0x80 /* self-test in progress */ +#define STAT_DFAIL 0x40 /* internal diagnostic failure */ +#define STAT_INIT 0x20 /* mailbox initialization required */ +#define STAT_IDLE 0x10 /* HBA is idle */ +#define STAT_CDFULL 0x08 /* Command/Data output port is full */ +#define STAT_DFULL 0x04 /* Data input port is full */ +#define STAT_INVCMD 0x01 /* Invalid command */ + +/* READ/WRITE DATA. */ +#define CMD_NOP 0x00 /* No operation */ +#define CMD_MBINIT 0x01 /* mailbox initialization */ +#define CMD_START_SCSI 0x02 /* Start SCSI command */ +#define CMD_BIOS 0x03 /* Execute ROM BIOS command */ +#define CMD_INQUIRY 0x04 /* Adapter inquiry */ +#define CMD_EMBOI 0x05 /* enable Mailbox Out Interrupt */ +#define CMD_SELTIMEOUT 0x06 /* Set SEL timeout */ +#define CMD_BUSON_TIME 0x07 /* set bus-On time */ +#define CMD_BUSOFF_TIME 0x08 /* set bus-off time */ +#define CMD_DMASPEED 0x09 /* set ISA DMA speed */ +#define CMD_RETDEVS 0x0A /* return installed devices */ +#define CMD_RETCONF 0x0B /* return configuration data */ +#define CMD_TARGET 0x0C /* set HBA to target mode */ +#define CMD_RETSETUP 0x0D /* return setup data */ +#define CMD_ECHO 0x1F /* ECHO command data */ + +/* READ INTERRUPT STATUS. */ +#define INTR_ANY 0x80 /* any interrupt */ +#define INTR_SRCD 0x08 /* SCSI reset detected */ +#define INTR_HACC 0x04 /* HA command complete */ +#define INTR_MBOA 0x02 /* MBO empty */ +#define INTR_MBIF 0x01 /* MBI full */ + + +/* + * Auto SCSI structure which is located + * in host adapter RAM and contains several + * configuration parameters. + */ +#pragma pack(push,1) +typedef struct { + uint8_t aInternalSignature[2]; + uint8_t cbInformation; + uint8_t aHostAdaptertype[6]; + uint8_t uReserved1; + uint8_t fFloppyEnabled :1, + fFloppySecondary :1, + fLevelSensitiveInterrupt:1, + uReserved2 :2, + uSystemRAMAreForBIOS :3; + uint8_t uDMAChannel :7, + fDMAAutoConfiguration :1, + uIrqChannel :7, + fIrqAutoConfiguration :1; + uint8_t uDMATransferRate; + uint8_t uSCSIId; + uint8_t fLowByteTerminated :1, + fParityCheckingEnabled :1, + fHighByteTerminated :1, + fNoisyCablingEnvironment:1, + fFastSyncNegotiation :1, + fBusResetEnabled :1, + fReserved3 :1, + fActiveNegotiationEna :1; + uint8_t uBusOnDelay; + uint8_t uBusOffDelay; + uint8_t fHostAdapterBIOSEnabled :1, + fBIOSRedirectionOfInt19 :1, + fExtendedTranslation :1, + fMapRemovableAsFixed :1, + fReserved4 :1, + fBIOSMoreThan2Drives :1, + fBIOSInterruptMode :1, + fFlopticalSupport :1; + uint16_t u16DeviceEnabledMask; + uint16_t u16WidePermittedMask; + uint16_t u16FastPermittedMask; + uint16_t u16SynchronousPermittedMask; + uint16_t u16DisconnectPermittedMask; + uint16_t u16SendStartUnitCommandMask; + uint16_t u16IgnoreInBIOSScanMask; + unsigned char uPCIInterruptPin : 2; + unsigned char uHostAdapterIoPortAddress : 2; + uint8_t fStrictRoundRobinMode : 1; + uint8_t fVesaBusSpeedGreaterThan33MHz : 1; + uint8_t fVesaBurstWrite : 1; + uint8_t fVesaBurstRead : 1; + uint16_t u16UltraPermittedMask; + uint32_t uReserved5; + uint8_t uReserved6; + uint8_t uAutoSCSIMaximumLUN; + uint8_t fReserved7 : 1; + uint8_t fSCAMDominant : 1; + uint8_t fSCAMenabled : 1; + uint8_t fSCAMLevel2 : 1; + unsigned char uReserved8 : 4; + uint8_t fInt13Extension : 1; + uint8_t fReserved9 : 1; + uint8_t fCDROMBoot : 1; + unsigned char uReserved10 : 5; + unsigned char uBootTargetId : 4; + unsigned char uBootChannel : 4; + uint8_t fForceBusDeviceScanningOrder : 1; + unsigned char uReserved11 : 7; + uint16_t u16NonTaggedToAlternateLunPermittedMask; + uint16_t u16RenegotiateSyncAfterCheckConditionMask; + uint8_t aReserved12[10]; + uint8_t aManufacturingDiagnostic[2]; + uint16_t u16Checksum; +} AutoSCSIRam; +#pragma pack(pop) + +/* The local RAM. */ +#pragma pack(push,1) +typedef union { + uint8_t u8View[256]; /* byte view */ + struct { /* structured view */ + uint8_t u8Bios[64]; /* offset 0 - 63 is for BIOS */ + AutoSCSIRam autoSCSIData; /* Auto SCSI structure */ + } structured; +} HALocalRAM; +#pragma pack(pop) + +/** Structure for the INQUIRE_SETUP_INFORMATION reply. */ +#pragma pack(push,1) +typedef struct { + uint8_t uOffset :4, + uTransferPeriod :3, + fSynchronous :1; +} ReplyInquireSetupInformationSynchronousValue; +#pragma pack(pop) + +#pragma pack(push,1) +typedef struct { + uint8_t fSynchronousInitiationEnabled :1, + fParityCheckingEnabled :1, + uReserved1 :6; + uint8_t uBusTransferRate; + uint8_t uPreemptTimeOnBus; + uint8_t uTimeOffBus; + uint8_t cMailbox; + addr24 MailboxAddress; + ReplyInquireSetupInformationSynchronousValue SynchronousValuesId0To7[8]; + uint8_t uDisconnectPermittedId0To7; + uint8_t uSignature; + uint8_t uCharacterD; + uint8_t uHostBusType; + uint8_t uWideTransferPermittedId0To7; + uint8_t uWideTransfersActiveId0To7; + ReplyInquireSetupInformationSynchronousValue SynchronousValuesId8To15[8]; + uint8_t uDisconnectPermittedId8To15; + uint8_t uReserved2; + uint8_t uWideTransferPermittedId8To15; + uint8_t uWideTransfersActiveId8To15; +} ReplyInquireSetupInformation; +#pragma pack(pop) + +/* Structure for the INQUIRE_EXTENDED_SETUP_INFORMATION. */ +#pragma pack(push,1) +typedef struct { + uint8_t uBusType; + uint8_t uBiosAddress; + uint16_t u16ScatterGatherLimit; + uint8_t cMailbox; + uint32_t uMailboxAddressBase; + uint8_t uReserved1 :2, + fFastEISA :1, + uReserved2 :3, + fLevelSensitiveInterrupt:1, + uReserved3 :1; + uint8_t aFirmwareRevision[3]; + uint8_t fHostWideSCSI :1, + fHostDifferentialSCSI :1, + fHostSupportsSCAM :1, + fHostUltraSCSI :1, + fHostSmartTermination :1, + uReserved4 :3; +} ReplyInquireExtendedSetupInformation; +#pragma pack(pop) + +/* Structure for the INQUIRE_PCI_HOST_ADAPTER_INFORMATION reply. */ +#pragma pack(push,1) +typedef struct { + uint8_t IsaIOPort; + uint8_t IRQ; + uint8_t LowByteTerminated :1, + HighByteTerminated :1, + uReserved :2, /* Reserved. */ + JP1 :1, /* Whatever that means. */ + JP2 :1, /* Whatever that means. */ + JP3 :1, /* Whatever that means. */ + InformationIsValid :1; + uint8_t uReserved2; /* Reserved. */ +} BuslogicPCIInformation_t; +#pragma pack(pop) + +#pragma pack(push,1) +typedef struct { + uint8_t Count; + addr24 Address; +} MailboxInit_t; +#pragma pack(pop) + +#pragma pack(push,1) +typedef struct { + uint8_t Count; + uint32_t Address; +} MailboxInitExtended_t; +#pragma pack(pop) + + +/* + * Mailbox Definitions. + * + * Mailbox Out (MBO) command values. + */ +#define MBO_FREE 0x00 +#define MBO_START 0x01 +#define MBO_ABORT 0x02 + +/* Mailbox In (MBI) status values. */ +#define MBI_FREE 0x00 +#define MBI_SUCCESS 0x01 +#define MBI_ABORT 0x02 +#define MBI_NOT_FOUND 0x03 +#define MBI_ERROR 0x04 + + +#pragma pack(push,1) +typedef struct { + uint8_t CmdStatus; + addr24 CCBPointer; +} Mailbox_t; +#pragma pack(pop) + +#pragma pack(push,1) +typedef struct { + uint32_t CCBPointer; + union { + struct { + uint8_t Reserved[3]; + uint8_t ActionCode; + } out; + struct { + uint8_t HostStatus; + uint8_t TargetStatus; + uint8_t Reserved; + uint8_t CompletionCode; + } in; + } u; +} Mailbox32_t; +#pragma pack(pop) + + +/* + * + * CCB - SCSI Command Control Block + * + * The CCB is a superset of the CDB (Command Descriptor Block) + * and specifies detailed information about a SCSI command. + * + */ +/* Byte 0 Command Control Block Operation Code */ +#define SCSI_INITIATOR_COMMAND 0x00 +#define TARGET_MODE_COMMAND 0x01 +#define SCATTER_GATHER_COMMAND 0x02 +#define SCSI_INITIATOR_COMMAND_RES 0x03 +#define SCATTER_GATHER_COMMAND_RES 0x04 +#define BUS_RESET 0x81 + +/* Byte 1 Address and Direction Control */ +#define CCB_TARGET_ID_SHIFT 0x06 /* CCB Op Code = 00, 02 */ +#define CCB_INITIATOR_ID_SHIFT 0x06 /* CCB Op Code = 01 */ +#define CCB_DATA_XFER_IN 0x01 +#define CCB_DATA_XFER_OUT 0x02 +#define CCB_LUN_MASK 0x07 /* Logical Unit Number */ + +/* Byte 2 SCSI_Command_Length - Length of SCSI CDB + Byte 3 Request Sense Allocation Length */ +#define FOURTEEN_BYTES 0x00 /* Request Sense Buffer size */ +#define NO_AUTO_REQUEST_SENSE 0x01 /* No Request Sense Buffer */ + +/* Bytes 4, 5 and 6 Data Length - Data transfer byte count */ +/* Bytes 7, 8 and 9 Data Pointer - SGD List or Data Buffer */ +/* Bytes 10, 11 and 12 Link Pointer - Next CCB in Linked List */ +/* Byte 13 Command Link ID - TBD (I don't know yet) */ +/* Byte 14 Host Status - Host Adapter status */ +#define CCB_COMPLETE 0x00 /* CCB completed without error */ +#define CCB_LINKED_COMPLETE 0x0A /* Linked command completed */ +#define CCB_LINKED_COMPLETE_INT 0x0B /* Linked complete with intr */ +#define CCB_SELECTION_TIMEOUT 0x11 /* Set SCSI selection timed out */ +#define CCB_DATA_OVER_UNDER_RUN 0x12 +#define CCB_UNEXPECTED_BUS_FREE 0x13 /* Trg dropped SCSI BSY */ +#define CCB_PHASE_SEQUENCE_FAIL 0x14 /* Trg bus phase sequence fail */ +#define CCB_BAD_MBO_COMMAND 0x15 /* MBO command not 0, 1 or 2 */ +#define CCB_INVALID_OP_CODE 0x16 /* CCB invalid operation code */ +#define CCB_BAD_LINKED_LUN 0x17 /* Linked CCB LUN diff from 1st */ +#define CCB_INVALID_DIRECTION 0x18 /* Invalid target direction */ +#define CCB_DUPLICATE_CCB 0x19 /* Duplicate CCB */ +#define CCB_INVALID_CCB 0x1A /* Invalid CCB - bad parameter */ + +/* Byte 15 Target Status + + See scsi.h files for these statuses. + Bytes 16 and 17 Reserved (must be 0) + Bytes 18 through 18+n-1, where n=size of CDB Command Descriptor Block */ + +#pragma pack(push,1) +typedef struct { + uint8_t Opcode; + uint8_t Reserved1 :3, + ControlByte :2, + TagQueued :1, + QueueTag :2; + uint8_t CdbLength; + uint8_t RequestSenseLength; + uint32_t DataLength; + uint32_t DataPointer; + uint8_t Reserved2[2]; + uint8_t HostStatus; + uint8_t TargetStatus; + uint8_t Id; + uint8_t Lun :5, + LegacyTagEnable :1, + LegacyQueueTag :2; + uint8_t Cdb[12]; + uint8_t Reserved3[6]; + uint32_t SensePointer; +} CCB32; +#pragma pack(pop) + +#pragma pack(push,1) +typedef struct { + uint8_t Opcode; + uint8_t Lun :3, + ControlByte :2, + Id :3; + uint8_t CdbLength; + uint8_t RequestSenseLength; + addr24 DataLength; + addr24 DataPointer; + addr24 LinkPointer; + uint8_t LinkId; + uint8_t HostStatus; + uint8_t TargetStatus; + uint8_t Reserved[2]; + uint8_t Cdb[12]; +} CCB; +#pragma pack(pop) + +#pragma pack(push,1) +typedef struct { + uint8_t Opcode; + uint8_t Pad1 :3, + ControlByte :2, + Pad2 :3; + uint8_t CdbLength; + uint8_t RequestSenseLength; + uint8_t Pad3[10]; + uint8_t HostStatus; + uint8_t TargetStatus; + uint8_t Pad4[2]; + uint8_t Cdb[12]; +} CCBC; +#pragma pack(pop) + +#pragma pack(push,1) +typedef union { + CCB32 new; + CCB old; + CCBC common; +} CCBU; +#pragma pack(pop) + + +/* + * + * Scatter/Gather Segment List Definitions + * + * Adapter limits + */ +/* #define MAX_SG_DESCRIPTORS ((bl->chip >= CHIP_BUSLOGIC_ISA) ? 32 : 17) */ +#define MAX_SG_DESCRIPTORS 32 /* Always make the array 32 elements long, if less are used, that's not an issue. */ + +#pragma pack(push,1) +typedef struct { + uint32_t Segment; + uint32_t SegmentPointer; +} SGE32; +#pragma pack(pop) + +#pragma pack(push,1) +typedef struct { + addr24 Segment; + addr24 SegmentPointer; +} SGE; +#pragma pack(pop) + +#pragma pack(push,1) +typedef struct { + CCBU CmdBlock; + uint8_t *RequestSenseBuffer; + uint32_t CCBPointer; + int Is24bit; + uint8_t TargetID; + uint8_t LUN; + uint8_t HostStatus; + uint8_t TargetStatus; + uint8_t MailboxCompletionCode; +} BuslogicRequests_t; +#pragma pack(pop) + +#pragma pack(push,1) +typedef struct { + rom_t bios; + int UseLocalRAM; + int StrictRoundRobinMode; + int ExtendedLUNCCBFormat; + HALocalRAM LocalRAM; + BuslogicRequests_t BuslogicRequests; + uint8_t Status; + uint8_t Interrupt; + uint8_t Geometry; + uint8_t Control; + uint8_t Command; + uint8_t CmdBuf[53]; + uint8_t CmdParam; + uint8_t CmdParamLeft; + uint8_t DataBuf[64]; + uint16_t DataReply; + uint16_t DataReplyLeft; + uint32_t MailboxCount; + uint32_t MailboxOutAddr; + uint32_t MailboxOutPosCur; + uint32_t MailboxInAddr; + uint32_t MailboxInPosCur; + int Base; + int PCIBase; + int MMIOBase; + int Irq; + int DmaChannel; + int IrqEnabled; + int Mbx24bit; + int MailboxOutInterrupts; + int MbiActive[256]; + int PendingInterrupt; + int Lock; + mem_mapping_t mmio_mapping; + aha_info aha; + int chip; +} Buslogic_t; +#pragma pack(pop) + + +int scsi_model = 1; +int BuslogicResetCallback = 0; +int BuslogicCallback = 0; +int BuslogicInOperation = 0; +static Buslogic_t *BuslogicResetDevice; + + +enum +{ + CHIP_AHA154XB, + CHIP_AHA154XCF, + CHIP_BUSLOGIC_ISA, + CHIP_BUSLOGIC_PCI +}; + + +static void BuslogicStartMailbox(Buslogic_t *Buslogic); + +#ifdef WALTJE +int buslogic_do_log = 1; +# define ENABLE_BUSLOGIC_LOG +#else +int buslogic_do_log = 0; +#endif + + +static void BuslogicLog(const char *format, ...) +{ +#ifdef ENABLE_BUSLOGIC_LOG + va_list ap; + + if (buslogic_do_log) { + va_start(ap, format); + vprintf(format, ap); + va_end(ap); + fflush(stdout); + } +#endif +} +#define pclog BuslogicLog + + +static void BuslogicClearInterrupt(Buslogic_t *bl) +{ + pclog("Buslogic: Lowering Interrupt 0x%02X\n", bl->Interrupt); + bl->Interrupt = 0; + pclog("Lowering IRQ %i\n", bl->Irq); + picintc(1 << bl->Irq); + if (bl->PendingInterrupt) { + bl->Interrupt = bl->PendingInterrupt; + pclog("Buslogic: Raising Interrupt 0x%02X (Pending)\n", bl->Interrupt); + if (bl->MailboxOutInterrupts || !(bl->Interrupt & INTR_MBOA)) { + if (bl->IrqEnabled) picint(1 << bl->Irq); + } + bl->PendingInterrupt = 0; + } +} + + +static void BuslogicLocalRAM(Buslogic_t *bl) +{ + /* + * These values are mostly from what I think is right + * looking at the dmesg output from a Linux guest inside + * a VMware server VM. + * + * So they don't have to be right :) + */ + memset(bl->LocalRAM.u8View, 0, sizeof(HALocalRAM)); + bl->LocalRAM.structured.autoSCSIData.fLevelSensitiveInterrupt = 1; + bl->LocalRAM.structured.autoSCSIData.fParityCheckingEnabled = 1; + bl->LocalRAM.structured.autoSCSIData.fExtendedTranslation = 1; /* Same as in geometry register. */ + bl->LocalRAM.structured.autoSCSIData.u16DeviceEnabledMask = UINT16_MAX; /* All enabled. Maybe mask out non present devices? */ + bl->LocalRAM.structured.autoSCSIData.u16WidePermittedMask = UINT16_MAX; + bl->LocalRAM.structured.autoSCSIData.u16FastPermittedMask = UINT16_MAX; + bl->LocalRAM.structured.autoSCSIData.u16SynchronousPermittedMask = UINT16_MAX; + bl->LocalRAM.structured.autoSCSIData.u16DisconnectPermittedMask = UINT16_MAX; + bl->LocalRAM.structured.autoSCSIData.fStrictRoundRobinMode = bl->StrictRoundRobinMode; + bl->LocalRAM.structured.autoSCSIData.u16UltraPermittedMask = UINT16_MAX; + /** @todo calculate checksum? */ +} + + +static void BuslogicReset(Buslogic_t *bl) +{ + BuslogicCallback = 0; + BuslogicResetCallback = 0; + bl->Status = STAT_IDLE | STAT_INIT; + bl->Geometry = 0x80; + bl->Command = 0xFF; + bl->CmdParam = 0; + bl->CmdParamLeft = 0; + bl->IrqEnabled = 1; + bl->StrictRoundRobinMode = 0; + bl->ExtendedLUNCCBFormat = 0; + bl->MailboxOutPosCur = 0; + bl->MailboxInPosCur = 0; + bl->MailboxOutInterrupts = 0; + bl->PendingInterrupt = 0; + bl->Lock = 0; + BuslogicInOperation = 0; + + BuslogicClearInterrupt(bl); + + BuslogicLocalRAM(bl); +} + + +void BuslogicSoftReset(void) +{ + if (BuslogicResetDevice != NULL) { + BuslogicReset(BuslogicResetDevice); + } +} + + +static void BuslogicResetControl(Buslogic_t *bl, uint8_t Reset) +{ + BuslogicReset(bl); + if (Reset) { + bl->Status |= STAT_STST; + bl->Status &= ~STAT_IDLE; + } + BuslogicResetCallback = BUSLOGIC_RESET_DURATION_NS * TIMER_USEC; +} + + +static void BuslogicCommandComplete(Buslogic_t *bl) +{ + bl->DataReply = 0; + bl->Status |= STAT_IDLE; + +#ifdef WALTJE + if ((bl->Command != 0x02) && (bl->Command != 0x82)) { +#else + if (bl->Command != 0x02) { +#endif + bl->Status &= ~STAT_DFULL; + bl->Interrupt = (INTR_ANY | INTR_HACC); + pclog("Raising IRQ %i\n", bl->Irq); + if (bl->IrqEnabled) + picint(1 << bl->Irq); + } + + bl->Command = 0xFF; + bl->CmdParam = 0; +} + + +static void BuslogicRaiseInterrupt(Buslogic_t *bl, uint8_t Interrupt) +{ + if (bl->Interrupt & INTR_HACC) { + pclog("Pending IRQ\n"); + bl->PendingInterrupt = Interrupt; + } else { + bl->Interrupt = Interrupt; + pclog("Raising IRQ %i\n", bl->Irq); + if (bl->IrqEnabled) + picint(1 << bl->Irq); + } +} + + +static void BuslogicMailboxInSetup(Buslogic_t *bl, uint32_t CCBPointer, + CCBU *CmdBlock, uint8_t HostStatus, + uint8_t TargetStatus, + uint8_t MailboxCompletionCode) +{ + BuslogicRequests_t *req = &bl->BuslogicRequests; + + req->CCBPointer = CCBPointer; + memcpy(&(req->CmdBlock), CmdBlock, sizeof(CCB32)); + req->Is24bit = bl->Mbx24bit; + req->HostStatus = HostStatus; + req->TargetStatus = TargetStatus; + req->MailboxCompletionCode = MailboxCompletionCode; + + pclog("Mailbox in setup\n"); + + BuslogicInOperation = 2; +} + + +static void BuslogicMailboxIn(Buslogic_t *bl) +{ + BuslogicRequests_t *req = &bl->BuslogicRequests; + uint32_t CCBPointer = req->CCBPointer; + CCBU *CmdBlock = &(req->CmdBlock); + uint8_t HostStatus = req->HostStatus; + uint8_t TargetStatus = req->TargetStatus; + uint8_t MailboxCompletionCode = req->MailboxCompletionCode; + Mailbox32_t Mailbox32; + Mailbox_t MailboxIn; + uint32_t Incoming; + + Mailbox32.CCBPointer = CCBPointer; + Mailbox32.u.in.HostStatus = HostStatus; + Mailbox32.u.in.TargetStatus = TargetStatus; + Mailbox32.u.in.CompletionCode = MailboxCompletionCode; + + Incoming = bl->MailboxInAddr + (bl->MailboxInPosCur * (bl->Mbx24bit ? sizeof(Mailbox_t) : sizeof(Mailbox32_t))); + + if (MailboxCompletionCode != MBI_NOT_FOUND) { + CmdBlock->common.HostStatus = HostStatus; + CmdBlock->common.TargetStatus = TargetStatus; + + /* Rewrite the CCB up to the CDB. */ + pclog("CCB rewritten to the CDB (pointer %08X, length %i)\n", CCBPointer, offsetof(CCBC, Cdb)); + DMAPageWrite(CCBPointer, (char *)CmdBlock, offsetof(CCBC, Cdb)); + } else { + pclog("Mailbox not found!\n"); + } + + pclog("Host Status 0x%02X, Target Status 0x%02X\n", + HostStatus, TargetStatus); + + if (bl->Mbx24bit) { + MailboxIn.CmdStatus = Mailbox32.u.in.CompletionCode; + U32_TO_ADDR(MailboxIn.CCBPointer, Mailbox32.CCBPointer); + pclog("Mailbox 24-bit: Status=0x%02X, CCB at 0x%04X\n", MailboxIn.CmdStatus, ADDR_TO_U32(MailboxIn.CCBPointer)); + + DMAPageWrite(Incoming, (char *)&MailboxIn, sizeof(Mailbox_t)); + pclog("%i bytes of 24-bit mailbox written to: %08X\n", sizeof(Mailbox_t), Incoming); + } else { + pclog("Mailbox 32-bit: Status=0x%02X, CCB at 0x%04X\n", Mailbox32.u.in.CompletionCode, Mailbox32.CCBPointer); + + DMAPageWrite(Incoming, (char *)&Mailbox32, sizeof(Mailbox32_t)); + pclog("%i bytes of 32-bit mailbox written to: %08X\n", sizeof(Mailbox32_t), Incoming); + } + + bl->MailboxInPosCur++; + if (bl->MailboxInPosCur >= bl->MailboxCount) + bl->MailboxInPosCur = 0; + + BuslogicRaiseInterrupt(bl, INTR_MBIF | INTR_ANY); + + BuslogicInOperation = 0; +} + + +static void BuslogicReadSGEntries(int Is24bit, uint32_t SGList, uint32_t Entries, SGE32 *SG) +{ + uint32_t i; + SGE SGE24[MAX_SG_DESCRIPTORS]; + + if (Is24bit) { + DMAPageRead(SGList, (char *)&SGE24, Entries * sizeof(SGE)); + + for (i=0;iCmdBlock.old.DataPointer); + DataLength = ADDR_TO_U32(req->CmdBlock.old.DataLength); + } else { + DataPointer = req->CmdBlock.new.DataPointer; + DataLength = req->CmdBlock.new.DataLength; + } + pclog("Data Buffer write: length %d, pointer 0x%04X\n", + DataLength, DataPointer); + + if ((req->CmdBlock.common.ControlByte != 0x03) && DataLength) { + if (req->CmdBlock.common.Opcode == SCATTER_GATHER_COMMAND || + req->CmdBlock.common.Opcode == SCATTER_GATHER_COMMAND_RES) { + uint32_t SGRead; + uint32_t ScatterEntry; + SGE32 SGBuffer[MAX_SG_DESCRIPTORS]; + uint32_t SGLeft = DataLength / SGEntryLength; + uint32_t SGAddrCurrent = DataPointer; + uint32_t DataToTransfer = 0; + + do { + SGRead = (SGLeft < ELEMENTS(SGBuffer)) ? SGLeft : ELEMENTS(SGBuffer); + SGLeft -= SGRead; + + BuslogicReadSGEntries(Is24bit, SGAddrCurrent, SGRead, SGBuffer); + + for (ScatterEntry = 0; ScatterEntry < SGRead; ScatterEntry++) { + uint32_t Address; + + pclog("BusLogic S/G Write: ScatterEntry=%u\n", ScatterEntry); + + Address = SGBuffer[ScatterEntry].SegmentPointer; + DataToTransfer += SGBuffer[ScatterEntry].Segment; + + pclog("BusLogic S/G Write: Address=%08X DatatoTransfer=%u\n", Address, DataToTransfer); + } + + SGAddrCurrent += SGRead * SGEntryLength; + } while (SGLeft > 0); + + pclog("Data to transfer (S/G) %d\n", DataToTransfer); + + SCSIDevices[req->TargetID][req->LUN].InitLength = DataToTransfer; + + /* If the control byte is 0x00, it means that the transfer direction is set up by the SCSI command without + checking its length, so do this procedure for both no read/write commands. */ + if ((req->CmdBlock.common.ControlByte == CCB_DATA_XFER_OUT) || + (req->CmdBlock.common.ControlByte == 0x00)) { + SGLeft = DataLength / SGEntryLength; + SGAddrCurrent = DataPointer; + + do { + SGRead = (SGLeft < ELEMENTS(SGBuffer)) ? SGLeft : ELEMENTS(SGBuffer); + SGLeft -= SGRead; + + BuslogicReadSGEntries(Is24bit, SGAddrCurrent, + SGRead, SGBuffer); + + for (ScatterEntry = 0; ScatterEntry < SGRead; ScatterEntry++) { + uint32_t Address; + + pclog("BusLogic S/G Write: ScatterEntry=%u\n", ScatterEntry); + + Address = SGBuffer[ScatterEntry].SegmentPointer; + DataToTransfer = SGBuffer[ScatterEntry].Segment; + + pclog("BusLogic S/G Write: Address=%08X DatatoTransfer=%u\n", Address, DataToTransfer); + + DMAPageRead(Address, (char *)SCSIDevices[req->TargetID][req->LUN].CmdBuffer + sg_buffer_pos, DataToTransfer); + sg_buffer_pos += DataToTransfer; + } + + SGAddrCurrent += SGRead * (Is24bit ? sizeof(SGE) : sizeof(SGE32)); + } while (SGLeft > 0); + } + } else if (req->CmdBlock.common.Opcode == SCSI_INITIATOR_COMMAND || + req->CmdBlock.common.Opcode == SCSI_INITIATOR_COMMAND_RES) { + uint32_t Address = DataPointer; + + SCSIDevices[req->TargetID][req->LUN].InitLength = DataLength; + if (DataLength > 0) { + DMAPageRead(Address, + (char *)SCSIDevices[req->TargetID][req->LUN].CmdBuffer, + SCSIDevices[req->TargetID][req->LUN].InitLength); + } + } + } +} + + +void BuslogicDataBufferFree(BuslogicRequests_t *req) +{ + uint32_t DataPointer = 0; + uint32_t DataLength = 0; + uint32_t sg_buffer_pos = 0; + uint32_t SGRead; + uint32_t ScatterEntry; + SGE32 SGBuffer[MAX_SG_DESCRIPTORS]; + uint32_t SGEntrySize; + uint32_t SGLeft; + uint32_t SGAddrCurrent; + uint32_t Address; + uint32_t Residual; + + if (req->Is24bit) { + DataPointer = ADDR_TO_U32(req->CmdBlock.old.DataPointer); + DataLength = ADDR_TO_U32(req->CmdBlock.old.DataLength); + } else { + DataPointer = req->CmdBlock.new.DataPointer; + DataLength = req->CmdBlock.new.DataLength; + } + + if ((DataLength != 0) && (req->CmdBlock.common.Cdb[0] == GPCMD_TEST_UNIT_READY)) { + pclog("Data length not 0 with TEST UNIT READY: %i (%i)\n", + DataLength, SCSIDevices[req->TargetID][req->LUN].InitLength); + } + + if (req->CmdBlock.common.Cdb[0] == GPCMD_TEST_UNIT_READY) { + DataLength = 0; + } + + pclog("Data Buffer read: length %d, pointer 0x%04X\n", + DataLength, DataPointer); + + /* If the control byte is 0x00, it means that the transfer direction is set up by the SCSI command without + checking its length, so do this procedure for both read/write commands. */ + if ((DataLength > 0) && + ((req->CmdBlock.common.ControlByte == CCB_DATA_XFER_IN) || + (req->CmdBlock.common.ControlByte == 0x00))) { + if ((req->CmdBlock.common.Opcode == SCATTER_GATHER_COMMAND) || + (req->CmdBlock.common.Opcode == SCATTER_GATHER_COMMAND_RES)) { + SGEntrySize = (req->Is24bit ? sizeof(SGE) : sizeof(SGE32)); + SGLeft = DataLength / SGEntrySize; + SGAddrCurrent = DataPointer; + + do { + SGRead = (SGLeft < ELEMENTS(SGBuffer)) ? SGLeft : ELEMENTS(SGBuffer); + SGLeft -= SGRead; + + BuslogicReadSGEntries(req->Is24bit, SGAddrCurrent, + SGRead, SGBuffer); + + for (ScatterEntry = 0; ScatterEntry < SGRead; ScatterEntry++) { + uint32_t Address; + uint32_t DataToTransfer; + + pclog("BusLogic S/G: ScatterEntry=%u\n", ScatterEntry); + + Address = SGBuffer[ScatterEntry].SegmentPointer; + DataToTransfer = SGBuffer[ScatterEntry].Segment; + + pclog("BusLogic S/G: Writing %i bytes at %08X\n", DataToTransfer, Address); + + DMAPageWrite(Address, (char *)SCSIDevices[req->TargetID][req->LUN].CmdBuffer + sg_buffer_pos, DataToTransfer); + sg_buffer_pos += DataToTransfer; + } + + SGAddrCurrent += (SGRead * SGEntrySize); + } while (SGLeft > 0); + } else if (req->CmdBlock.common.Opcode == SCSI_INITIATOR_COMMAND || + req->CmdBlock.common.Opcode == SCSI_INITIATOR_COMMAND_RES) { + Address = DataPointer; + + pclog("BusLogic DMA: Writing %i bytes at %08X\n", DataLength, Address); + DMAPageWrite(Address, (char *)SCSIDevices[req->TargetID][req->LUN].CmdBuffer, DataLength); + } + } + + if ((req->CmdBlock.common.Opcode == SCSI_INITIATOR_COMMAND_RES) || + (req->CmdBlock.common.Opcode == SCATTER_GATHER_COMMAND_RES)) { + /* Should be 0 when scatter/gather? */ + if (DataLength >= SCSIDevices[req->TargetID][req->LUN].InitLength) { + Residual = DataLength; + Residual -= SCSIDevices[req->TargetID][req->LUN].InitLength; + } else { + Residual = 0; + } + + if (req->Is24bit) { + U32_TO_ADDR(req->CmdBlock.old.DataLength, Residual); + pclog("24-bit Residual data length for reading: %d\n", + ADDR_TO_U32(req->CmdBlock.old.DataLength)); + } else { + req->CmdBlock.new.DataLength = Residual; + pclog("32-bit Residual data length for reading: %d\n", + req->CmdBlock.new.DataLength); + } + } +} + + +static uint8_t BuslogicRead(uint16_t Port, void *p) +{ + Buslogic_t *bl = (Buslogic_t *)p; + uint8_t Temp; + + switch (Port & 3) { + case 0: + Temp = bl->Status; + break; + + case 1: + if (bl->UseLocalRAM) + Temp = bl->LocalRAM.u8View[bl->DataReply]; + else + Temp = bl->DataBuf[bl->DataReply]; + if (bl->DataReplyLeft) { + bl->DataReply++; + bl->DataReplyLeft--; + if (!bl->DataReplyLeft) { + BuslogicCommandComplete(bl); + } + } + break; + + case 2: + Temp = bl->Interrupt; + break; + + case 3: + Temp = bl->Geometry; + break; + } + + if (Port < 0x1000) { + pclog("Buslogic: Read Port 0x%02X, Returned Value %02X\n", + Port, Temp); + } + + return(Temp); +} + + +static uint16_t BuslogicReadW(uint16_t Port, void *p) +{ + return BuslogicRead(Port, p); +} + + +static uint32_t BuslogicReadL(uint16_t Port, void *p) +{ + return BuslogicRead(Port, p); +} + + +/* This is BS - we just need a 'dev_present' indication.. --FvK */ +int +buslogic_dev_present(uint8_t id, uint8_t lun) +{ + if (lun > 7) return(0); + + if (scsi_cdrom_drives[id][lun] >= CDROM_NUM) return(0); + + if (cdrom_drives[scsi_cdrom_drives[id][lun]].enabled && + cdrom_drives[scsi_cdrom_drives[id][lun]].bus_type && + (cdrom_drives[scsi_cdrom_drives[id][lun]].bus_mode & 2)) return(1); + + return(0); +} + + +static void BuslogicWriteW(uint16_t Port, uint16_t Val, void *p); +static void BuslogicWriteL(uint16_t Port, uint32_t Val, void *p); +static void BuslogicWrite(uint16_t Port, uint8_t Val, void *p) +{ + int i = 0; + uint8_t j = 0; + Buslogic_t *bl = (Buslogic_t *)p; + uint8_t max_id = (bl->chip >= CHIP_BUSLOGIC_ISA) ? 16 : 8; + uint8_t Offset; + MailboxInit_t *MailboxInit; + ReplyInquireSetupInformation *ReplyISI; + MailboxInitExtended_t *MailboxInitE; + ReplyInquireExtendedSetupInformation *ReplyIESI; + BuslogicPCIInformation_t *ReplyPI; + char aModelName[] = "542B "; /* Trailing \0 is fine, that's the filler anyway. */ + int cCharsToTransfer; + + pclog("Buslogic: Write Port 0x%02X, Value %02X\n", Port, Val); + + switch (Port & 3) { + case 0: + if ((Val & CTRL_HRST) || (Val & CTRL_SRST)) { + uint8_t Reset = !(Val & CTRL_HRST); + BuslogicResetControl(bl, Reset); + break; + } + + if (Val & CTRL_IRST) { + BuslogicClearInterrupt(bl); + } + break; + + case 1: + /* Fast path for the mailbox execution command. */ + if (((Val == 0x02) || (Val == 0x82)) && + (bl->Command == 0xFF)) { + /* If there are no mailboxes configured, don't even try to do anything. */ + if (bl->MailboxCount) { + if (!BuslogicCallback) { + BuslogicCallback = 50 * SCSI_TIME; + } + } + return; + } + + if (bl->Command == 0xFF) { + bl->Command = Val; + bl->CmdParam = 0; + bl->CmdParamLeft = 0; + + bl->Status &= ~(STAT_INVCMD | STAT_IDLE); + pclog("Buslogic: Operation Code 0x%02X\n", Val); + switch (bl->Command) { + case 0x01: + bl->CmdParamLeft = sizeof(MailboxInit_t); + break; + + case 0x03: /* Exec BIOS Command */ + if (bl->chip < CHIP_BUSLOGIC_ISA) { + bl->CmdParamLeft = 10; + } + break; + + case 0x25: + if (bl->chip < CHIP_BUSLOGIC_ISA) { + /* Same as 0x01 for AHA. */ + bl->CmdParamLeft = sizeof(MailboxInit_t); + } else { + bl->CmdParamLeft = 1; + } + break; + + case 0x05: + case 0x07: + case 0x08: + case 0x09: + case 0x0D: + case 0x1F: + case 0x21: + case 0x24: + bl->CmdParamLeft = 1; + break; + + case 0x06: + bl->CmdParamLeft = 4; + break; + + case 0x1C: + case 0x1D: + bl->CmdParamLeft = 3; + break; + + case 0x22: /* write EEPROM */ + if (bl->chip < CHIP_BUSLOGIC_ISA) { + bl->CmdParamLeft = 3+32; + } + break; + + case 0x23: /* read EEPROM */ + if (bl->chip < CHIP_BUSLOGIC_ISA) { + bl->CmdParamLeft = 3; + } + break; + + case 0x29: + bl->CmdParamLeft = (bl->chip >= CHIP_BUSLOGIC_ISA) ? 0 : 2; + break; + + case 0x8B: + case 0x8D: + case 0x8F: + case 0x96: + bl->CmdParamLeft = (bl->chip >= CHIP_BUSLOGIC_ISA) ? 1 : 0; + break; + + case 0x81: + pclog("Command 0x81 on %s\n", (bl->chip >= CHIP_BUSLOGIC_ISA) ? "BusLogic" : "Adaptec"); + bl->CmdParamLeft = (bl->chip >= CHIP_BUSLOGIC_ISA) ? sizeof(MailboxInitExtended_t) : 0; + break; + + case 0x8C: + bl->CmdParamLeft = (bl->chip >= CHIP_BUSLOGIC_ISA) ? 1 : 0; + break; + + case 0x91: + bl->CmdParamLeft = 2; + break; + + case 0x95: /* Valid only for PCI */ + bl->CmdParamLeft = (bl->chip == CHIP_BUSLOGIC_PCI) ? 1 : 0; + break; + } + } else { + bl->CmdBuf[bl->CmdParam] = Val; + bl->CmdParam++; + bl->CmdParamLeft--; + } + + if (!bl->CmdParamLeft) { + pclog("Running Operation Code 0x%02X\n", bl->Command); + switch (bl->Command) { + case 0x00: + bl->DataReplyLeft = 0; + break; + + case 0x01: +aha_0x01: + { + bl->Mbx24bit = 1; + + MailboxInit = (MailboxInit_t *)bl->CmdBuf; + + bl->MailboxCount = MailboxInit->Count; + bl->MailboxOutAddr = ADDR_TO_U32(MailboxInit->Address); + bl->MailboxInAddr = bl->MailboxOutAddr + (bl->MailboxCount * sizeof(Mailbox_t)); + + pclog("Buslogic Initialize Mailbox Command\n"); + pclog("Mailbox Out Address=0x%08X\n", bl->MailboxOutAddr); + pclog("Mailbox In Address=0x%08X\n", bl->MailboxInAddr); + pclog("Initialized Mailbox, %d entries at 0x%08X\n", MailboxInit->Count, ADDR_TO_U32(MailboxInit->Address)); + + bl->Status &= ~STAT_INIT; + bl->DataReplyLeft = 0; + } + break; + + case 0x03: + bl->DataBuf[0] = 0x00; + bl->DataReplyLeft = 1; + break; + + case 0x04: + if (bl->chip >= CHIP_BUSLOGIC_ISA) { + bl->DataBuf[0] = 0x41; + bl->DataBuf[1] = 0x41; + bl->DataBuf[2] = '5'; + bl->DataBuf[3] = '0'; + } else { + bl->DataBuf[0] = bl->aha.bid; + bl->DataBuf[1] = 0x30; + bl->DataBuf[2] = bl->aha.fwh; + bl->DataBuf[3] = bl->aha.fwl; + } + bl->DataReplyLeft = 4; + break; + + case 0x05: + if (bl->CmdBuf[0] <= 1) { + bl->MailboxOutInterrupts = bl->CmdBuf[0]; + pclog("Mailbox out interrupts: %s\n", bl->MailboxOutInterrupts ? "ON" : "OFF"); + } else { + bl->Status |= STAT_INVCMD; + } + bl->DataReplyLeft = 0; + break; + + case 0x06: + bl->DataReplyLeft = 0; + break; + + case 0x07: + bl->DataReplyLeft = 0; + bl->LocalRAM.structured.autoSCSIData.uBusOnDelay = bl->CmdBuf[0]; + pclog("Bus-on time: %d\n", bl->CmdBuf[0]); + break; + + case 0x08: + bl->DataReplyLeft = 0; + bl->LocalRAM.structured.autoSCSIData.uBusOffDelay = bl->CmdBuf[0]; + pclog("Bus-off time: %d\n", bl->CmdBuf[0]); + break; + + case 0x09: + bl->DataReplyLeft = 0; + bl->LocalRAM.structured.autoSCSIData.uDMATransferRate = bl->CmdBuf[0]; + pclog("DMA transfer rate: %02X\n", bl->CmdBuf[0]); + break; + + case 0x0A: + memset(bl->DataBuf, 0, 8); + for (i=0; i<7; i++) { + bl->DataBuf[i] = 0; + for (j=0; j<8; j++) { + if (SCSIDevices[i][j].LunType != SCSI_NONE) + bl->DataBuf[i] |= (1 << j); + } + } + bl->DataBuf[7] = 0; + bl->DataReplyLeft = 8; + break; + + case 0x0B: + bl->DataBuf[0] = (1 << bl->DmaChannel); + if (bl->chip >= CHIP_BUSLOGIC_ISA) { + bl->DataBuf[1] = (1<<(bl->Irq-9)); + } else { + if (bl->Irq >= 8) + bl->DataBuf[1]=(1<<(bl->Irq-9)); + else + bl->DataBuf[1]=(1<Irq); + } + bl->DataBuf[2] = 7; /* HOST ID */ + bl->DataReplyLeft = 3; + break; + + case 0x0D: + { + bl->DataReplyLeft = bl->CmdBuf[0]; + + ReplyISI = (ReplyInquireSetupInformation *)bl->DataBuf; + memset(ReplyISI, 0, sizeof(ReplyInquireSetupInformation)); + + ReplyISI->fSynchronousInitiationEnabled = 1; + ReplyISI->fParityCheckingEnabled = 1; + ReplyISI->cMailbox = bl->MailboxCount; + U32_TO_ADDR(ReplyISI->MailboxAddress, bl->MailboxOutAddr); + + if (bl->chip >= CHIP_BUSLOGIC_ISA) { + ReplyISI->uSignature = 'B'; + /* The 'D' signature prevents Buslogic's OS/2 drivers from getting too + * friendly with Adaptec hardware and upsetting the HBA state. + */ + ReplyISI->uCharacterD = 'D'; /* BusLogic model. */ + ReplyISI->uHostBusType = (bl->chip == CHIP_BUSLOGIC_PCI) ? 'F' : 'A'; /* ISA bus. */ + } + + pclog("Return Setup Information: %d\n", bl->CmdBuf[0]); + } + break; + + case 0x1C: + { + uint32_t FIFOBuf; + addr24 Address; + + bl->DataReplyLeft = 0; + Address.hi = bl->CmdBuf[0]; + Address.mid = bl->CmdBuf[1]; + Address.lo = bl->CmdBuf[2]; + FIFOBuf = ADDR_TO_U32(Address); + DMAPageRead(FIFOBuf, (char *)&bl->LocalRAM.u8View[64], 64); + } + break; + + case 0x1D: + { + uint32_t FIFOBuf; + addr24 Address; + + bl->DataReplyLeft = 0; + Address.hi = bl->CmdBuf[0]; + Address.mid = bl->CmdBuf[1]; + Address.lo = bl->CmdBuf[2]; + FIFOBuf = ADDR_TO_U32(Address); + pclog("Buslogic FIFO: Writing 64 bytes at %08X\n", FIFOBuf); + DMAPageWrite(FIFOBuf, (char *)&bl->LocalRAM.u8View[64], 64); + } + break; + + case 0x1F: + bl->DataBuf[0] = bl->CmdBuf[0]; + bl->DataReplyLeft = 1; + break; + + case 0x20: + bl->DataReplyLeft = 0; + if (bl->chip >= CHIP_BUSLOGIC_ISA) { + BuslogicResetControl(bl, 1); + } else { + bl->Status |= STAT_INVCMD; + } + break; + + case 0x21: + if (bl->CmdParam == 1) + bl->CmdParamLeft = bl->CmdBuf[0]; + bl->DataReplyLeft = 0; + break; + + case 0x22: /* write EEPROM */ + if (bl->chip < CHIP_BUSLOGIC_ISA) { + /* Sent by CF BIOS. */ + bl->DataReplyLeft = + aha154x_eeprom(bl->Command, + bl->CmdBuf[0], + bl->CmdBuf[1], + bl->CmdBuf[2], + &bl->CmdBuf[3]); + if (bl->DataReplyLeft == 0xff) { + bl->DataReplyLeft = 0; + bl->Status |= STAT_INVCMD; + } + } else { + bl->Status |= STAT_INVCMD; + bl->DataReplyLeft = 0; + } + break; + + case 0x23: + if (bl->chip >= CHIP_BUSLOGIC_ISA) { + memset(bl->DataBuf, 0, 8); + for (i = 8; i < 16; i++) { + bl->DataBuf[i] = 0; + for (i=0; j<8; j++) { + if (SCSIDevices[i][j].LunType != SCSI_NONE) + bl->DataBuf[i] |= (1 << j); + } + } + bl->DataReplyLeft = 8; + } else { + /* Sent by CF BIOS. */ + bl->DataReplyLeft = + aha154x_eeprom(bl->Command, + bl->CmdBuf[0], + bl->CmdBuf[1], + bl->CmdBuf[2], + bl->DataBuf); + if (bl->DataReplyLeft == 0xff) { + bl->DataReplyLeft = 0; + bl->Status |= STAT_INVCMD; + } + } + break; + + case 0x24: + if (bl->chip >= CHIP_BUSLOGIC_ISA) { + uint16_t TargetsPresentMask = 0; + + for (i=0; i<16; i++) { + for (j=0; j<8; j++) { + if (SCSIDevices[i][j].LunType != SCSI_NONE) + TargetsPresentMask |= (1 << i); + } + } + bl->DataBuf[0] = TargetsPresentMask & 0xFF; + bl->DataBuf[1] = TargetsPresentMask >> 8; + bl->DataReplyLeft = 2; + } else { + /* + * For AHA1542CF, this is the command + * to play with the Shadow RAM. BIOS + * gives us one argument (00,02,03) + * and expects a 0x04 back in the INTR + * register. --FvK + */ + bl->Interrupt = aha154x_shram(Val); + } + break; + + case 0x25: + if ((bl->chip < CHIP_BUSLOGIC_ISA)) { + goto aha_0x01; + } else { + if (bl->CmdBuf[0] == 0) + bl->IrqEnabled = 0; + else + bl->IrqEnabled = 1; + pclog("Lowering IRQ %i\n", bl->Irq); + picintc(1 << bl->Irq); + } + break; + + case 0x26: /* AHA memory mapper */ + case 0x27: /* AHA memory mapper */ + if (bl->chip < CHIP_BUSLOGIC_ISA) { + bl->DataReplyLeft = + aha154x_memory(bl->Command); + } else { + bl->Status |= STAT_INVCMD; + bl->DataReplyLeft = 0; + } + break; + + case 0x28: + if (bl->chip < CHIP_BUSLOGIC_ISA) { + bl->DataBuf[0] = 0x08; + bl->DataBuf[1] = bl->Lock; + bl->DataReplyLeft = 2; + } else { + bl->DataReplyLeft = 0; + bl->Status |= STAT_INVCMD; + } + break; + + case 0x29: + if (bl->chip < CHIP_BUSLOGIC_ISA) { + if (bl->CmdBuf[1] == bl->Lock) { + if (bl->CmdBuf[0] & 1) { + bl->Lock = 1; + } else { + bl->Lock = 0; + } + } + bl->DataReplyLeft = 0; + } else { + bl->DataReplyLeft = 0; + bl->Status |= STAT_INVCMD; + } + break; + + case 0x2C: /* AHA-1542CP sends this */ + if (bl->chip < CHIP_BUSLOGIC_ISA) { + bl->DataBuf[0] = 0x00; + bl->DataReplyLeft = 1; + } else { + bl->DataReplyLeft = 0; + bl->Status |= STAT_INVCMD; + } + break; + + case 0x33: /* AHA-1542CP sends this */ + if (bl->chip < CHIP_BUSLOGIC_ISA) { + bl->DataBuf[0] = 0x00; + bl->DataBuf[1] = 0x00; + bl->DataBuf[2] = 0x00; + bl->DataBuf[3] = 0x00; + bl->DataReplyLeft = 256; + } else { + bl->DataReplyLeft = 0; + bl->Status |= STAT_INVCMD; + } + break; + + case 0x81: + { + if (bl->chip >= CHIP_BUSLOGIC_ISA) { + bl->Mbx24bit = 0; + + MailboxInitE = (MailboxInitExtended_t *)bl->CmdBuf; + + bl->MailboxCount = MailboxInitE->Count; + bl->MailboxOutAddr = MailboxInitE->Address; + bl->MailboxInAddr = MailboxInitE->Address + (bl->MailboxCount * sizeof(Mailbox32_t)); + + pclog("Buslogic Extended Initialize Mailbox Command\n"); + pclog("Mailbox Out Address=0x%08X\n", bl->MailboxOutAddr); + pclog("Mailbox In Address=0x%08X\n", bl->MailboxInAddr); + pclog("Initialized Extended Mailbox, %d entries at 0x%08X\n", MailboxInitE->Count, MailboxInitE->Address); + + bl->Status &= ~STAT_INIT; + bl->DataReplyLeft = 0; + } else { + bl->DataReplyLeft = 0; + bl->Status |= STAT_INVCMD; + } + } + break; + + case 0x84: + if (bl->chip >= CHIP_BUSLOGIC_ISA) { + bl->DataBuf[0] = '7'; + bl->DataReplyLeft = 1; + } else { + bl->DataReplyLeft = 0; + bl->Status |= STAT_INVCMD; + } + break; + + case 0x85: + if (bl->chip >= CHIP_BUSLOGIC_ISA) { + bl->DataBuf[0] = 'B'; + bl->DataReplyLeft = 1; + } else { + bl->DataReplyLeft = 0; + bl->Status |= STAT_INVCMD; + } + break; + + case 0x86: + if (bl->chip == CHIP_BUSLOGIC_PCI) + { + ReplyPI = (BuslogicPCIInformation_t *) bl->DataBuf; + memset(ReplyPI, 0, sizeof(BuslogicPCIInformation_t)); + ReplyPI->InformationIsValid = 0; + switch(bl->Base) + { + case 0x330: + ReplyPI->IsaIOPort = 0; + break; + case 0x334: + ReplyPI->IsaIOPort = 1; + break; + case 0x230: + ReplyPI->IsaIOPort = 2; + break; + case 0x234: + ReplyPI->IsaIOPort = 3; + break; + case 0x130: + ReplyPI->IsaIOPort = 4; + break; + case 0x134: + ReplyPI->IsaIOPort = 5; + break; + default: + ReplyPI->IsaIOPort = 0xFF; + break; + } + ReplyPI->IRQ = bl->Irq; + bl->DataReplyLeft = sizeof(BuslogicPCIInformation_t); + } else { + bl->DataReplyLeft = 0; + bl->Status |= STAT_INVCMD; + } + break; + + case 0x8B: + { + if (bl->chip >= CHIP_BUSLOGIC_ISA) { + /* The reply length is set by the guest and is found in the first byte of the command buffer. */ + bl->DataReplyLeft = bl->CmdBuf[0]; + memset(bl->DataBuf, 0, bl->DataReplyLeft); + if (bl->chip == CHIP_BUSLOGIC_PCI) { + aModelName[0] = '9'; + aModelName[1] = '5'; + aModelName[2] = '8'; + aModelName[3] = 'D'; + } + cCharsToTransfer = bl->DataReplyLeft <= sizeof(aModelName) + ? bl->DataReplyLeft + : sizeof(aModelName); + + for (i = 0; i < cCharsToTransfer; i++) + bl->DataBuf[i] = aModelName[i]; + } else { + bl->DataReplyLeft = 0; + bl->Status |= STAT_INVCMD; + } + } + break; + + case 0x8C: + if (bl->chip >= CHIP_BUSLOGIC_ISA) { + bl->DataReplyLeft = bl->CmdBuf[0]; + memset(bl->DataBuf, 0, bl->DataReplyLeft); + } else { + bl->DataReplyLeft = 0; + bl->Status |= STAT_INVCMD; + } + break; + + case 0x8D: + { + if (bl->chip >= CHIP_BUSLOGIC_ISA) { + bl->DataReplyLeft = bl->CmdBuf[0]; + ReplyIESI = (ReplyInquireExtendedSetupInformation *)bl->DataBuf; + memset(ReplyIESI, 0, sizeof(ReplyInquireExtendedSetupInformation)); + + ReplyIESI->uBusType = (bl->chip == CHIP_BUSLOGIC_PCI) ? 'E' : 'A'; /* ISA style */ + ReplyIESI->uBiosAddress = 0; + ReplyIESI->u16ScatterGatherLimit = 8192; + ReplyIESI->cMailbox = bl->MailboxCount; + ReplyIESI->uMailboxAddressBase = bl->MailboxOutAddr; + if (bl->chip == CHIP_BUSLOGIC_PCI) { + ReplyIESI->fLevelSensitiveInterrupt = 1; + ReplyIESI->fHostWideSCSI = 1; + ReplyIESI->fHostUltraSCSI = 1; + } + memcpy(ReplyIESI->aFirmwareRevision, "07B", sizeof(ReplyIESI->aFirmwareRevision)); + pclog("Return Extended Setup Information: %d\n", bl->CmdBuf[0]); + } else { + bl->DataReplyLeft = 0; + bl->Status |= STAT_INVCMD; + } + } + break; + + /* VirtualBox has these two modes implemented in reverse. + According to the BusLogic datasheet: + 0 is the strict round robin mode, which is also the one used by the AHA-154x according to the + Adaptec specification; + 1 is the aggressive round robin mode, which "hunts" for an active outgoing mailbox and then + processes it. */ + case 0x8F: + if (bl->chip >= CHIP_BUSLOGIC_ISA) { + if (bl->CmdBuf[0] == 0) + bl->StrictRoundRobinMode = 1; + else if (bl->CmdBuf[0] == 1) + bl->StrictRoundRobinMode = 0; + + bl->DataReplyLeft = 0; + } else { + bl->DataReplyLeft = 0; + bl->Status |= STAT_INVCMD; + } + break; + + case 0x91: + { + Offset = bl->CmdBuf[0]; + bl->DataReplyLeft = bl->CmdBuf[1]; + + bl->UseLocalRAM = 1; + bl->DataReply = Offset; + } + break; + + case 0x95: + if (bl->chip == CHIP_BUSLOGIC_PCI) { + if (bl->Base != 0) { + io_removehandler(bl->Base, 4, + BuslogicRead, + BuslogicReadW, + BuslogicReadL, + BuslogicWrite, + BuslogicWriteW, + BuslogicWriteL, + bl); + } + switch(bl->CmdBuf[0]) { + case 0: + bl->Base = 0x330; + break; + case 1: + bl->Base = 0x334; + break; + case 2: + bl->Base = 0x230; + break; + case 3: + bl->Base = 0x234; + break; + case 4: + bl->Base = 0x130; + break; + case 5: + bl->Base = 0x134; + break; + default: + bl->Base = 0; + break; + } + if (bl->Base != 0) { + io_sethandler(bl->Base, 4, + BuslogicRead, + BuslogicReadW, + BuslogicReadL, + BuslogicWrite, + BuslogicWriteW, + BuslogicWriteL, + bl); + } + bl->DataReplyLeft = 0; + } else { + bl->DataReplyLeft = 0; + bl->Status |= STAT_INVCMD; + } + break; + + case 0x96: + if (bl->chip >= CHIP_BUSLOGIC_ISA) { + if (bl->CmdBuf[0] == 0) + bl->ExtendedLUNCCBFormat = 0; + else if (bl->CmdBuf[0] == 1) + bl->ExtendedLUNCCBFormat = 1; + + bl->DataReplyLeft = 0; + } else { + bl->DataReplyLeft = 0; + bl->Status |= STAT_INVCMD; + } + break; + + default: + bl->DataReplyLeft = 0; + bl->Status |= STAT_INVCMD; + break; + } + } + + if (bl->DataReplyLeft) + bl->Status |= STAT_DFULL; + else if (!bl->CmdParamLeft) + BuslogicCommandComplete(bl); + break; + + case 2: + if (bl->chip >= CHIP_BUSLOGIC_ISA) + bl->Interrupt = Val; /* For Buslogic */ + break; + + case 3: + if (bl->chip >= CHIP_BUSLOGIC_ISA) + bl->Geometry = Val; /* For Buslogic */ + break; + } +} + + +static void BuslogicWriteW(uint16_t Port, uint16_t Val, void *p) +{ + BuslogicWrite(Port, Val & 0xFF, p); +} + + +static void BuslogicWriteL(uint16_t Port, uint32_t Val, void *p) +{ + BuslogicWrite(Port, Val & 0xFF, p); +} + + +static uint8_t BuslogicConvertSenseLength(uint8_t RequestSenseLength) +{ + pclog("Unconverted Request Sense length %i\n", RequestSenseLength); + + if (RequestSenseLength == 0) + RequestSenseLength = 14; + else if (RequestSenseLength == 1) + RequestSenseLength = 0; + + pclog("Request Sense length %i\n", RequestSenseLength); + + return(RequestSenseLength); +} + + +static void BuslogicSenseBufferFree(BuslogicRequests_t *req, int Copy, int is_hd) +{ + uint8_t SenseLength = BuslogicConvertSenseLength(req->CmdBlock.common.RequestSenseLength); + uint8_t cdrom_id = scsi_cdrom_drives[req->TargetID][req->LUN]; + uint8_t hdc_id = scsi_hard_disks[req->TargetID][req->LUN]; + uint32_t SenseBufferAddress; + uint8_t temp_sense[256]; + + if (SenseLength && Copy) { + if (is_hd) + { + scsi_hd_request_sense_for_scsi(hdc_id, temp_sense, SenseLength); + } + else + { + cdrom_request_sense_for_scsi(cdrom_id, temp_sense, SenseLength); + } + + /* + * The sense address, in 32-bit mode, is located in the + * Sense Pointer of the CCB, but in 24-bit mode, it is + * located at the end of the Command Descriptor Block. + */ + if (req->Is24bit) { + SenseBufferAddress = req->CCBPointer; + SenseBufferAddress += req->CmdBlock.common.CdbLength + offsetof(CCB, Cdb); + } else { + SenseBufferAddress = req->CmdBlock.new.SensePointer; + } + + pclog("Request Sense address: %02X\n", SenseBufferAddress); + + pclog("BuslogicSenseBufferFree(): Writing %i bytes at %08X\n", + SenseLength, SenseBufferAddress); + DMAPageWrite(SenseBufferAddress, (char *)temp_sense, SenseLength); + pclog("Sense data written to buffer: %02X %02X %02X\n", + temp_sense[2], temp_sense[12], temp_sense[13]); + } +} + + +static void BuslogicHDCommand(Buslogic_t *bl) +{ + BuslogicRequests_t *req = &bl->BuslogicRequests; + uint8_t Id, Lun; + uint8_t hdc_id; + uint8_t hd_phase; + uint8_t temp_cdb[12]; + uint32_t i; + + Id = req->TargetID; + Lun = req->LUN; + hdc_id = scsi_hard_disks[Id][Lun]; + + pclog("SCSI HD command being executed on: SCSI ID %i, SCSI LUN %i, HD %i\n", + Id, Lun, hdc_id); + + pclog("SCSI Cdb[0]=0x%02X\n", req->CmdBlock.common.Cdb[0]); + for (i = 1; i < req->CmdBlock.common.CdbLength; i++) { + pclog("SCSI Cdb[%i]=%i\n", i, req->CmdBlock.common.Cdb[i]); + } + + memset(temp_cdb, 0, shdc[hdc_id].cdb_len); + if (req->CmdBlock.common.CdbLength <= shdc[hdc_id].cdb_len) { + memcpy(temp_cdb, req->CmdBlock.common.Cdb, + req->CmdBlock.common.CdbLength); + } else { + memcpy(temp_cdb, req->CmdBlock.common.Cdb, shdc[hdc_id].cdb_len); + } + + /* + * Since that field in the HDC struct is never used when + * the bus type is SCSI, let's use it for this scope. + */ + shdc[hdc_id].request_length = temp_cdb[1]; + + if (req->CmdBlock.common.CdbLength != 12) { + /* + * Make sure the LUN field of the temporary CDB is always 0, + * otherwise Daemon Tools drives will misbehave when a command + * is passed through to them. + */ + temp_cdb[1] &= 0x1f; + } + + /* Finally, execute the SCSI command immediately and get the transfer length. */ + SCSIPhase = SCSI_PHASE_COMMAND; + scsi_hd_command(hdc_id, temp_cdb); + SCSIStatus = scsi_hd_err_stat_to_scsi(hdc_id); + if (SCSIStatus == SCSI_STATUS_OK) { + hd_phase = scsi_hd_phase_to_scsi(hdc_id); + if (hd_phase == 2) { + /* Command completed - call the phase callback to complete the command. */ + scsi_hd_callback(hdc_id); + } else { + /* Command first phase complete - call the callback to execute the second phase. */ + scsi_hd_callback(hdc_id); + SCSIStatus = scsi_hd_err_stat_to_scsi(hdc_id); + /* Command second phase complete - call the callback to complete the command. */ + scsi_hd_callback(hdc_id); + } + } else { + /* Error (Check Condition) - call the phase callback to complete the command. */ + scsi_hd_callback(hdc_id); + } + + pclog("SCSI Status: %s, Sense: %02X, ASC: %02X, ASCQ: %02X\n", (SCSIStatus == SCSI_STATUS_OK) ? "OK" : "CHECK CONDITION", shdc[hdc_id].sense[2], shdc[hdc_id].sense[12], shdc[hdc_id].sense[13]); + + BuslogicDataBufferFree(req); + + BuslogicSenseBufferFree(req, (SCSIStatus != SCSI_STATUS_OK), 1); + + pclog("Request complete\n"); + + if (SCSIStatus == SCSI_STATUS_OK) { + BuslogicMailboxInSetup(bl, req->CCBPointer, &req->CmdBlock, + CCB_COMPLETE, SCSI_STATUS_OK, MBI_SUCCESS); + } else if (SCSIStatus == SCSI_STATUS_CHECK_CONDITION) { + BuslogicMailboxInSetup(bl, req->CCBPointer, &req->CmdBlock, + CCB_COMPLETE, SCSI_STATUS_CHECK_CONDITION, MBI_ERROR); + } +} + +static void BuslogicCDROMCommand(Buslogic_t *bl) +{ + BuslogicRequests_t *req = &bl->BuslogicRequests; + uint8_t Id, Lun; + uint8_t cdrom_id; + uint8_t cdrom_phase; + uint8_t temp_cdb[12]; + uint32_t i; + + Id = req->TargetID; + Lun = req->LUN; + cdrom_id = scsi_cdrom_drives[Id][Lun]; + + pclog("CD-ROM command being executed on: SCSI ID %i, SCSI LUN %i, CD-ROM %i\n", + Id, Lun, cdrom_id); + + pclog("SCSI Cdb[0]=0x%02X\n", req->CmdBlock.common.Cdb[0]); + for (i = 1; i < req->CmdBlock.common.CdbLength; i++) { + pclog("SCSI Cdb[%i]=%i\n", i, req->CmdBlock.common.Cdb[i]); + } + + memset(temp_cdb, 0, cdrom[cdrom_id].cdb_len); + if (req->CmdBlock.common.CdbLength <= cdrom[cdrom_id].cdb_len) { + memcpy(temp_cdb, req->CmdBlock.common.Cdb, + req->CmdBlock.common.CdbLength); + } else { + memcpy(temp_cdb, req->CmdBlock.common.Cdb, cdrom[cdrom_id].cdb_len); + } + + /* + * Since that field in the CDROM struct is never used when + * the bus type is SCSI, let's use it for this scope. + */ + cdrom[cdrom_id].request_length = temp_cdb[1]; + + if (req->CmdBlock.common.CdbLength != 12) { + /* + * Make sure the LUN field of the temporary CDB is always 0, + * otherwise Daemon Tools drives will misbehave when a command + * is passed through to them. + */ + temp_cdb[1] &= 0x1f; + } + + /* Finally, execute the SCSI command immediately and get the transfer length. */ + SCSIPhase = SCSI_PHASE_COMMAND; + cdrom_command(cdrom_id, temp_cdb); + SCSIStatus = cdrom_CDROM_PHASE_to_scsi(cdrom_id); + if (SCSIStatus == SCSI_STATUS_OK) { + cdrom_phase = cdrom_atapi_phase_to_scsi(cdrom_id); + if (cdrom_phase == 2) { + /* Command completed - call the phase callback to complete the command. */ + cdrom_phase_callback(cdrom_id); + } else { + /* Command first phase complete - call the callback to execute the second phase. */ + cdrom_phase_callback(cdrom_id); + SCSIStatus = cdrom_CDROM_PHASE_to_scsi(cdrom_id); + /* Command second phase complete - call the callback to complete the command. */ + cdrom_phase_callback(cdrom_id); + } + } else { + /* Error (Check Condition) - call the phase callback to complete the command. */ + cdrom_phase_callback(cdrom_id); + } + + pclog("SCSI Status: %s, Sense: %02X, ASC: %02X, ASCQ: %02X\n", (SCSIStatus == SCSI_STATUS_OK) ? "OK" : "CHECK CONDITION", cdrom[cdrom_id].sense[2], cdrom[cdrom_id].sense[12], cdrom[cdrom_id].sense[13]); + + BuslogicDataBufferFree(req); + + BuslogicSenseBufferFree(req, (SCSIStatus != SCSI_STATUS_OK), 0); + + pclog("Request complete\n"); + + if (SCSIStatus == SCSI_STATUS_OK) { + BuslogicMailboxInSetup(bl, req->CCBPointer, &req->CmdBlock, + CCB_COMPLETE, SCSI_STATUS_OK, MBI_SUCCESS); + } else if (SCSIStatus == SCSI_STATUS_CHECK_CONDITION) { + BuslogicMailboxInSetup(bl, req->CCBPointer, &req->CmdBlock, + CCB_COMPLETE, SCSI_STATUS_CHECK_CONDITION, MBI_ERROR); + } +} + + +static void BuslogicSCSIRequestSetup(Buslogic_t *bl, uint32_t CCBPointer, Mailbox32_t *Mailbox32) +{ + BuslogicRequests_t *req = &bl->BuslogicRequests; + uint8_t Id, Lun; + uint8_t last_id = (bl->chip >= CHIP_BUSLOGIC_ISA) ? 15 : 7; + + /* Fetch data from the Command Control Block. */ + DMAPageRead(CCBPointer, (char *)&req->CmdBlock, sizeof(CCB32)); + + req->Is24bit = bl->Mbx24bit; + req->CCBPointer = CCBPointer; + req->TargetID = bl->Mbx24bit ? req->CmdBlock.old.Id : req->CmdBlock.new.Id; + req->LUN = bl->Mbx24bit ? req->CmdBlock.old.Lun : req->CmdBlock.new.Lun; + + Id = req->TargetID; + Lun = req->LUN; + if ((Id > last_id) || (Lun > 7)) { + BuslogicMailboxInSetup(bl, CCBPointer, &req->CmdBlock, + CCB_INVALID_CCB, SCSI_STATUS_OK, MBI_ERROR); + return; + } + + pclog("Scanning SCSI Target ID %i\n", Id); + + SCSIStatus = SCSI_STATUS_OK; + SCSIDevices[Id][Lun].InitLength = 0; + + /* Do this here, so MODE SELECT data does not get lost in transit. */ + memset(SCSIDevices[Id][Lun].CmdBuffer, 0, 390144); + + BuslogicDataBufferAllocate(req, req->Is24bit); + + if (SCSIDevices[Id][Lun].LunType == SCSI_NONE) { + pclog("SCSI Target ID %i and LUN %i have no device attached\n",Id,Lun); + BuslogicDataBufferFree(req); + BuslogicSenseBufferFree(req, 0, 0); + BuslogicMailboxInSetup(bl, CCBPointer, &req->CmdBlock, + CCB_SELECTION_TIMEOUT,SCSI_STATUS_OK,MBI_ERROR); + } else { + pclog("SCSI Target ID %i and LUN %i detected and working\n", Id, Lun); + + pclog("Transfer Control %02X\n", req->CmdBlock.common.ControlByte); + pclog("CDB Length %i\n", req->CmdBlock.common.CdbLength); + pclog("CCB Opcode %x\n", req->CmdBlock.common.Opcode); + if (req->CmdBlock.common.ControlByte > 0x03) { + pclog("Invalid control byte: %02X\n", + req->CmdBlock.common.ControlByte); + } + + BuslogicInOperation = (SCSIDevices[Id][Lun].LunType == SCSI_HDD) ? 0x11 : 1; + pclog("SCSI (%i:%i) -> %i\n", Id, Lun, SCSIDevices[Id][Lun].LunType); + } +} + + +static void BuslogicSCSIRequestAbort(Buslogic_t *bl, uint32_t CCBPointer) +{ + CCBU CmdBlock; + + /* Fetch data from the Command Control Block. */ + DMAPageRead(CCBPointer, (char *)&CmdBlock, sizeof(CCB32)); + + /* Only SCSI CD-ROMs are supported at the moment, SCSI hard disk support will come soon. */ + BuslogicMailboxInSetup(bl, CCBPointer, &CmdBlock, + 0x26, SCSI_STATUS_OK, MBI_NOT_FOUND); +} + + +static uint32_t BuslogicMailboxOut(Buslogic_t *bl, Mailbox32_t *Mailbox32) +{ + Mailbox_t MailboxOut; + uint32_t Outgoing; + + if (bl->Mbx24bit) { + Outgoing = bl->MailboxOutAddr + (bl->MailboxOutPosCur * sizeof(Mailbox_t)); + DMAPageRead(Outgoing, (char *)&MailboxOut, sizeof(Mailbox_t)); + + Mailbox32->CCBPointer = ADDR_TO_U32(MailboxOut.CCBPointer); + Mailbox32->u.out.ActionCode = MailboxOut.CmdStatus; + } else { + Outgoing = bl->MailboxOutAddr + (bl->MailboxOutPosCur * sizeof(Mailbox32_t)); + + DMAPageRead(Outgoing, (char *)Mailbox32, sizeof(Mailbox32_t)); + } + + return Outgoing; +} + + +static void BuslogicMailboxOutAdvance(Buslogic_t *bl) +{ + bl->MailboxOutPosCur = (bl->MailboxOutPosCur + 1) % bl->MailboxCount; +} + + +static void BuslogicProcessMailbox(Buslogic_t *bl) +{ + Mailbox32_t mb32; + uint32_t Outgoing; + uint8_t CmdStatus = MBO_FREE; + uint32_t CodeOffset = 0; + + CodeOffset = bl->Mbx24bit ? offsetof(Mailbox_t, CmdStatus) : offsetof(Mailbox32_t, u.out.ActionCode); + + if (! bl->StrictRoundRobinMode) { + uint8_t MailboxCur = bl->MailboxOutPosCur; + + /* Search for a filled mailbox - stop if we have scanned all mailboxes. */ + do { + /* Fetch mailbox from guest memory. */ + Outgoing = BuslogicMailboxOut(bl, &mb32); + + /* Check the next mailbox. */ + BuslogicMailboxOutAdvance(bl); + } while ((mb32.u.out.ActionCode == MBO_FREE) && (MailboxCur != bl->MailboxOutPosCur)); + } else { + Outgoing = BuslogicMailboxOut(bl, &mb32); + } + + if (mb32.u.out.ActionCode != MBO_FREE) { + /* We got the mailbox, mark it as free in the guest. */ + pclog("BuslogicStartMailbox(): Writing %i bytes at %08X\n", sizeof(CmdStatus), Outgoing + CodeOffset); + DMAPageWrite(Outgoing + CodeOffset, (char *)&CmdStatus, sizeof(CmdStatus)); + } + + if (bl->MailboxOutInterrupts) + BuslogicRaiseInterrupt(bl, INTR_MBOA | INTR_ANY); + + /* Check if the mailbox is actually loaded. */ + if (mb32.u.out.ActionCode == MBO_FREE) { + return; + } + + if (mb32.u.out.ActionCode == MBO_START) { + pclog("Start Mailbox Command\n"); + BuslogicSCSIRequestSetup(bl, mb32.CCBPointer, &mb32); + } else if (mb32.u.out.ActionCode == MBO_ABORT) { + pclog("Abort Mailbox Command\n"); + BuslogicSCSIRequestAbort(bl, mb32.CCBPointer); + } else { + pclog("Invalid action code: %02X\n", mb32.u.out.ActionCode); + } + + /* Advance to the next mailbox. */ + if (bl->StrictRoundRobinMode) + BuslogicMailboxOutAdvance(bl); +} + + +void BuslogicResetPoll(void *p) +{ + Buslogic_t *bl = (Buslogic_t *)p; + + bl->Status &= ~STAT_STST; + bl->Status |= STAT_IDLE; + + BuslogicResetCallback = 0; +} + + +void BuslogicCommandCallback(void *p) +{ + Buslogic_t *bl = (Buslogic_t *)p; + + if (BuslogicInOperation == 0) { + if (bl->MailboxCount) { + BuslogicProcessMailbox(bl); + } else { + BuslogicCallback += 50 * SCSI_TIME; + return; + } + } else if (BuslogicInOperation == 1) { + pclog("BusLogic Callback: Process CD-ROM request\n"); + BuslogicCDROMCommand(bl); + } else if (BuslogicInOperation == 2) { + pclog("BusLogic Callback: Send incoming mailbox\n"); + BuslogicMailboxIn(bl); + } else if (BuslogicInOperation == 0x11) { + pclog("BusLogic Callback: Process hard disk request\n"); + BuslogicHDCommand(bl); + } else { + fatal("Invalid BusLogic callback phase: %i\n", BuslogicInOperation); + } + + BuslogicCallback += 50 * SCSI_TIME; +} + + +static uint8_t mem_read_null(uint32_t addr, void *priv) +{ + return(0); +} + + +static uint16_t mem_read_nullw(uint32_t addr, void *priv) +{ + return(0); +} + + +static uint32_t mem_read_nulll(uint32_t addr, void *priv) +{ + return(0); +} + + +typedef union { + uint32_t addr; + uint8_t addr_regs[4]; +} bar_t; + + +uint8_t buslogic_pci_regs[256]; +bar_t buslogic_pci_bar[3]; + + +static uint8_t BuslogicPCIRead(int func, int addr, void *p) +{ + Buslogic_t *bl = (Buslogic_t *)p; + + switch (addr) { + case 0x00: + return 0x4b; + case 0x01: + return 0x10; + case 0x02: + return 0x40; + case 0x03: + return 0x10; + case 0x04: + return buslogic_pci_regs[0x04]; /*Respond to IO and memory accesses*/ + case 0x05: + return buslogic_pci_regs[0x05]; + case 0x07: + return 2; + case 0x08: + return 1; /*Revision ID*/ + case 0x09: + return 0; /*Programming interface*/ + case 0x0A: + return 0; /*Subclass*/ + case 0x0B: + return 1; /* Class code*/ + case 0x10: + return (buslogic_pci_bar[0].addr_regs[0] & 0xe0) | 1; /*I/O space*/ + case 0x11: + return buslogic_pci_bar[0].addr_regs[1]; + case 0x12: + return buslogic_pci_bar[0].addr_regs[2]; + case 0x13: + return buslogic_pci_bar[0].addr_regs[3]; + case 0x14: + return (buslogic_pci_bar[1].addr_regs[0] & 0xe0); /*Memory space*/ + case 0x15: + return buslogic_pci_bar[1].addr_regs[1]; + case 0x16: + return buslogic_pci_bar[1].addr_regs[2]; + case 0x17: + return buslogic_pci_bar[1].addr_regs[3]; + case 0x2C: + return 0x4b; + case 0x2D: + return 0x10; + case 0x2E: + return 0x40; + case 0x2F: + return 0x10; + case 0x30: + return buslogic_pci_bar[2].addr_regs[0] & 0x01; /*BIOS ROM address*/ + case 0x31: + return buslogic_pci_bar[2].addr_regs[1] | 0x18; + case 0x32: + return buslogic_pci_bar[2].addr_regs[2]; + case 0x33: + return buslogic_pci_bar[2].addr_regs[3]; + case 0x3C: + return bl->Irq; + case 0x3D: + return 1; + } + + return(0); +} + + +static void BuslogicPCIWrite(int func, int addr, uint8_t val, void *p) +{ + Buslogic_t *bl = (Buslogic_t *)p; + + switch (addr) { + case 0x04: + io_removehandler(bl->PCIBase, 4, + BuslogicRead, BuslogicReadW, BuslogicReadL, + BuslogicWrite, BuslogicWriteW, BuslogicWriteL, + bl); + mem_mapping_disable(&bl->mmio_mapping); + if (val & PCI_COMMAND_IO) { + if (bl->PCIBase != 0) { + io_sethandler(bl->PCIBase, 0x0020, + BuslogicRead, BuslogicReadW, + BuslogicReadL, BuslogicWrite, + BuslogicWriteW, BuslogicWriteL, + bl); + } + } + if (val & PCI_COMMAND_MEM) { + if (bl->PCIBase != 0) { + mem_mapping_set_addr(&bl->mmio_mapping, + bl->MMIOBase, 0x20); + } + } + buslogic_pci_regs[addr] = val; + break; + + case 0x10: + val &= 0xe0; + val |= 1; + + case 0x11: case 0x12: case 0x13: + /* I/O Base set. */ + /* First, remove the old I/O. */ + io_removehandler(bl->PCIBase, 0x0020, + BuslogicRead, BuslogicReadW, BuslogicReadL, + BuslogicWrite, BuslogicWriteW, BuslogicWriteL, + bl); + /* Then let's set the PCI regs. */ + buslogic_pci_bar[0].addr_regs[addr & 3] = val; + /* Then let's calculate the new I/O base. */ + bl->PCIBase = buslogic_pci_bar[0].addr & 0xffe0; + /* Log the new base. */ + pclog("BusLogic PCI: New I/O base is %04X\n" , bl->PCIBase); + /* We're done, so get out of the here. */ + if (buslogic_pci_regs[4] & PCI_COMMAND_IO) { + if (bl->PCIBase != 0) { + io_sethandler(bl->PCIBase, 0x0020, + BuslogicRead, BuslogicReadW, + BuslogicReadL, BuslogicWrite, + BuslogicWriteW, BuslogicWriteL, + bl); + } + } + return; + + case 0x14: + val &= 0xe0; + + case 0x15: case 0x16: case 0x17: + /* I/O Base set. */ + /* First, remove the old I/O. */ + mem_mapping_disable(&bl->mmio_mapping); + /* Then let's set the PCI regs. */ + buslogic_pci_bar[1].addr_regs[addr & 3] = val; + /* Then let's calculate the new I/O base. */ + bl->MMIOBase = buslogic_pci_bar[1].addr & 0xffffffe0; + /* Log the new base. */ + pclog("BusLogic PCI: New MMIO base is %04X\n" , bl->MMIOBase); + /* We're done, so get out of the here. */ + if (buslogic_pci_regs[4] & PCI_COMMAND_MEM) { + if (bl->PCIBase != 0) { + mem_mapping_set_addr(&bl->mmio_mapping, + bl->MMIOBase, 0x20); + } + } + return; + +#if 0 + /* Commented out until an APIC controller is emulated for the PIIX3, + * otherwise the BT-958 will not get an IRQ on boards using the PIIX3. + */ + case 0x3C: + buslogic_pci_regs[addr] = val; + if (val != 0xFF) { + buslogic_log("BusLogic IRQ now: %i\n", val); + bl->Irq = val; + } + return; +#endif + } +} + + +void *AdaptecInit(int has_bios, int chip) +{ + Buslogic_t *bl; + int i = 0; + int j = 0; + uint32_t bios_addr = 0; + int bios = 0; + + bl = malloc(sizeof(Buslogic_t)); + memset(bl, 0x00, sizeof(Buslogic_t)); + + BuslogicResetDevice = bl; + bl->chip = chip; + bl->Base = device_get_config_int("addr"); + bl->PCIBase = 0; + bl->MMIOBase = 0; + bl->Irq = device_get_config_int("irq"); + bl->DmaChannel = device_get_config_int("dma"); + bios = device_get_config_int("bios"); + bios_addr = device_get_config_int("bios_addr"); + + if (bl->Base != 0) { + io_sethandler(bl->Base, 4, + BuslogicRead, BuslogicReadW, NULL, + BuslogicWrite, BuslogicWriteW, NULL, bl); + } + + pclog("Building SCSI hard disk map...\n"); + build_scsi_hd_map(); + pclog("Building SCSI CD-ROM map...\n"); + build_scsi_cdrom_map(); + + for (i=0; i<16; i++) { + for (j=0; j<8; j++) + { + if (scsi_hard_disks[i][j] != 0xff) + { + SCSIDevices[i][j].LunType = SCSI_HDD; + } + } + } + + for (i=0; iBase); + + BuslogicResetControl(bl, CTRL_HRST); + + if (bios) { + /* Perform AHA-154xNN-specific initialization. */ + aha154x_init(bl->Base, bios_addr, &bl->aha); + } + + return(bl); +} + +void *AHA_154xB_Init() +{ + return AdaptecInit(0, CHIP_AHA154XB); +} + +void *AHA_154xCF_Init() +{ + return AdaptecInit(1, CHIP_AHA154XCF); +} + + +void *BuslogicInit(int chip) +{ + Buslogic_t *bl; + + int i = 0; + int j = 0; + + bl = malloc(sizeof(Buslogic_t)); + memset(bl, 0x00, sizeof(Buslogic_t)); + + BuslogicResetDevice = bl; + if (!PCI && (chip == CHIP_BUSLOGIC_PCI)) + { + chip = CHIP_BUSLOGIC_ISA; + } + bl->chip = chip; + bl->Base = device_get_config_int("addr"); + bl->PCIBase = 0; + bl->MMIOBase = 0; + bl->Irq = device_get_config_int("irq"); + bl->DmaChannel = device_get_config_int("dma"); + + if (bl->Base != 0) { + if (bl->chip == CHIP_BUSLOGIC_PCI) { + io_sethandler(bl->Base, 4, + BuslogicRead, BuslogicReadW, BuslogicReadL, + BuslogicWrite, BuslogicWriteW, BuslogicWriteL, + bl); + } else { + io_sethandler(bl->Base, 4, + BuslogicRead, BuslogicReadW, NULL, + BuslogicWrite, BuslogicWriteW, NULL, bl); + } + } + + pclog("Building SCSI hard disk map...\n"); + build_scsi_hd_map(); + pclog("Building SCSI CD-ROM map...\n"); + build_scsi_cdrom_map(); + + for (i=0; i<16; i++) { + for (j=0; j<8; j++) + { + if (scsi_hard_disks[i][j] != 0xff) + { + SCSIDevices[i][j].LunType = SCSI_HDD; + } + } + } + + for (i=0; ichip == CHIP_BUSLOGIC_PCI) { + pci_add(BuslogicPCIRead, BuslogicPCIWrite, bl); + + buslogic_pci_bar[0].addr_regs[0] = 1; + buslogic_pci_bar[1].addr_regs[0] = 0; + buslogic_pci_regs[0x04] = 1; + buslogic_pci_regs[0x05] = 0; + buslogic_pci_regs[0x07] = 2; + buslogic_pci_bar[2].addr = 0; + + mem_mapping_add(&bl->mmio_mapping, 0xfffd0000, 0x20, + mem_read_null, mem_read_nullw, mem_read_nulll, + mem_write_null, mem_write_nullw, mem_write_nulll, + NULL, MEM_MAPPING_EXTERNAL, bl); + mem_mapping_disable(&bl->mmio_mapping); + } + + pclog("Buslogic on port 0x%04X\n", bl->Base); + + BuslogicResetControl(bl, CTRL_HRST); + + return(bl); +} + +void *Buslogic_542B_Init() +{ + return BuslogicInit(CHIP_BUSLOGIC_ISA); +} + +void *Buslogic_958D_Init() +{ + return BuslogicInit(CHIP_BUSLOGIC_PCI); +} + + +void BuslogicClose(void *p) +{ + Buslogic_t *bl = (Buslogic_t *)p; + free(bl); + BuslogicResetDevice = NULL; +} + + +static device_config_t AHA154XCF_Config[] = +{ + { + "addr", "Address", CONFIG_SELECTION, "", 0x334, + { + { + "None", 0 + }, + { + "0x330", 0x330 + }, + { + "0x334", 0x334 + }, + { + "0x230", 0x230 + }, + { + "0x234", 0x234 + }, + { + "0x130", 0x130 + }, + { + "0x134", 0x134 + }, + { + "" + } + }, + }, + { + "irq", "IRQ", CONFIG_SELECTION, "", 9, + { + { + "IRQ 9", 9 + }, + { + "IRQ 10", 10 + }, + { + "IRQ 11", 11 + }, + { + "IRQ 12", 12 + }, + { + "IRQ 14", 14 + }, + { + "IRQ 15", 15 + }, + { + "" + } + }, + }, + { + "dma", "DMA channel", CONFIG_SELECTION, "", 6, + { + { + "DMA 5", 5 + }, + { + "DMA 6", 6 + }, + { + "DMA 7", 7 + }, + { + "" + } + }, + }, + { + "bios", "Enable BIOS", CONFIG_BINARY, 0 + }, + { + "bios_addr", "BIOS Address", CONFIG_SELECTION, "", 0xd8000, + { + { + "C800H", 0xc8000 + }, + { + "D000H", 0xd0000 + }, + { + "D800H", 0xd8000 + }, + { + "" + } + }, + }, + { + "", "", -1 + } +}; + +static device_config_t BuslogicConfig[] = +{ + { + "addr", "Address", CONFIG_SELECTION, "", 0x334, + { + { + "None", 0 + }, + { + "0x330", 0x330 + }, + { + "0x334", 0x334 + }, + { + "0x230", 0x230 + }, + { + "0x234", 0x234 + }, + { + "0x130", 0x130 + }, + { + "0x134", 0x134 + }, + { + "" + } + }, + }, + { + "irq", "IRQ", CONFIG_SELECTION, "", 9, + { + { + "IRQ 9", 9 + }, + { + "IRQ 10", 10 + }, + { + "IRQ 11", 11 + }, + { + "IRQ 12", 12 + }, + { + "IRQ 14", 14 + }, + { + "IRQ 15", 15 + }, + { + "" + } + }, + }, + { + "dma", "DMA channel", CONFIG_SELECTION, "", 6, + { + { + "DMA 5", 5 + }, + { + "DMA 6", 6 + }, + { + "DMA 7", 7 + }, + { + "" + } + }, + }, + { + "", "", -1 + } +}; + +device_t aha1540b_device = +{ + "Adaptec AHA-1540B", + 0, + AHA_154xB_Init, + BuslogicClose, + NULL, + NULL, + NULL, + NULL, + BuslogicConfig +}; + +device_t aha1542cf_device = +{ + "Adaptec AHA-1542CF", + 0, + AHA_154xCF_Init, + BuslogicClose, + NULL, + NULL, + NULL, + NULL, + AHA154XCF_Config +}; + +device_t buslogic_device = +{ + "Buslogic BT-542B PCI", + 0, + Buslogic_542B_Init, + BuslogicClose, + NULL, + NULL, + NULL, + NULL, + BuslogicConfig +}; + +device_t buslogic_pci_device = +{ + "Buslogic BT-542B PCI", + 0, + Buslogic_958D_Init, + BuslogicClose, + NULL, + NULL, + NULL, + NULL, + BuslogicConfig +}; diff --git a/src/scsi_buslogic.h b/src/scsi_buslogic.h new file mode 100644 index 000000000..c4b6805f0 --- /dev/null +++ b/src/scsi_buslogic.h @@ -0,0 +1,27 @@ +#ifndef BUSLOGIC_H +# define BUSLOGIC_H + + +typedef struct { + uint8_t flags; /* local flags */ + uint8_t bid; /* board ID */ + char fwl, fwh; /* firmware info */ +} aha_info; +#define AHA_GLAG_MEMEN 0x01 /* BIOS Shadow RAM enabled */ + + +extern device_t aha1540b_device; +extern device_t aha1542cf_device; +extern device_t buslogic_device; +extern device_t buslogic_pci_device; + + +extern int buslogic_dev_present(uint8_t id, uint8_t lun); + +extern void aha154x_init(uint16_t, uint32_t, aha_info *); +extern uint8_t aha154x_shram(uint8_t); +extern uint8_t aha154x_eeprom(uint8_t,uint8_t,uint8_t,uint8_t,uint8_t *); +extern uint8_t aha154x_memory(uint8_t); + + +#endif /*BUSLOGIC_H*/ diff --git a/src/scsi_hd.c b/src/scsi_hd.c new file mode 100644 index 000000000..1f2bd2788 --- /dev/null +++ b/src/scsi_hd.c @@ -0,0 +1,1164 @@ +/* SCSI hard disk emulation */ + +#define _LARGEFILE_SOURCE +#define _LARGEFILE64_SOURCE +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include "86box.h" +#include "cdrom.h" +#include "ibm.h" +#include "ide.h" +#include "piix.h" +#include "scsi.h" +#include "timer.h" + +/* Bits of 'status' */ +#define ERR_STAT 0x01 +#define DRQ_STAT 0x08 /* Data request */ +#define DSC_STAT 0x10 +#define SERVICE_STAT 0x10 +#define READY_STAT 0x40 +#define BUSY_STAT 0x80 + +/* Bits of 'error' */ +#define ABRT_ERR 0x04 /* Command aborted */ +#define MCR_ERR 0x08 /* Media change request */ + +#define MAX_BLOCKS_AT_ONCE 340 + +#define scsi_hd_sense_error shdc[id].sense[0] +#define scsi_hd_sense_key shdc[id].sense[2] +#define scsi_hd_asc shdc[id].sense[12] +#define scsi_hd_ascq shdc[id].sense[13] + +uint8_t scsi_hard_disks[16][8] = { { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } }; + +/* Table of all SCSI commands and their flags, needed for the new disc change / not ready handler. */ +uint8_t scsi_hd_command_flags[0x100] = +{ + IMPLEMENTED | CHECK_READY | NONDATA, /* 0x00 */ + IMPLEMENTED | ALLOW_UA | NONDATA | SCSI_ONLY, /* 0x01 */ + 0, + IMPLEMENTED | ALLOW_UA, /* 0x03 */ + 0, 0, 0, 0, + IMPLEMENTED | CHECK_READY, /* 0x08 */ + 0, + IMPLEMENTED | CHECK_READY, /* 0x0A */ + 0, 0, 0, 0, 0, 0, 0, + IMPLEMENTED | ALLOW_UA, /* 0x12 */ + IMPLEMENTED | CHECK_READY | NONDATA | SCSI_ONLY, /* 0x13 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + IMPLEMENTED | CHECK_READY, /* 0x1E */ + 0, 0, 0, 0, 0, 0, + IMPLEMENTED | CHECK_READY, /* 0x25 */ + 0, 0, + IMPLEMENTED | CHECK_READY, /* 0x28 */ + 0, + IMPLEMENTED | CHECK_READY, /* 0x2A */ + 0, 0, 0, 0, + IMPLEMENTED | CHECK_READY | NONDATA | SCSI_ONLY, /* 0x2F */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + IMPLEMENTED | CHECK_READY, /* 0xA8 */ + 0, + IMPLEMENTED | CHECK_READY, /* 0xAA */ + 0, 0, 0, 0, + IMPLEMENTED | CHECK_READY | NONDATA | SCSI_ONLY, /* 0xAF */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + IMPLEMENTED, /* 0xBD */ + 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +int scsi_hd_do_log = 0; + +void scsi_hd_log(const char *format, ...) +{ +#ifdef ENABLE_scsi_hd_LOG + if (scsi_hd_do_log) + { + va_list ap; + va_start(ap, format); + vprintf(format, ap); + va_end(ap); + fflush(stdout); + } +#endif +} + +/* Translates ATAPI status (ERR_STAT flag) to SCSI status. */ +int scsi_hd_err_stat_to_scsi(uint8_t id) +{ + if (shdc[id].status & ERR_STAT) + { + return SCSI_STATUS_CHECK_CONDITION; + } + else + { + return SCSI_STATUS_OK; + } + + return SCSI_STATUS_OK; +} + +/* Translates ATAPI phase (DRQ, I/O, C/D) to SCSI phase (MSG, C/D, I/O). */ +int scsi_hd_phase_to_scsi(uint8_t id) +{ + if (shdc[id].status & 8) + { + switch (shdc[id].phase & 3) + { + case 0: + return 0; + case 1: + return 2; + case 2: + return 1; + case 3: + return 7; + } + } + else + { + if ((shdc[id].phase & 3) == 3) + { + return 3; + } + else + { + /* Translate reserved ATAPI phase to reserved SCSI phase. */ + return 4; + } + } + + return 0; +} + +int find_hdc_for_scsi_id(uint8_t scsi_id, uint8_t scsi_lun) +{ + uint8_t i = 0; + + for (i = 0; i < HDC_NUM; i++) + { + if ((hdc[i].bus == 3) && (hdc[i].scsi_id == scsi_id) && (hdc[i].scsi_lun == scsi_lun)) + { + return i; + } + } + return 0xff; +} + +static void scsi_loadhd(int scsi_id, int scsi_lun, int id) +{ + uint32_t sector_size = 512; + uint32_t zero = 0; + uint64_t signature = 0xD778A82044445459ll; + uint64_t full_size = 0; + int c; + char *fn = hdd_fn[id]; + + shdc[id].base = 0; + + if (shdf[id] != NULL) + { + fclose(shdf[id]); + shdf[id] == NULL; + } + + /* Try to open existing hard disk image */ + if (fn[0] == '.') + { + scsi_hard_disks[scsi_id][scsi_lun] = 0xff; + return; + } + shdf[id] = fopen64(fn, "rb+"); + if (shdf[id] == NULL) + { + /* Failed to open existing hard disk image */ + if (errno == ENOENT) + { + /* Failed because it does not exist, + so try to create new file */ + shdf[id] = fopen64(fn, "wb+"); + if (shdf[id] == NULL) + { + scsi_hard_disks[scsi_id][scsi_lun] = 0xff; + return; + } + else + { + memset(&(shdc[id]), 0, sizeof(scsi_hard_disk_t)); + if (image_is_hdi(fn)) + { + shdc[id].base = 0x1000; + fwrite(&zero, 1, 4, shdf[id]); + fwrite(&zero, 1, 4, shdf[id]); + fwrite(&(shdc[id].base), 1, 4, shdf[id]); + fwrite(&full_size, 1, 4, shdf[id]); + fwrite(§or_size, 1, 4, shdf[id]); + fwrite(&(hdc[id].spt), 1, 4, shdf[id]); + fwrite(&(hdc[id].hpc), 1, 4, shdf[id]); + fwrite(&(hdc[id].tracks), 1, 4, shdf[id]); + for (c = 0; c < 0x3f8; c++) + { + fwrite(&zero, 1, 4, shdf[id]); + } + } + else if (image_is_hdx(fn, 0)) + { + shdc[id].base = 0x28; + fwrite(&signature, 1, 8, shdf[id]); + fwrite(&full_size, 1, 8, shdf[id]); + fwrite(§or_size, 1, 4, shdf[id]); + fwrite(&(hdc[id].spt), 1, 4, shdf[id]); + fwrite(&(hdc[id].hpc), 1, 4, shdf[id]); + fwrite(&(hdc[id].tracks), 1, 4, shdf[id]); + fwrite(&zero, 1, 4, shdf[id]); + fwrite(&zero, 1, 4, shdf[id]); + } + full_size = hdc[id].spt * hdc[id].hpc * hdc[id].tracks * 512; + shdc[id].last_sector = (uint32_t) (full_size >> 9) - 1; + shdc[id].cdb_len = 12; + } + } + else + { + /* Failed for another reason */ + scsi_hard_disks[scsi_id][scsi_lun] = 0xff; + return; + } + } + else + { + memset(&(shdc[id]), 0, sizeof(scsi_hard_disk_t)); + if (image_is_hdi(fn)) + { + fseeko64(shdf[id], 0x8, SEEK_SET); + fread(&(shdc[id].base), 1, 4, shdf[id]); + fseeko64(shdf[id], 0x10, SEEK_SET); + fread(§or_size, 1, 4, shdf[id]); + if (sector_size != 512) + { + /* Sector size is not 512 */ + fclose(shdf[id]); + scsi_hard_disks[scsi_id][scsi_lun] = 0xff; + return; + } + fread(&(hdc[id].spt), 1, 4, shdf[id]); + fread(&(hdc[id].hpc), 1, 4, shdf[id]); + fread(&(hdc[id].tracks), 1, 4, shdf[id]); + } + else if (image_is_hdx(fn, 1)) + { + shdc[id].base = 0x28; + fseeko64(shdf[id], 0x10, SEEK_SET); + fread(§or_size, 1, 4, shdf[id]); + if (sector_size != 512) + { + /* Sector size is not 512 */ + fclose(shdf[id]); + scsi_hard_disks[scsi_id][scsi_lun] = 0xff; + return; + } + fread(&(hdc[id].spt), 1, 4, shdf[id]); + fread(&(hdc[id].hpc), 1, 4, shdf[id]); + fread(&(hdc[id].tracks), 1, 4, shdf[id]); + fread(&(hdc[id].at_spt), 1, 4, shdf[id]); + fread(&(hdc[id].at_hpc), 1, 4, shdf[id]); + } + full_size = hdc[id].spt * hdc[id].hpc * hdc[id].tracks * 512; + shdc[id].last_sector = (uint32_t) (full_size >> 9) - 1; + shdc[id].cdb_len = 12; + } +} + +void build_scsi_hd_map() +{ + uint8_t i = 0; + uint8_t j = 0; + + for (i = 0; i < 16; i++) + { + memset(scsi_hard_disks[i], 0xff, 8); + } + + for (i = 0; i < 16; i++) + { + for (j = 0; j < 8; j++) + { + scsi_hard_disks[i][j] = find_hdc_for_scsi_id(i, j); + if (scsi_hard_disks[i][j] != 0xff) + { + scsi_loadhd(i, j, scsi_hard_disks[i][j]); + } + } + } +} + +int scsi_hd_read_capacity(uint8_t id, uint8_t *cdb, uint8_t *buffer, uint32_t *len) +{ + int ret = 0; + int size = 0; + + size = shdc[id].last_sector; + memset(buffer, 0, 8); + buffer[0] = (size >> 24) & 0xff; + buffer[1] = (size >> 16) & 0xff; + buffer[2] = (size >> 8) & 0xff; + buffer[3] = size & 0xff; + buffer[6] = 2; /* 512 = 0x0200 */ + *len = 8; + + return 1; +} + +void scsi_hd_set_cdb_len(int id, int cdb_len) +{ + shdc[id].cdb_len = cdb_len; +} + +void scsi_hd_reset_cdb_len(int id) +{ + shdc[id].cdb_len = 12; +} + +void scsi_hd_update_request_length(uint8_t id, int len, int block_len) +{ + /* For media access commands, make sure the requested DRQ length matches the block length. */ + switch (shdc[id].current_cdb[0]) + { + case 0x08: + case 0x0a: + case 0x28: + case 0x2a: + case 0xa8: + case 0xaa: + if (shdc[id].request_length < block_len) + { + shdc[id].request_length = block_len; + } + /* Make sure we respect the limit of how many blocks we can transfer at once. */ + if (shdc[id].requested_blocks > shdc[id].max_blocks_at_once) + { + shdc[id].requested_blocks = shdc[id].max_blocks_at_once; + } + shdc[id].block_total = (shdc[id].requested_blocks * block_len); + if (len > shdc[id].block_total) + { + len = shdc[id].block_total; + } + break; + default: + shdc[id].packet_len = len; + break; + } + /* If the DRQ length is odd, and the total remaining length is bigger, make sure it's even. */ + if ((shdc[id].request_length & 1) && (shdc[id].request_length < len)) + { + shdc[id].request_length &= 0xfffe; + } + /* If the DRQ length is smaller or equal in size to the total remaining length, set it to that. */ + if (len <= shdc[id].request_length) + { + shdc[id].request_length = len; + } + return; +} + +static void scsi_hd_command_common(uint8_t id) +{ + shdc[id].status = BUSY_STAT; + shdc[id].phase = 1; + shdc[id].pos = 0; + if (shdc[id].packet_status == CDROM_PHASE_COMPLETE) + { + shdc[id].callback = 20 * SCSI_TIME; + } + else + { + shdc[id].callback = 60 * SCSI_TIME; + } +} + +static void scsi_hd_command_complete(uint8_t id) +{ + shdc[id].packet_status = CDROM_PHASE_COMPLETE; + scsi_hd_command_common(id); +} + +static void scsi_hd_command_read_dma(uint8_t id) +{ + shdc[id].packet_status = CDROM_PHASE_DATA_IN_DMA; + scsi_hd_command_common(id); + shdc[id].total_read = 0; +} + +static void scsi_hd_command_write_dma(uint8_t id) +{ + shdc[id].packet_status = CDROM_PHASE_DATA_OUT_DMA; + scsi_hd_command_common(id); +} + +static void scsi_hd_data_command_finish(uint8_t id, int len, int block_len, int alloc_len, int direction) +{ + scsi_hd_log("SCSI HD %i: Finishing command (%02X): %i, %i, %i, %i, %i\n", id, shdc[id].current_cdb[0], len, block_len, alloc_len, direction, shdc[id].request_length); + shdc[id].pos=0; + if (alloc_len >= 0) + { + if (alloc_len < len) + { + len = alloc_len; + } + } + if (len == 0) + { + SCSIDevices[hdc[id].scsi_id][hdc[id].scsi_lun].InitLength = 0; + scsi_hd_command_complete(id); + } + else + { + if (direction == 0) + { + SCSIDevices[hdc[id].scsi_id][hdc[id].scsi_lun].InitLength = alloc_len; + scsi_hd_command_read_dma(id); + } + else + { + scsi_hd_command_write_dma(id); + } + } + + scsi_hd_log("SCSI HD %i: Status: %i, cylinder %i, packet length: %i, position: %i, phase: %i\n", id, shdc[id].packet_status, shdc[id].request_length, shdc[id].packet_len, shdc[id].pos, shdc[id].phase); +} + +static void scsi_hd_sense_clear(int id, int command) +{ + shdc[id].previous_command = command; + scsi_hd_sense_key = scsi_hd_asc = scsi_hd_ascq = 0; +} + +static void scsi_hd_cmd_error(uint8_t id) +{ + shdc[id].error = ((scsi_hd_sense_key & 0xf) << 4) | ABRT_ERR; + shdc[id].status = READY_STAT | ERR_STAT; + shdc[id].phase = 3; + shdc[id].packet_status = 0x80; + shdc[id].callback = 50 * SCSI_TIME; + scsi_hd_log("SCSI HD %i: ERROR: %02X/%02X/%02X\n", id, scsi_hd_sense_key, scsi_hd_asc, scsi_hd_ascq); +} + +static void scsi_hd_invalid_lun(uint8_t id) +{ + scsi_hd_sense_key = SENSE_ILLEGAL_REQUEST; + scsi_hd_asc = ASC_INV_LUN; + scsi_hd_ascq = 0; + scsi_hd_cmd_error(id); +} + +static void scsi_hd_illegal_opcode(uint8_t id) +{ + scsi_hd_sense_key = SENSE_ILLEGAL_REQUEST; + scsi_hd_asc = ASC_ILLEGAL_OPCODE; + scsi_hd_ascq = 0; + scsi_hd_cmd_error(id); +} + +static void scsi_hd_lba_out_of_range(uint8_t id) +{ + scsi_hd_sense_key = SENSE_ILLEGAL_REQUEST; + scsi_hd_asc = ASC_LBA_OUT_OF_RANGE; + scsi_hd_ascq = 0; + scsi_hd_cmd_error(id); +} + +static void scsi_hd_invalid_field(uint8_t id) +{ + scsi_hd_sense_key = SENSE_ILLEGAL_REQUEST; + scsi_hd_asc = ASC_INV_FIELD_IN_CMD_PACKET; + scsi_hd_ascq = 0; + scsi_hd_cmd_error(id); + shdc[id].status = 0x53; +} + +static void scsi_hd_data_phase_error(uint8_t id) +{ + scsi_hd_sense_key = SENSE_ILLEGAL_REQUEST; + scsi_hd_asc = ASC_DATA_PHASE_ERROR; + scsi_hd_ascq = 0; + scsi_hd_cmd_error(id); +} + +void scsi_hd_update_cdb(uint8_t *cdb, int lba_pos, int number_of_blocks) +{ + switch(cdb[0]) + { + case GPCMD_READ_6: + case GPCMD_WRITE_6: + cdb[1] = (lba_pos >> 16) & 0xff; + cdb[2] = (lba_pos >> 8) & 0xff; + cdb[3] = lba_pos & 0xff; + break; + + case GPCMD_READ_10: + case GPCMD_WRITE_10: + cdb[2] = (lba_pos >> 24) & 0xff; + cdb[3] = (lba_pos >> 16) & 0xff; + cdb[4] = (lba_pos >> 8) & 0xff; + cdb[5] = lba_pos & 0xff; + cdb[7] = (number_of_blocks >> 8) & 0xff; + cdb[8] = number_of_blocks & 0xff; + break; + + case GPCMD_READ_12: + case GPCMD_WRITE_12: + cdb[2] = (lba_pos >> 24) & 0xff; + cdb[3] = (lba_pos >> 16) & 0xff; + cdb[4] = (lba_pos >> 8) & 0xff; + cdb[5] = lba_pos & 0xff; + cdb[6] = (number_of_blocks >> 24) & 0xff; + cdb[7] = (number_of_blocks >> 16) & 0xff; + cdb[8] = (number_of_blocks >> 8) & 0xff; + cdb[9] = number_of_blocks & 0xff; + break; + } +} + +int scsi_hd_read_data(uint8_t id, uint32_t *len) +{ + uint8_t *hdbufferb = (uint8_t *) shdc[id].buffer; + + int temp_len = 0; + + int last_valid_data_pos = 0; + + uint64_t pos64 = (uint64_t) shdc[id].sector_pos; + + if (shdc[id].sector_pos > shdc[id].last_sector) + { + /* scsi_hd_log("SCSI HD %i: Trying to read beyond the end of disk\n", id); */ + scsi_hd_lba_out_of_range(id); + return 0; + } + + shdc[id].old_len = 0; + *len = 0; + + fseeko64(shdf[id], pos64 << 9, SEEK_SET); + fread(hdbufferb + shdc[id].data_pos, (shdc[id].sector_len << 9), 1, shdf[id]); + temp_len = (shdc[id].sector_len << 9); + + last_valid_data_pos = shdc[id].data_pos; + + shdc[id].data_pos += temp_len; + shdc[id].old_len += temp_len; + + *len += temp_len; + + scsi_hd_log("SCSI HD %i: Data from raw sector read: %02X %02X %02X %02X %02X %02X %02X %02X\n", id, hdbufferb[last_valid_data_pos + 0], hdbufferb[last_valid_data_pos + 1], hdbufferb[last_valid_data_pos + 2], hdbufferb[last_valid_data_pos + 3], hdbufferb[last_valid_data_pos + 4], hdbufferb[last_valid_data_pos + 5], hdbufferb[last_valid_data_pos + 6], hdbufferb[last_valid_data_pos + 7]); + + return 1; +} + +int scsi_hd_read_blocks(uint8_t id, uint32_t *len, int first_batch) +{ + int ret = 0; + + shdc[id].data_pos = 0; + + if (!shdc[id].sector_len) + { + scsi_hd_command_complete(id); + return -1; + } + + scsi_hd_log("Reading %i blocks starting from %i...\n", shdc[id].requested_blocks, shdc[id].sector_pos); + + scsi_hd_update_cdb(shdc[id].current_cdb, shdc[id].sector_pos, shdc[id].requested_blocks); + + ret = scsi_hd_read_data(id, len); + + scsi_hd_log("Read %i bytes of blocks...\n", *len); + + if (!ret) + { + return 0; + } + + shdc[id].sector_pos += shdc[id].requested_blocks; + shdc[id].sector_len -= shdc[id].requested_blocks; + + return 1; +} + +/*SCSI Sense Initialization*/ +void scsi_hd_sense_code_ok(uint8_t id) +{ + scsi_hd_sense_key = SENSE_NONE; + scsi_hd_asc = 0; + scsi_hd_ascq = 0; +} + +int scsi_hd_pre_execution_check(uint8_t id, uint8_t *cdb) +{ + if (((shdc[id].request_length >> 5) & 7) != hdc[id].scsi_lun) + { + scsi_hd_log("SCSI HD %i: Attempting to execute a unknown command targeted at SCSI LUN %i\n", id, ((shdc[id].request_length >> 5) & 7)); + scsi_hd_invalid_lun(id); + return 0; + } + + if (!(scsi_hd_command_flags[cdb[0]] & IMPLEMENTED)) + { + scsi_hd_log("SCSI HD %i: Attempting to execute unknown command %02X\n", id, cdb[0]); + scsi_hd_illegal_opcode(id); + return 0; + } + + /* Unless the command is REQUEST SENSE, clear the sense. This will *NOT* + the UNIT ATTENTION condition if it's set. */ + if (cdb[0] != GPCMD_REQUEST_SENSE) + { + scsi_hd_sense_clear(id, cdb[0]); + } + + scsi_hd_log("SCSI HD %i: Continuing with command\n", id); + + return 1; +} + +static void scsi_hd_seek(uint8_t id, uint32_t pos) +{ + /* scsi_hd_log("SCSI HD %i: Seek %08X\n", id, pos); */ + shdc[id].seek_pos = pos; +} + +static void scsi_hd_rezero(uint8_t id) +{ + shdc[id].sector_pos = shdc[id].sector_len = 0; + scsi_hd_seek(id, 0); +} + +void scsi_hd_reset(uint8_t id) +{ + scsi_hd_rezero(id); + shdc[id].status = 0; + shdc[id].callback = 0; + shdc[id].packet_status = 0xff; +} + +void scsi_hd_request_sense(uint8_t id, uint8_t *buffer, uint8_t alloc_length) +{ + /*Will return 18 bytes of 0*/ + if (alloc_length != 0) + { + memset(buffer, 0, alloc_length); + memcpy(buffer, shdc[id].sense, alloc_length); + } + + buffer[0] = 0x70; + + /* scsi_hd_log("SCSI HD %i: Reporting sense: %02X %02X %02X\n", id, hdbufferb[2], hdbufferb[12], hdbufferb[13]); */ + + /* Clear the sense stuff as per the spec. */ + scsi_hd_sense_clear(id, GPCMD_REQUEST_SENSE); +} + +void scsi_hd_request_sense_for_scsi(uint8_t id, uint8_t *buffer, uint8_t alloc_length) +{ + /* Do *NOT* advance the unit attention phase. */ + + scsi_hd_request_sense(id, buffer, alloc_length); +} + +int scsi_hd_read_from_dma(uint8_t id); + +void scsi_hd_command(uint8_t id, uint8_t *cdb) +{ + uint8_t *hdbufferb = (uint8_t *) shdc[id].buffer; + uint32_t len; + int pos=0; + int max_len; + unsigned idx = 0; + unsigned size_idx; + unsigned preamble_len; + uint32_t alloc_length; + int ret; + uint64_t pos64; + char device_identify[8] = { '8', '6', 'B', '_', 'H', 'D', '0', 0 }; + char device_identify_ex[14] = { '8', '6', 'B', '_', 'H', 'D', '0', ' ', 'v', '1', '.', '0', '0', 0 }; + +#if 0 + int CdbLength; +#endif + shdc[id].status &= ~ERR_STAT; + + shdc[id].packet_len = 0; + shdc[id].request_pos = 0; + + device_identify[6] = id + 0x30; + + device_identify_ex[6] = id + 0x30; + device_identify_ex[9] = emulator_version[0]; + device_identify_ex[11] = emulator_version[2]; + device_identify_ex[12] = emulator_version[3]; + + shdc[id].data_pos = 0; + + memcpy(shdc[id].current_cdb, cdb, shdc[id].cdb_len); + + if (cdb[0] != 0) + { + scsi_hd_log("SCSI HD %i: Command 0x%02X, Sense Key %02X, Asc %02X, Ascq %02X, %i\n", id, cdb[0], scsi_hd_sense_key, scsi_hd_asc, scsi_hd_ascq, ins); + scsi_hd_log("SCSI HD %i: Request length: %04X\n", id, shdc[id].request_length); + +#if 0 + for (CdbLength = 1; CdbLength < shdc[id].cdb_len; CdbLength++) + { + scsi_hd_log("SCSI HD %i: CDB[%d] = 0x%02X\n", id, CdbLength, cdb[CdbLength]); + } +#endif + } + + shdc[id].sector_len = 0; + + /* This handles the Not Ready/Unit Attention check if it has to be handled at this point. */ + if (scsi_hd_pre_execution_check(id, cdb) == 0) + { + return; + } + + switch (cdb[0]) + { + case GPCMD_TEST_UNIT_READY: + case GPCMD_VERIFY_6: + case GPCMD_VERIFY_10: + case GPCMD_VERIFY_12: + scsi_hd_command_complete(id); + break; + + case GPCMD_REZERO_UNIT: + shdc[id].sector_pos = shdc[id].sector_len = 0; + scsi_hd_seek(id, 0); + break; + + case GPCMD_REQUEST_SENSE: + /* If there's a unit attention condition and there's a buffered not ready, a standalone REQUEST SENSE + should forget about the not ready, and report unit attention straight away. */ + scsi_hd_request_sense(id, hdbufferb, cdb[4]); + scsi_hd_data_command_finish(id, 18, 18, cdb[4], 0); + break; + + case GPCMD_MECHANISM_STATUS: + len = (hdbufferb[7] << 16) | (hdbufferb[8] << 8) | hdbufferb[9]; + + memset(hdbufferb, 0, 8); + hdbufferb[5] = 1; + + scsi_hd_data_command_finish(id, 8, 8, len, 0); + break; + + case GPCMD_READ_6: + case GPCMD_READ_10: + case GPCMD_READ_12: + switch(cdb[0]) + { + case GPCMD_READ_6: + shdc[id].sector_len = cdb[4]; + shdc[id].sector_pos = ((((uint32_t) cdb[1]) & 0x1f) << 16) | (((uint32_t) cdb[2]) << 8) | ((uint32_t) cdb[3]); + break; + case GPCMD_READ_10: + shdc[id].sector_len = (cdb[7] << 8) | cdb[8]; + shdc[id].sector_pos = (cdb[2] << 24) | (cdb[3] << 16) | (cdb[4] << 8) | cdb[5]; + scsi_hd_log("SCSI HD %i: Length: %i, LBA: %i\n", id, shdc[id].sector_len, shdc[id].sector_pos); + break; + case GPCMD_READ_12: + shdc[id].sector_len = (((uint32_t) cdb[6]) << 24) | (((uint32_t) cdb[7]) << 16) | (((uint32_t) cdb[8]) << 8) | ((uint32_t) cdb[9]); + shdc[id].sector_pos = (((uint32_t) cdb[2]) << 24) | (((uint32_t) cdb[3]) << 16) | (((uint32_t) cdb[4]) << 8) | ((uint32_t) cdb[5]); + break; + } + + if (!shdc[id].sector_len) + { + /* scsi_hd_log("SCSI HD %i: All done - callback set\n", id); */ + shdc[id].packet_status = CDROM_PHASE_COMPLETE; + shdc[id].callback = 20 * SCSI_TIME; + break; + } + + max_len = shdc[id].sector_len; + shdc[id].requested_blocks = max_len; + +#if 0 + ret = scsi_hd_read_blocks(id, &alloc_length, 1); + if (ret <= 0) + { + return; + } +#endif + + pos64 = (uint64_t) shdc[id].sector_pos; + + if (shdc[id].requested_blocks > 0) + { + fseeko64(shdf[id], pos64 << 9, SEEK_SET); + fread(hdbufferb, (shdc[id].sector_len << 9), 1, shdf[id]); + } + + alloc_length = shdc[id].packet_len = max_len << 9; + if (shdc[id].requested_blocks > 1) + { + scsi_hd_data_command_finish(id, alloc_length, alloc_length / shdc[id].requested_blocks, alloc_length, 0); + } + else + { + scsi_hd_data_command_finish(id, alloc_length, alloc_length, alloc_length, 0); + } + shdc[id].all_blocks_total = shdc[id].block_total; + if (shdc[id].packet_status != CDROM_PHASE_COMPLETE) + { + update_status_bar_icon(0x22, 1); + } + else + { + update_status_bar_icon(0x22, 0); + } + return; + + case GPCMD_WRITE_6: + case GPCMD_WRITE_10: + case GPCMD_WRITE_12: + switch(cdb[0]) + { + case GPCMD_WRITE_6: + shdc[id].sector_len = cdb[4]; + shdc[id].sector_pos = ((((uint32_t) cdb[1]) & 0x1f) << 16) | (((uint32_t) cdb[2]) << 8) | ((uint32_t) cdb[3]); + break; + case GPCMD_WRITE_10: + shdc[id].sector_len = (cdb[7] << 8) | cdb[8]; + shdc[id].sector_pos = (cdb[2] << 24) | (cdb[3] << 16) | (cdb[4] << 8) | cdb[5]; + scsi_hd_log("SCSI HD %i: Length: %i, LBA: %i\n", id, shdc[id].sector_len, shdc[id].sector_pos); + break; + case GPCMD_WRITE_12: + shdc[id].sector_len = (((uint32_t) cdb[6]) << 24) | (((uint32_t) cdb[7]) << 16) | (((uint32_t) cdb[8]) << 8) | ((uint32_t) cdb[9]); + shdc[id].sector_pos = (((uint32_t) cdb[2]) << 24) | (((uint32_t) cdb[3]) << 16) | (((uint32_t) cdb[4]) << 8) | ((uint32_t) cdb[5]); + break; + } + + if (!shdc[id].sector_len) + { + /* scsi_hd_log("SCSI HD %i: All done - callback set\n", id); */ + shdc[id].packet_status = CDROM_PHASE_COMPLETE; + shdc[id].callback = 20 * SCSI_TIME; + break; + } + + max_len = shdc[id].sector_len; + shdc[id].requested_blocks = max_len; + + scsi_hd_read_from_dma(id); + + pos64 = (uint64_t) shdc[id].sector_pos; + + if (shdc[id].requested_blocks > 0) + { + fseeko64(shdf[id], pos64 << 9, SEEK_SET); + fwrite(hdbufferb, 1, (shdc[id].sector_len << 9), shdf[id]); + } + + alloc_length = shdc[id].packet_len = max_len << 9; + if (shdc[id].requested_blocks > 1) + { + scsi_hd_data_command_finish(id, alloc_length, alloc_length / shdc[id].requested_blocks, alloc_length, 1); + } + else + { + scsi_hd_data_command_finish(id, alloc_length, alloc_length, alloc_length, 1); + } + shdc[id].all_blocks_total = shdc[id].block_total; + if (shdc[id].packet_status != CDROM_PHASE_COMPLETE) + { + update_status_bar_icon(0x22, 1); + } + else + { + update_status_bar_icon(0x22, 0); + } + return; + + case GPCMD_INQUIRY: + max_len = cdb[3]; + max_len <<= 8; + max_len |= cdb[4]; + + if (cdb[1] & 1) + { + preamble_len = 4; + size_idx = 3; + + hdbufferb[idx++] = 05; + hdbufferb[idx++] = cdb[2]; + hdbufferb[idx++] = 0; + + idx++; + + switch (cdb[2]) + { + case 0x00: + hdbufferb[idx++] = 0x00; + hdbufferb[idx++] = 0x83; + break; + case 0x83: + if (idx + 24 > max_len) + { + scsi_hd_data_phase_error(id); + return; + } + + hdbufferb[idx++] = 0x02; + hdbufferb[idx++] = 0x00; + hdbufferb[idx++] = 0x00; + hdbufferb[idx++] = 20; + ide_padstr8(hdbufferb + idx, 20, "53R141"); /* Serial */ + idx += 20; + + if (idx + 72 > cdb[4]) + { + goto atapi_out; + } + hdbufferb[idx++] = 0x02; + hdbufferb[idx++] = 0x01; + hdbufferb[idx++] = 0x00; + hdbufferb[idx++] = 68; + ide_padstr8(hdbufferb + idx, 8, "86Box"); /* Vendor */ + idx += 8; + ide_padstr8(hdbufferb + idx, 40, device_identify_ex); /* Product */ + idx += 40; + ide_padstr8(hdbufferb + idx, 20, "53R141"); /* Product */ + idx += 20; + break; + default: + scsi_hd_log("INQUIRY: Invalid page: %02X\n", cdb[2]); + scsi_hd_invalid_field(id); + return; + } + } + else + { + preamble_len = 5; + size_idx = 4; + + memset(hdbufferb, 0, 8); + hdbufferb[0] = 0; /*SCSI HD*/ + hdbufferb[1] = 0; /*Fixed*/ + hdbufferb[2] = 0x02; /*SCSI-2 compliant*/ + hdbufferb[3] = 0x02; + hdbufferb[4] = 31; + + ide_padstr8(hdbufferb + 8, 8, "86Box"); /* Vendor */ + ide_padstr8(hdbufferb + 16, 16, device_identify); /* Product */ + ide_padstr8(hdbufferb + 32, 4, emulator_version); /* Revision */ + idx = 36; + } + +atapi_out: + hdbufferb[size_idx] = idx - preamble_len; + len=idx; + + scsi_hd_data_command_finish(id, len, len, max_len, 0); + break; + + case GPCMD_PREVENT_REMOVAL: + scsi_hd_command_complete(id); + break; + + case GPCMD_SEEK_6: + case GPCMD_SEEK_10: + switch(cdb[0]) + { + case GPCMD_SEEK_6: + pos = (cdb[2] << 8) | cdb[3]; + break; + case GPCMD_SEEK_10: + pos = (cdb[2] << 24) | (cdb[3]<<16) | (cdb[4]<<8) | cdb[5]; + break; + } + scsi_hd_seek(id, pos); + scsi_hd_command_complete(id); + break; + + case GPCMD_READ_CDROM_CAPACITY: + if (scsi_hd_read_capacity(id, shdc[id].current_cdb, hdbufferb, &len) == 0) + { + return; + } + + scsi_hd_data_command_finish(id, len, len, len, 0); + break; + + default: + scsi_hd_illegal_opcode(id); + break; + } + + /* scsi_hd_log("SCSI HD %i: Phase: %02X, request length: %i\n", shdc[id].phase, shdc[id].request_length); */ +} + +void scsi_hd_callback(uint8_t id); + +int scsi_hd_read_from_scsi_dma(uint8_t scsi_id, uint8_t scsi_lun) +{ + uint8_t *hdbufferb; + + uint8_t id = scsi_hard_disks[scsi_id][scsi_lun]; + + hdbufferb = (uint8_t *) shdc[id].buffer; + + if (id > HDC_NUM) + { + return 0; + } + + scsi_hd_log("Reading from SCSI DMA: SCSI ID %02X, init length %i\n", scsi_id, SCSIDevices[scsi_id][scsi_lun].InitLength); + memcpy(hdbufferb, SCSIDevices[scsi_id][scsi_lun].CmdBuffer, SCSIDevices[scsi_id][scsi_lun].InitLength); + return 1; +} + +int scsi_hd_read_from_dma(uint8_t id) +{ + int ret = 0; + + ret = scsi_hd_read_from_scsi_dma(hdc[id].scsi_id, hdc[id].scsi_lun); + + if (!ret) + { + return 0; + } + + return 0; +} + +int scsi_hd_write_to_scsi_dma(uint8_t scsi_id, uint8_t scsi_lun) +{ + uint8_t *hdbufferb; + + uint8_t id = scsi_hard_disks[scsi_id][scsi_lun]; + + if (id > HDC_NUM) + { + return 0; + } + + hdbufferb = (uint8_t *) shdc[id].buffer; + + scsi_hd_log("Writing to SCSI DMA: SCSI ID %02X, init length %i\n", scsi_id, SCSIDevices[scsi_id][scsi_lun].InitLength); + memcpy(SCSIDevices[scsi_id][scsi_lun].CmdBuffer, hdbufferb, SCSIDevices[scsi_id][scsi_lun].InitLength); + scsi_hd_log("SCSI HD %i: Data from HD buffer: %02X %02X %02X %02X %02X %02X %02X %02X\n", id, hdbufferb[0], hdbufferb[1], hdbufferb[2], hdbufferb[3], hdbufferb[4], hdbufferb[5], hdbufferb[6], hdbufferb[7]); + scsi_hd_log("SCSI HD %i: Data from SCSI DMA : %02X %02X %02X %02X %02X %02X %02X %02X\n", id, SCSIDevices[scsi_id][scsi_lun].CmdBuffer[0], SCSIDevices[scsi_id][scsi_lun].CmdBuffer[1], SCSIDevices[scsi_id][scsi_lun].CmdBuffer[2], SCSIDevices[scsi_id][scsi_lun].CmdBuffer[3], SCSIDevices[scsi_id][scsi_lun].CmdBuffer[4], SCSIDevices[scsi_id][scsi_lun].CmdBuffer[5], SCSIDevices[scsi_id][scsi_lun].CmdBuffer[6], SCSIDevices[scsi_id][scsi_lun].CmdBuffer[7]); + return 1; +} + +int scsi_hd_write_to_dma(uint8_t id) +{ + int ret = 0; + + ret = scsi_hd_write_to_scsi_dma(hdc[id].scsi_id, hdc[id].scsi_lun); + + if (!ret) + { + return 0; + } + + return 1; +} + +/* If the result is 1, issue an IRQ, otherwise not. */ +void scsi_hd_callback(uint8_t id) +{ + switch(shdc[id].packet_status) + { + case CDROM_PHASE_IDLE: + scsi_hd_log("SCSI HD %i: PHASE_IDLE\n", id); + shdc[id].pos=0; + shdc[id].phase = 1; + shdc[id].status = READY_STAT | DRQ_STAT | (shdc[id].status & ERR_STAT); + return; + case CDROM_PHASE_COMMAND: + scsi_hd_log("SCSI HD %i: PHASE_COMMAND\n", id); + shdc[id].status = BUSY_STAT | (shdc[id].status &ERR_STAT); + memcpy(shdc[id].hd_cdb, (uint8_t *) shdc[id].buffer, shdc[id].cdb_len); + scsi_hd_command(id, shdc[id].hd_cdb); + return; + case CDROM_PHASE_COMPLETE: + scsi_hd_log("SCSI HD %i: PHASE_COMPLETE\n", id); + shdc[id].status = READY_STAT; + shdc[id].phase = 3; + shdc[id].packet_status = 0xFF; + update_status_bar_icon(0x22, 0); + return; + case CDROM_PHASE_DATA_OUT: + scsi_hd_log("SCSI HD %i: PHASE_DATA_OUT\n", id); + shdc[id].status = READY_STAT | DRQ_STAT | (shdc[id].status & ERR_STAT); + shdc[id].phase = 0; + return; + case CDROM_PHASE_DATA_OUT_DMA: + scsi_hd_log("SCSI HD %i: PHASE_DATA_OUT_DMA\n", id); + scsi_hd_read_from_dma(id); + shdc[id].packet_status = CDROM_PHASE_COMPLETE; + shdc[id].status = READY_STAT; + shdc[id].phase = 3; + update_status_bar_icon(0x22, 0); + return; + case CDROM_PHASE_DATA_IN: + scsi_hd_log("SCSI HD %i: PHASE_DATA_IN\n", id); + shdc[id].status = READY_STAT | DRQ_STAT | (shdc[id].status & ERR_STAT); + shdc[id].phase = 2; + return; + case CDROM_PHASE_DATA_IN_DMA: + scsi_hd_log("SCSI HD %i: PHASE_DATA_IN_DMA\n", id); + scsi_hd_write_to_dma(id); + shdc[id].packet_status = CDROM_PHASE_COMPLETE; + shdc[id].status = READY_STAT; + shdc[id].phase = 3; + update_status_bar_icon(0x22, 0); + return; + case CDROM_PHASE_ERROR: + scsi_hd_log("SCSI HD %i: PHASE_ERROR\n", id); + shdc[id].status = READY_STAT | ERR_STAT; + shdc[id].phase = 3; + return; + } +} diff --git a/src/serial.c b/src/serial.c index da41b00f9..4eb78e821 100644 --- a/src/serial.c +++ b/src/serial.c @@ -61,7 +61,6 @@ void serial_update_ints(SERIAL *serial) void serial_write_fifo(SERIAL *serial, uint8_t dat) { -// pclog("serial_write_fifo %02X\n", serial->lsr); serial->fifo[serial->fifo_write] = dat; serial->fifo_write = (serial->fifo_write + 1) & 0xFF; if (!(serial->lsr & 1)) @@ -85,8 +84,6 @@ uint8_t serial_read_fifo(SERIAL *serial) void serial_write(uint16_t addr, uint8_t val, void *p) { SERIAL *serial = (SERIAL *)p; - // pclog("Serial: Write value %02X on port: %04X\n", val, addr); -// pclog("Write serial %03X %02X %04X:%04X\n",addr,val,CS,pc); switch (addr&7) { case 0: @@ -113,6 +110,9 @@ void serial_write(uint16_t addr, uint8_t val, void *p) serial->ier = val & 0xf; serial_update_ints(serial); break; + case 2: + serial->fcr = val; + break; case 3: serial->lcr = val; break; @@ -121,7 +121,6 @@ void serial_write(uint16_t addr, uint8_t val, void *p) { if (serial->rcr_callback) serial->rcr_callback(serial, serial->rcr_callback_p); -// pclog("RCR raised! sending M\n"); } serial->mctrl = val; if (val & 0x10) @@ -170,7 +169,6 @@ uint8_t serial_read(uint16_t addr, void *p) { SERIAL *serial = (SERIAL *)p; uint8_t temp = 0; - // pclog("Read serial %03X %04X(%08X):%04X %i %i ", addr, CS, cs, cpu_state.pc, mousedelay, ins); switch (addr&7) { case 0: @@ -200,6 +198,8 @@ uint8_t serial_read(uint16_t addr, void *p) serial->int_status &= ~SERIAL_INT_TRANSMIT; serial_update_ints(serial); } + if (serial->fcr & 1) + temp |= 0xc0; break; case 3: temp = serial->lcr; @@ -214,7 +214,6 @@ uint8_t serial_read(uint16_t addr, void *p) temp = serial->lsr; if (serial->lsr & 0x1f) serial->lsr &= ~0x1e; -// serial.lsr |= 0x60; serial->int_status &= ~SERIAL_INT_LSR; serial_update_ints(serial); break; @@ -228,8 +227,6 @@ uint8_t serial_read(uint16_t addr, void *p) temp = serial->scratch; break; } -// pclog("%02X\n",temp); - // pclog("Serial: Read value %02X on port: %04X\n", temp, addr); return temp; } @@ -266,7 +263,6 @@ void serial1_set(uint16_t addr, int irq) serial1_remove(); io_sethandler(addr, 0x0008, serial_read, NULL, NULL, serial_write, NULL, NULL, &serial1); serial1.irq = irq; - // pclog("serial1_set(%04X, %02X)\n", addr, irq); serial_addr[0] = addr; serial_irq[0] = irq; } @@ -290,7 +286,6 @@ void serial2_set(uint16_t addr, int irq) serial2_remove(); io_sethandler(addr, 0x0008, serial_read, NULL, NULL, serial_write, NULL, NULL, &serial2); serial2.irq = irq; - // pclog("serial2_set(%04X, %02X)\n", addr, irq); serial_addr[1] = addr; serial_irq[1] = irq; } diff --git a/src/serial.h b/src/serial.h index 0e5995706..96104068e 100644 --- a/src/serial.h +++ b/src/serial.h @@ -18,6 +18,7 @@ typedef struct uint8_t dat; uint8_t int_status; uint8_t scratch; + uint8_t fcr; int irq; @@ -30,3 +31,5 @@ typedef struct } SERIAL; extern SERIAL serial1, serial2; + +void serial_write_fifo(SERIAL *serial, uint8_t dat); diff --git a/src/serial_bh.c b/src/serial_bh.c new file mode 100644 index 000000000..23ec556e8 --- /dev/null +++ b/src/serial_bh.c @@ -0,0 +1,606 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Implementation of host serial port services for Win32. + * + * This code is based on a universal serial port driver for + * Windows and UNIX systems, with support for FTDI and Prolific + * USB ports. Support for these has been removed. + * + * Version: @(#)serial_bh.c 1.0.1 2017/04/14 + * + * Author: Fred N. van Kempen, + * Copyright 2017 Fred N. van Kempen. + */ +#define _WIN32_WINNT 0x0501 +#include +#include +#include +#define BHTTY_C +#include "serial_bh.h" + + +extern void pclog(char *__fmt, ...); + + +/* Set the state of a port. */ +int +bhtty_sstate(BHTTY *pp, void *arg) +{ + int i = 0; + + /* Make sure we can do this. */ + if (pp == NULL || arg == NULL) { + pclog("invalid argument\n"); + return(-1); + } + + if (SetCommState(pp->handle, (DCB *)arg) == FALSE) { + /* Mark an error. */ + pclog("%s: set state: %d\n", pp->name, GetLastError()); + return(-1); + } + + return(0); +} + + +/* Fetch the state of a port. */ +int +bhtty_gstate(BHTTY *pp, void *arg) +{ + int i = 0; + + /* Make sure we can do this. */ + if (pp == NULL || arg == NULL) { + pclog("BHTTY: invalid argument\n"); + return(-1); + } + + if (GetCommState(pp->handle, (DCB *)arg) == FALSE) { + /* Mark an error. */ + pclog("%s: get state: %d\n", pp->name, GetLastError()); + return(-1); + } + + return(0); +} + + +/* Enable or disable RTS/CTS mode (hardware handshaking.) */ +int +bhtty_crtscts(BHTTY *pp, char yesno) +{ + /* Make sure we can do this. */ + if (pp == NULL) { + pclog("invalid handle\n"); + return(-1); + } + + /* Get the current mode. */ + if (bhtty_gstate(pp, &pp->dcb) < 0) return(-1); + + switch(yesno) { + case 0: /* disable CRTSCTS */ + pp->dcb.fOutxDsrFlow = 0; /* disable DSR/DCD mode */ + pp->dcb.fDsrSensitivity = 0; + + pp->dcb.fOutxCtsFlow = 0; /* disable RTS/CTS mode */ + + pp->dcb.fTXContinueOnXoff = 0; /* disable XON/XOFF mode */ + pp->dcb.fOutX = 0; + pp->dcb.fInX = 0; + break; + + case 1: /* enable CRTSCTS */ + pp->dcb.fOutxDsrFlow = 0; /* disable DSR/DCD mode */ + pp->dcb.fDsrSensitivity = 0; + + pp->dcb.fOutxCtsFlow = 1; /* enable RTS/CTS mode */ + + pp->dcb.fTXContinueOnXoff = 0; /* disable XON/XOFF mode */ + pp->dcb.fOutX = 0; + pp->dcb.fInX = 0; + break; + + default: + pclog("%s: invalid parameter '%d'!\n", pp->name, yesno); + return(-1); + } + + /* Set new mode. */ + if (bhtty_sstate(pp, &pp->dcb) < 0) return(-1); + + return(0); +} + + +/* Set the port parameters. */ +int +bhtty_params(BHTTY *pp, char dbit, char par, char sbit) +{ + /* Make sure we can do this. */ + if (pp == NULL) { + pclog("invalid handle\n"); + return(-1); + } + + /* Get the current mode. */ + if (bhtty_gstate(pp, &pp->dcb) < 0) return(-1); + + /* Set the desired word length. */ + switch((int)dbit) { + case -1: /* no change */ + break; + + case 5: /* FTDI doesnt like these */ + case 6: + case 9: + break; + + case 7: + case 8: + pp->dcb.ByteSize = dbit; + break; + + default: + pclog("%s: invalid parameter '%d'!\n", pp->name, dbit); + return(-1); + } + + /* Set the type of parity encoding. */ + switch((int)par) { + case -1: /* no change */ + case ' ': + break; + + case 0: + case 'N': + pp->dcb.fParity = FALSE; + pp->dcb.Parity = NOPARITY; + break; + + case 1: + case 'O': + pp->dcb.fParity = TRUE; + pp->dcb.Parity = ODDPARITY; + break; + + case 2: + case 'E': + pp->dcb.fParity = TRUE; + pp->dcb.Parity = EVENPARITY; + break; + + case 3: + case 'M': + case 4: + case 'S': + break; + + default: + pclog("%s: invalid parameter '%c'!\n", pp->name, par); + return(-1); + } + + /* Set the number of stop bits. */ + switch((int)sbit) { + case -1: /* no change */ + break; + + case 1: + pp->dcb.StopBits = ONESTOPBIT; + break; + + case 2: + pp->dcb.StopBits = TWOSTOPBITS; + break; + + default: + pclog("%s: invalid parameter '%d'!\n", pp->name, sbit); + return(-1); + } + + /* Set new mode. */ + if (bhtty_sstate(pp, &pp->dcb) < 0) return(-1); + + return(0); +} + + +/* Put a port in transparent ("raw") state. */ +void +bhtty_raw(BHTTY *pp, void *arg) +{ + DCB *dcb = (DCB *)arg; + + /* Make sure we can do this. */ + if (pp == NULL || arg == NULL) { + pclog("invalid parameter\n"); + return; + } + + /* Enable BINARY transparent mode. */ + dcb->fBinary = 1; + dcb->fErrorChar = 0; /* disable Error Replacement */ + dcb->fNull = 0; /* disable NUL stripping */ + + /* Disable the DTR and RTS lines. */ + dcb->fDtrControl = DTR_CONTROL_DISABLE; /* DTR line */ + dcb->fRtsControl = RTS_CONTROL_DISABLE; /* RTS line */ + + /* Disable DSR/DCD handshaking. */ + dcb->fOutxDsrFlow = 0; /* DSR handshaking */ + dcb->fDsrSensitivity = 0; /* DSR Sensitivity */ + + /* Disable RTS/CTS handshaking. */ + dcb->fOutxCtsFlow = 0; /* CTS handshaking */ + + /* Disable XON/XOFF handshaking. */ + dcb->fTXContinueOnXoff = 0; /* continue TX after Xoff */ + dcb->fOutX = 0; /* enable output X-ON/X-OFF */ + dcb->fInX = 0; /* enable input X-ON/X-OFF */ + dcb->XonChar = 0x11; /* ASCII XON */ + dcb->XoffChar = 0x13; /* ASCII XOFF */ + dcb->XonLim = 100; + dcb->XoffLim = 100; + + dcb->fParity = FALSE; + dcb->Parity = NOPARITY; + dcb->StopBits = ONESTOPBIT; + dcb->BaudRate = CBR_1200; +} + + +/* Set the port speed. */ +int +bhtty_speed(BHTTY *pp, long speed) +{ + int i; + + /* Make sure we can do this. */ + if (pp == NULL) { + pclog("invalid handle\n"); + return(-1); + } + + /* Get the current mode and speed. */ + if (bhtty_gstate(pp, &pp->dcb) < 0) return(-1); + + /* + * Set speed. + * + * This is not entirely correct, we should use a table + * with DCB_xxx speed values here, but we removed that + * and just hardcode the speed value into DCB. --FvK + */ + pp->dcb.BaudRate = speed; + + /* Set new speed. */ + if (bhtty_sstate(pp, &pp->dcb) < 0) return(-1); + + return(0); +} + + +/* Clean up and flush. */ +int +bhtty_flush(BHTTY *pp) +{ + DWORD dwErrs; + COMSTAT cs; + int i = 0; + + /* Make sure we can do this. */ + if (pp == NULL) { + pclog("invalid handle\n"); + return(-1); + } + + /* First, clear any errors. */ + (void)ClearCommError(pp->handle, &dwErrs, &cs); + + /* Now flush all buffers. */ + if (PurgeComm(pp->handle, + (PURGE_RXABORT | PURGE_TXABORT | \ + PURGE_RXCLEAR | PURGE_TXCLEAR)) == FALSE) { + pclog("%s: flush: %d\n", pp->name, GetLastError()); + return(-1); + } + + /* Re-clear any errors. */ + if (ClearCommError(pp->handle, &dwErrs, &cs) == FALSE) { + pclog("%s: clear errors: %d\n", pp->name, GetLastError()); + return(-1); + } + + return(0); +} + + +/* Close an open serial port. */ +void +bhtty_close(BHTTY *pp) +{ + /* Make sure we can do this. */ + if (pp == NULL) { + pclog("BHTTY: invalid handle\n"); + return; + } + + if (pp->handle != INVALID_HANDLE_VALUE) { + /* Restore the previous port state, if any. */ + (void)bhtty_sstate(pp, &pp->odcb); + + /* Close the port. */ + CloseHandle(pp->handle); + pp->handle = INVALID_HANDLE_VALUE; + } + + /* Release the control block. */ + free(pp); +} + + +/* Open a host serial port for I/O. */ +BHTTY * +bhtty_open(char *port, int tmo) +{ + char buff[64]; + COMMTIMEOUTS to; +#if 0 + COMMCONFIG conf; + DWORD d; +#endif + BHTTY *pp; + int i = 0; + + /* Make sure we can do this. */ + if (port == NULL) { + pclog("invalid argument!\n"); + return(NULL); + } + + /* First things first... create a control block. */ + if ((pp = (BHTTY *)malloc(sizeof(BHTTY))) == NULL) { + pclog("%s: out of memory!\n", port); + return(NULL); + } + memset(pp, 0x00, sizeof(BHTTY)); + strncpy(pp->name, port, sizeof(pp->name)-1); + + /* Try a regular Win32 serial port. */ + sprintf(buff, "\\\\.\\%s", pp->name); + pp->handle = CreateFile(buff, + (GENERIC_READ|GENERIC_WRITE), + 0, NULL, OPEN_EXISTING, + FILE_FLAG_OVERLAPPED, + 0); + if (pp->handle == INVALID_HANDLE_VALUE) { + pclog("%s: open port: %d\n", pp->name, GetLastError()); + free(pp); + return(NULL); + } + +#if 0 + /* Set up buffer size of the port. */ + if (SetupComm(pp->handle, 32768L, 32768L) == FALSE) { + /* This fails on FTDI-based devices. */ + pclog("%s: set buffers: %d\n", pp->name, GetLastError()); +// CloseHandle(pp->handle); +// free(pp); +// return(NULL); + } + + /* Grab default config for the driver and set it. */ + d = sizeof(COMMCONFIG); + memset(&conf, 0x00, d); + conf.dwSize = d; + if (GetDefaultCommConfig(pp->name, &conf, &d) == TRUE) { + /* Change config here... */ + + /* Set new configuration. */ + if (SetCommConfig(pp->handle, &conf, d) == FALSE) { + /* This fails on FTDI-based devices. */ + pclog("%s: set configuration: %d\n", pp->name, GetLastError()); +// CloseHandle(pp->handle); +// free(pp); +// return(NULL); + } + } +#endif + + /* + * We now have an open port. To allow for clean exit + * of the application, we first retrieve the port's + * current settings, and save these for later. + */ + if (bhtty_gstate(pp, &pp->odcb) < 0) { + (void)bhtty_close(pp); + return(NULL); + } + memcpy(&pp->dcb, &pp->odcb, sizeof(DCB)); + + /* Force the port to BINARY mode. */ + bhtty_raw(pp, &pp->dcb); + + /* Set new state of this port. */ + if (bhtty_sstate(pp, &pp->dcb) < 0) { + (void)bhtty_close(pp); + return(NULL); + } + + /* Just to make sure.. disable RTS/CTS mode. */ + (void)bhtty_crtscts(pp, 0); + + /* Set new timeout values. */ + if (GetCommTimeouts(pp->handle, &to) == FALSE) { + pclog("%s: error %d while getting current TO\n", + pp->name, GetLastError()); + (void)bhtty_close(pp); + return(NULL); + } + if (tmo < 0) { + /* No timeout, immediate return. */ + to.ReadIntervalTimeout = MAXDWORD; + to.ReadTotalTimeoutMultiplier = 0; + to.ReadTotalTimeoutConstant = 0; + } else if (tmo == 0) { + /* No timeout, wait for data. */ + memset(&to, 0x00, sizeof(to)); + } else { + /* Timeout specified. */ + to.ReadIntervalTimeout = MAXDWORD; + to.ReadTotalTimeoutMultiplier = MAXDWORD; + to.ReadTotalTimeoutConstant = tmo; + } + if (SetCommTimeouts(pp->handle, &to) == FALSE) { + pclog("%s: error %d while setting TO\n", + pp->name, GetLastError()); + (void)bhtty_close(pp); + return(NULL); + } + + /* Clear all errors and flush all buffers. */ + if (bhtty_flush(pp) < 0) { + (void)bhtty_close(pp); + return(NULL); + } + + return(pp); +} + + +/* A pending WRITE has finished, handle it. */ +static VOID CALLBACK +bhtty_write_comp(DWORD err, DWORD num, OVERLAPPED *priv) +{ + BHTTY *pp = (BHTTY *)priv->hEvent; + +//pclog("%s: write complete, status %d, num %d\n", pp->name, err, num); +#if 0 + if ( + if (GetOverlappedResult(p->handle, + &p->rov, &mst, TRUE) == FALSE) { + r = GetLastError(); + if (r != ERROR_OPERATION_ABORTED) + /* OK, we're being shut down. */ + sprintf(serial_errmsg, + "%s: I/O read error!", p->name); + return(-1); + } +#endif +} + + +/* Try to write data to an open port. */ +int +bhtty_write(BHTTY *pp, unsigned char val) +{ + DWORD n; + + /* Make sure we can do this. */ + if (pp == NULL) { + pclog("invalid parameter\n"); + return(-1); + } +//pclog("BHwrite(%08lx, %02x, '%c')\n", pp->handle, val, val); + + /* Save the control pointer for later use. */ + pp->wov.hEvent = (HANDLE)pp; + + if (WriteFileEx(pp->handle, + &val, 1, + &pp->wov, + bhtty_write_comp) == FALSE) { + n = GetLastError(); + pclog("%s: I/O error %d in write!\n", pp->name, n); + return(-1); + } + + /* Its pending, so handled in the completion routine. */ + SleepEx(1, TRUE); + + return(0); +} + + +/* + * A pending READ has finished, handle it. + */ +static VOID CALLBACK +bhtty_read_comp(DWORD err, DWORD num, OVERLAPPED *priv) +{ + BHTTY *pp = (BHTTY *)priv->hEvent; + DWORD r; +//pclog("%s: read complete, status %d, num %d\n", pp->name, err, num); + + if (GetOverlappedResult(pp->handle, &pp->rov, &r, TRUE) == FALSE) { + r = GetLastError(); + if (r != ERROR_OPERATION_ABORTED) + /* OK, we're being shut down. */ + pclog("%s: I/O read error!", pp->name); + return; + } +//pclog("%s: read done, num=%d (%d)\n", pp->name, num, r); + + /* Do a callback to let them know. */ + if (pp->rd_done != NULL) + pp->rd_done(pp->rd_arg, num); +} + + +/* + * Try to read data from an open port. + * + * For now, we will use one byte per call. Eventually, + * we should go back to loading a buffer full of data, + * just to speed things up a bit. --FvK + * + * Also, not that we do not wait here. We just POST a + * read operation, and the completion routine will do + * the clean-up and notify the caller. + */ +int +bhtty_read(BHTTY *pp, unsigned char *bufp, int max) +{ + DWORD r; + + /* Just one byte. */ + max = 1; + + /* Make sure we can do this. */ + if (pp == NULL) { + pclog("invalid parameter\n"); + return(-1); + } + + /* Save the control pointer for later use. */ + pp->rov.hEvent = (HANDLE)pp; +//pclog("%s: read(%08lx, %d)\n", pp->name, pp->handle, max); + + /* Post a READ on the device. */ + if (ReadFileEx(pp->handle, + bufp, (DWORD)max, + &pp->rov, + bhtty_read_comp) == FALSE) { + r = GetLastError(); + if (r != ERROR_IO_PENDING) { + /* OK, we're being shut down. */ + if (r != ERROR_INVALID_HANDLE) + pclog("%s: I/O read error!\n", pp->name); + return(-1); + } + } + + /* Make ourself alertable. */ + SleepEx(1, TRUE); + + /* OK, it's pending, so we are good for now. */ + return(0); +} diff --git a/src/serial_bh.h b/src/serial_bh.h new file mode 100644 index 000000000..a3f42a1ba --- /dev/null +++ b/src/serial_bh.h @@ -0,0 +1,53 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Definitions for the Bottom Half of the SERIAL card. + * + * Version: @(#)serial_bh.h 1.0.1 2017/04/14 + * + * Author: Fred N. van Kempen, + * Copyright 2017 Fred N. van Kempen. + */ +#ifndef SERIAL_BH_H +# define SERIAL_BH_H + + +#define BHTTY_PORT1 "COM2" /* port 1 connects to .. */ +#define BHTTY_PORT2 "COM4" /* port 2 connects to .. */ + + +typedef struct { + char name[79]; /* name of open port */ + void (*rd_done)(void *, int); + void *rd_arg; +#ifdef BHTTY_C + HANDLE handle; + OVERLAPPED rov, /* READ and WRITE events */ + wov; + int tmo; /* current timeout value */ + DCB dcb, /* terminal settings */ + odcb; +#endif +} BHTTY; + + +extern BHTTY *bhtty_open(char *__port, int __tmo); +extern void bhtty_close(BHTTY *); +extern int bhtty_flush(BHTTY *); +extern void bhtty_raw(BHTTY *, void *__arg); +extern int bhtty_speed(BHTTY *, long __speed); +extern int bhtty_params(BHTTY *, char __dbit, char __par, char __sbit); +extern int bhtty_sstate(BHTTY *, void *__arg); +extern int bhtty_gstate(BHTTY *, void *__arg); +extern int bhtty_crtscts(BHTTY *, char __yesno); + +extern int bhtty_write(BHTTY *, unsigned char); +extern int bhtty_read(BHTTY *, unsigned char *, int); + + +#endif /*SERIAL_BH_H*/ diff --git a/src/sio.c b/src/sio.c index ffc676995..a5303935e 100644 --- a/src/sio.c +++ b/src/sio.c @@ -11,8 +11,12 @@ #include "ibm.h" #include "cdrom.h" #include "cpu.h" +#include "disc.h" +#include "dma.h" +#include "fdc.h" #include "ide.h" #include "io.h" +#include "keyboard_at.h" #include "mem.h" #include "pci.h" @@ -91,45 +95,50 @@ uint8_t trc_read(uint16_t port, void *priv) return trc_reg & 0xfb; } -void trc_write(uint16_t port, uint8_t val, void *priv) +void trc_reset(uint8_t val) { int i = 0; + if (val & 2) + { + if (pci_reset_handler.pci_master_reset) + { + pci_reset_handler.pci_master_reset(); + } + + if (pci_reset_handler.pci_set_reset) + { + pci_reset_handler.pci_set_reset(); + } + + fdc_hard_reset(); + + if (pci_reset_handler.super_io_reset) + { + pci_reset_handler.super_io_reset(); + } + + resetide(); + for (i = 0; i < CDROM_NUM; i++) + { + if (!cdrom_drives[i].bus_type) + { + cdrom_reset(i); + } + } + + port_92_reset(); + keyboard_at_reset(); + } + resetx86(); +} + +void trc_write(uint16_t port, uint8_t val, void *priv) +{ pclog("TRC Write: %02X\n", val); if (!(trc_reg & 4) && (val & 4)) { - if (val & 2) - { - if (pci_reset_handler.pci_master_reset) - { - pci_reset_handler.pci_master_reset(); - } - - if (pci_reset_handler.pci_set_reset) - { - pci_reset_handler.pci_set_reset(); - } - - fdc_hard_reset(); - - if (pci_reset_handler.super_io_reset) - { - pci_reset_handler.super_io_reset(); - } - - resetide(); - for (i = 0; i < CDROM_NUM; i++) - { - if (!cdrom_drives[i].bus_type) - { - cdrom_reset(i); - } - } - - port_92_reset(); - keyboard_at_reset(); - } - resetx86(); + trc_reset(val); } trc_reg = val & 0xfd; } diff --git a/src/sis496.c b/src/sis496.c index 1265330dd..8cdb87a95 100644 --- a/src/sis496.c +++ b/src/sis496.c @@ -51,7 +51,6 @@ void sis496_recalcmapping(sis496_t *sis496) void sis496_write(int func, int addr, uint8_t val, void *p) { sis496_t *sis496 = (sis496_t *)p; - //pclog("sis496_write : addr=%02x val=%02x\n", addr, val); switch (addr) { case 0x44: /*Shadow configure*/ diff --git a/src/sis85c471.c b/src/sis85c471.c index cf8e24add..5d12ae341 100644 --- a/src/sis85c471.c +++ b/src/sis85c471.c @@ -23,9 +23,7 @@ static uint8_t sis85c471_regs[39]; void sis85c471_write(uint16_t port, uint8_t val, void *priv) { uint8_t index = (port & 1) ? 0 : 1; - int temp; uint8_t x; - // pclog("sis85c471_write : port=%04x reg %02X = %02X\n", port, sis85c471_curreg, val); if (index) { @@ -85,7 +83,6 @@ process_value: uint8_t sis85c471_read(uint16_t port, void *priv) { - // pclog("sis85c471_read : port=%04x reg %02X\n", port, sis85c471_curreg); uint8_t index = (port & 1) ? 0 : 1; uint8_t temp; @@ -106,9 +103,6 @@ void sis85c471_init() { int i = 0; - // pclog("SiS 85c471 Init\n"); - - // ide_sec_disable(); lpt2_remove(); sis85c471_curreg = 0; diff --git a/src/slirp/debug.h b/src/slirp/debug.h index 9a8c5e8c8..a1eafa130 100644 --- a/src/slirp/debug.h +++ b/src/slirp/debug.h @@ -37,7 +37,6 @@ extern int slirp_debug; #endif void debug_init _P((char *, int)); -//void ttystats _P((struct ttys *)); void allttystats _P((void)); void ipstats _P((void)); void vjstats _P((void)); diff --git a/src/slirp/misc.c b/src/slirp/misc.c index 88c0c13e0..b39a4d9a3 100644 --- a/src/slirp/misc.c +++ b/src/slirp/misc.c @@ -92,8 +92,8 @@ getouraddr() struct hostent *he = NULL; #define ANCIENT #ifdef ANCIENT - if (gethostname(&buff,500) == 0) - he = gethostbyname(&buff); + if (gethostname(buff,500) == 0) + he = gethostbyname(buff); if (he) our_addr = *(struct in_addr *)he->h_addr; if (our_addr.s_addr == 0) diff --git a/src/slirp/queue.h b/src/slirp/queue.h index 534dcb84b..786950ab7 100644 --- a/src/slirp/queue.h +++ b/src/slirp/queue.h @@ -96,4 +96,6 @@ queueElementT QueueDelete(queueADT queue); int QueueIsEmpty(queueADT queue); int QueueIsFull(queueADT queue); +int QueuePeek(queueADT queue); + #endif /* not defined _QUEUE_H */ diff --git a/src/slirp/slirp.h b/src/slirp/slirp.h index 92cfe2fc9..b7b077527 100644 --- a/src/slirp/slirp.h +++ b/src/slirp/slirp.h @@ -12,7 +12,7 @@ #include "slirp_config.h" #ifdef _WIN32 -#ifdef __GNUC__ //MINGW? +#ifdef __GNUC__ /* MINGW? */ # include typedef uint8_t u_int8_t; typedef uint16_t u_int16_t; @@ -39,7 +39,7 @@ typedef unsigned long ioctlsockopt_t; #endif -# include //needs to be on top otherwise, it'll pull in winsock1 +# include /* needs to be on top otherwise, it'll pull in winsock1 */ # include # include @@ -243,8 +243,6 @@ int inet_aton _P((const char *cp, struct in_addr *ia)); #define PACK_END 0 #define PACKED__ #elif _MSC_VER -//#define PRAGMA_PACK_SUPPORTED 1 -//#define PACK_END 4 #define PACKED__ #else #error "Packed attribute or pragma shall be supported" @@ -323,15 +321,15 @@ void lprint _P((const char *, ...)); extern int do_echo; #ifdef _MSC_VER -#define inline +#define __inline #endif #if SIZEOF_CHAR_P == 4 # define insque_32 insque # define remque_32 remque #else - extern inline void insque_32 _P((void *, void *)); - extern inline void remque_32 _P((void *)); + extern __inline void insque_32 _P((void *, void *)); + extern __inline void remque_32 _P((void *)); #endif #ifndef _WIN32 diff --git a/src/sound.c b/src/sound.c index 53b6ae732..a00f7f9ca 100644 --- a/src/sound.c +++ b/src/sound.c @@ -36,11 +36,14 @@ static SOUND_CARD sound_cards[] = { {"None", "none", NULL}, {"Adlib", "adlib", &adlib_device}, + {"Adlib MCA", "adlib_mca", &adlib_mca_device}, {"Sound Blaster 1.0", "sb", &sb_1_device}, {"Sound Blaster 1.5", "sb1.5", &sb_15_device}, + {"Sound Blaster MCV", "sbmcv", &sb_mcv_device}, {"Sound Blaster 2.0", "sb2.0", &sb_2_device}, {"Sound Blaster Pro v1", "sbprov1", &sb_pro_v1_device}, {"Sound Blaster Pro v2", "sbprov2", &sb_pro_v2_device}, + {"Sound Blaster Pro MCV", "sbpromcv", &sb_pro_mcv_device}, {"Sound Blaster 16", "sb16", &sb_16_device}, {"Sound Blaster AWE32", "sbawe32", &sb_awe32_device}, {"Adlib Gold", "adlibgold", &adgold_device}, @@ -108,7 +111,7 @@ static struct static int sound_handlers_num; -static int sound_poll_time = 0, sound_get_buffer_time = 0, sound_poll_latch; +static int sound_poll_time = 0, sound_poll_latch; int sound_pos_global = 0; int soundon = 1; @@ -184,10 +187,8 @@ static void sound_cd_thread(void *param) /* Then, adjust input from drive according to ATAPI/SCSI volume. */ cd_buffer_temp[0] *= (float) audio_vol_l; - // cd_buffer_temp[0] /= 255.0; cd_buffer_temp[0] /= 511.0; cd_buffer_temp[1] *= (float) audio_vol_r; - // cd_buffer_temp[1] /= 255.0; cd_buffer_temp[1] /= 511.0; /*Apply ATAPI channel select*/ @@ -251,13 +252,11 @@ void sound_init() if (available_cdrom_drives) { - // pclog("One or more CD-ROM drives are available, starting CD Audio thread...\n"); sound_cd_event = thread_create_event(); sound_cd_thread_h = thread_create(sound_cd_thread, NULL); } cd_thread_enable = available_cdrom_drives ? 1 : 0; - // pclog("cd_thread_enable = %i\n", cd_thread_enable); } void sound_add_handler(void (*get_buffer)(int32_t *buffer, int len, void *p), void *p) @@ -325,7 +324,6 @@ void sound_speed_changed() void sound_reset() { int i = 0; - int available_cdrom_drives = 0; timer_add(sound_poll, &sound_poll_time, TIMER_ALWAYS_ENABLED, NULL); @@ -357,13 +355,11 @@ void sound_cd_thread_reset() if (available_cdrom_drives && !cd_thread_enable) { - // pclog("One or more CD-ROM drives are now available, but none was before, starting the CD Audio thread...\n"); sound_cd_event = thread_create_event(); sound_cd_thread_h = thread_create(sound_cd_thread, NULL); } else if (!available_cdrom_drives && cd_thread_enable) { - // pclog("No CD-ROM drives are now available, but one or more was before, killing the CD Audio thread...\n"); thread_destroy_event(sound_cd_event); thread_kill(sound_cd_thread_h); sound_cd_thread_h = NULL; diff --git a/src/sound.h b/src/sound.h index 1878c4729..23eea439e 100644 --- a/src/sound.h +++ b/src/sound.h @@ -18,3 +18,13 @@ void sound_set_cd_volume(unsigned int vol_l, unsigned int vol_r); extern int sound_pos_global; void sound_speed_changed(); + +void sound_init(); +void sound_reset(); + +void sound_cd_thread_reset(); + +void initalmain(int argc, char *argv[]); +void inital(); +void givealbuffer(float *buf); +void givealbuffer_cd(float *buf); diff --git a/src/sound_ad1848.c b/src/sound_ad1848.c index 9dd339bce..c97a6d518 100644 --- a/src/sound_ad1848.c +++ b/src/sound_ad1848.c @@ -2,7 +2,11 @@ AD1848 CODEC emulation (Windows Sound System compatible)*/ +#include + #include "ibm.h" +#include "dma.h" +#include "pic.h" #include "sound.h" #include "sound_ad1848.h" @@ -22,7 +26,6 @@ uint8_t ad1848_read(uint16_t addr, void *p) { ad1848_t *ad1848 = (ad1848_t *)p; uint8_t temp = 0xff; -// pclog("ad1848_read - addr %04X %04X(%08X):%08X ", addr, CS, cs, pc); switch (addr & 3) { case 0: /*Index*/ @@ -35,7 +38,6 @@ uint8_t ad1848_read(uint16_t addr, void *p) temp = ad1848->status; break; } -// pclog("return %02X\n", temp); return temp; } @@ -43,7 +45,6 @@ void ad1848_write(uint16_t addr, uint8_t val, void *p) { ad1848_t *ad1848 = (ad1848_t *)p; double freq; -// pclog("ad1848_write - addr %04X val %02X %04X(%08X):%08X\n", addr, val, CS, cs, pc); switch (addr & 3) { case 0: /*Index*/ @@ -165,12 +166,10 @@ static void ad1848_poll(void *p) } ad1848->count--; -// pclog("ad1848_poll : enable %X %X %X %X %X %X\n", ad1848->pcm_buffer[0][ad1848->pos], ad1848->pcm_buffer[1][ad1848->pos], ad1848->out_l[0], ad1848->out_r[0], ad1848->out_l[1], ad1848->out_r[1]); } else { ad1848->out_l = ad1848->out_r = 0; -// pclog("ad1848_poll : not enable\n"); } } @@ -212,7 +211,6 @@ void ad1848_init(ad1848_t *ad1848) attenuation = pow(10, attenuation / 10); ad1848_vols[c] = (int)(attenuation * 65536); -// pclog("ad1848_vols %i = %f %i\n", c, attenuation, ad1848_vols[c]); } timer_add(ad1848_poll, &ad1848->timer_count, &ad1848->enable, ad1848); diff --git a/src/sound_ad1848.h b/src/sound_ad1848.h index b97e1e499..6c5e02c55 100644 --- a/src/sound_ad1848.h +++ b/src/sound_ad1848.h @@ -33,3 +33,5 @@ void ad1848_write(uint16_t addr, uint8_t val, void *p); void ad1848_update(ad1848_t *ad1848); void ad1848_speed_changed(ad1848_t *ad1848); + +void ad1848_init(ad1848_t *ad1848); diff --git a/src/sound_adlib.c b/src/sound_adlib.c index f4e24bb44..70ed47b7a 100644 --- a/src/sound_adlib.c +++ b/src/sound_adlib.c @@ -1,7 +1,9 @@ #include #include "ibm.h" +#include "io.h" #include "device.h" #include "sound.h" +#include "mca.h" #include "sound_adlib.h" #include "sound_opl.h" @@ -9,6 +11,8 @@ typedef struct adlib_t { opl_t opl; + + uint8_t pos_regs[8]; } adlib_t; static void adlib_get_buffer(int32_t *buffer, int len, void *p) @@ -24,6 +28,36 @@ static void adlib_get_buffer(int32_t *buffer, int len, void *p) adlib->opl.pos = 0; } +uint8_t adlib_mca_read(int port, void *p) +{ + adlib_t *adlib = (adlib_t *)p; + + pclog("adlib_mca_read: port=%04x\n", port); + + return adlib->pos_regs[port & 7]; +} + +void adlib_mca_write(int port, uint8_t val, void *p) +{ + adlib_t *adlib = (adlib_t *)p; + + if (port < 0x102) + return; + + pclog("adlib_mca_write: port=%04x val=%02x\n", port, val); + + switch (port) + { + case 0x102: + if ((adlib->pos_regs[2] & 1) && !(val & 1)) + io_removehandler(0x0388, 0x0002, opl2_read, NULL, NULL, opl2_write, NULL, NULL, &adlib->opl); + if (!(adlib->pos_regs[2] & 1) && (val & 1)) + io_sethandler(0x0388, 0x0002, opl2_read, NULL, NULL, opl2_write, NULL, NULL, &adlib->opl); + break; + } + adlib->pos_regs[port & 7] = val; +} + void *adlib_init() { adlib_t *adlib = malloc(sizeof(adlib_t)); @@ -36,6 +70,18 @@ void *adlib_init() return adlib; } +void *adlib_mca_init() +{ + adlib_t *adlib = adlib_init(); + + io_removehandler(0x0388, 0x0002, opl2_read, NULL, NULL, opl2_write, NULL, NULL, &adlib->opl); + mca_add(adlib_mca_read, adlib_mca_write, adlib); + adlib->pos_regs[0] = 0xd7; + adlib->pos_regs[1] = 0x70; + + return adlib; +} + void adlib_close(void *p) { adlib_t *adlib = (adlib_t *)p; @@ -54,3 +100,15 @@ device_t adlib_device = NULL, NULL }; + +device_t adlib_mca_device = +{ + "AdLib (MCA)", + DEVICE_MCA, + adlib_init, + adlib_close, + NULL, + NULL, + NULL, + NULL +}; diff --git a/src/sound_adlib.h b/src/sound_adlib.h index c8db01482..1e2c363af 100644 --- a/src/sound_adlib.h +++ b/src/sound_adlib.h @@ -1 +1,2 @@ extern device_t adlib_device; +extern device_t adlib_mca_device; diff --git a/src/sound_adlibgold.c b/src/sound_adlibgold.c index a0f0956a9..398ed139c 100644 --- a/src/sound_adlibgold.c +++ b/src/sound_adlibgold.c @@ -146,7 +146,6 @@ void adgold_update_irq_status(adgold_t *adgold) if ((adgold->adgold_status ^ 0xf) && !adgold->adgold_irq_status) { -// pclog("adgold irq %02X\n", adgold->adgold_status); picint(0x80); } @@ -161,14 +160,12 @@ void adgold_getsamp_dma(adgold_t *adgold, int channel) return; temp = dma_channel_read(1); -// pclog("adgold DMA1 return %02X %i L\n", temp, channel); if (temp == DMA_NODATA) return; adgold->adgold_mma_fifo[channel][adgold->adgold_mma_fifo_end[channel]] = temp; adgold->adgold_mma_fifo_end[channel] = (adgold->adgold_mma_fifo_end[channel] + 1) & 255; if (adgold->adgold_mma_regs[channel][0xc] & 0x60) { temp = dma_channel_read(1); -// pclog("adgold DMA1 return %02X %i H\n", temp, channel); adgold->adgold_mma_fifo[channel][adgold->adgold_mma_fifo_end[channel]] = temp; adgold->adgold_mma_fifo_end[channel] = (adgold->adgold_mma_fifo_end[channel] + 1) & 255; } @@ -182,7 +179,6 @@ void adgold_getsamp_dma(adgold_t *adgold, int channel) void adgold_write(uint16_t addr, uint8_t val, void *p) { adgold_t *adgold = (adgold_t *)p; -// if (addr > 0x389) pclog("adgold_write : addr %04X val %02X %04X:%04X\n", addr, val, CS, pc); switch (addr & 7) { case 0: case 1: @@ -326,12 +322,10 @@ void adgold_write(uint16_t addr, uint8_t val, void *p) if (!(adgold->adgold_mma_regs[0][0x9] & 1)) adgold->adgold_mma.voice_count[0] = adgold->adgold_mma.voice_latch[0]; -// pclog("adgold start! FIFO fill %i %i %i %02X\n", (adgold->adgold_mma_fifo_end[0] - adgold->adgold_mma_fifo_start[0]) & 255, adgold->adgold_mma_fifo_end[0], adgold->adgold_mma_fifo_start[0], adgold->adgold_mma_regs[0][0xc]); if (adgold->adgold_mma_regs[0][0xc] & 1) { if (adgold->adgold_mma_regs[0][0xc] & 0x80) { -// pclog("adgold start interleaved %i %i adgold->adgold_mma_enable[1] = 1; adgold->adgold_mma.voice_count[1] = adgold->adgold_mma.voice_latch[1]; @@ -364,7 +358,6 @@ void adgold_write(uint16_t addr, uint8_t val, void *p) } } } -// pclog("adgold end\n"); } adgold->adgold_mma_enable[0] = val & 0x01; break; @@ -413,7 +406,6 @@ void adgold_write(uint16_t addr, uint8_t val, void *p) if (!(adgold->adgold_mma_regs[1][0x9] & 1)) adgold->adgold_mma.voice_count[1] = adgold->adgold_mma.voice_latch[1]; -// pclog("adgold start! FIFO fill %i %i %i %02X\n", (adgold->adgold_mma_fifo_end[1] - adgold->adgold_mma_fifo_start[1]) & 255, adgold->adgold_mma_fifo_end[1], adgold->adgold_mma_fifo_start[1], adgold->adgold_mma_regs[1][0xc]); if (adgold->adgold_mma_regs[1][0xc] & 1) { while (((adgold->adgold_mma_fifo_end[1] - adgold->adgold_mma_fifo_start[1]) & 255) < 128) @@ -421,7 +413,6 @@ void adgold_write(uint16_t addr, uint8_t val, void *p) adgold_getsamp_dma(adgold, 1); } } -// pclog("adgold end\n"); } adgold->adgold_mma_enable[1] = val & 0x01; break; @@ -514,7 +505,6 @@ uint8_t adgold_read(uint16_t addr, void *p) temp = adgold->adgold_mma_regs[1][adgold->adgold_mma_addr]; break; } -// if (addr > 0x389) pclog("adgold_read : addr %04X %02X\n", addr, temp); return temp; } @@ -570,7 +560,6 @@ void adgold_mma_poll(adgold_t *adgold, int channel) } if (((adgold->adgold_mma_fifo_end[channel] - adgold->adgold_mma_fifo_start[channel]) & 255) < adgold->adgold_mma_intpos[channel] && !(adgold->adgold_mma_status & 0x01)) { -// pclog("adgold_mma_poll - IRQ! %i\n", channel); adgold->adgold_mma_status |= 1 << channel; adgold_update_irq_status(adgold); } @@ -594,7 +583,6 @@ void adgold_timer_poll(void *p) if (!adgold->adgold_mma.timer0_count) { adgold->adgold_mma.timer0_count = adgold->adgold_mma.timer0_latch; -// pclog("Timer 0 interrupt\n"); adgold->adgold_mma_status |= 0x10; adgold_update_irq_status(adgold); } @@ -611,7 +599,6 @@ void adgold_timer_poll(void *p) if (!adgold->adgold_mma.timer1_count) { adgold->adgold_mma.timer1_count = adgold->adgold_mma.timer1_latch; -// pclog("Timer 1 interrupt\n"); adgold->adgold_mma_status |= 0x20; adgold_update_irq_status(adgold); } @@ -622,7 +609,6 @@ void adgold_timer_poll(void *p) if (!adgold->adgold_mma.timer2_count) { adgold->adgold_mma.timer2_count = adgold->adgold_mma.timer2_latch; -// pclog("Timer 2 interrupt\n"); adgold->adgold_mma_status |= 0x40; adgold_update_irq_status(adgold); } @@ -839,13 +825,10 @@ void adgold_close(void *p) static device_config_t adgold_config[] = { { - .name = "surround", - .description = "Surround module", - .type = CONFIG_BINARY, - .default_int = 1 + "surround", "Surround module", CONFIG_BINARY, "", 1 }, { - .type = -1 + "", "", -1 } }; diff --git a/src/sound_emu8k.c b/src/sound_emu8k.c index 6274b8839..1d82385f1 100644 --- a/src/sound_emu8k.c +++ b/src/sound_emu8k.c @@ -7,6 +7,7 @@ #include #include "ibm.h" #include "device.h" +#include "io.h" #include "sound.h" #include "sound_emu8k.h" #include "timer.h" @@ -40,7 +41,7 @@ static int32_t filt_w0[256]; case 2: var = (var & 0x0000ffff) | ((val) << 16); break; \ } -static inline int16_t EMU8K_READ(emu8k_t *emu8k, uint32_t addr) +static __inline int16_t EMU8K_READ(emu8k_t *emu8k, uint16_t addr) { addr &= 0xffffff; if (addr < 0x80000) @@ -52,14 +53,14 @@ static inline int16_t EMU8K_READ(emu8k_t *emu8k, uint32_t addr) return emu8k->ram[addr - 0x200000]; } -static inline int16_t EMU8K_READ_INTERP(emu8k_t *emu8k, uint32_t addr) +static __inline int16_t EMU8K_READ_INTERP(emu8k_t *emu8k, uint16_t addr) { int16_t dat1 = EMU8K_READ(emu8k, addr >> 8); int16_t dat2 = EMU8K_READ(emu8k, (addr >> 8) + 1); return ((dat1 * (0xff - (addr & 0xff))) + (dat2 * (addr & 0xff))) >> 8; } -static inline void EMU8K_WRITE(emu8k_t *emu8k, uint32_t addr, uint16_t val) +static __inline void EMU8K_WRITE(emu8k_t *emu8k, uint16_t addr, uint16_t val) { addr &= 0xffffff; if (emu8k->ram && addr >= 0x200000 && addr < emu8k->ram_end_addr) @@ -68,10 +69,10 @@ static inline void EMU8K_WRITE(emu8k_t *emu8k, uint32_t addr, uint16_t val) static int ff = 0; static int voice_count = 0; -uint16_t emu8k_inw(uint32_t addr, void *p) +uint16_t emu8k_inw(uint16_t addr, void *p) { emu8k_t *emu8k = (emu8k_t *)p; - uint16_t ret; + uint16_t ret = 0xffff; /* pclog("emu8k_inw %04X reg=%i voice=%i\n", addr, emu8k->cur_reg, emu8k->cur_voice);*/ addr -= 0x220; @@ -114,7 +115,6 @@ uint16_t emu8k_inw(uint32_t addr, void *p) { case 0: { - uint32_t val = (emu8k->voice[emu8k->cur_voice].ccca & 0xff000000) | (emu8k->voice[emu8k->cur_voice].addr >> 8); READ16(addr, emu8k->voice[emu8k->cur_voice].ccca); return ret; } @@ -170,7 +170,6 @@ uint16_t emu8k_inw(uint32_t addr, void *p) { case 0: { - uint32_t val = (emu8k->voice[emu8k->cur_voice].ccca & 0xff000000) | (emu8k->voice[emu8k->cur_voice].addr >> 8); READ16(addr, emu8k->voice[emu8k->cur_voice].ccca); return ret; } @@ -254,13 +253,12 @@ uint16_t emu8k_inw(uint32_t addr, void *p) return 0xffff; } -void emu8k_outw(uint32_t addr, uint16_t val, void *p) +void emu8k_outw(uint16_t addr, uint16_t val, void *p) { emu8k_t *emu8k = (emu8k_t *)p; emu8k_update(emu8k); /* pclog("emu8k_outw : addr=%08X reg=%i voice=%i val=%04X\n", addr, emu8k->cur_reg, emu8k->cur_voice, val);*/ -//emu8k_outw : addr=00000A22 reg=3 voice=21 val=0265 addr -= 0x220; switch (addr & 0xc02) { @@ -487,14 +485,14 @@ void emu8k_outw(uint32_t addr, uint16_t val, void *p) } } -uint8_t emu8k_inb(uint32_t addr, void *p) +uint8_t emu8k_inb(uint16_t addr, void *p) { if (addr & 1) return emu8k_inw(addr & ~1, p) >> 1; return emu8k_inw(addr, p) & 0xff; } -void emu8k_outb(uint32_t addr, uint8_t val, void *p) +void emu8k_outb(uint16_t addr, uint8_t val, void *p) { if (addr & 1) emu8k_outw(addr & ~1, val << 8, p); @@ -504,13 +502,13 @@ void emu8k_outb(uint32_t addr, uint8_t val, void *p) void emu8k_update(emu8k_t *emu8k) { + int32_t *buf; + int pos; + int c; + int new_pos = (sound_pos_global * 44100) / 48000; if (emu8k->pos < new_pos) { - int32_t *buf; - int pos; - int c; - int32_t out_l = 0, out_r = 0; buf = &emu8k->buffer[emu8k->pos*2]; @@ -526,10 +524,7 @@ void emu8k_update(emu8k_t *emu8k) int32_t voice_l, voice_r; int32_t dat; int lfo1_vibrato, lfo2_vibrato; - int tremolo; - tremolo = ((lfotable[(emu8k->voice[c].lfo1_count >> 8) & 4095] * emu8k->voice[c].lfo1_trem) * 4) >> 12; - if (freqtable[emu8k->voice[c].pitch] >> 32) dat = EMU8K_READ(emu8k, emu8k->voice[c].addr >> 32); else diff --git a/src/sound_gus.c b/src/sound_gus.c index 7158c7203..34b0416e4 100644 --- a/src/sound_gus.c +++ b/src/sound_gus.c @@ -93,28 +93,23 @@ void pollgusirqs(gus_t *gus) { if (gus->waveirqs[c]) { -// gus->waveirqs[c]=0; gus->irqstatus2=0x60|c; if (gus->rampirqs[c]) gus->irqstatus2 |= 0x80; gus->irqstatus|=0x20; -// printf("Voice IRQ %i %02X %i\n",c,gus->irqstatus2,ins); if (gus->irq != -1) picint(1 << gus->irq); return; } if (gus->rampirqs[c]) { -// gus->rampirqs[c]=0; gus->irqstatus2=0xA0|c; gus->irqstatus|=0x40; -// printf("Ramp IRQ %i %02X %i\n",c,gus->irqstatus2,ins); if (gus->irq != -1) picint(1 << gus->irq); return; } } gus->irqstatus2=0xE0; -// gus->irqstatus&=~0x20; if (!gus->irqstatus && gus->irq != -1) picintc(1 << gus->irq); } @@ -164,7 +159,6 @@ void gus_midi_update_int_status(gus_t *gus) if ((gus->midi_status & MIDI_INT_MASTER) && (gus->irq_midi != -1)) { -// pclog("Take MIDI IRQ\n"); picint(1 << gus->irq_midi); } } @@ -174,7 +168,6 @@ void writegus(uint16_t addr, uint8_t val, void *p) gus_t *gus = (gus_t *)p; int c, d; int old; -// pclog("Write GUS %04X %02X %04X:%04X\n",addr,val,CS,pc); if (gus->latch_enable && addr != 0x24b) gus->latch_enable = 0; switch (addr) @@ -188,7 +181,6 @@ void writegus(uint16_t addr, uint8_t val, void *p) else if ((old & 3) == 3) { gus->midi_status |= MIDI_INT_TRANSMIT; -// pclog("MIDI_INT_TRANSMIT\n"); } gus_midi_update_int_status(gus); break; @@ -210,11 +202,9 @@ void writegus(uint16_t addr, uint8_t val, void *p) gus->global=val; break; case 0x344: /*Global low*/ -// if (gus->global!=0x43 && gus->global!=0x44) printf("Writing register %02X %02X %02X %i\n",gus->global,gus->voice,val, ins); switch (gus->global) { case 0: /*Voice control*/ -// if (val&1 && !(gus->ctrl[gus->voice]&1)) printf("Voice on %i\n",gus->voice); gus->ctrl[gus->voice]=val; break; case 1: /*Frequency control*/ @@ -223,41 +213,32 @@ void writegus(uint16_t addr, uint8_t val, void *p) case 2: /*Start addr high*/ gus->startx[gus->voice]=(gus->startx[gus->voice]&0xF807F)|(val<<7); gus->start[gus->voice]=(gus->start[gus->voice]&0x1F00FFFF)|(val<<16); -// printf("Write %i start %08X %08X\n",gus->voice,gus->start[gus->voice],gus->startx[gus->voice]); break; case 3: /*Start addr low*/ gus->start[gus->voice]=(gus->start[gus->voice]&0x1FFFFF00)|val; -// printf("Write %i start %08X %08X\n",gus->voice,gus->start[gus->voice],gus->startx[gus->voice]); break; case 4: /*End addr high*/ gus->endx[gus->voice]=(gus->endx[gus->voice]&0xF807F)|(val<<7); gus->end[gus->voice]=(gus->end[gus->voice]&0x1F00FFFF)|(val<<16); -// printf("Write %i end %08X %08X\n",gus->voice,gus->end[gus->voice],gus->endx[gus->voice]); break; case 5: /*End addr low*/ gus->end[gus->voice]=(gus->end[gus->voice]&0x1FFFFF00)|val; -// printf("Write %i end %08X %08X\n",gus->voice,gus->end[gus->voice],gus->endx[gus->voice]); break; case 0x6: /*Ramp frequency*/ gus->rfreq[gus->voice] = (int)( (double)((val & 63)*512)/(double)(1 << (3*(val >> 6)))); -// printf("RFREQ %02X %i %i %f\n",val,gus->voice,gus->rfreq[gus->voice],(double)(val & 63)/(double)(1 << (3*(val >> 6)))); break; case 0x9: /*Current volume*/ gus->curvol[gus->voice] = gus->rcur[gus->voice] = (gus->rcur[gus->voice] & ~(0xff << 6)) | (val << 6); -// printf("Vol %i is %04X\n",gus->voice,gus->curvol[gus->voice]); break; case 0xA: /*Current addr high*/ gus->cur[gus->voice]=(gus->cur[gus->voice]&0x1F00FFFF)|(val<<16); gus->curx[gus->voice]=(gus->curx[gus->voice]&0xF807F00)|((val<<7)<<8); -// gus->cur[gus->voice]=(gus->cur[gus->voice]&0x0F807F00)|((val<<7)<<8); -// printf("Write %i cur %08X\n",gus->voice,gus->cur[gus->voice],gus->curx[gus->voice]); break; case 0xB: /*Current addr low*/ gus->cur[gus->voice]=(gus->cur[gus->voice]&0x1FFFFF00)|val; -// printf("Write %i cur %08X\n",gus->voice,gus->cur[gus->voice],gus->curx[gus->voice]); break; case 0x42: /*DMA address low*/ @@ -268,21 +249,16 @@ gus->curx[gus->voice]=(gus->curx[gus->voice]&0xF807F00)|((val<<7)<<8); gus->addr=(gus->addr&0xFFF00)|val; break; case 0x45: /*Timer control*/ -// printf("Timer control %02X\n",val); gus->tctrl=val; break; } break; case 0x345: /*Global high*/ -// if (gus->global!=0x43 && gus->global!=0x44) printf("HWriting register %02X %02X %02X %04X:%04X %i %X\n",gus->global,gus->voice,val,CS,pc, ins, gus->rcur[1] >> 10); switch (gus->global) { case 0: /*Voice control*/ if (!(val&1) && gus->ctrl[gus->voice]&1) { -// printf("Voice on %i - start %05X end %05X freq %04X\n",gus->voice,gus->start[gus->voice],gus->end[gus->voice],gus->freq[gus->voice]); -// if (val&0x40) gus->cur[gus->voice]=gus->end[gus->voice]<<8; -// else gus->cur[gus->voice]=gus->start[gus->voice]<<8; } gus->ctrl[gus->voice] = val & 0x7f; @@ -298,52 +274,40 @@ gus->curx[gus->voice]=(gus->curx[gus->voice]&0xF807F00)|((val<<7)<<8); case 2: /*Start addr high*/ gus->startx[gus->voice]=(gus->startx[gus->voice]&0x07FFF)|(val<<15); gus->start[gus->voice]=(gus->start[gus->voice]&0x00FFFFFF)|((val&0x1F)<<24); -// printf("Write %i start %08X %08X %02X\n",gus->voice,gus->start[gus->voice],gus->startx[gus->voice],val); break; case 3: /*Start addr low*/ gus->startx[gus->voice]=(gus->startx[gus->voice]&0xFFF80)|(val&0x7F); gus->start[gus->voice]=(gus->start[gus->voice]&0x1FFF00FF)|(val<<8); -// printf("Write %i start %08X %08X\n",gus->voice,gus->start[gus->voice],gus->startx[gus->voice]); break; case 4: /*End addr high*/ gus->endx[gus->voice]=(gus->endx[gus->voice]&0x07FFF)|(val<<15); gus->end[gus->voice]=(gus->end[gus->voice]&0x00FFFFFF)|((val&0x1F)<<24); -// printf("Write %i end %08X %08X %02X\n",gus->voice,gus->end[gus->voice],gus->endx[gus->voice],val); break; case 5: /*End addr low*/ gus->endx[gus->voice]=(gus->endx[gus->voice]&0xFFF80)|(val&0x7F); gus->end[gus->voice]=(gus->end[gus->voice]&0x1FFF00FF)|(val<<8); -// printf("Write %i end %08X %08X\n",gus->voice,gus->end[gus->voice],gus->endx[gus->voice]); break; case 0x6: /*Ramp frequency*/ gus->rfreq[gus->voice] = (int)( (double)((val & 63) * (1 << 10))/(double)(1 << (3 * (val >> 6)))); -// pclog("Ramp freq %02X %i %i %f %i\n", val, gus->voice, gus->rfreq[gus->voice], (double)(val & 63)/(double)(1 << (3*(val >> 6))), ins); break; case 0x7: /*Ramp start*/ gus->rstart[gus->voice] = val << 14; -// pclog("Ramp start %04X\n", gus->rstart[gus->voice] >> 10); break; case 0x8: /*Ramp end*/ gus->rend[gus->voice] = val << 14; -// pclog("Ramp end %04X\n", gus->rend[gus->voice] >> 10); break; case 0x9: /*Current volume*/ gus->curvol[gus->voice] = gus->rcur[gus->voice] = (gus->rcur[gus->voice] & ~(0xff << 14)) | (val << 14); -// printf("Vol %i is %04X\n",gus->voice,gus->curvol[gus->voice]); break; case 0xA: /*Current addr high*/ gus->cur[gus->voice]=(gus->cur[gus->voice]&0x00FFFFFF)|((val&0x1F)<<24); gus->curx[gus->voice]=(gus->curx[gus->voice]&0x07FFF00)|((val<<15)<<8); -// printf("Write %i cur %08X %08X %02X\n",gus->voice,gus->cur[gus->voice],gus->curx[gus->voice],val); -// gus->cur[gus->voice]=(gus->cur[gus->voice]&0x007FFF00)|((val<<15)<<8); break; case 0xB: /*Current addr low*/ gus->cur[gus->voice]=(gus->cur[gus->voice]&0x1FFF00FF)|(val<<8); gus->curx[gus->voice]=(gus->curx[gus->voice]&0xFFF8000)|((val&0x7F)<<8); -// gus->cur[gus->voice]=(gus->cur[gus->voice]&0x0FFF8000)|((val&0x7F)<<8); -// printf("Write %i cur %08X %08X\n",gus->voice,gus->cur[gus->voice],gus->curx[gus->voice]); break; case 0xC: /*Pan*/ gus->pan_l[gus->voice] = 15 - (val & 0xf); @@ -355,7 +319,6 @@ gus->curx[gus->voice]=(gus->curx[gus->voice]&0xFFF8000)|((val&0x7F)<<8); gus->rampirqs[gus->voice] = ((val & 0xa0) == 0xa0) ? 1 : 0; if (gus->rampirqs[gus->voice] != old) pollgusirqs(gus); -// printf("Ramp control %02i %02X %02X %i\n",gus->voice,val,gus->rampirqs[gus->voice],ins); break; case 0xE: @@ -363,7 +326,6 @@ gus->curx[gus->voice]=(gus->curx[gus->voice]&0xFFF8000)|((val&0x7F)<<8); if (gus->voices>32) gus->voices=32; if (gus->voices<14) gus->voices=14; gus->global=val; -// printf("GUS voices %i\n",val&31); if (gus->voices < 14) gus->samp_latch = (int)(TIMER_USEC * (1000000.0 / 44100.0)); else @@ -373,7 +335,6 @@ gus->curx[gus->voice]=(gus->curx[gus->voice]&0xFFF8000)|((val&0x7F)<<8); case 0x41: /*DMA*/ if (val&1 && gus->dma != -1) { -// printf("DMA start! %05X %02X\n",gus->dmaaddr,val); if (val & 2) { c=0; @@ -391,7 +352,6 @@ gus->curx[gus->voice]=(gus->curx[gus->voice]&0xFFF8000)|((val&0x7F)<<8); if (dma_result & DMA_OVER) break; } -// printf("GUS->MEM Transferred %i bytes\n",c); gus->dmactrl=val&~0x40; if (val&0x20) gus->irqnext=1; } @@ -411,11 +371,9 @@ gus->curx[gus->voice]=(gus->curx[gus->voice]&0xFFF8000)|((val&0x7F)<<8); if (d & DMA_OVER) break; } -// printf("MEM->GUS Transferred %i bytes\n",c); gus->dmactrl=val&~0x40; if (val&0x20) gus->irqnext=1; } -// exit(-1); } break; @@ -442,24 +400,16 @@ gus->curx[gus->voice]=(gus->curx[gus->voice]&0xFFF8000)|((val&0x7F)<<8); gus->ad_status &= ~0x01; nmi = 0; } -// printf("Timer control %02X\n",val); -/* if ((val&4) && !(gus->tctrl&4)) - { - gus->t1=gus->t1l; - gus->t1on=1; - }*/ gus->tctrl=val; gus->sb_ctrl = val; break; case 0x46: /*Timer 1*/ gus->t1 = gus->t1l = val; gus->t1on = 1; -// printf("GUS timer 1 %i\n",val); break; case 0x47: /*Timer 2*/ gus->t2 = gus->t2l = val; gus->t2on = 1; -// printf("GUS timer 2 %i\n",val); break; case 0x4c: /*Reset*/ @@ -469,12 +419,10 @@ gus->curx[gus->voice]=(gus->curx[gus->voice]&0xFFF8000)|((val&0x7F)<<8); break; case 0x347: /*DRAM access*/ gus->ram[gus->addr]=val; -// pclog("GUS RAM write %05X %02X\n",gus->addr,val); gus->addr&=0xFFFFF; break; case 0x248: case 0x388: gus->adcommand = val; -// pclog("Setting ad command %02X %02X %p\n", val, gus->adcommand, &gus->adcommand); break; case 0x389: @@ -541,7 +489,6 @@ gus->curx[gus->voice]=(gus->curx[gus->voice]&0xFFF8000)|((val&0x7F)<<8); gus->sb_nmi = val & 0x80; } gus->latch_enable = 0; -// pclog("IRQ %i DMA %i\n", gus->irq, gus->dma); break; case 1: gus->gp1 = val; @@ -601,12 +548,10 @@ uint8_t readgus(uint16_t addr, void *p) { gus_t *gus = (gus_t *)p; uint8_t val; -// /*if (addr!=0x246) */printf("Read GUS %04X %04X(%06X):%04X %02X\n",addr,CS,cs,pc,gus->global); switch (addr) { case 0x340: /*MIDI status*/ val = gus->midi_status; -// pclog("Read MIDI status %02X\n", val); break; case 0x341: /*MIDI data*/ @@ -620,14 +565,12 @@ uint8_t readgus(uint16_t addr, void *p) val = gus->irqstatus & ~0x10; if (gus->ad_status & 0x19) val |= 0x10; -// pclog("Read IRQ status %02X\n", val); return val; case 0x24F: return 0; case 0x342: return gus->voice; case 0x343: return gus->global; case 0x344: /*Global low*/ -// /*if (gus->global!=0x43 && gus->global!=0x44) */printf("Reading register %02X %02X\n",gus->global,gus->voice); switch (gus->global) { case 0x82: /*Start addr high*/ @@ -644,7 +587,6 @@ uint8_t readgus(uint16_t addr, void *p) case 0x8F: /*IRQ status*/ val=gus->irqstatus2; -// pclog("Read IRQ status - %02X\n",val); gus->rampirqs[gus->irqstatus2&0x1F]=0; gus->waveirqs[gus->irqstatus2&0x1F]=0; pollgusirqs(gus); @@ -656,17 +598,12 @@ uint8_t readgus(uint16_t addr, void *p) case 0x0c: case 0x0d: case 0x0e: case 0x0f: val = 0xff; break; - -// default: -// fatal("Bad GUS global low read %02X\n",gus->global); } break; case 0x345: /*Global high*/ -// /*if (gus->global!=0x43 && gus->global!=0x44) */printf("HReading register %02X %02X\n",gus->global,gus->voice); switch (gus->global) { case 0x80: /*Voice control*/ -// pclog("Read voice control %02i %02X\n", gus->voice, gus->ctrl[gus->voice]|(gus->waveirqs[gus->voice]?0x80:0)); return gus->ctrl[gus->voice]|(gus->waveirqs[gus->voice]?0x80:0); case 0x82: /*Start addr high*/ @@ -675,7 +612,6 @@ uint8_t readgus(uint16_t addr, void *p) return gus->start[gus->voice]>>8; case 0x89: /*Current volume*/ -// pclog("Read current volume %i\n", gus->rcur[gus->voice] >> 14); return gus->rcur[gus->voice]>>14; case 0x8A: /*Current addr high*/ @@ -687,16 +623,13 @@ uint8_t readgus(uint16_t addr, void *p) return gus->pan_r[gus->voice]; case 0x8D: -// pclog("Read ramp control %02X %04X %08X %08X %08X\n",gus->rctrl[gus->voice]|(gus->rampirqs[gus->voice]?0x80:0),gus->rcur[gus->voice] >> 14,gus->rfreq[gus->voice],gus->rstart[gus->voice],gus->rend[gus->voice]); return gus->rctrl[gus->voice]|(gus->rampirqs[gus->voice]?0x80:0); case 0x8F: /*IRQ status*/ -// pclog("Read IRQ 1\n"); val=gus->irqstatus2; gus->rampirqs[gus->irqstatus2&0x1F]=0; gus->waveirqs[gus->irqstatus2&0x1F]=0; pollgusirqs(gus); -// pclog("Read IRQ status - %02X %i %i\n",val, gus->waveirqs[gus->irqstatus2&0x1F], gus->rampirqs[gus->irqstatus2&0x1F]); return val; case 0x41: /*DMA control*/ @@ -714,15 +647,11 @@ uint8_t readgus(uint16_t addr, void *p) case 0x0c: case 0x0d: case 0x0e: case 0x0f: val = 0xff; break; - -// default: -// fatal("Bad GUS global high read %02X\n",gus->global); } break; case 0x346: return 0xff; case 0x347: /*DRAM access*/ val=gus->ram[gus->addr]; -// pclog("GUS RAM read %05X %02X\n",gus->addr,val); gus->addr&=0xFFFFF; return val; case 0x349: return 0; @@ -753,19 +682,9 @@ uint8_t readgus(uint16_t addr, void *p) gus->sb_2xc &= 0x80; break; case 0x24e: -/* gus->ad_status |= 0x10; - if (gus->reg_ctrl & 0x80) - { - gus->reg_ctrl_r |= 0x80; - if (gus->sb_nmi) - nmi = 1; - else - picint(1 << gus->irq); - }*/ return gus->sb_2xe; case 0x248: case 0x388: -// pclog("Read ad_status %02X\n", gus->ad_status); if (gus->tctrl & GUS_TIMER_CTRL_AUTO) val = gus->sb_2xa; else @@ -785,12 +704,9 @@ uint8_t readgus(uint16_t addr, void *p) case 0x24A: val = gus->adcommand; -// pclog("Read ad command %02X %02X %p\n", gus->adcommand, val, &gus->adcommand); break; } -// printf("Bad GUS read %04X! %02X\n",addr,gus->global); -// exit(-1); return val; } @@ -799,13 +715,11 @@ void gus_poll_timer_1(void *p) gus_t *gus = (gus_t *)p; gus->timer_1 += (TIMER_USEC * 80); -// pclog("gus_poll_timer_1 %i %i %i %i %02X\n", gustime, gus->t1on, gus->t1, gus->t1l, gus->tctrl); if (gus->t1on) { gus->t1++; if (gus->t1 > 0xFF) { -// gus->t1on=0; gus->t1=gus->t1l; gus->ad_status |= 0x40; if (gus->tctrl&4) @@ -814,13 +728,11 @@ void gus_poll_timer_1(void *p) picint(1 << gus->irq); gus->ad_status |= 0x04; gus->irqstatus |= 0x04; -// pclog("GUS T1 IRQ!\n"); } } } if (gus->irqnext) { -// pclog("Take IRQ\n"); gus->irqnext=0; gus->irqstatus|=0x80; if (gus->irq != -1) @@ -834,13 +746,11 @@ void gus_poll_timer_2(void *p) gus_t *gus = (gus_t *)p; gus->timer_2 += (TIMER_USEC * 320); -// pclog("pollgus2 %i %i %i %i %02X\n", gustime, gus->t2on, gus->t2, gus->t2l, gus->tctrl); if (gus->t2on) { gus->t2++; if (gus->t2 > 0xFF) { -// gus->t2on=0; gus->t2=gus->t2l; gus->ad_status |= 0x20; if (gus->tctrl&8) @@ -849,13 +759,11 @@ void gus_poll_timer_2(void *p) picint(1 << gus->irq); gus->ad_status |= 0x02; gus->irqstatus |= 0x08; -// pclog("GUS T2 IRQ!\n"); } } } if (gus->irqnext) { -// pclog("Take IRQ\n"); gus->irqnext=0; gus->irqstatus|=0x80; if (gus->irq != -1) @@ -899,7 +807,6 @@ void gus_poll_wave(void *p) if ((gus->reset & 3) != 3) return; -//pclog("gus_poll_wave\n"); for (d=0;d<32;d++) { if (!(gus->ctrl[d] & 3)) @@ -929,10 +836,8 @@ void gus_poll_wave(void *p) v = (int16_t)(int8_t)((gus->ram[(gus->cur[d] >> 9) & 0xFFFFF] ^ 0x80) - 0x80); } -// pclog("Voice %i : %04X %05X %04X ", d, v, gus->cur[d] >> 9, gus->rcur[d] >> 10); if ((gus->rcur[d] >> 14) > 4095) v = (int16_t)(float)(v) * 24.0 * vol16bit[4095]; else v = (int16_t)(float)(v) * 24.0 * vol16bit[(gus->rcur[d]>>10) & 4095]; -// pclog("%f %04X\n", vol16bit[(gus->rcur[d]>>10) & 4095], v); gus->out_l += (v * gus->pan_l[d]) / 7; gus->out_r += (v * gus->pan_r[d]) / 7; @@ -959,7 +864,6 @@ void gus_poll_wave(void *p) { gus->waveirqs[d] = 1; update_irqs = 1; -// pclog("Causing wave IRQ %02X %i\n", gus->ctrl[d], d); } } } @@ -986,7 +890,6 @@ void gus_poll_wave(void *p) { gus->waveirqs[d] = 1; update_irqs = 1; -// pclog("Causing wave IRQ %02X %i\n", gus->ctrl[d], d); } } } @@ -1014,14 +917,12 @@ void gus_poll_wave(void *p) { gus->rampirqs[d] = 1; update_irqs = 1; -// pclog("Causing ramp IRQ %02X %i\n",gus->rctrl[d], d); } } } else { gus->rcur[d] += gus->rfreq[d]; -// if (d == 1) printf("RCUR+ %i %08X %08X %08X %08X\n",d,gus->rfreq[d],gus->rcur[d],gus->rstart[d],gus->rend[d]); if (gus->rcur[d] >= gus->rend[d]) { int diff = gus->rcur[d] - gus->rend[d]; @@ -1040,7 +941,6 @@ void gus_poll_wave(void *p) { gus->rampirqs[d] = 1; update_irqs = 1; -// pclog("Causing ramp IRQ %02X %i\n",gus->rctrl[d], d); } } } @@ -1087,7 +987,7 @@ void *gus_init() } for (c=4095;c>=0;c--) { - vol16bit[c]=out;//(float)c/4095.0;//out; + vol16bit[c]=out; out/=1.002709201; /* 0.0235 dB Steps */ } diff --git a/src/sound_mpu401_uart.c b/src/sound_mpu401_uart.c index 3ff22de61..5d70b5427 100644 --- a/src/sound_mpu401_uart.c +++ b/src/sound_mpu401_uart.c @@ -1,5 +1,6 @@ #include "ibm.h" #include "io.h" +#include "plat-midi.h" #include "sound_mpu401_uart.h" enum diff --git a/src/sound_pas16.c b/src/sound_pas16.c index cc5a23538..69c245f5e 100644 --- a/src/sound_pas16.c +++ b/src/sound_pas16.c @@ -149,7 +149,7 @@ static int pas16_sb_dmas[8] = {0, 1, 2, 3}; enum { PAS16_INT_SAMP = 0x04, - PAS16_INT_PCM = 0x08, + PAS16_INT_PCM = 0x08 }; enum @@ -260,6 +260,10 @@ static uint8_t pas16_in(uint16_t port, void *p) case 0xff8b: /*Master mode read*/ temp = 0x20 | 0x10 | 0x01; /*AT bus, XT/AT timing*/ break; + + default: + temp = 0xff; + break; } /* if (port != 0x388 && port != 0x389 && port != 0xb8b) */pclog("pas16_in : port %04X return %02X %04X:%04X\n", port, temp, CS,cpu_state.pc); /* if (CS == 0x1FF4 && pc == 0x0585) @@ -289,7 +293,6 @@ static void pas16_out(uint16_t port, uint8_t val, void *p) case 0xb89: pas16->irq_stat &= ~val; -// pas16_update_irqs(); break; case 0xb8a: @@ -299,7 +302,6 @@ static void pas16_out(uint16_t port, uint8_t val, void *p) case 0xb8b: pas16->irq_ena = val; -// pas16_update_irqs(); break; case 0xf88: @@ -490,9 +492,8 @@ static void pas16_pit_out(uint16_t port, uint8_t val, void *p) static uint8_t pas16_pit_in(uint16_t port, void *p) { pas16_t *pas16 = (pas16_t *)p; - uint8_t temp; + uint8_t temp = 0xff; int t = port & 3; -// printf("Read PIT %04X ",addr); switch (port & 3) { case 0: case 1: case 2: /*Timers*/ @@ -538,7 +539,6 @@ static uint8_t pas16_pit_in(uint16_t port, void *p) temp = pas16->pit.ctrl; break; } -// printf("%02X %i %i %04X:%04X\n",temp,pit.rm[addr&3],pit.wp,cs>>4,pc); return temp; } @@ -552,8 +552,6 @@ static void pas16_pcm_poll(void *p) pas16_t *pas16 = (pas16_t *)p; pas16_update(pas16); -// if (pas16->pcm_ctrl & PAS16_PCM_ENA) -// pclog("pas16_pcm_poll : poll %i %i ", pas16->pit.c[0], pas16->pit.l[0]); if (pas16->pit.m[0] & 2) { if (pas16->pit.l[0]) @@ -566,13 +564,10 @@ static void pas16_pcm_poll(void *p) pas16->pit.c[0] = -1; pas16->pit.enable[0] = 0; } -// if (pas16->pcm_ctrl & PAS16_PCM_ENA) -// pclog(" %i\n", pas16->pit.c[0]); pas16->irq_stat |= PAS16_INT_SAMP; if (pas16->irq_ena & PAS16_INT_SAMP) picint(1 << pas16->irq); -// pas16_update_irqs(); /*Update sample rate counter*/ if (pas16->pit.enable[1]) @@ -602,11 +597,6 @@ static void pas16_pcm_poll(void *p) pas16->stereo_lr = !pas16->stereo_lr; } -// pclog("pas16_pcm_poll : %04X %i\n", temp, pas16->stereo_lr); -// pclog("pas16_pcm_poll : %i %02X %i\n", pas16->pit.c[1], temp, pas16->pit.c[0]); -/* if (!pas16_pcm) - pas16_pcm=fopen("pas16->pcm", "wb"); - putc(temp, pas16_pcm);*/ } if (pas16->sys_conf_2 & PAS16_SC2_16BIT) pas16->pit.c[1] -= 2; @@ -614,8 +604,6 @@ static void pas16_pcm_poll(void *p) pas16->pit.c[1]--; if (pas16->pit.c[1] == 0) { -// if (pas16->pcm_ctrl & PAS16_PCM_ENA) -// pclog("pas16_pcm_poll : buffer over\n"); if (pas16->pit.m[1] & 2) { if (pas16->pit.l[1]) diff --git a/src/sound_ps1.c b/src/sound_ps1.c index 4f42cd4d8..6c2498e7e 100644 --- a/src/sound_ps1.c +++ b/src/sound_ps1.c @@ -2,6 +2,7 @@ #include "ibm.h" #include "device.h" #include "io.h" +#include "pic.h" #include "sound.h" #include "sound_ps1.h" #include "sound_sn76489.h" @@ -36,8 +37,6 @@ static uint8_t ps1_audio_read(uint16_t port, void *p) { ps1_audio_t *ps1 = (ps1_audio_t *)p; uint8_t temp; - -// pclog("ps1_audio_read %04x %04x:%04x\n", port, CS, pc); switch (port & 7) { @@ -52,7 +51,6 @@ static uint8_t ps1_audio_read(uint16_t port, void *p) temp |= 0x08; /*FIFO full*/ if (ps1->fifo_read_idx == ps1->fifo_write_idx) temp |= 0x04; /*FIFO empty*/ -// pclog("Return status %02x\n", temp); return temp; case 3: /*FIFO timer*/ /*PS/1 technical reference says this should return the current value, @@ -67,13 +65,10 @@ static uint8_t ps1_audio_read(uint16_t port, void *p) static void ps1_audio_write(uint16_t port, uint8_t val, void *p) { ps1_audio_t *ps1 = (ps1_audio_t *)p; - -// pclog("ps1_audio_write %04x %02x\n", port, val); - + switch (port & 7) { case 0: /*DAC output*/ -// pclog("DAC write %08x %08x %i\n", ps1->fifo_write_idx, ps1->fifo_read_idx, ps1->fifo_write_idx - ps1->fifo_read_idx); if ((ps1->fifo_write_idx - ps1->fifo_read_idx) < 2048) { ps1->fifo[ps1->fifo_write_idx & 2047] = val; @@ -114,10 +109,8 @@ static void ps1_audio_callback(void *p) ps1->dac_val = ps1->fifo[ps1->fifo_read_idx & 2047]; ps1->fifo_read_idx++; } -// pclog("ps1_callback %08x %08x %08x\n", ps1->fifo_write_idx, ps1->fifo_read_idx, ps1->fifo_threshold); if ((ps1->fifo_write_idx - ps1->fifo_read_idx) == ps1->fifo_threshold) { -// pclog("FIFO almost empty\n"); ps1->status |= 0x02; /*FIFO almost empty*/ } ps1->status |= 0x10; /*ADC data ready*/ diff --git a/src/sound_pssj.c b/src/sound_pssj.c index 0e4963d5d..bda1442fd 100644 --- a/src/sound_pssj.c +++ b/src/sound_pssj.c @@ -41,7 +41,6 @@ static void pssj_write(uint16_t port, uint8_t val, void *p) { pssj_t *pssj = (pssj_t *)p; -// pclog("pssj_write: port=%04x val=%02x\n", port, val); switch (port & 3) { case 0: @@ -77,7 +76,6 @@ static uint8_t pssj_read(uint16_t port, void *p) { pssj_t *pssj = (pssj_t *)p; -// pclog("pssj_read: port=%04x %02x\n", port, (pssj->ctrl & ~0x88) | (pssj->irq ? 8 : 0)); switch (port & 3) { case 0: @@ -99,7 +97,11 @@ static uint8_t pssj_read(uint16_t port, void *p) return pssj->freq & 0xff; case 3: return (pssj->freq >> 8) | (pssj->amplitude << 4); + default: + return 0xff; } + + return 0xff; } static void pssj_update(pssj_t *pssj) @@ -123,7 +125,6 @@ static void pssj_callback(void *p) if (data != DMA_NODATA) { pssj->dac_val = data & 0xff; -// pclog("DAC_val=%02x\n", data); } } else @@ -133,7 +134,6 @@ static void pssj_callback(void *p) if ((data & DMA_OVER) && data != DMA_NODATA) { -// pclog("Check IRQ %i %02x\n", pssj->irq, pssj->ctrl); if (pssj->ctrl & 0x08) { pssj->irq = 1; diff --git a/src/sound_sb.c b/src/sound_sb.c index 20baaa547..d29f5028e 100644 --- a/src/sound_sb.c +++ b/src/sound_sb.c @@ -1,6 +1,11 @@ #include #include "ibm.h" #include "device.h" +#include "io.h" +#include "mca.h" +#include "mem.h" +#include "rom.h" +#include "sound.h" #include "sound_emu8k.h" #include "sound_mpu401_uart.h" #include "sound_opl.h" @@ -32,6 +37,8 @@ typedef struct sb_t emu8k_t emu8k; int pos; + + uint8_t pos_regs[8]; } sb_t; static int sb_att[]= @@ -103,7 +110,6 @@ static void sb_get_buffer_opl3(int32_t *buffer, int len, void *p) sb_dsp_update(&sb->dsp); for (c = 0; c < len * 2; c += 2) { - // int c_emu8k = (((c/2) * 44100) / 48000)*2; int32_t out_l, out_r; out_l = ((sb->opl.buffer[c] * mixer->fm_l) >> 16); @@ -226,8 +232,6 @@ void sb_pro_mixer_write(uint16_t addr, uint8_t val, void *p) mixer->treble_l = mixer->treble_r = 8; sound_set_cd_volume(((uint32_t)mixer->master_l * (uint32_t)mixer->cd_l) / 65535, ((uint32_t)mixer->master_r * (uint32_t)mixer->cd_r) / 65535); -// pclog("%02X %02X %02X\n", mixer->regs[0x04], mixer->regs[0x22], mixer->regs[0x26]); -// pclog("Mixer - %04X %04X %04X %04X %04X %04X\n", mixer->master_l, mixer->master_r, mixer->voice_l, mixer->voice_r, mixer->fm_l, mixer->fm_r); if (mixer->index == 0xe) sb_dsp_set_stereo(&sb->dsp, val & 2); } @@ -301,8 +305,6 @@ void sb_16_mixer_write(uint16_t addr, uint8_t val, void *p) mixer->filter = 0; sound_set_cd_volume(((uint32_t)mixer->master_l * (uint32_t)mixer->cd_l) / 65535, ((uint32_t)mixer->master_r * (uint32_t)mixer->cd_r) / 65535); -// pclog("%02X %02X %02X %02X %02X %02X\n", mixer->regs[0x30], mixer->regs[0x31], mixer->regs[0x32], mixer->regs[0x33], mixer->regs[0x34], mixer->regs[0x35]); -// pclog("Mixer - %04X %04X %04X %04X %04X %04X\n", mixer->master_l, mixer->master_r, mixer->voice_l, mixer->voice_r, mixer->fm_l, mixer->fm_r); } } @@ -357,7 +359,6 @@ uint8_t sb_16_mixer_read(uint16_t addr, void *p) temp |= 0x00; break; } - // return 0x22; /*DMA 1 and 5*/ return temp; case 0x82: return ((sb->dsp.sb_irq8) ? 1 : 0) | ((sb->dsp.sb_irq16) ? 2 : 0); @@ -377,6 +378,89 @@ void sb_mixer_init(sb_mixer_t *mixer) sound_set_cd_volume(((uint32_t)mixer->master_l * (uint32_t)mixer->cd_l) / 65535, ((uint32_t)mixer->master_r * (uint32_t)mixer->cd_r) / 65535); } + +static uint16_t sb_mcv_addr[8] = {0x200, 0x210, 0x220, 0x230, 0x240, 0x250, 0x260, 0x270}; + +uint8_t sb_mcv_read(int port, void *p) +{ + sb_t *sb = (sb_t *)p; + + pclog("sb_mcv_read: port=%04x\n", port); + + return sb->pos_regs[port & 7]; +} + +void sb_mcv_write(int port, uint8_t val, void *p) +{ + uint16_t addr; + sb_t *sb = (sb_t *)p; + + if (port < 0x102) + return; + + pclog("sb_mcv_write: port=%04x val=%02x\n", port, val); + + addr = sb_mcv_addr[sb->pos_regs[4] & 7]; + io_removehandler(addr+8, 0x0002, opl2_read, NULL, NULL, opl2_write, NULL, NULL, &sb->opl); + io_removehandler(0x0388, 0x0002, opl2_read, NULL, NULL, opl2_write, NULL, NULL, &sb->opl); + sb_dsp_setaddr(&sb->dsp, 0); + + sb->pos_regs[port & 7] = val; + + if (sb->pos_regs[2] & 1) + { + addr = sb_mcv_addr[sb->pos_regs[4] & 7]; + + io_sethandler(addr+8, 0x0002, opl2_read, NULL, NULL, opl2_write, NULL, NULL, &sb->opl); + io_sethandler(0x0388, 0x0002, opl2_read, NULL, NULL, opl2_write, NULL, NULL, &sb->opl); + sb_dsp_setaddr(&sb->dsp, addr); + } +} + +static int sb_pro_mcv_irqs[4] = {7, 5, 3, 3}; + +uint8_t sb_pro_mcv_read(int port, void *p) +{ + sb_t *sb = (sb_t *)p; + + pclog("sb_pro_mcv_read: port=%04x\n", port); + + return sb->pos_regs[port & 7]; +} + +void sb_pro_mcv_write(int port, uint8_t val, void *p) +{ + uint16_t addr; + sb_t *sb = (sb_t *)p; + + if (port < 0x102) + return; + + pclog("sb_pro_mcv_write: port=%04x val=%02x\n", port, val); + + addr = (sb->pos_regs[2] & 0x20) ? 0x220 : 0x240; + io_removehandler(addr+0, 0x0004, opl3_read, NULL, NULL, opl3_write, NULL, NULL, &sb->opl); + io_removehandler(addr+8, 0x0002, opl3_read, NULL, NULL, opl3_write, NULL, NULL, &sb->opl); + io_removehandler(0x0388, 0x0004, opl3_read, NULL, NULL, opl3_write, NULL, NULL, &sb->opl); + io_removehandler(addr+4, 0x0002, sb_pro_mixer_read, NULL, NULL, sb_pro_mixer_write, NULL, NULL, sb); + sb_dsp_setaddr(&sb->dsp, 0); + + sb->pos_regs[port & 7] = val; + + if (sb->pos_regs[2] & 1) + { + addr = (sb->pos_regs[2] & 0x20) ? 0x220 : 0x240; + + io_sethandler(addr+0, 0x0004, opl3_read, NULL, NULL, opl3_write, NULL, NULL, &sb->opl); + io_sethandler(addr+8, 0x0002, opl3_read, NULL, NULL, opl3_write, NULL, NULL, &sb->opl); + io_sethandler(0x0388, 0x0004, opl3_read, NULL, NULL, opl3_write, NULL, NULL, &sb->opl); + io_sethandler(addr+4, 0x0002, sb_pro_mixer_read, NULL, NULL, sb_pro_mixer_write, NULL, NULL, sb); + + sb_dsp_setaddr(&sb->dsp, addr); + } + sb_dsp_setirq(&sb->dsp, sb_pro_mcv_irqs[(sb->pos_regs[5] >> 4) & 3]); + sb_dsp_setdma8(&sb->dsp, sb->pos_regs[4] & 3); +} void *sb_1_init() { @@ -412,6 +496,24 @@ void *sb_15_init() sound_add_handler(sb_get_buffer_opl2, sb); return sb; } + +void *sb_mcv_init() +{ + sb_t *sb = malloc(sizeof(sb_t)); + memset(sb, 0, sizeof(sb_t)); + + opl2_init(&sb->opl); + sb_dsp_init(&sb->dsp, SB15); + sb_dsp_setaddr(&sb->dsp, 0); + sb_dsp_setirq(&sb->dsp, device_get_config_int("irq")); + sb_dsp_setdma8(&sb->dsp, device_get_config_int("dma")); + sb_mixer_init(&sb->mixer); + sound_add_handler(sb_get_buffer_opl2, sb); + mca_add(sb_mcv_read, sb_mcv_write, sb); + sb->pos_regs[0] = 0x84; + sb->pos_regs[1] = 0x50; + return sb; +} void *sb_2_init() { sb_t *sb = malloc(sizeof(sb_t)); @@ -485,6 +587,32 @@ void *sb_pro_v2_init() return sb; } +void *sb_pro_mcv_init() +{ + sb_t *sb = malloc(sizeof(sb_t)); + memset(sb, 0, sizeof(sb_t)); + + opl3_init(&sb->opl); + sb_dsp_init(&sb->dsp, SBPRO2); + /*sb_dsp_setaddr(&sb->dsp, addr); + sb_dsp_setirq(&sb->dsp, device_get_config_int("irq")); + sb_dsp_setdma8(&sb->dsp, device_get_config_int("dma"));*/ + sb_mixer_init(&sb->mixer); + io_sethandler(0x0388, 0x0004, opl3_read, NULL, NULL, opl3_write, NULL, NULL, &sb->opl); + sound_add_handler(sb_get_buffer_opl3, sb); + + sb->mixer.regs[0x22] = 0xff; + sb->mixer.regs[0x04] = 0xff; + sb->mixer.regs[0x26] = 0xff; + sb->mixer.regs[0xe] = 0; + + mca_add(sb_pro_mcv_read, sb_pro_mcv_write, sb); + sb->pos_regs[0] = 0x03; + sb->pos_regs[1] = 0x51; + + return sb; +} + void *sb_16_init() { sb_t *sb = malloc(sizeof(sb_t)); @@ -605,462 +733,367 @@ void sb_add_status_info(char *s, int max_len, void *p) static device_config_t sb_config[] = { { - .name = "addr", - .description = "Address", - .type = CONFIG_BINARY, - .type = CONFIG_SELECTION, - .selection = + "addr", "Address", CONFIG_SELECTION, "", 0x220, { { - .description = "0x220", - .value = 0x220 + "0x220", 0x220 }, { - .description = "0x240", - .value = 0x240 + "0x240", 0x240 }, { - .description = "" + "" } - }, - .default_int = 0x220 + } }, { - .name = "irq", - .description = "IRQ", - .type = CONFIG_SELECTION, - .selection = + "irq", "IRQ", CONFIG_SELECTION, "", 7, { { - .description = "IRQ 2", - .value = 2 + "IRQ 2", 2 }, { - .description = "IRQ 3", - .value = 3 + "IRQ 3", 3 }, { - .description = "IRQ 5", - .value = 5 + "IRQ 5", 5 }, { - .description = "IRQ 7", - .value = 7 + "IRQ 7", 7 }, { - .description = "" + "" } - }, - .default_int = 7 + } }, { - .name = "dma", - .description = "DMA", - .type = CONFIG_SELECTION, - .selection = + "dma", "DMA", CONFIG_SELECTION, "", 1, { { - .description = "DMA 1", - .value = 1 + "DMA 1", 1 }, { - .description = "DMA 3", - .value = 3 + "DMA 3", 3 }, { - .description = "" + "" } - }, - .default_int = 1 + } }, { - .type = -1 + "", "", -1 + } +}; + +static device_config_t sb_mcv_config[] = +{ + { + "irq", "IRQ", CONFIG_SELECTION, "", 7, + { + { + "IRQ 3", 3 + }, + { + "IRQ 5", 5 + }, + { + "IRQ 7", 7 + }, + { + "" + } + } + }, + { + "dma", "DMA", CONFIG_SELECTION, "", 1, + { + { + "DMA 1", 1 + }, + { + "DMA 3", 3 + }, + { + "" + } + } + }, + { + "", "", -1 } }; static device_config_t sb_pro_config[] = { { - .name = "addr", - .description = "Address", - .type = CONFIG_BINARY, - .type = CONFIG_SELECTION, - .selection = + "addr", "Address", CONFIG_SELECTION, "", 0x220, { { - .description = "0x220", - .value = 0x220 + "0x220", 0x220 }, { - .description = "0x240", - .value = 0x240 + "0x240", 0x240 }, { - .description = "" + "" } - }, - .default_int = 0x220 + } }, { - .name = "irq", - .description = "IRQ", - .type = CONFIG_SELECTION, - .selection = + "irq", "IRQ", CONFIG_SELECTION, "", 7, { { - .description = "IRQ 2", - .value = 2 + "IRQ 2", 2 }, { - .description = "IRQ 5", - .value = 5 + "IRQ 5", 5 }, { - .description = "IRQ 7", - .value = 7 + "IRQ 7", 7 }, { - .description = "IRQ 10", - .value = 10 + "IRQ 10", 10 }, { - .description = "" + "" } - }, - .default_int = 7 + } }, { - .name = "dma", - .description = "DMA", - .type = CONFIG_SELECTION, - .selection = + "dma", "DMA", CONFIG_SELECTION, "", 1, { { - .description = "DMA 1", - .value = 1 + "DMA 1", 1 }, { - .description = "DMA 3", - .value = 3 + "DMA 3", 3 }, { - .description = "" + "" } - }, - .default_int = 1 + } }, { - .type = -1 + "", "", -1 } }; static device_config_t sb_16_config[] = { { - .name = "addr", - .description = "Address", - .type = CONFIG_BINARY, - .type = CONFIG_SELECTION, - .selection = + "addr", "Address", CONFIG_SELECTION, "", 0x220, { { - .description = "0x220", - .value = 0x220 + "0x220", 0x220 }, { - .description = "0x240", - .value = 0x240 + "0x240", 0x240 }, { - .description = "0x260", - .value = 0x260 + "0x260", 0x260 }, { - .description = "0x280", - .value = 0x280 + "0x280", 0x280 }, { - .description = "" + "" } - }, - .default_int = 0x220 + } }, { - .name = "addr401", - .description = "MPU-401 Address", - .type = CONFIG_BINARY, - .type = CONFIG_SELECTION, - .selection = + "addr401", "MPU-401 Address", CONFIG_SELECTION, "", 0x330, { { - .description = "0x300", - .value = 0x300 + "0x300", 0x300 }, { - .description = "0x330", - .value = 0x330 + "0x330", 0x330 }, { - .description = "" + "" } - }, - .default_int = 0x330 + } }, { - .name = "irq", - .description = "IRQ", - .type = CONFIG_SELECTION, - .selection = + "irq", "IRQ", CONFIG_SELECTION, "", 5, { { - .description = "IRQ 2", - .value = 2 + "IRQ 2", 2 }, { - .description = "IRQ 5", - .value = 5 + "IRQ 5", 5 }, { - .description = "IRQ 7", - .value = 7 + "IRQ 7", 7 }, { - .description = "IRQ 10", - .value = 10 + "IRQ 10", 10 }, { - .description = "" + "" } - }, - .default_int = 5 + } }, { - .name = "dma", - .description = "Low DMA channel", - .type = CONFIG_SELECTION, - .selection = + "dma", "Low DMA channel", CONFIG_SELECTION, "", 1, { { - .description = "DMA 0", - .value = 0 + "DMA 0", 0 }, { - .description = "DMA 1", - .value = 1 + "DMA 1", 1 }, { - .description = "DMA 3", - .value = 3 + "DMA 3", 3 }, { - .description = "" + "" } - }, - .default_int = 1 + } }, { - .name = "dma16", - .description = "High DMA channel", - .type = CONFIG_SELECTION, - .selection = + "dma16", "High DMA channel", CONFIG_SELECTION, "", 5, { { - .description = "DMA 5", - .value = 5 + "DMA 5", 5 }, { - .description = "DMA 6", - .value = 6 + "DMA 6", 6 }, { - .description = "DMA 7", - .value = 7 + "DMA 7", 7 }, { - .description = "" + "" } - }, - .default_int = 5 + } }, { - .name = "midi", - .description = "MIDI out device", - .type = CONFIG_MIDI, - .default_int = 0 + "midi", "MIDI out device", CONFIG_MIDI, "", 0 }, { - .type = -1 + "", "", -1 } }; static device_config_t sb_awe32_config[] = { { - .name = "addr", - .description = "Address", - .type = CONFIG_BINARY, - .type = CONFIG_SELECTION, - .selection = + "addr", "Address", CONFIG_SELECTION, "", 0x220, { { - .description = "0x220", - .value = 0x220 + "0x220", 0x220 }, { - .description = "0x240", - .value = 0x240 + "0x240", 0x240 }, { - .description = "0x260", - .value = 0x260 + "0x260", 0x260 }, { - .description = "0x280", - .value = 0x280 + "0x280", 0x280 }, { - .description = "" + "" } - }, - .default_int = 0x220 + } }, { - .name = "addr401", - .description = "MPU-401 Address", - .type = CONFIG_BINARY, - .type = CONFIG_SELECTION, - .selection = + "addr401", "MPU-401 Address", CONFIG_SELECTION, "", 0x330, { { - .description = "0x300", - .value = 0x300 + "0x300", 0x300 }, { - .description = "0x330", - .value = 0x330 + "0x330", 0x330 }, { - .description = "" + "" } - }, - .default_int = 0x330 + } }, { - .name = "irq", - .description = "IRQ", - .type = CONFIG_SELECTION, - .selection = + "irq", "IRQ", CONFIG_SELECTION, "", 5, { { - .description = "IRQ 2", - .value = 2 + "IRQ 2", 2 }, { - .description = "IRQ 5", - .value = 5 + "IRQ 5", 5 }, { - .description = "IRQ 7", - .value = 7 + "IRQ 7", 7 }, { - .description = "IRQ 10", - .value = 10 + "IRQ 10", 10 }, { - .description = "" + "" } - }, - .default_int = 5 + } }, { - .name = "dma", - .description = "Low DMA channel", - .type = CONFIG_SELECTION, - .selection = + "dma", "Low DMA channel", CONFIG_SELECTION, "", 1, { { - .description = "DMA 0", - .value = 0 + "DMA 0", 0 }, { - .description = "DMA 1", - .value = 1 + "DMA 1", 1 }, { - .description = "DMA 3", - .value = 3 + "DMA 3", 3 }, { - .description = "" + "" } - }, - .default_int = 1 + } }, { - .name = "dma16", - .description = "High DMA channel", - .type = CONFIG_SELECTION, - .selection = + "dma16", "High DMA channel", CONFIG_SELECTION, "", 5, { { - .description = "DMA 5", - .value = 5 + "DMA 5", 5 }, { - .description = "DMA 6", - .value = 6 + "DMA 6", 6 }, { - .description = "DMA 7", - .value = 7 + "DMA 7", 7 }, { - .description = "" + "" } - }, - .default_int = 5 + } }, { - .name = "midi", - .description = "MIDI out device", - .type = CONFIG_MIDI, - .default_int = 0 + "midi", "MIDI out device", CONFIG_MIDI, "", 0 }, { - .name = "onboard_ram", - .description = "Onboard RAM", - .type = CONFIG_SELECTION, - .selection = + "onboard_ram", "Onboard RAM", CONFIG_SELECTION, "", 512, { { - .description = "None", - .value = 0 + "None", 0 }, { - .description = "512 KB", - .value = 512 + "512 KB", 512 }, { - .description = "2 MB", - .value = 2048 + "2 MB", 2048 }, { - .description = "8 MB", - .value = 8192 + "8 MB", 8192 }, { - .description = "28 MB", - .value = 28*1024 + "28 MB", 28*1024 }, { - .description = "" + "" } - }, - .default_int = 512 + } }, { - .type = -1 + "", "", -1 } }; @@ -1088,6 +1121,18 @@ device_t sb_15_device = sb_add_status_info, sb_config }; +device_t sb_mcv_device = +{ + "Sound Blaster MCV", + DEVICE_MCA, + sb_mcv_init, + sb_close, + NULL, + sb_speed_changed, + NULL, + sb_add_status_info, + sb_mcv_config +}; device_t sb_2_device = { "Sound Blaster v2.0", @@ -1124,6 +1169,18 @@ device_t sb_pro_v2_device = sb_add_status_info, sb_pro_config }; +device_t sb_pro_mcv_device = +{ + "Sound Blaster Pro MCV", + DEVICE_MCA, + sb_pro_mcv_init, + sb_close, + NULL, + sb_speed_changed, + NULL, + sb_add_status_info, + NULL +}; device_t sb_16_device = { "Sound Blaster 16", diff --git a/src/sound_sb.h b/src/sound_sb.h index 81130fecd..4a0b974b8 100644 --- a/src/sound_sb.h +++ b/src/sound_sb.h @@ -1,7 +1,9 @@ extern device_t sb_1_device; extern device_t sb_15_device; +extern device_t sb_mcv_device; extern device_t sb_2_device; extern device_t sb_pro_v1_device; extern device_t sb_pro_v2_device; +extern device_t sb_pro_mcv_device; extern device_t sb_16_device; extern device_t sb_awe32_device; diff --git a/src/sound_sb_dsp.c b/src/sound_sb_dsp.c index 40dd6e0e7..13298d446 100644 --- a/src/sound_sb_dsp.c +++ b/src/sound_sb_dsp.c @@ -100,7 +100,6 @@ uint16_t sb_dsp_versions[] = {0, 0, 0x105, 0x200, 0x201, 0x300, 0x302, 0x405, 0x void sb_irq(sb_dsp_t *dsp, int irq8) { -// pclog("IRQ %i %02X\n",irq8,pic.mask); if (irq8) dsp->sb_irq8 = 1; else dsp->sb_irq16 = 1; picint(1 << dsp->sb_irqnum); @@ -193,7 +192,6 @@ void sb_start_dma(sb_dsp_t *dsp, int dma8, int autoinit, uint8_t format, int len timer_update_outstanding(); dsp->sbleftright = 0; dsp->sbdacpos = 0; -// pclog("Start 8-bit DMA addr %06X len %04X\n",dma.ac[1]+(dma.page[1]<<16),len); } else { @@ -207,7 +205,6 @@ void sb_start_dma(sb_dsp_t *dsp, int dma8, int autoinit, uint8_t format, int len timer_process(); dsp->sbenable = dsp->sb_16_enable; timer_update_outstanding(); -// pclog("Start 16-bit DMA addr %06X len %04X\n",dma16.ac[1]+(dma16.page[1]<<16),len); } } @@ -225,7 +222,6 @@ void sb_start_dma_i(sb_dsp_t *dsp, int dma8, int autoinit, uint8_t format, int l timer_process(); dsp->sb_enable_i = dsp->sb_8_enable; timer_update_outstanding(); -// pclog("Start 8-bit input DMA addr %06X len %04X\n",dma.ac[1]+(dma.page[1]<<16),len); } else { @@ -239,7 +235,6 @@ void sb_start_dma_i(sb_dsp_t *dsp, int dma8, int autoinit, uint8_t format, int l timer_process(); dsp->sb_enable_i = dsp->sb_16_enable; timer_update_outstanding(); -// pclog("Start 16-bit input DMA addr %06X len %04X\n",dma.ac[1]+(dma.page[1]<<16),len); } } @@ -278,7 +273,6 @@ void sb_dsp_setdma16(sb_dsp_t *dsp, int dma) void sb_exec_command(sb_dsp_t *dsp) { int temp,c; -// pclog("sb_exec_command : SB command %02X\n", dsp->sb_command); switch (dsp->sb_command) { case 0x01: /*???*/ @@ -298,7 +292,6 @@ void sb_exec_command(sb_dsp_t *dsp) case 0x17: /*2-bit ADPCM output with reference*/ dsp->sbref = sb_8_read_dma(dsp); dsp->sbstep = 0; -// pclog("Ref byte 2 %02X\n",sbref); case 0x16: /*2-bit ADPCM output*/ sb_start_dma(dsp, 1, 0, ADPCM_2, dsp->sb_data[0] + (dsp->sb_data[1] << 8)); dsp->sbdat2 = sb_8_read_dma(dsp); @@ -329,14 +322,12 @@ void sb_exec_command(sb_dsp_t *dsp) dsp->sblatcho = dsp->sblatchi = TIMER_USEC * (256 - dsp->sb_data[0]); temp = 256 - dsp->sb_data[0]; temp = 1000000 / temp; -// pclog("Sample rate - %ihz (%i)\n",temp, dsp->sblatcho); dsp->sb_freq = temp; break; case 0x41: /*Set output sampling rate*/ case 0x42: /*Set input sampling rate*/ if (dsp->sb_type < SB16) break; dsp->sblatcho = (int)(TIMER_USEC * (1000000.0f / (float)(dsp->sb_data[1] + (dsp->sb_data[0] << 8)))); -// pclog("Sample rate - %ihz (%i)\n",dsp->sb_data[1]+(dsp->sb_data[0]<<8), dsp->sblatcho); dsp->sb_freq = dsp->sb_data[1] + (dsp->sb_data[0] << 8); dsp->sb_timeo = 256 + dsp->sb_freq; dsp->sblatchi = dsp->sblatcho; @@ -348,7 +339,6 @@ void sb_exec_command(sb_dsp_t *dsp) case 0x75: /*4-bit ADPCM output with reference*/ dsp->sbref = sb_8_read_dma(dsp); dsp->sbstep = 0; -// pclog("Ref byte 4 %02X\n",sbref); case 0x74: /*4-bit ADPCM output*/ sb_start_dma(dsp, 1, 0, ADPCM_4, dsp->sb_data[0] + (dsp->sb_data[1] << 8)); dsp->sbdat2 = sb_8_read_dma(dsp); @@ -357,7 +347,6 @@ void sb_exec_command(sb_dsp_t *dsp) case 0x77: /*2.6-bit ADPCM output with reference*/ dsp->sbref = sb_8_read_dma(dsp); dsp->sbstep = 0; -// pclog("Ref byte 26 %02X\n",sbref); case 0x76: /*2.6-bit ADPCM output*/ sb_start_dma(dsp, 1, 0, ADPCM_26, dsp->sb_data[0] + (dsp->sb_data[1] << 8)); dsp->sbdat2 = sb_8_read_dma(dsp); @@ -377,7 +366,6 @@ void sb_exec_command(sb_dsp_t *dsp) break; case 0x80: /*Pause DAC*/ dsp->sb_pausetime = dsp->sb_data[0] + (dsp->sb_data[1] << 8); -// pclog("SB pause %04X\n",sb_pausetime); timer_process(); dsp->sbenable = 1; timer_update_outstanding(); @@ -483,7 +471,6 @@ void sb_exec_command(sb_dsp_t *dsp) sb_add_data(dsp, dsp->sb_test); break; case 0xF2: /*Trigger 8-bit IRQ*/ -// pclog("Trigger IRQ\n"); sb_irq(dsp, 1); break; case 0xE7: /*???*/ @@ -499,13 +486,10 @@ void sb_exec_command(sb_dsp_t *dsp) case 0x0E: /*ASP set register*/ if (dsp->sb_type < SB16) break; dsp->sb_asp_regs[dsp->sb_data[0]] = dsp->sb_data[1]; -// pclog("ASP write reg %02X %02X\n", sb_data[0], sb_data[1]); break; case 0x0F: /*ASP get register*/ if (dsp->sb_type < SB16) break; -// sb_add_data(0); sb_add_data(dsp, dsp->sb_asp_regs[dsp->sb_data[0]]); -// pclog("ASP read reg %02X %02X\n", sb_data[0], sb_asp_regs[sb_data[0]]); break; case 0xF9: if (dsp->sb_type < SB16) break; @@ -516,15 +500,12 @@ void sb_exec_command(sb_dsp_t *dsp) case 0x04: case 0x05: break; -// default: -// fatal("Exec bad SB command %02X\n",sb_command); } } void sb_write(uint16_t a, uint8_t v, void *priv) { sb_dsp_t *dsp = (sb_dsp_t *)priv; -// pclog("sb_write : Write soundblaster %04X %02X %04X:%04X %02X\n",a,v,CS,pc,dsp->sb_command); switch (a&0xF) { case 6: /*Reset*/ @@ -542,7 +523,6 @@ void sb_write(uint16_t a, uint8_t v, void *priv) timer_update_outstanding(); if (dsp->asp_data_len) { -// pclog("ASP data %i\n", dsp->asp_data_len); dsp->asp_data_len--; if (!dsp->asp_data_len) sb_add_data(dsp, 0); @@ -553,8 +533,6 @@ void sb_write(uint16_t a, uint8_t v, void *priv) dsp->sb_command = v; if (v == 0x01) sb_add_data(dsp, 0); -// if (sb_commands[v]==-1) -// fatal("Bad SB command %02X\n",v); dsp->sb_data_stat++; } else @@ -571,8 +549,6 @@ void sb_write(uint16_t a, uint8_t v, void *priv) uint8_t sb_read(uint16_t a, void *priv) { sb_dsp_t *dsp = (sb_dsp_t *)priv; -// if (a==0x224) output=1; -// pclog("sb_read : Read soundblaster %04X %04X:%04X\n",a,CS,pc); switch (a & 0xf) { case 0xA: /*Read data*/ @@ -582,7 +558,6 @@ uint8_t sb_read(uint16_t a, void *priv) dsp->sb_read_rp++; dsp->sb_read_rp &= 0xFF; } -// pclog("SB read %02X\n",sbreaddat); return dsp->sbreaddat; case 0xC: /*Write data ready*/ if (dsp->wb_full) @@ -627,7 +602,6 @@ void sb_dsp_init(sb_dsp_t *dsp, int type) void sb_dsp_setaddr(sb_dsp_t *dsp, uint16_t addr) { -// pclog("sb_dsp_setaddr : %04X\n", addr); io_removehandler(dsp->sb_addr + 6, 0x0002, sb_read, NULL, NULL, sb_write, NULL, NULL, dsp); io_removehandler(dsp->sb_addr + 0xa, 0x0006, sb_read, NULL, NULL, sb_write, NULL, NULL, dsp); dsp->sb_addr = addr; @@ -649,13 +623,11 @@ void pollsb(void *p) int tempi,ref; dsp->sbcount += dsp->sblatcho; -// pclog("PollSB %i %i %i %i\n",sb_8_enable,sb_8_pause,sb_pausetime,sb_8_output); if (dsp->sb_8_enable && !dsp->sb_8_pause && dsp->sb_pausetime < 0 && dsp->sb_8_output) { int data[2]; sb_dsp_update(dsp); -// pclog("Dopoll %i %02X %i\n", sb_8_length, sb_8_format, sblatcho); switch (dsp->sb_8_format) { case 0x00: /*Mono unsigned*/ @@ -805,9 +777,6 @@ void pollsb(void *p) else dsp->sbdatl = dsp->sbdatr = dsp->sbdat; break; - -// default: - //fatal("Unrecognised SB 8-bit format %02X\n",sb_8_format); } if (dsp->sb_8_length < 0) @@ -841,14 +810,10 @@ void pollsb(void *p) dsp->sbdatr = sb_16_read_dma(dsp); dsp->sb_16_length -= 2; break; - -// default: -// fatal("Unrecognised SB 16-bit format %02X\n",sb_16_format); } if (dsp->sb_16_length < 0) { -// pclog("16DMA over %i\n",dsp->sb_16_autoinit); if (dsp->sb_16_autoinit) dsp->sb_16_length = dsp->sb_16_autolen; else dsp->sb_16_enable = dsp->sbenable = 0; sb_irq(dsp, 0); @@ -861,7 +826,6 @@ void pollsb(void *p) { sb_irq(dsp, 1); dsp->sbenable = dsp->sb_8_enable; -// pclog("SB pause over\n"); } } } @@ -871,7 +835,6 @@ void sb_poll_i(void *p) sb_dsp_t *dsp = (sb_dsp_t *)p; dsp->sb_count_i += dsp->sblatchi; -// pclog("PollSBi %i %i %i %i\n",sb_8_enable,sb_8_pause,sb_pausetime,sb_8_output); if (dsp->sb_8_enable && !dsp->sb_8_pause && dsp->sb_pausetime < 0 && !dsp->sb_8_output) { switch (dsp->sb_8_format) @@ -894,14 +857,10 @@ void sb_poll_i(void *p) sb_8_write_dma(dsp, 0x00); dsp->sb_8_length -= 2; break; - -// default: -// fatal("Unrecognised SB 8-bit input format %02X\n",sb_8_format); } if (dsp->sb_8_length < 0) { -// pclog("Input DMA over %i\n",sb_8_autoinit); if (dsp->sb_8_autoinit) dsp->sb_8_length = dsp->sb_8_autolen; else dsp->sb_8_enable = dsp->sbenable = 0; sb_irq(dsp, 1); @@ -929,14 +888,10 @@ void sb_poll_i(void *p) sb_16_write_dma(dsp, 0); dsp->sb_16_length -= 2; break; - -// default: -// fatal("Unrecognised SB 16-bit input format %02X\n",sb_16_format); } if (dsp->sb_16_length < 0) { -// pclog("16iDMA over %i\n",sb_16_autoinit); if (dsp->sb_16_autoinit) dsp->sb_16_length = dsp->sb_16_autolen; else dsp->sb_16_enable = dsp->sbenable = 0; sb_irq(dsp, 0); @@ -956,7 +911,6 @@ void sb_dsp_update(sb_dsp_t *dsp) void sb_dsp_add_status_info(char *s, int max_len, sb_dsp_t *dsp) { char temps[128]; - int len; int freq; if (dsp->sb_timeo < 256) diff --git a/src/sound_sn76489.c b/src/sound_sn76489.c index 2dae07669..7d6fe80a1 100644 --- a/src/sound_sn76489.c +++ b/src/sound_sn76489.c @@ -1,4 +1,5 @@ #include +#include #include "ibm.h" #include "device.h" #include "io.h" @@ -15,8 +16,6 @@ static float volslog[16]= 7.51785f,9.46440f,11.9194f,15.0000f }; -//#define PSGCONST ((3579545.0 / 64.0) / 48000.0) - void sn76489_update(sn76489_t *sn76489) { for (; sn76489->pos < sound_pos_global; sn76489->pos++) diff --git a/src/sound_speaker.c b/src/sound_speaker.c index 8e678253e..f4bc7086d 100644 --- a/src/sound_speaker.c +++ b/src/sound_speaker.c @@ -15,7 +15,6 @@ void speaker_update() { int16_t val; -// printf("SPeaker - %i %i %i %02X\n",speakval,gated,speakon,pit.m[2]); for (; speaker_pos < sound_pos_global; speaker_pos++) { if (speaker_gated && was_speaker_enable) diff --git a/src/sound_ssi2001.c b/src/sound_ssi2001.c index fd675c309..d0a7e2136 100644 --- a/src/sound_ssi2001.c +++ b/src/sound_ssi2001.c @@ -1,6 +1,7 @@ #include #include "ibm.h" #include "device.h" +#include "io.h" #include "sound.h" #include "sound_resid.h" diff --git a/src/sound_wss.c b/src/sound_wss.c index b5fecd08f..f8a5bcbd6 100644 --- a/src/sound_wss.c +++ b/src/sound_wss.c @@ -10,6 +10,7 @@ #include "dma.h" #include "io.h" #include "pic.h" +#include "sound.h" #include "sound_ad1848.h" #include "sound_opl.h" #include "sound_wss.h" @@ -27,7 +28,6 @@ static int wss_dma[4] = {0, 0, 1, 3}; static int wss_irq[8] = {5, 7, 9, 10, 11, 12, 14, 15}; /*W95 only uses 7-9, others may be wrong*/ -static uint16_t wss_addr[4] = {0x530, 0x604, 0xe80, 0xf40}; typedef struct wss_t { @@ -41,16 +41,13 @@ uint8_t wss_read(uint16_t addr, void *p) { wss_t *wss = (wss_t *)p; uint8_t temp; -// pclog("wss_read - addr %04X %04X(%08X):%08X ", addr, CS, cs, pc); temp = 4 | (wss->config & 0x40); -// pclog("return %02X\n", temp); return temp; } void wss_write(uint16_t addr, uint8_t val, void *p) { wss_t *wss = (wss_t *)p; -// pclog("wss_write - addr %04X val %02X %04X(%08X):%08X\n", addr, val, CS, cs, pc); wss->config = val; ad1848_setdma(&wss->ad1848, wss_dma[val & 3]); @@ -78,8 +75,6 @@ static void wss_get_buffer(int32_t *buffer, int len, void *p) void *wss_init() { wss_t *wss = malloc(sizeof(wss_t)); - int c; - double attenuation; memset(wss, 0, sizeof(wss_t)); diff --git a/src/sound_ym7128.c b/src/sound_ym7128.c index 7c1aa06ff..be0b3946c 100644 --- a/src/sound_ym7128.c +++ b/src/sound_ym7128.c @@ -27,46 +27,37 @@ void ym7128_write(ym7128_t *ym7128, uint8_t val) int new_dat = val & 1; int new_sci = val & 2; int new_a0 = val & 4; -// pclog("ym7128_write %i %i %i\n", new_dat, new_sci, new_a0); if (!ym7128->sci && new_sci) ym7128->dat = (ym7128->dat << 1) | new_dat; if (ym7128->a0 != new_a0) { -// pclog("ym7128 write %i %02x\n", ym7128->a0, ym7128->dat); if (!ym7128->a0) ym7128->reg_sel = ym7128->dat & 0x1f; else { -// pclog("YM7128 write %02x %02x\n", ym7128->reg_sel, ym7128->dat); switch (ym7128->reg_sel) { case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: ym7128->gl[ym7128->reg_sel & 7] = GET_ATTENUATION(ym7128->dat); -// pclog(" GL[%i] = %04x\n", ym7128->reg_sel & 7, GET_ATTENUATION(ym7128->dat)); break; case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: case 0x0f: ym7128->gr[ym7128->reg_sel & 7] = GET_ATTENUATION(ym7128->dat); -// pclog(" GR[%i] = %04x\n", ym7128->reg_sel & 7, GET_ATTENUATION(ym7128->dat)); break; case 0x10: ym7128->vm = GET_ATTENUATION(ym7128->dat); -// pclog(" VM = %04x\n", GET_ATTENUATION(ym7128->dat)); break; case 0x11: ym7128->vc = GET_ATTENUATION(ym7128->dat); -// pclog(" VC = %04x\n", GET_ATTENUATION(ym7128->dat)); break; case 0x12: ym7128->vl = GET_ATTENUATION(ym7128->dat); -// pclog(" VL = %04x\n", GET_ATTENUATION(ym7128->dat)); break; case 0x13: ym7128->vr = GET_ATTENUATION(ym7128->dat); -// pclog(" VR = %04x\n", GET_ATTENUATION(ym7128->dat)); break; case 0x14: @@ -83,7 +74,6 @@ void ym7128_write(ym7128_t *ym7128, uint8_t val) case 0x16: case 0x17: case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c: case 0x1d: case 0x1e: ym7128->t[ym7128->reg_sel - 0x16] = tap_position[ym7128->dat & 0x1f]; -// pclog(" T[%i] = %i\n", ym7128->reg_sel - 0x16, tap_position[ym7128->dat & 0x1f]); break; } ym7128->regs[ym7128->reg_sel] = ym7128->dat; diff --git a/src/soundopenal.c b/src/soundopenal.c index 45322c1a8..8cb065fbd 100644 --- a/src/soundopenal.c +++ b/src/soundopenal.c @@ -12,9 +12,9 @@ FILE *allog; #ifdef USE_OPENAL -ALuint buffers[4]; // front and back buffers -ALuint buffers_cd[4]; // front and back buffers -static ALuint source[2]; // audio source +ALuint buffers[4]; /* front and back buffers */ +ALuint buffers_cd[4]; /* front and back buffers */ +static ALuint source[2]; /* audio source */ #endif #define FREQ 48000 #define BUFLEN SOUNDBUFLEN @@ -25,13 +25,13 @@ ALvoid alutInit(ALint *argc,ALbyte **argv) ALCcontext *Context; ALCdevice *Device; - //Open device - Device=alcOpenDevice((ALubyte*)""); - //Create context(s) + /* Open device */ + Device=alcOpenDevice((ALCchar *)""); + /* Create context(s) */ Context=alcCreateContext(Device,NULL); - //Set active context + /* Set active context */ alcMakeContextCurrent(Context); - //Register extensions + /* Register extensions */ } ALvoid alutExit(ALvoid) @@ -39,26 +39,24 @@ ALvoid alutExit(ALvoid) ALCcontext *Context; ALCdevice *Device; - //Unregister extensions + /* Unregister extensions */ - //Get active context + /* Get active context */ Context=alcGetCurrentContext(); - //Get device for active context + /* Get device for active context */ Device=alcGetContextsDevice(Context); - //Disable context + /* Disable context */ alcMakeContextCurrent(NULL); - //Release context(s) + /* Release context(s) */ alcDestroyContext(Context); - //Close device + /* Close device */ alcCloseDevice(Device); } void initalmain(int argc, char *argv[]) { #ifdef USE_OPENAL alutInit(0,0); -// printf("AlutInit\n"); atexit(closeal); -// printf("AlutInit\n"); #endif } @@ -69,18 +67,6 @@ void closeal() #endif } -void check() -{ -#ifdef USE_OPENAL - ALenum error; - if ((error = alGetError()) != AL_NO_ERROR) - { -// printf("Error : %08X\n", error); -// exit(-1); - } -#endif -} - void inital() { #ifdef USE_OPENAL @@ -89,37 +75,25 @@ void inital() float cd_buf[CD_BUFLEN*2]; -// printf("1\n"); - check(); - -// printf("2\n"); alGenBuffers(4, buffers); - check(); alGenBuffers(4, buffers_cd); - check(); -// printf("3\n"); alGenSources(2, source); - check(); -// printf("4\n"); alSource3f(source[0], AL_POSITION, 0.0, 0.0, 0.0); alSource3f(source[0], AL_VELOCITY, 0.0, 0.0, 0.0); alSource3f(source[0], AL_DIRECTION, 0.0, 0.0, 0.0); alSourcef (source[0], AL_ROLLOFF_FACTOR, 0.0 ); alSourcei (source[0], AL_SOURCE_RELATIVE, AL_TRUE ); - check(); alSource3f(source[1], AL_POSITION, 0.0, 0.0, 0.0); alSource3f(source[1], AL_VELOCITY, 0.0, 0.0, 0.0); alSource3f(source[1], AL_DIRECTION, 0.0, 0.0, 0.0); alSourcef (source[1], AL_ROLLOFF_FACTOR, 0.0 ); alSourcei (source[1], AL_SOURCE_RELATIVE, AL_TRUE ); - check(); memset(buf,0,BUFLEN*2*sizeof(float)); memset(cd_buf,0,BUFLEN*2*sizeof(float)); -// printf("5\n"); for (c = 0; c < 4; c++) { alBufferData(buffers[c], AL_FORMAT_STEREO_FLOAT32, buf, BUFLEN*2*sizeof(float), FREQ); @@ -127,81 +101,35 @@ void inital() } alSourceQueueBuffers(source[0], 4, buffers); - check(); alSourceQueueBuffers(source[1], 4, buffers_cd); - check(); -// printf("6 %08X\n",source); alSourcePlay(source[0]); - check(); alSourcePlay(source[1]); - check(); -// printf("InitAL!!! %08X\n",source); #endif } void givealbuffer(float *buf) { #ifdef USE_OPENAL - int16_t buf16[BUFLEN*2]; int processed; int state; - - //return; - -// printf("Start\n"); - check(); - -// printf("GiveALBuffer %08X\n",source); - + ALuint buffer; + alGetSourcei(source[0], AL_SOURCE_STATE, &state); - check(); - if (state==0x1014) { alSourcePlay(source[0]); -// printf("Resetting sound\n"); } -// printf("State - %i %08X\n",state,state); alGetSourcei(source[0], AL_BUFFERS_PROCESSED, &processed); -// printf("P "); - check(); -// printf("Processed - %i\n",processed); - if (processed>=1) { - int c; - ALuint buffer; - alSourceUnqueueBuffers(source[0], 1, &buffer); -// printf("U "); - check(); - /* for (c=0;c 32767) - buf16[c] = 32767; - else - buf16[c] = buf[c]; - } */ -// for (c=0;c=1) { ALuint buffer; alSourceUnqueueBuffers(source[1], 1, &buffer); -// printf("U "); - check(); -// for (c=0;c #include "ibm.h" #include "device.h" +#include "io.h" #include "tandy_eeprom.h" typedef struct @@ -34,7 +35,6 @@ void tandy_eeprom_write(uint16_t addr, uint8_t val, void *p) if ((val & 4) && !eeprom->clock) { -// pclog("eeprom_write %02x %i %i\n", val, eeprom->state, eeprom->count); switch (eeprom->state) { case EEPROM_IDLE: @@ -65,7 +65,6 @@ void tandy_eeprom_write(uint16_t addr, uint8_t val, void *p) if (eeprom->count == 8) { eeprom->count = 0; -// pclog("EEPROM get operation %02x\n", eeprom->data); eeprom->addr = eeprom->data & 0x3f; switch (eeprom->data & 0xc0) { @@ -75,7 +74,6 @@ void tandy_eeprom_write(uint16_t addr, uint8_t val, void *p) case 0x80: eeprom->state = EEPROM_READ; eeprom->data = eeprom->store[eeprom->addr]; -// pclog("EEPROM read data %02x %04x\n", eeprom->addr, eeprom->data); break; default: eeprom->state = EEPROM_IDLE; @@ -101,7 +99,6 @@ void tandy_eeprom_write(uint16_t addr, uint8_t val, void *p) { eeprom->count = 0; eeprom->state = EEPROM_IDLE; -// pclog("EEPROM write %04x to %02x\n", eeprom->data, eeprom->addr); eeprom->store[eeprom->addr] = eeprom->data; } break; @@ -113,7 +110,6 @@ void tandy_eeprom_write(uint16_t addr, uint8_t val, void *p) int tandy_eeprom_read() { -// pclog("tandy_eeprom_read: data_out=%x\n", eeprom_data_out); return eeprom_data_out; } diff --git a/src/tandy_rom.c b/src/tandy_rom.c index bfa8738ef..fb4c6bdfd 100644 --- a/src/tandy_rom.c +++ b/src/tandy_rom.c @@ -4,6 +4,7 @@ #include #include "ibm.h" #include "device.h" +#include "io.h" #include "mem.h" #include "tandy_rom.h" @@ -15,19 +16,15 @@ static mem_mapping_t tandy_rom_mapping; uint8_t tandy_read_rom(uint32_t addr, void *p) { uint32_t addr2 = (addr & 0xffff) + tandy_rom_offset; -// if (!nopageerrors) pclog("tandy_read_rom: %05x %05x %02x %04x:%04x\n", addr, addr2, tandy_rom[addr2], CS,pc); return tandy_rom[addr2]; } uint16_t tandy_read_romw(uint32_t addr, void *p) { uint32_t addr2 = (addr & 0xffff) + tandy_rom_offset; -// if (!nopageerrors) pclog("tandy_read_romw: %05x %05x %04x %04x:%04x\n", addr, addr2, *(uint16_t *)&tandy_rom[addr2], CS,pc); return *(uint16_t *)&tandy_rom[addr2]; } uint32_t tandy_read_roml(uint32_t addr, void *p) { - uint32_t addr2 = (addr & 0xffff) + tandy_rom_offset; -// if (!nopageerrors) pclog("tandy_read_roml: %05x %05x %08x\n", addr, addr2, *(uint32_t *)&tandy_rom[addr2]); return *(uint32_t *)&tandy_rom[addr]; } @@ -45,10 +42,7 @@ void tandy_rom_bank_write(uint16_t port, uint8_t val, void *p) tandy_rom_bank = val; tandy_rom_offset = ((val ^ 4) & 7) * 0x10000; mem_mapping_set_exec(&tandy_rom_mapping, &tandy_rom[tandy_rom_offset]); -// pclog("tandy_rom_bank_write: port=%04x val=%02x offset=%05x\n", port, val, tandy_rom_offset); } -// else -// pclog("Bad tandy write port=%04x val=%02x\n", port, val); } void *tandy_rom_init() diff --git a/src/timer.c b/src/timer.c index 7020fdf6c..07cc7c336 100644 --- a/src/timer.c +++ b/src/timer.c @@ -30,7 +30,6 @@ int timer_start = 0; void timer_process() { int c; - int retry; int process = 0; /*Get actual elapsed time*/ int diff = timer_latch - timer_count; @@ -93,7 +92,6 @@ void timer_reset() pclog("timer_reset\n"); timers_present = 0; timer_latch = timer_count = 0; -// timer_process(); } int timer_add(void (*callback)(void *priv), int *count, int *enable, void *priv) @@ -109,12 +107,11 @@ int timer_add(void (*callback)(void *priv), int *count, int *enable, void *priv) { if (timers[i].present && (timers[i].callback == callback) && (timers[i].priv == priv) && (timers[i].count == count) && (timers[i].enable == enable)) { - return; + return 0; } } } -// pclog("timer_add : adding timer %i\n", timers_present); timers[timers_present].present = 1; timers[timers_present].callback = callback; timers[timers_present].priv = priv; diff --git a/src/um8669f.c b/src/um8669f.c index 63b7fffc4..a20b1589e 100644 --- a/src/um8669f.c +++ b/src/um8669f.c @@ -21,6 +21,13 @@ C1 bits 7-6 = LPT1 mode : 11 = ECP/EPP, 01 = EPP, 10 = SPP bit 3 = clear when LPT1 = 278 +Added by OBattler based on more sources: + C2 + bit 2 = I430FX: floppy drive swap (1 = swap, 0 = do not swap) + I430VX: DENSEL polarity + bits 3-6 = IR stuff + bits 3-4 = 00 = Normal, 01 = Infrared (HPSIR), 10 - Amplitude Shift Keyed IR (ASKIR), 11 - Reserved + C3 bits 7-6 = LPT1 DMA mode : 11 = ECP/EPP DMA1, 10 = ECP/EPP DMA3, 01 = EPP/SPP, 00 = ECP bits 5-4 = LPT1 addr : 10 = 278/IRQ5, 01 = 3BC/IRQ7, 00 = 378/IRQ7 @@ -43,6 +50,7 @@ COM2 : #include "disc.h" #include "fdc.h" +#include "fdd.h" #include "io.h" #include "lpt.h" #include "serial.h" @@ -55,7 +63,6 @@ static uint8_t um8669f_regs[256]; void um8669f_write(uint16_t port, uint8_t val, void *priv) { int temp; -// pclog("um8669f_write : port=%04x reg %02X = %02X locked=%i\n", port, um8669f_curreg, val, um8669f_locked); if (um8669f_locked) { if (port == 0x108 && val == 0xaa) @@ -105,7 +112,20 @@ void um8669f_write(uint16_t port, uint8_t val, void *priv) case 3: serial2_set(0x2e8, 3); break; } } - + + if (um8669f_curreg == 0xC2) + { + /* Make sure to invert this. */ + if (romset == ROM_430VX) + { + fdc_update_densel_polarity(val & 4 ? 0 : 1); + } + else + { + fdd_setswap(val & 4 ? 1 : 0); + } + } + lpt1_remove(); lpt2_remove(); temp = (um8669f_regs[0xc3] >> 4) & 3; @@ -121,7 +141,6 @@ void um8669f_write(uint16_t port, uint8_t val, void *priv) uint8_t um8669f_read(uint16_t port, void *priv) { -// pclog("um8669f_read : port=%04x reg %02X locked=%i\n", port, um8669f_curreg, um8669f_locked); if (um8669f_locked) return 0xff; diff --git a/src/usb.c b/src/usb.c index 9a1d424c0..330f408de 100644 --- a/src/usb.c +++ b/src/usb.c @@ -10,7 +10,7 @@ #include "usb.h" -uint8_t (*usb_packet_handle[32])(usb_packet_t* packet, void *priv); +void (*usb_packet_handle[32])(usb_packet_t* packet, void *priv); void *usb_priv[32]; static int usb_min_card, usb_max_card; @@ -45,4 +45,4 @@ void usb_add(void (*packet_handle)(usb_packet_t *packet, void *priv), void *priv return; } } -} \ No newline at end of file +} diff --git a/src/vid_ati18800.c b/src/vid_ati18800.c index 110980f41..068d2bcd5 100644 --- a/src/vid_ati18800.c +++ b/src/vid_ati18800.c @@ -30,8 +30,6 @@ void ati18800_out(uint16_t addr, uint8_t val, void *p) svga_t *svga = &ati18800->svga; uint8_t old; -// pclog("ati18800_out : %04X %02X %04X:%04X\n", addr, val, CS,cpu_state.pc); - if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(svga->miscout & 1)) addr ^= 0x60; @@ -106,8 +104,6 @@ uint8_t ati18800_in(uint16_t addr, void *p) svga_t *svga = &ati18800->svga; uint8_t temp; -// if (addr != 0x3da) pclog("ati18800_in : %04X ", addr); - if (((addr&0xFFF0) == 0x3D0 || (addr&0xFFF0) == 0x3B0) && !(svga->miscout&1)) addr ^= 0x60; switch (addr) diff --git a/src/vid_ati28800.c b/src/vid_ati28800.c index 69004067c..821185883 100644 --- a/src/vid_ati28800.c +++ b/src/vid_ati28800.c @@ -34,8 +34,6 @@ void ati28800_out(uint16_t addr, uint8_t val, void *p) svga_t *svga = &ati28800->svga; uint8_t old; -// pclog("ati28800_out : %04X %02X %04X:%04X\n", addr, val, CS,cpu_state.pc); - if (((addr&0xFFF0) == 0x3D0 || (addr&0xFFF0) == 0x3B0) && !(svga->miscout&1)) addr ^= 0x60; @@ -104,8 +102,6 @@ uint8_t ati28800_in(uint16_t addr, void *p) svga_t *svga = &ati28800->svga; uint8_t temp; -// if (addr != 0x3da) pclog("ati28800_in : %04X ", addr); - if (((addr&0xFFF0) == 0x3D0 || (addr&0xFFF0) == 0x3B0) && !(svga->miscout&1)) addr ^= 0x60; switch (addr) @@ -158,7 +154,6 @@ void ati28800_svga_recalctimings(ati28800_t *ati28800) { double crtcconst; double _dispontime, _dispofftime, disptime; - int hdisp_old; svga_t *svga = &ati28800->svga; svga->vtotal = svga->crtc[6]; @@ -280,8 +275,6 @@ void ati28800_svga_recalctimings(ati28800_t *ati28800) } } -// pclog("svga_render %08X : %08X %08X %08X %08X %08X %i %i %02X %i %i\n", svga_render, svga_render_text_40, svga_render_text_80, svga_render_8bpp_lowres, svga_render_8bpp_highres, svga_render_blank, scrblank,gdcreg[6]&1,gdcreg[5]&0x60,bpp,seqregs[1]&8); - svga->linedbl = svga->crtc[9] & 0x80; svga->rowcount = svga->crtc[9] & 31; if (svga->recalctimings_ex) @@ -295,7 +288,6 @@ void ati28800_svga_recalctimings(ati28800_t *ati28800) disptime = svga->htotal; _dispontime = svga->hdisp_time; -// printf("Disptime %f dispontime %f hdisp %i\n",disptime,dispontime,crtc[1]*8); if (svga->seqregs[1] & 8) { disptime *= 2; _dispontime *= 2; } _dispofftime = disptime - _dispontime; _dispontime *= crtcconst; @@ -313,15 +305,16 @@ void ati28800_svga_recalctimings(ati28800_t *ati28800) void ati28800_recalctimings(svga_t *svga) { ati28800_t *ati28800 = (ati28800_t *)svga->p; + uint8_t clock_sel = (svga->miscout >> 2) & 3; + double freq; + #ifndef RELEASE_BUILD pclog("ati28800_recalctimings\n"); #endif svga->interlace = (!svga->scrblank && (ati28800->regs[0x3e] & 2)); - uint8_t clock_sel = (svga->miscout >> 2) & 3; clock_sel |= (ati28800->regs[0x39] & 2) << 2; clock_sel |= (ati28800->regs[0x3e] & 0x10) >> 1; - double freq; switch(clock_sel) { case 0x00: freq = 42954000; break; @@ -446,58 +439,45 @@ void ati28800_add_status_info(char *s, int max_len, void *p) static device_config_t ati28800_config[] = { { - .name = "memory", - .description = "Memory size", - .type = CONFIG_SELECTION, - .selection = + "memory", "Memory size", CONFIG_SELECTION, "", 512, { { - .description = "256 kB", - .value = 256 + "256 kB", 256 }, { - .description = "512 kB", - .value = 512 + "512 kB", 512 }, { - .description = "" + "" } - }, - .default_int = 512 + } }, { - .type = -1 + "", "", -1 } }; static device_config_t ati28800_wonderxl_config[] = { { - .name = "memory", - .description = "Memory size", - .type = CONFIG_SELECTION, - .selection = + "memory", "Memory size", CONFIG_SELECTION, "", 512, { { - .description = "256 kB", - .value = 256 + "256 kB", 256 }, { - .description = "512 kB", - .value = 512 + "512 kB", 512 }, { - .description = "1 MB", - .value = 1024 + "1 MB", 1024 }, { - .description = "" + "" } - }, - .default_int = 512 + } }, { - .type = -1 + "", "", -1 } }; diff --git a/src/vid_ati68860_ramdac.c b/src/vid_ati68860_ramdac.c index 58cc899c0..a8c2f132d 100644 --- a/src/vid_ati68860_ramdac.c +++ b/src/vid_ati68860_ramdac.c @@ -30,7 +30,6 @@ bit 0 Controls 6/8bit DAC. 0: 8bit DAC/LUT, 1: 6bit DAC/LUT void ati68860_ramdac_out(uint16_t addr, uint8_t val, ati68860_ramdac_t *ramdac, svga_t *svga) { -// pclog("ati68860_out : addr %04X val %02X %04X:%04X\n", addr, val, CS,pc); switch (addr) { case 0: @@ -151,7 +150,6 @@ uint8_t ati68860_ramdac_in(uint16_t addr, ati68860_ramdac_t *ramdac, svga_t *svg ret = ramdac->regs[addr & 0xf]; break; } -// pclog("ati68860_in : addr %04X ret %02X %04X:%04X\n", addr, ret, CS,pc); return ret; } diff --git a/src/vid_ati_eeprom.c b/src/vid_ati_eeprom.c index 8111c30ab..ffc2a04d8 100644 --- a/src/vid_ati_eeprom.c +++ b/src/vid_ati_eeprom.c @@ -57,7 +57,6 @@ void ati_eeprom_save(ati_eeprom_t *eeprom) void ati_eeprom_write(ati_eeprom_t *eeprom, int ena, int clk, int dat) { int c; -// pclog("EEPROM write %i %i %i\n", ena, clk, dat); if (!ena) { eeprom->out = 1; @@ -73,7 +72,6 @@ void ati_eeprom_write(ati_eeprom_t *eeprom, int ena, int clk, int dat) } else if (ena) { -// pclog("EEPROM receive %i %i %i\n", ena, clk, dat); switch (eeprom->state) { case EEPROM_WAIT: @@ -86,7 +84,6 @@ void ati_eeprom_write(ati_eeprom_t *eeprom, int ena, int clk, int dat) eeprom->count--; if (!eeprom->count) { -// pclog("EEPROM opcode - %i\n", eeprom->opcode); switch (eeprom->opcode) { case EEPROM_OP_WRITE: @@ -118,11 +115,9 @@ void ati_eeprom_write(ati_eeprom_t *eeprom, int ena, int clk, int dat) eeprom->count--; if (!eeprom->count) { -// pclog("EEPROM dat - %02X\n", eeprom->dat); switch (eeprom->opcode) { case EEPROM_OP_WRITE: -// pclog("EEPROM_OP_WRITE addr %02X eeprom_dat %04X\n", (eeprom->dat >> 16) & (eeprom->type ? 255 : 63), eeprom->dat & 0xffff); if (!eeprom->wp) { eeprom->data[(eeprom->dat >> 16) & (eeprom->type ? 255 : 63)] = eeprom->dat & 0xffff; @@ -136,10 +131,8 @@ void ati_eeprom_write(ati_eeprom_t *eeprom, int ena, int clk, int dat) eeprom->count = 17; eeprom->state = EEPROM_OUTPUT; eeprom->dat = eeprom->data[eeprom->dat]; -// pclog("Trigger EEPROM_OUTPUT %04X\n", eeprom->dat); break; case EEPROM_OP_EW: -// pclog("EEPROM_OP_EW %i\n", eeprom->dat); switch (eeprom->dat) { case EEPROM_OP_EWDS: @@ -165,7 +158,6 @@ void ati_eeprom_write(ati_eeprom_t *eeprom, int ena, int clk, int dat) break; case EEPROM_OP_ERASE: -// pclog("EEPROM_OP_ERASE %i\n", eeprom->dat); if (!eeprom->wp) { eeprom->data[eeprom->dat] = 0xffff; @@ -176,7 +168,6 @@ void ati_eeprom_write(ati_eeprom_t *eeprom, int ena, int clk, int dat) break; case EEPROM_OP_WRALMAIN: -// pclog("EEPROM_OP_WRAL %04X\n", eeprom->dat); if (!eeprom->wp) { for (c = 0; c < 256; c++) @@ -202,11 +193,9 @@ void ati_eeprom_write(ati_eeprom_t *eeprom, int ena, int clk, int dat) case EEPROM_OUTPUT: eeprom->out = (eeprom->dat & 0x10000) ? 1 : 0; eeprom->dat <<= 1; -// pclog("EEPROM_OUTPUT - data %i\n", eeprom->out); eeprom->count--; if (!eeprom->count) { -// pclog("EEPROM_OUTPUT complete\n"); eeprom->state = EEPROM_IDLE; } break; diff --git a/src/vid_ati_mach64.c b/src/vid_ati_mach64.c index f2faa8138..46d7f53a7 100644 --- a/src/vid_ati_mach64.c +++ b/src/vid_ati_mach64.c @@ -9,12 +9,11 @@ #include "thread.h" #include "video.h" #include "vid_svga.h" +#include "vid_svga_render.h" #include "vid_ati68860_ramdac.h" #include "vid_ati_eeprom.h" #include "vid_ics2595.h" -//#define MACH64_DEBUG - #define FIFO_SIZE 65536 #define FIFO_MASK (FIFO_SIZE - 1) #define FIFO_ENTRY_SIZE (1 << 31) @@ -40,11 +39,18 @@ typedef struct uint32_t val; } fifo_entry_t; +enum +{ + MACH64_GX = 0, + MACH64_VT2 +}; + typedef struct mach64_t { mem_mapping_t linear_mapping; mem_mapping_t mmio_mapping; mem_mapping_t mmio_linear_mapping; + mem_mapping_t mmio_linear_mapping_2; ati68860_ramdac_t ramdac; ati_eeprom_t eeprom; @@ -55,6 +61,8 @@ typedef struct mach64_t uint8_t regs[256]; int index; + + int type; uint8_t pci_regs[256]; @@ -179,6 +187,34 @@ typedef struct mach64_t int blitter_busy; uint64_t blitter_time; uint64_t status_time; + + uint16_t pci_id; + uint32_t config_chip_id; + uint32_t block_decoded_io; + + int pll_addr; + uint8_t pll_regs[16]; + double pll_freq[4]; + + uint32_t config_stat0; + + uint32_t cur_clr0, cur_clr1; + + uint32_t overlay_dat[1024]; + uint32_t overlay_graphics_key_clr, overlay_graphics_key_msk; + uint32_t overlay_video_key_clr, overlay_video_key_msk; + uint32_t overlay_key_cntl; + uint32_t overlay_scale_inc; + uint32_t overlay_scale_cntl; + uint32_t overlay_y_x_start, overlay_y_x_end; + + uint32_t scaler_height_width; + int scaler_format; + int scaler_update; + + uint32_t buf_offset[2], buf_pitch[2]; + + int overlay_v_acc; } mach64_t; enum @@ -272,8 +308,6 @@ void mach64_out(uint16_t addr, uint8_t val, void *p) if (((addr&0xFFF0) == 0x3D0 || (addr&0xFFF0) == 0x3B0) && !(svga->miscout & 1)) addr ^= 0x60; -// pclog("mach64 out %04X %02X\n", addr, val); - switch (addr) { case 0x1ce: @@ -286,7 +320,10 @@ void mach64_out(uint16_t addr, uint8_t val, void *p) break; case 0x3C6: case 0x3C7: case 0x3C8: case 0x3C9: - ati68860_ramdac_out((addr & 3) | ((mach64->dac_cntl & 3) << 2), val, &mach64->ramdac, svga); + if (mach64->type == MACH64_GX) + ati68860_ramdac_out((addr & 3) | ((mach64->dac_cntl & 3) << 2), val, &mach64->ramdac, svga); + else + svga_out(addr, val, svga); return; case 0x3cf: @@ -334,8 +371,6 @@ uint8_t mach64_in(uint16_t addr, void *p) if (((addr&0xFFF0) == 0x3D0 || (addr&0xFFF0) == 0x3B0) && !(svga->miscout&1)) addr ^= 0x60; -// pclog("IN mach64 %04X\n", addr); - switch (addr) { case 0x1ce: @@ -344,7 +379,9 @@ uint8_t mach64_in(uint16_t addr, void *p) return mach64->regs[mach64->index & 0x3f]; case 0x3C6: case 0x3C7: case 0x3C8: case 0x3C9: - return ati68860_ramdac_in((addr & 3) | ((mach64->dac_cntl & 3) << 2), &mach64->ramdac, svga); + if (mach64->type == MACH64_GX) + return ati68860_ramdac_in((addr & 3) | ((mach64->dac_cntl & 3) << 2), &mach64->ramdac, svga); + return svga_in(addr, svga); case 0x3D4: return svga->crtcreg; @@ -373,45 +410,48 @@ void mach64_recalctimings(svga_t *svga) svga->linedbl = svga->rowcount = 0; svga->split = 0xffffff; svga->vblankstart = svga->dispend; -// svga_htotal <<= 1; -// svga_hdisp <<= 1; + svga->rowcount = mach64->crtc_gen_cntl & 1; svga->rowoffset <<= 1; - svga->render = mach64->ramdac.render; + if (mach64->type == MACH64_GX) + svga->render = mach64->ramdac.render; switch ((mach64->crtc_gen_cntl >> 8) & 7) { case 1: -// svga->render = svga_render_4bpp_highres; + if (mach64->type != MACH64_GX) + svga->render = svga_render_4bpp_highres; svga->hdisp *= 8; break; case 2: -// svga->render = svga_render_8bpp_highres; + if (mach64->type != MACH64_GX) + svga->render = svga_render_8bpp_highres; svga->hdisp *= 8; svga->rowoffset /= 2; break; case 3: -// svga->render = svga_render_15bpp_highres; + if (mach64->type != MACH64_GX) + svga->render = svga_render_15bpp_highres; svga->hdisp *= 8; - //svga_rowoffset *= 2; break; case 4: -// svga->render = svga_render_16bpp_highres; + if (mach64->type != MACH64_GX) + svga->render = svga_render_16bpp_highres; svga->hdisp *= 8; - //svga_rowoffset *= 2; break; case 5: -// svga->render = svga_render_24bpp_highres; + if (mach64->type != MACH64_GX) + svga->render = svga_render_24bpp_highres; svga->hdisp *= 8; svga->rowoffset = (svga->rowoffset * 3) / 2; break; case 6: -// svga->render = svga_render_32bpp_highres; + if (mach64->type != MACH64_GX) + svga->render = svga_render_32bpp_highres; svga->hdisp *= 8; svga->rowoffset *= 2; break; } svga->vrammask = mach64->vram_mask; -// pclog("mach64_recalctimings : frame %i,%i disp %i,%i vsync at %i rowoffset %i pixel clock %f MA %08X\n", svga->htotal, svga->vtotal, svga->hdisp, svga->dispend, svga->vsyncstart, svga->rowoffset, svga->clock, svga->ma); } else { @@ -430,11 +470,11 @@ void mach64_updatemapping(mach64_t *mach64) mem_mapping_disable(&mach64->linear_mapping); mem_mapping_disable(&mach64->mmio_mapping); mem_mapping_disable(&mach64->mmio_linear_mapping); + mem_mapping_disable(&mach64->mmio_linear_mapping_2); return; } mem_mapping_disable(&mach64->mmio_mapping); -// pclog("Write mapping %02X\n", val); switch (svga->gdcreg[6] & 0xc) { case 0x0: /*128k at A0000*/ @@ -465,30 +505,41 @@ void mach64_updatemapping(mach64_t *mach64) } if (mach64->linear_base) { - if ((mach64->config_cntl & 3) == 2) - { - /*8 MB aperture*/ - pclog("8 MB aperture\n"); - mem_mapping_set_addr(&mach64->linear_mapping, mach64->linear_base, 0x007FFC00); - mem_mapping_set_addr(&mach64->mmio_linear_mapping, mach64->linear_base + 0x007FFC00, 0x400); - } - else - { - /*4 MB aperture*/ - pclog("4 MB aperture\n"); - mem_mapping_set_addr(&mach64->linear_mapping, mach64->linear_base, 0x003FFC00); - mem_mapping_set_addr(&mach64->mmio_linear_mapping, mach64->linear_base + 0x003FFC00, 0x400); - } - svga->linear_base = mach64->linear_base; + if (mach64->type == MACH64_GX) + { + if ((mach64->config_cntl & 3) == 2) + { + /*8 MB aperture*/ + pclog("8 MB aperture\n"); + mem_mapping_set_addr(&mach64->linear_mapping, mach64->linear_base, 0x007FFC00); + mem_mapping_set_addr(&mach64->mmio_linear_mapping, mach64->linear_base + 0x007FFC00, 0x400); + } + else + { + /*4 MB aperture*/ + pclog("4 MB aperture\n"); + mem_mapping_set_addr(&mach64->linear_mapping, mach64->linear_base, 0x003FFC00); + mem_mapping_set_addr(&mach64->mmio_linear_mapping, mach64->linear_base + 0x003FFC00, 0x400); + } + svga->linear_base = mach64->linear_base; + } + else + { + /*2*8 MB aperture*/ + mem_mapping_set_addr(&mach64->linear_mapping, mach64->linear_base, (8 << 20) - 0x4000); + mem_mapping_set_addr(&mach64->mmio_linear_mapping, mach64->linear_base + ((8 << 20) - 0x4000), 0x4000); + mem_mapping_set_addr(&mach64->mmio_linear_mapping_2, mach64->linear_base + ((16 << 20) - 0x4000), 0x4000); + } } else { mem_mapping_disable(&mach64->linear_mapping); mem_mapping_disable(&mach64->mmio_linear_mapping); + mem_mapping_disable(&mach64->mmio_linear_mapping_2); } } -static inline void wake_fifo_thread(mach64_t *mach64) +static __inline void wake_fifo_thread(mach64_t *mach64) { thread_set_event(mach64->wake_fifo_thread); /*Wake up FIFO thread if moving from idle*/ } @@ -520,7 +571,6 @@ static void mach64_wait_fifo_idle(mach64_t *mach64) static void mach64_accel_write_fifo(mach64_t *mach64, uint32_t addr, uint8_t val) { -// pclog("mach64_accel_write_fifo: addr=%08x val=%02x\n", addr, val); switch (addr & 0x3ff) { case 0x100: case 0x101: case 0x102: case 0x103: @@ -543,8 +593,8 @@ static void mach64_accel_write_fifo(mach64_t *mach64, uint32_t addr, uint8_t val case 0x11e: case 0x11f: WRITE8(addr, mach64->dst_height_width, val); case 0x113: - if ((addr & 0x3ff) == 0x11b || (addr & 0x3ff) == 0x11f || - ((addr & 0x3ff) == 0x113) && !(val & 0x80)) + if (((addr & 0x3ff) == 0x11b) || ((addr & 0x3ff) == 0x11f) || + (((addr & 0x3ff) == 0x113) && !(val & 0x80))) { mach64_start_fill(mach64); #ifdef MACH64_DEBUG @@ -725,7 +775,6 @@ static void mach64_accel_write_fifo(mach64_t *mach64, uint32_t addr, uint8_t val } static void mach64_accel_write_fifo_w(mach64_t *mach64, uint32_t addr, uint16_t val) { -// pclog("mach64_accel_write_fifo_w: addr=%08x val=%04x\n", addr, val); switch (addr & 0x3fe) { case 0x200: case 0x202: case 0x204: case 0x206: @@ -753,7 +802,6 @@ static void mach64_accel_write_fifo_w(mach64_t *mach64, uint32_t addr, uint16_t } static void mach64_accel_write_fifo_l(mach64_t *mach64, uint32_t addr, uint32_t val) { -// pclog("mach64_accel_write_fifo_l: addr=%08x %02x val=%08x\n", addr, addr >> 2, val); switch (addr & 0x3fc) { case 0x32c: @@ -788,6 +836,10 @@ static void mach64_accel_write_fifo_l(mach64_t *mach64, uint32_t addr, uint32_t static void fifo_thread(void *param) { mach64_t *mach64 = (mach64_t *)param; + fifo_entry_t *fifo; + + uint64_t start_time = 0; + uint64_t end_time = 0; while (1) { @@ -797,10 +849,8 @@ static void fifo_thread(void *param) mach64->blitter_busy = 1; while (!FIFO_EMPTY) { - uint64_t start_time = timer_read(); - uint64_t end_time; - fifo_entry_t *fifo = &mach64->fifo[mach64->fifo_read_idx & FIFO_MASK]; - uint32_t val = fifo->val; + start_time = timer_read(); + fifo = &mach64->fifo[mach64->fifo_read_idx & FIFO_MASK]; switch (fifo->addr_type & FIFO_TYPE) { @@ -831,7 +881,6 @@ static void fifo_thread(void *param) static void mach64_queue(mach64_t *mach64, uint32_t addr, uint32_t val, uint32_t type) { fifo_entry_t *fifo = &mach64->fifo[mach64->fifo_write_idx & FIFO_MASK]; - int c; if (FIFO_FULL) { @@ -853,7 +902,6 @@ static void mach64_queue(mach64_t *mach64, uint32_t addr, uint32_t val, uint32_t void mach64_cursor_dump(mach64_t *mach64) { - svga_t *svga = &mach64->svga; /* pclog("Mach64 cursor :\n"); pclog("Ena = %i X = %i Y = %i Addr = %05X Xoff = %i Yoff = %i\n", svga->hwcursor.ena, svga->hwcursor.x, svga->hwcursor.y, svga->hwcursor.addr, svga->hwcursor.xoff, svga->hwcursor.yoff);*/ } @@ -918,11 +966,6 @@ void mach64_start_fill(mach64_t *mach64) mach64->accel.dst_size = mach64_width[mach64->accel.dst_pix_width]; mach64->accel.src_size = mach64_width[mach64->accel.src_pix_width]; mach64->accel.host_size = mach64_width[mach64->accel.host_pix_width]; - -/* mach64->accel.src_x *= mach64_inc[mach64->accel.src_pix_width]; - mach64->accel.src_pitch *= mach64_inc[mach64->accel.src_pix_width]; - mach64->accel.dst_x *= mach64_inc[mach64->accel.dst_pix_width]; - mach64->accel.dst_pitch *= mach64_inc[mach64->accel.dst_pix_width];*/ if (mach64->accel.src_size == WIDTH_1BIT) mach64->accel.src_offset <<= 3; @@ -934,39 +977,24 @@ void mach64_start_fill(mach64_t *mach64) else mach64->accel.dst_offset >>= mach64->accel.dst_size; -/* if (mach64->accel.source_fg == SRC_BLITSRC || mach64->accel.source_bg == SRC_BLITSRC) - {*/ - mach64->accel.xinc = (mach64->dst_cntl & DST_X_DIR) ? 1 : -1; - mach64->accel.yinc = (mach64->dst_cntl & DST_Y_DIR) ? 1 : -1; -/* } - else - { - mach64->accel.xinc = mach64_inc[mach64->accel.src_pix_width]; - mach64->accel.yinc = 1; - }*/ + mach64->accel.xinc = (mach64->dst_cntl & DST_X_DIR) ? 1 : -1; + mach64->accel.yinc = (mach64->dst_cntl & DST_Y_DIR) ? 1 : -1; mach64->accel.source_host = ((mach64->dp_src & 7) == SRC_HOST) || (((mach64->dp_src >> 8) & 7) == SRC_HOST); - - -// pclog("mach64_start_fill : pattern %08X %08X\n", mach64->pat_reg0, mach64->pat_reg1); + for (y = 0; y < 8; y++) { for (x = 0; x < 8; x++) { uint32_t temp = (y & 4) ? mach64->pat_reg1 : mach64->pat_reg0; mach64->accel.pattern[y][x] = (temp >> (x + ((y & 3) * 8))) & 1; -// pclog("%i ", mach64->accel.pattern[y][x]); } -// pclog("\n"); } mach64->accel.sc_left = mach64->sc_left_right & 0x1fff; mach64->accel.sc_right = (mach64->sc_left_right >> 16) & 0x1fff; mach64->accel.sc_top = mach64->sc_top_bottom & 0x7fff; mach64->accel.sc_bottom = (mach64->sc_top_bottom >> 16) & 0x7fff; - -/* mach64->accel.sc_left *= mach64_inc[mach64->accel.dst_pix_width]; - mach64->accel.sc_right *= mach64_inc[mach64->accel.dst_pix_width];*/ mach64->accel.dp_frgd_clr = mach64->dp_frgd_clr; mach64->accel.dp_bkgd_clr = mach64->dp_bkgd_clr; @@ -1411,8 +1439,6 @@ void mach64_blit(uint32_t cpu_dat, int count, mach64_t *mach64) } READ(mach64->accel.dst_offset + (mach64->accel.dst_y * mach64->accel.dst_pitch) + mach64->accel.dst_x, dest_dat, mach64->accel.dst_size); - -// pclog("Blit %i,%i %i,%i %X %X %i %02X %02X %i ", mach64->accel.src_x, mach64->accel.src_y, mach64->accel.dst_x, mach64->accel.dst_y, (mach64->accel.src_offset + (mach64->accel.src_y * mach64->accel.src_pitch) + mach64->accel.src_x) & 0x7fffff, (mach64->accel.dst_offset + (mach64->accel.dst_y * mach64->accel.dst_pitch) + mach64->accel.dst_x) & 0x7fffff, count, src_dat, dest_dat, mix); switch (mach64->accel.clr_cmp_fn) { @@ -1430,8 +1456,6 @@ void mach64_blit(uint32_t cpu_dat, int count, mach64_t *mach64) if (!cmp_clr) MIX -// pclog("%02X %i\n", dest_dat, mach64->accel.dst_height); - WRITE(mach64->accel.dst_offset + (mach64->accel.dst_y * mach64->accel.dst_pitch) + mach64->accel.dst_x, mach64->accel.dst_size); } @@ -1569,11 +1593,113 @@ void mach64_load_context(mach64_t *mach64) } } +#define PLL_REF_DIV 0x2 +#define VCLK_POST_DIV 0x6 +#define VCLK0_FB_DIV 0x7 + +static void pll_write(mach64_t *mach64, uint32_t addr, uint8_t val) +{ + int c; + + switch (addr & 3) + { + case 0: /*Clock sel*/ + break; + case 1: /*Addr*/ + mach64->pll_addr = (val >> 2) & 0xf; + break; + case 2: /*Data*/ + mach64->pll_regs[mach64->pll_addr] = val; + pclog("pll_write %02x,%02x\n", mach64->pll_addr, val); + + for (c = 0; c < 4; c++) + { + double m = (double)mach64->pll_regs[PLL_REF_DIV]; + double n = (double)mach64->pll_regs[VCLK0_FB_DIV+c]; + double r = 14318184.0; + double p = (double)(1 << ((mach64->pll_regs[VCLK_POST_DIV] >> (c*2)) & 3)); + + pclog("PLLfreq %i = %g %g m=%02x n=%02x p=%02x\n", c, (2.0 * r * n) / (m * p), p, mach64->pll_regs[PLL_REF_DIV], mach64->pll_regs[VCLK0_FB_DIV+c], mach64->pll_regs[VCLK_POST_DIV]); + mach64->pll_freq[c] = (2.0 * r * n) / (m * p); + pclog(" %g\n", mach64->pll_freq[c]); + } + break; + } +} + +#define OVERLAY_EN (1 << 30) +static void mach64_vblank_start(svga_t *svga) +{ + mach64_t *mach64 = (mach64_t *)svga->p; + int overlay_cmp_mix = (mach64->overlay_key_cntl >> 8) & 0xf; + + mach64->crtc_int_cntl |= 4; + + svga->overlay.x = (mach64->overlay_y_x_start >> 16) & 0x7ff; + svga->overlay.y = mach64->overlay_y_x_start & 0x7ff; + + svga->overlay.xsize = ((mach64->overlay_y_x_end >> 16) & 0x7ff) - svga->overlay.x; + svga->overlay.ysize = (mach64->overlay_y_x_end & 0x7ff) - svga->overlay.y; + + svga->overlay.addr = mach64->buf_offset[0] & 0x3ffff8; + svga->overlay.pitch = mach64->buf_pitch[0] & 0xfff; + + svga->overlay.ena = (mach64->overlay_scale_cntl & OVERLAY_EN) && (overlay_cmp_mix != 1); + + mach64->overlay_v_acc = 0; + mach64->scaler_update = 1; +} + uint8_t mach64_ext_readb(uint32_t addr, void *p) { mach64_t *mach64 = (mach64_t *)p; uint8_t ret; - switch (addr & 0x3ff) + if (!(addr & 0x400)) + { + switch (addr & 0x3ff) + { + case 0x00: case 0x01: case 0x02: case 0x03: + READ8(addr, mach64->overlay_y_x_start); + break; + case 0x04: case 0x05: case 0x06: case 0x07: + READ8(addr, mach64->overlay_y_x_end); + break; + case 0x08: case 0x09: case 0x0a: case 0x0b: + READ8(addr, mach64->overlay_video_key_clr); + break; + case 0x0c: case 0x0d: case 0x0e: case 0x0f: + READ8(addr, mach64->overlay_video_key_msk); + break; + case 0x10: case 0x11: case 0x12: case 0x13: + READ8(addr, mach64->overlay_graphics_key_clr); + break; + case 0x14: case 0x15: case 0x16: case 0x17: + READ8(addr, mach64->overlay_graphics_key_msk); + break; + case 0x18: case 0x19: case 0x1a: case 0x1b: + READ8(addr, mach64->overlay_key_cntl); + break; + + case 0x20: case 0x21: case 0x22: case 0x23: + READ8(addr, mach64->overlay_scale_inc); + break; + case 0x24: case 0x25: case 0x26: case 0x27: + READ8(addr, mach64->overlay_scale_cntl); + break; + case 0x28: case 0x29: case 0x2a: case 0x2b: + READ8(addr, mach64->scaler_height_width); + break; + + case 0x4a: + ret = mach64->scaler_format; + break; + + default: + ret = 0xff; + break; + } + } + else switch (addr & 0x3ff) { case 0x00: case 0x01: case 0x02: case 0x03: READ8(addr, mach64->crtc_h_total_disp); @@ -1613,6 +1739,12 @@ uint8_t mach64_ext_readb(uint32_t addr, void *p) READ8(addr, mach64->ovr_wid_top_bottom); break; + case 0x60: case 0x61: case 0x62: case 0x63: + READ8(addr, mach64->cur_clr0); + break; + case 0x64: case 0x65: case 0x66: case 0x67: + READ8(addr, mach64->cur_clr1); + break; case 0x68: case 0x69: case 0x6a: case 0x6b: READ8(addr, mach64->cur_offset); break; @@ -1630,6 +1762,10 @@ uint8_t mach64_ext_readb(uint32_t addr, void *p) READ8(addr, mach64->scratch_reg1); break; + case 0x79: + ret = 0x30; + break; + case 0x90: case 0x91: case 0x92: case 0x93: READ8(addr, mach64->clock_cntl); break; @@ -1639,18 +1775,33 @@ uint8_t mach64_ext_readb(uint32_t addr, void *p) break; case 0xc0: case 0xc1: case 0xc2: case 0xc3: - ret = ati68860_ramdac_in((addr & 3) | ((mach64->dac_cntl & 3) << 2), &mach64->ramdac, &mach64->svga); + if (mach64->type == MACH64_GX) + ret = ati68860_ramdac_in((addr & 3) | ((mach64->dac_cntl & 3) << 2), &mach64->ramdac, &mach64->svga); + else + ret = ati68860_ramdac_in(addr & 3, &mach64->ramdac, &mach64->svga); break; case 0xc4: case 0xc5: case 0xc6: case 0xc7: + if (mach64->type == MACH64_VT2) + mach64->dac_cntl |= (4 << 24); READ8(addr, mach64->dac_cntl); break; case 0xd0: case 0xd1: case 0xd2: case 0xd3: READ8(addr, mach64->gen_test_cntl); break; - + + case 0xdc: case 0xdd: case 0xde: case 0xdf: + if (mach64->type == MACH64_GX) + mach64->config_cntl = (mach64->config_cntl & ~0x3ff0) | ((mach64->linear_base >> 22) << 4); + else + mach64->config_cntl = (mach64->config_cntl & ~0x3ff0) | ((mach64->linear_base >> 24) << 4); + READ8(addr, mach64->config_cntl); + break; case 0xe0: case 0xe1: case 0xe2: case 0xe3: - READ8(addr, 0x020000d7); /*88800GX-2*/ + READ8(addr, mach64->config_chip_id); + break; + case 0xe4: case 0xe5: case 0xe6: case 0xe7: + READ8(addr, mach64->config_stat0); break; case 0x100: case 0x101: case 0x102: case 0x103: @@ -1872,9 +2023,15 @@ uint8_t mach64_ext_readb(uint32_t addr, void *p) } uint16_t mach64_ext_readw(uint32_t addr, void *p) { - mach64_t *mach64 = (mach64_t *)p; uint16_t ret; - switch (addr & 0x3ff) + if (!(addr & 0x400)) + { +#ifdef MACH64_DEBUG + pclog("nmach64_ext_readw: addr=%04x %04x(%08x):%08x\n", addr, CS, cs, cpu_state.pc); +#endif + ret = 0xffff; + } + else switch (addr & 0x3ff) { default: #ifdef MACH64_DEBUG @@ -1896,7 +2053,11 @@ uint32_t mach64_ext_readl(uint32_t addr, void *p) { mach64_t *mach64 = (mach64_t *)p; uint32_t ret; - switch (addr & 0x3ff) + if (!(addr & 0x400)) + { + ret = 0xffffffff; + } + else switch (addr & 0x3ff) { case 0x18: ret = mach64->crtc_int_cntl & ~1; @@ -1933,9 +2094,69 @@ void mach64_ext_writeb(uint32_t addr, uint8_t val, void *p) mach64_t *mach64 = (mach64_t *)p; svga_t *svga = &mach64->svga; #ifdef MACH64_DEBUG - pclog("mach64_ext_writeb : addr %08X val %02X\n", addr, val); + pclog("mach64_ext_writeb : addr %08X val %02X %04x(%08x):%08x\n", addr, val, CS,cs,cpu_state.pc); #endif - if (addr & 0x300) + if (!(addr & 0x400)) + { + switch (addr & 0x3ff) + { + case 0x00: case 0x01: case 0x02: case 0x03: + WRITE8(addr, mach64->overlay_y_x_start, val); + break; + case 0x04: case 0x05: case 0x06: case 0x07: + WRITE8(addr, mach64->overlay_y_x_end, val); + break; + case 0x08: case 0x09: case 0x0a: case 0x0b: + WRITE8(addr, mach64->overlay_video_key_clr, val); + break; + case 0x0c: case 0x0d: case 0x0e: case 0x0f: + WRITE8(addr, mach64->overlay_video_key_msk, val); + break; + case 0x10: case 0x11: case 0x12: case 0x13: + WRITE8(addr, mach64->overlay_graphics_key_clr, val); + break; + case 0x14: case 0x15: case 0x16: case 0x17: + WRITE8(addr, mach64->overlay_graphics_key_msk, val); + break; + case 0x18: case 0x19: case 0x1a: case 0x1b: + WRITE8(addr, mach64->overlay_key_cntl, val); + break; + + case 0x20: case 0x21: case 0x22: case 0x23: + WRITE8(addr, mach64->overlay_scale_inc, val); + break; + case 0x24: case 0x25: case 0x26: case 0x27: + WRITE8(addr, mach64->overlay_scale_cntl, val); + break; + case 0x28: case 0x29: case 0x2a: case 0x2b: + WRITE8(addr, mach64->scaler_height_width, val); + break; + + case 0x4a: + mach64->scaler_format = val & 0xf; + break; + + case 0x80: case 0x81: case 0x82: case 0x83: + WRITE8(addr, mach64->buf_offset[0], val); + break; + + case 0x8c: case 0x8d: case 0x8e: case 0x8f: + WRITE8(addr, mach64->buf_pitch[0], val); + break; + + case 0x98: case 0x99: case 0x9a: case 0x9b: + WRITE8(addr, mach64->buf_offset[1], val); + break; + + case 0xa4: case 0xa5: case 0xa6: case 0xa7: + WRITE8(addr, mach64->buf_pitch[1], val); + break; + } +#ifdef MACH64_DEBUG + pclog("nmach64_ext_writeb: addr=%04x val=%02x\n", addr, val); +#endif + } + else if (addr & 0x300) { mach64_queue(mach64, addr & 0x3ff, val, FIFO_WRITE_BYTE); } @@ -1961,7 +2182,9 @@ void mach64_ext_writeb(uint32_t addr, uint8_t val, void *p) break; case 0x18: - mach64->crtc_int_cntl = val; + mach64->crtc_int_cntl = (mach64->crtc_int_cntl & 0x75) | (val & ~0x75); + if (val & 4) + mach64->crtc_int_cntl &= ~4; break; case 0x1c: case 0x1d: case 0x1e: case 0x1f: @@ -1983,6 +2206,16 @@ void mach64_ext_writeb(uint32_t addr, uint8_t val, void *p) WRITE8(addr, mach64->ovr_wid_top_bottom, val); break; + case 0x60: case 0x61: case 0x62: case 0x63: + WRITE8(addr, mach64->cur_clr0, val); + if (mach64->type == MACH64_VT2) + mach64->ramdac.pallook[0] = makecol32((mach64->cur_clr0 >> 24) & 0xff, (mach64->cur_clr0 >> 16) & 0xff, (mach64->cur_clr0 >> 8) & 0xff); + break; + case 0x64: case 0x65: case 0x66: case 0x67: + WRITE8(addr, mach64->cur_clr1, val); + if (mach64->type == MACH64_VT2) + mach64->ramdac.pallook[1] = makecol32((mach64->cur_clr1 >> 24) & 0xff, (mach64->cur_clr1 >> 16) & 0xff, (mach64->cur_clr1 >> 8) & 0xff); + break; case 0x68: case 0x69: case 0x6a: case 0x6b: WRITE8(addr, mach64->cur_offset, val); svga->hwcursor.addr = (mach64->cur_offset & 0xfffff) * 8; @@ -2010,7 +2243,13 @@ void mach64_ext_writeb(uint32_t addr, uint8_t val, void *p) case 0x90: case 0x91: case 0x92: case 0x93: WRITE8(addr, mach64->clock_cntl, val); - ics2595_write(&mach64->ics2595, val & 0x40, val & 0xf); + if (mach64->type == MACH64_GX) + ics2595_write(&mach64->ics2595, val & 0x40, val & 0xf); + else + { + pll_write(mach64, addr, val); + mach64->ics2595.output_clock = mach64->pll_freq[mach64->clock_cntl & 3]; + } svga_recalctimings(&mach64->svga); break; @@ -2044,7 +2283,10 @@ void mach64_ext_writeb(uint32_t addr, uint8_t val, void *p) break; case 0xc0: case 0xc1: case 0xc2: case 0xc3: - ati68860_ramdac_out((addr & 3) | ((mach64->dac_cntl & 3) << 2), val, &mach64->ramdac, &mach64->svga); + if (mach64->type == MACH64_GX) + ati68860_ramdac_out((addr & 3) | ((mach64->dac_cntl & 3) << 2), val, &mach64->ramdac, &mach64->svga); + else + ati68860_ramdac_out(addr & 3, val, &mach64->ramdac, &mach64->svga); break; case 0xc4: case 0xc5: case 0xc6: case 0xc7: WRITE8(addr, mach64->dac_cntl, val); @@ -2054,12 +2296,21 @@ void mach64_ext_writeb(uint32_t addr, uint8_t val, void *p) case 0xd0: case 0xd1: case 0xd2: case 0xd3: WRITE8(addr, mach64->gen_test_cntl, val); -// if (val == 2) output = 3; ati_eeprom_write(&mach64->eeprom, mach64->gen_test_cntl & 0x10, mach64->gen_test_cntl & 2, mach64->gen_test_cntl & 1); mach64->gen_test_cntl = (mach64->gen_test_cntl & ~8) | (ati_eeprom_read(&mach64->eeprom) ? 8 : 0); svga->hwcursor.ena = mach64->gen_test_cntl & 0x80; mach64_cursor_dump(mach64); break; + + case 0xdc: case 0xdd: case 0xde: case 0xdf: + WRITE8(addr, mach64->config_cntl, val); + mach64_updatemapping(mach64); + break; + + case 0xe4: case 0xe5: case 0xe6: case 0xe7: + if (mach64->type != MACH64_GX) + WRITE8(addr, mach64->config_stat0, val); + break; } } void mach64_ext_writew(uint32_t addr, uint16_t val, void *p) @@ -2068,7 +2319,15 @@ void mach64_ext_writew(uint32_t addr, uint16_t val, void *p) #ifdef MACH64_DEBUG pclog("mach64_ext_writew : addr %08X val %04X\n", addr, val); #endif - if (addr & 0x300) + if (!(addr & 0x400)) + { +#ifdef MACH64_DEBUG + pclog("nmach64_ext_writew: addr=%04x val=%04x %04x(%08x):%08x\n", addr, val, CS, cs, cpu_state.pc); +#endif + mach64_ext_writeb(addr, val, p); + mach64_ext_writeb(addr + 1, val >> 8, p); + } + else if (addr & 0x300) { mach64_queue(mach64, addr & 0x3fe, val, FIFO_WRITE_WORD); } @@ -2093,7 +2352,15 @@ void mach64_ext_writel(uint32_t addr, uint32_t val, void *p) if ((addr & 0x3c0) != 0x200) pclog("mach64_ext_writel : addr %08X val %08X\n", addr, val); #endif - if (addr & 0x300) + if (!(addr & 0x400)) + { +#ifdef MACH64_DEBUG + pclog("nmach64_ext_writel: addr=%04x val=%08x %04x(%08x):%08x\n", addr, val, CS, cs, cpu_state.pc); +#endif + mach64_ext_writew(addr, val, p); + mach64_ext_writew(addr + 2, val >> 16, p); + } + else if (addr & 0x300) { mach64_queue(mach64, addr & 0x3fc, val, FIFO_WRITE_DWORD); } @@ -2116,93 +2383,101 @@ uint8_t mach64_ext_inb(uint16_t port, void *p) { mach64_t *mach64 = (mach64_t *)p; uint8_t ret; -// if (CS == 0x2be7) output = 3; switch (port) { case 0x02ec: case 0x02ed: case 0x02ee: case 0x02ef: case 0x7eec: case 0x7eed: case 0x7eee: case 0x7eef: - ret = mach64_ext_readb(0x00 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x00 | (port & 3), p); break; case 0x0aec: case 0x0aed: case 0x0aee: case 0x0aef: - ret = mach64_ext_readb(0x08 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x08 | (port & 3), p); break; case 0x0eec: case 0x0eed: case 0x0eee: case 0x0eef: - ret = mach64_ext_readb(0x0c | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x0c | (port & 3), p); break; case 0x12ec: case 0x12ed: case 0x12ee: case 0x12ef: - ret = mach64_ext_readb(0x10 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x10 | (port & 3), p); break; case 0x16ec: case 0x16ed: case 0x16ee: case 0x16ef: - ret = mach64_ext_readb(0x14 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x14 | (port & 3), p); break; case 0x1aec: - ret = mach64_ext_readb(0x18, p); + ret = mach64_ext_readb(0x400 | 0x18, p); break; case 0x1eec: case 0x1eed: case 0x1eee: case 0x1eef: - ret = mach64_ext_readb(0x1c | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x1c | (port & 3), p); break; case 0x22ec: case 0x22ed: case 0x22ee: case 0x22ef: - ret = mach64_ext_readb(0x40 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x40 | (port & 3), p); break; case 0x26ec: case 0x26ed: case 0x26ee: case 0x26ef: - ret = mach64_ext_readb(0x44 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x44 | (port & 3), p); break; case 0x2aec: case 0x2aed: case 0x2aee: case 0x2aef: - ret = mach64_ext_readb(0x48 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x48 | (port & 3), p); + break; + case 0x2eec: case 0x2eed: case 0x2eee: case 0x2eef: + ret = mach64_ext_readb(0x400 | 0x60 | (port & 3), p); break; + case 0x32ec: case 0x32ed: case 0x32ee: case 0x32ef: + ret = mach64_ext_readb(0x400 | 0x64 | (port & 3), p); + break; case 0x36ec: case 0x36ed: case 0x36ee: case 0x36ef: - ret = mach64_ext_readb(0x68 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x68 | (port & 3), p); break; case 0x3aec: case 0x3aed: case 0x3aee: case 0x3aef: - ret = mach64_ext_readb(0x6c | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x6c | (port & 3), p); break; case 0x3eec: case 0x3eed: case 0x3eee: case 0x3eef: - ret = mach64_ext_readb(0x70 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x70 | (port & 3), p); break; case 0x42ec: case 0x42ed: case 0x42ee: case 0x42ef: - ret = mach64_ext_readb(0x80 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x80 | (port & 3), p); break; case 0x46ec: case 0x46ed: case 0x46ee: case 0x46ef: - ret = mach64_ext_readb(0x84 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x84 | (port & 3), p); break; case 0x4aec: case 0x4aed: case 0x4aee: case 0x4aef: - ret = mach64_ext_readb(0x90 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x90 | (port & 3), p); break; case 0x52ec: case 0x52ed: case 0x52ee: case 0x52ef: - ret = mach64_ext_readb(0xb0 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0xb0 | (port & 3), p); break; case 0x56ec: - ret = mach64_ext_readb(0xb4, p); + ret = mach64_ext_readb(0x400 | 0xb4, p); break; case 0x56ed: case 0x56ee: - ret = mach64_ext_readb(0xb5, p); + ret = mach64_ext_readb(0x400 | 0xb5, p); break; case 0x5aec: - ret = mach64_ext_readb(0xb8, p); + ret = mach64_ext_readb(0x400 | 0xb8, p); break; case 0x5aed: case 0x5aee: - ret = mach64_ext_readb(0xb9, p); + ret = mach64_ext_readb(0x400 | 0xb9, p); break; case 0x5eec: case 0x5eed: case 0x5eee: case 0x5eef: - ret = ati68860_ramdac_in((port & 3) | ((mach64->dac_cntl & 3) << 2), &mach64->ramdac, &mach64->svga); + if (mach64->type == MACH64_GX) + ret = ati68860_ramdac_in((port & 3) | ((mach64->dac_cntl & 3) << 2), &mach64->ramdac, &mach64->svga); + else + ret = ati68860_ramdac_in(port & 3, &mach64->ramdac, &mach64->svga); break; case 0x62ec: case 0x62ed: case 0x62ee: case 0x62ef: - ret = mach64_ext_readb(0xc4 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0xc4 | (port & 3), p); break; case 0x66ec: case 0x66ed: case 0x66ee: case 0x66ef: - ret = mach64_ext_readb(0xd0 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0xd0 | (port & 3), p); break; case 0x6aec: case 0x6aed: case 0x6aee: case 0x6aef: @@ -2211,18 +2486,11 @@ uint8_t mach64_ext_inb(uint16_t port, void *p) break; case 0x6eec: case 0x6eed: case 0x6eee: case 0x6eef: - ret = mach64_ext_readb(0xe0 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0xe0 | (port & 3), p); break; - case 0x72ec: - if (PCI) - ret = 7 | (3 << 3); /*PCI, 256Kx16 DRAM*/ - else - ret = 6 | (3 << 3); /*VLB, 256Kx16 DRAM*/ - break; - case 0x72ed: - ret = 5 << 1; /*ATI-68860*/ - break; + case 0x72ec: case 0x72ed: case 0x72ee: case 0x72ef: + ret = mach64_ext_readb(0x400 | 0xe4 | (port & 3), p); default: ret = 0; @@ -2235,7 +2503,6 @@ uint8_t mach64_ext_inb(uint16_t port, void *p) } uint16_t mach64_ext_inw(uint16_t port, void *p) { - mach64_t *mach64 = (mach64_t *)p; uint16_t ret; switch (port) { @@ -2257,15 +2524,14 @@ uint16_t mach64_ext_inw(uint16_t port, void *p) } uint32_t mach64_ext_inl(uint16_t port, void *p) { - mach64_t *mach64 = (mach64_t *)p; uint32_t ret; switch (port) { case 0x56ec: - ret = mach64_ext_readl(0xb4, p); + ret = mach64_ext_readl(0x400 | 0xb4, p); break; case 0x5aec: - ret = mach64_ext_readl(0xb8, p); + ret = mach64_ext_readl(0x400 | 0xb8, p); break; default: @@ -2295,84 +2561,93 @@ void mach64_ext_outb(uint16_t port, uint8_t val, void *p) { case 0x02ec: case 0x02ed: case 0x02ee: case 0x02ef: case 0x7eec: case 0x7eed: case 0x7eee: case 0x7eef: - mach64_ext_writeb(0x00 | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0x00 | (port & 3), val, p); break; case 0x0aec: case 0x0aed: case 0x0aee: case 0x0aef: - mach64_ext_writeb(0x08 | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0x08 | (port & 3), val, p); break; case 0x0eec: case 0x0eed: case 0x0eee: case 0x0eef: - mach64_ext_writeb(0x0c | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0x0c | (port & 3), val, p); break; case 0x16ec: case 0x16ed: case 0x16ee: case 0x16ef: - mach64_ext_writeb(0x14 | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0x14 | (port & 3), val, p); break; case 0x1aec: - mach64_ext_writeb(0x18, val, p); + mach64_ext_writeb(0x400 | 0x18, val, p); break; case 0x1eec: case 0x1eed: case 0x1eee: case 0x1eef: - mach64_ext_writeb(0x1c | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0x1c | (port & 3), val, p); break; case 0x22ec: case 0x22ed: case 0x22ee: case 0x22ef: - mach64_ext_writeb(0x40 | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0x40 | (port & 3), val, p); break; case 0x26ec: case 0x26ed: case 0x26ee: case 0x26ef: - mach64_ext_writeb(0x44 | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0x44 | (port & 3), val, p); break; case 0x2aec: case 0x2aed: case 0x2aee: case 0x2aef: - mach64_ext_writeb(0x48 | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0x48 | (port & 3), val, p); + break; + case 0x2eec: case 0x2eed: case 0x2eee: case 0x2eef: + mach64_ext_writeb(0x400 | 0x60 | (port & 3), val, p); break; + case 0x32ec: case 0x32ed: case 0x32ee: case 0x32ef: + mach64_ext_writeb(0x400 | 0x64 | (port & 3), val, p); + break; case 0x36ec: case 0x36ed: case 0x36ee: case 0x36ef: - mach64_ext_writeb(0x68 | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0x68 | (port & 3), val, p); break; case 0x3aec: case 0x3aed: case 0x3aee: case 0x3aef: - mach64_ext_writeb(0x6c | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0x6c | (port & 3), val, p); break; case 0x3eec: case 0x3eed: case 0x3eee: case 0x3eef: - mach64_ext_writeb(0x70 | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0x70 | (port & 3), val, p); break; case 0x42ec: case 0x42ed: case 0x42ee: case 0x42ef: - mach64_ext_writeb(0x80 | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0x80 | (port & 3), val, p); break; case 0x46ec: case 0x46ed: case 0x46ee: case 0x46ef: - mach64_ext_writeb(0x84 | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0x84 | (port & 3), val, p); break; case 0x4aec: case 0x4aed: case 0x4aee: case 0x4aef: - mach64_ext_writeb(0x90 | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0x90 | (port & 3), val, p); break; case 0x52ec: case 0x52ed: case 0x52ee: case 0x52ef: - mach64_ext_writeb(0xb0 | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0xb0 | (port & 3), val, p); break; case 0x56ec: - mach64_ext_writeb(0xb4, val, p); + mach64_ext_writeb(0x400 | 0xb4, val, p); break; case 0x56ed: case 0x56ee: - mach64_ext_writeb(0xb5, val, p); + mach64_ext_writeb(0x400 | 0xb5, val, p); break; case 0x5aec: - mach64_ext_writeb(0xb8, val, p); + mach64_ext_writeb(0x400 | 0xb8, val, p); break; case 0x5aed: case 0x5aee: - mach64_ext_writeb(0xb9, val, p); + mach64_ext_writeb(0x400 | 0xb9, val, p); break; case 0x5eec: case 0x5eed: case 0x5eee: case 0x5eef: - ati68860_ramdac_out((port & 3) | ((mach64->dac_cntl & 3) << 2), val, &mach64->ramdac, &mach64->svga); + if (mach64->type == MACH64_GX) + ati68860_ramdac_out((port & 3) | ((mach64->dac_cntl & 3) << 2), val, &mach64->ramdac, &mach64->svga); + else + ati68860_ramdac_out(port & 3, val, &mach64->ramdac, &mach64->svga); break; case 0x62ec: case 0x62ed: case 0x62ee: case 0x62ef: - mach64_ext_writeb(0xc4 | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0xc4 | (port & 3), val, p); break; case 0x66ec: case 0x66ed: case 0x66ee: case 0x66ef: - mach64_ext_writeb(0xd0 | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0xd0 | (port & 3), val, p); break; case 0x6aec: case 0x6aed: case 0x6aee: case 0x6aef: @@ -2383,7 +2658,6 @@ void mach64_ext_outb(uint16_t port, uint8_t val, void *p) } void mach64_ext_outw(uint16_t port, uint16_t val, void *p) { - mach64_t *mach64 = (mach64_t *)p; #ifdef MACH64_DEBUG pclog("mach64_ext_outw : port %04X val %04X\n", port, val); #endif @@ -2403,7 +2677,6 @@ void mach64_ext_outw(uint16_t port, uint16_t val, void *p) } void mach64_ext_outl(uint16_t port, uint32_t val, void *p) { - mach64_t *mach64 = (mach64_t *)p; pclog("mach64_ext_outl : port %04X val %08X\n", port, val); switch (port) { @@ -2420,13 +2693,73 @@ void mach64_ext_outl(uint16_t port, uint32_t val, void *p) } } +static uint8_t mach64_block_inb(uint16_t port, void *p) +{ + mach64_t *mach64 = (mach64_t *)p; + uint8_t ret; + + ret = mach64_ext_readb(0x400 | (port & 0x3ff), mach64); +#ifdef MACH64_DEBUG + pclog("mach64_block_inb : port %04X ret %02X %04x:%04x\n", port, ret, CS,cpu_state.pc); +#endif + return ret; +} +static uint16_t mach64_block_inw(uint16_t port, void *p) +{ + mach64_t *mach64 = (mach64_t *)p; + uint16_t ret; + + ret = mach64_ext_readw(0x400 | (port & 0x3ff), mach64); +#ifdef MACH64_DEBUG + pclog("mach64_block_inw : port %04X ret %04X\n", port, ret); +#endif + return ret; +} +static uint32_t mach64_block_inl(uint16_t port, void *p) +{ + mach64_t *mach64 = (mach64_t *)p; + uint32_t ret; + + ret = mach64_ext_readl(0x400 | (port & 0x3ff), mach64); +#ifdef MACH64_DEBUG + pclog("mach64_block_inl : port %04X ret %08X\n", port, ret); +#endif + return ret; +} + +static void mach64_block_outb(uint16_t port, uint8_t val, void *p) +{ + mach64_t *mach64 = (mach64_t *)p; + +#ifdef MACH64_DEBUG + pclog("mach64_block_outb : port %04X val %02X\n ", port, val); +#endif + mach64_ext_writeb(0x400 | (port & 0x3ff), val, mach64); +} +static void mach64_block_outw(uint16_t port, uint16_t val, void *p) +{ + mach64_t *mach64 = (mach64_t *)p; + +#ifdef MACH64_DEBUG + pclog("mach64_block_outw : port %04X val %04X\n ", port, val); +#endif + mach64_ext_writew(0x400 | (port & 0x3ff), val, mach64); +} +static void mach64_block_outl(uint16_t port, uint32_t val, void *p) +{ + mach64_t *mach64 = (mach64_t *)p; + +#ifdef MACH64_DEBUG + pclog("mach64_block_outl : port %04X val %08X\n ", port, val); +#endif + mach64_ext_writel(0x400 | (port & 0x3ff), val, mach64); +} + void mach64_write(uint32_t addr, uint8_t val, void *p) { mach64_t *mach64 = (mach64_t *)p; svga_t *svga = &mach64->svga; -// pclog("mach64_write : %05X %02X ", addr, val); addr = (addr & 0x7fff) + mach64->bank_w[(addr >> 15) & 1]; -// pclog("%08X\n", addr); svga_write_linear(addr, val, svga); } @@ -2435,10 +2768,8 @@ uint8_t mach64_read(uint32_t addr, void *p) mach64_t *mach64 = (mach64_t *)p; svga_t *svga = &mach64->svga; uint8_t ret; -// pclog("mach64_read : %05X ", addr); addr = (addr & 0x7fff) + mach64->bank_r[(addr >> 15) & 1]; ret = svga_read_linear(addr, svga); -// pclog("%08X %02X\n", addr, ret); return ret; } @@ -2473,6 +2804,270 @@ void mach64_hwcursor_draw(svga_t *svga, int displine) svga->hwcursor_latch.addr += 16; } +#define CLAMP(x) do \ + { \ + if ((x) & ~0xff) \ + x = ((x) < 0) ? 0 : 0xff; \ + } \ + while (0) + +#define DECODE_ARGB1555() \ + do \ + { \ + for (x = 0; x < mach64->svga.overlay_latch.xsize; x++) \ + { \ + uint16_t dat = ((uint16_t *)src)[x]; \ + \ + int b = dat & 0x1f; \ + int g = (dat >> 5) & 0x1f; \ + int r = (dat >> 10) & 0x1f; \ + \ + b = (b << 3) | (b >> 2); \ + g = (g << 3) | (g >> 2); \ + r = (r << 3) | (r >> 2); \ + \ + mach64->overlay_dat[x] = (r << 16) | (g << 8) | b; \ + } \ + } while (0) + +#define DECODE_RGB565() \ + do \ + { \ + for (x = 0; x < mach64->svga.overlay_latch.xsize; x++) \ + { \ + uint16_t dat = ((uint16_t *)src)[x]; \ + \ + int b = dat & 0x1f; \ + int g = (dat >> 5) & 0x3f; \ + int r = (dat >> 11) & 0x1f; \ + \ + b = (b << 3) | (b >> 2); \ + g = (g << 2) | (g >> 4); \ + r = (r << 3) | (r >> 2); \ + \ + mach64->overlay_dat[x] = (r << 16) | (g << 8) | b; \ + } \ + } while (0) + +#define DECODE_ARGB8888() \ + do \ + { \ + for (x = 0; x < mach64->svga.overlay_latch.xsize; x++) \ + { \ + int b = src[0]; \ + int g = src[1]; \ + int r = src[2]; \ + src += 4; \ + \ + mach64->overlay_dat[x] = (r << 16) | (g << 8) | b; \ + } \ + } while (0) + +#define DECODE_VYUY422() \ + do \ + { \ + for (x = 0; x < mach64->svga.overlay_latch.xsize; x += 2) \ + { \ + uint8_t y1, y2; \ + int8_t u, v; \ + int dR, dG, dB; \ + int r, g, b; \ + \ + y1 = src[0]; \ + u = src[1] - 0x80; \ + y2 = src[2]; \ + v = src[3] - 0x80; \ + src += 4; \ + \ + dR = (359*v) >> 8; \ + dG = (88*u + 183*v) >> 8; \ + dB = (453*u) >> 8; \ + \ + r = y1 + dR; \ + CLAMP(r); \ + g = y1 - dG; \ + CLAMP(g); \ + b = y1 + dB; \ + CLAMP(b); \ + mach64->overlay_dat[x] = (r << 16) | (g << 8) | b; \ + \ + r = y2 + dR; \ + CLAMP(r); \ + g = y2 - dG; \ + CLAMP(g); \ + b = y2 + dB; \ + CLAMP(b); \ + mach64->overlay_dat[x+1] = (r << 16) | (g << 8) | b; \ + } \ + } while (0) + +#define DECODE_YVYU422() \ + do \ + { \ + for (x = 0; x < mach64->svga.overlay_latch.xsize; x += 2) \ + { \ + uint8_t y1, y2; \ + int8_t u, v; \ + int dR, dG, dB; \ + int r, g, b; \ + \ + u = src[0] - 0x80; \ + y1 = src[1]; \ + v = src[2] - 0x80; \ + y2 = src[3]; \ + src += 4; \ + \ + dR = (359*v) >> 8; \ + dG = (88*u + 183*v) >> 8; \ + dB = (453*u) >> 8; \ + \ + r = y1 + dR; \ + CLAMP(r); \ + g = y1 - dG; \ + CLAMP(g); \ + b = y1 + dB; \ + CLAMP(b); \ + mach64->overlay_dat[x] = (r << 16) | (g << 8) | b; \ + \ + r = y2 + dR; \ + CLAMP(r); \ + g = y2 - dG; \ + CLAMP(g); \ + b = y2 + dB; \ + CLAMP(b); \ + mach64->overlay_dat[x+1] = (r << 16) | (g << 8) | b; \ + } \ + } while (0) + +void mach64_overlay_draw(svga_t *svga, int displine) +{ + mach64_t *mach64 = (mach64_t *)svga->p; + int x; + int h_acc = 0; + int h_max = (mach64->scaler_height_width >> 16) & 0x3ff; + int h_inc = mach64->overlay_scale_inc >> 16; + int v_max = mach64->scaler_height_width & 0x3ff; + int v_inc = mach64->overlay_scale_inc & 0xffff; + uint32_t *p; + uint8_t *src = &svga->vram[svga->overlay.addr]; + int old_y = mach64->overlay_v_acc; + int y_diff; + int video_key_fn = mach64->overlay_key_cntl & 5; + int graphics_key_fn = (mach64->overlay_key_cntl >> 4) & 5; + int overlay_cmp_mix = (mach64->overlay_key_cntl >> 8) & 0xf; + + p = &((uint32_t *)buffer32->line[displine])[32 + mach64->svga.overlay_latch.x]; + + if (mach64->scaler_update) + { + switch (mach64->scaler_format) + { + case 0x3: + DECODE_ARGB1555(); + break; + case 0x4: + DECODE_RGB565(); + break; + case 0x6: + DECODE_ARGB8888(); + break; + case 0xb: + DECODE_VYUY422(); + break; + case 0xc: + DECODE_YVYU422(); + break; + + default: + pclog("Unknown Mach64 scaler format %x\n", mach64->scaler_format); + /*Fill buffer with something recognisably wrong*/ + for (x = 0; x < mach64->svga.overlay_latch.xsize; x++) + mach64->overlay_dat[x] = 0xff00ff; + break; + } + } + + if (overlay_cmp_mix == 2) + { + for (x = 0; x < mach64->svga.overlay_latch.xsize; x++) + { + int h = h_acc >> 12; + + p[x] = mach64->overlay_dat[h]; + + h_acc += h_inc; + if (h_acc > (h_max << 12)) + h_acc = (h_max << 12); + } + } + else + { + for (x = 0; x < mach64->svga.overlay_latch.xsize; x++) + { + int h = h_acc >> 12; + int gr_cmp = 0, vid_cmp = 0; + int use_video; + + switch (video_key_fn) + { + case 0: vid_cmp = 0; break; + case 1: vid_cmp = 1; break; + case 4: vid_cmp = ((mach64->overlay_dat[h] ^ mach64->overlay_video_key_clr) & mach64->overlay_video_key_msk); break; + case 5: vid_cmp = !((mach64->overlay_dat[h] ^ mach64->overlay_video_key_clr) & mach64->overlay_video_key_msk); break; + } + switch (graphics_key_fn) + { + case 0: gr_cmp = 0; break; + case 1: gr_cmp = 1; break; + case 4: gr_cmp = (((p[x]) ^ mach64->overlay_graphics_key_clr) & mach64->overlay_graphics_key_msk & 0xffffff); break; + case 5: gr_cmp = !(((p[x]) ^ mach64->overlay_graphics_key_clr) & mach64->overlay_graphics_key_msk & 0xffffff); break; + } + vid_cmp = vid_cmp ? -1 : 0; + gr_cmp = gr_cmp ? -1 : 0; + + switch (overlay_cmp_mix) + { + case 0x0: use_video = gr_cmp; break; + case 0x1: use_video = 0; break; + case 0x2: use_video = ~0; break; + case 0x3: use_video = ~gr_cmp; break; + case 0x4: use_video = ~vid_cmp; break; + case 0x5: use_video = gr_cmp ^ vid_cmp; break; + case 0x6: use_video = ~gr_cmp ^ vid_cmp; break; + case 0x7: use_video = vid_cmp; break; + case 0x8: use_video = ~gr_cmp | ~vid_cmp; break; + case 0x9: use_video = gr_cmp | ~vid_cmp; break; + case 0xa: use_video = ~gr_cmp | vid_cmp; break; + case 0xb: use_video = gr_cmp | vid_cmp; break; + case 0xc: use_video = gr_cmp & vid_cmp; break; + case 0xd: use_video = ~gr_cmp & vid_cmp; break; + case 0xe: use_video = gr_cmp & ~vid_cmp; break; + case 0xf: use_video = ~gr_cmp & ~vid_cmp; break; + } + + if (use_video) + p[x] = mach64->overlay_dat[h]; + + h_acc += h_inc; + if (h_acc > (h_max << 12)) + h_acc = (h_max << 12); + } + } + + mach64->overlay_v_acc += v_inc; + if (mach64->overlay_v_acc > (v_max << 12)) + mach64->overlay_v_acc = v_max << 12; + + y_diff = (mach64->overlay_v_acc >> 12) - (old_y >> 12); + + if (mach64->scaler_format == 6) + svga->overlay.addr += svga->overlay.pitch*4*y_diff; + else + svga->overlay.addr += svga->overlay.pitch*2*y_diff; + + mach64->scaler_update = y_diff; +} + static void mach64_io_remove(mach64_t *mach64) { int c; @@ -2488,6 +3083,9 @@ static void mach64_io_remove(mach64_t *mach64) } io_removehandler(0x01ce, 0x0002, mach64_in, NULL, NULL, mach64_out, NULL, NULL, mach64); + + if (mach64->block_decoded_io && mach64->block_decoded_io < 0x10000) + io_removehandler(mach64->block_decoded_io, 0x0400, mach64_block_inb, mach64_block_inw, mach64_block_inl, mach64_block_outb, mach64_block_outw, mach64_block_outl, mach64); } static void mach64_io_set(mach64_t *mach64) @@ -2507,41 +3105,48 @@ static void mach64_io_set(mach64_t *mach64) } io_sethandler(0x01ce, 0x0002, mach64_in, NULL, NULL, mach64_out, NULL, NULL, mach64); + + if (mach64->block_decoded_io && mach64->block_decoded_io < 0x10000) + io_sethandler(mach64->block_decoded_io, 0x0400, mach64_block_inb, mach64_block_inw, mach64_block_inl, mach64_block_outb, mach64_block_outw, mach64_block_outl, mach64); } uint8_t mach64_pci_read(int func, int addr, void *p) { mach64_t *mach64 = (mach64_t *)p; - svga_t *svga = &mach64->svga; - -// pclog("Mach64 PCI read %08X\n", addr); switch (addr) { case 0x00: return 0x02; /*ATi*/ case 0x01: return 0x10; - case 0x02: return 'X'; /*88800GX*/ - case 0x03: return 'G'; + case 0x02: return mach64->pci_id & 0xff; + case 0x03: return mach64->pci_id >> 8; case PCI_REG_COMMAND: return mach64->pci_regs[PCI_REG_COMMAND]; /*Respond to IO and memory accesses*/ case 0x07: return 1 << 1; /*Medium DEVSEL timing*/ - case 0x08: return 0; /*Revision ID*/ + case 0x08: /*Revision ID*/ + if (mach64->type == MACH64_GX) + return 0; + return 0x40; + case 0x09: return 0; /*Programming interface*/ - // case 0x0a: return 0x01; /*Supports VGA interface, XGA compatible*/ case 0x0a: return 0x00; case 0x0b: return 0x03; case 0x10: return 0x00; /*Linear frame buffer address*/ case 0x11: return 0x00; - // case 0x12: return mach64->linear_base >> 16; case 0x12: return 0x00; case 0x13: return mach64->linear_base >> 24; + case 0x14: return 0x01; /*Block decoded IO address*/ + case 0x15: return mach64->block_decoded_io >> 8; + case 0x16: return mach64->block_decoded_io >> 16; + case 0x17: return mach64->block_decoded_io >> 24; + case 0x30: return mach64->pci_regs[0x30] & 0x01; /*BIOS ROM address*/ case 0x31: return 0x00; case 0x32: return mach64->pci_regs[0x32]; @@ -2555,8 +3160,6 @@ uint32_t bios_base = 0x000c0000; void mach64_pci_write(int func, int addr, uint8_t val, void *p) { mach64_t *mach64 = (mach64_t *)p; - -// pclog("Mach64 PCI write %08X %02X\n", addr, val); switch (addr) { @@ -2571,6 +3174,10 @@ void mach64_pci_write(int func, int addr, uint8_t val, void *p) mach64_updatemapping(mach64); break; + case 0x12: + if (mach64->type == MACH64_VT2) + val = 0; + break; /* case 0x12: mach64->linear_base = (mach64->linear_base & 0xff000000) | ((val & 0x80) << 16); mach64_updatemapping(mach64); @@ -2580,6 +3187,37 @@ void mach64_pci_write(int func, int addr, uint8_t val, void *p) mach64_updatemapping(mach64); break; + case 0x15: + if (mach64->type == MACH64_VT2) + { + if (mach64->pci_regs[PCI_REG_COMMAND] & PCI_COMMAND_IO) + mach64_io_remove(mach64); + mach64->block_decoded_io = (mach64->block_decoded_io & 0xffff0000) | ((val & 0xfc) << 8); + if (mach64->pci_regs[PCI_REG_COMMAND] & PCI_COMMAND_IO) + mach64_io_set(mach64); + } + break; + case 0x16: + if (mach64->type == MACH64_VT2) + { + if (mach64->pci_regs[PCI_REG_COMMAND] & PCI_COMMAND_IO) + mach64_io_remove(mach64); + mach64->block_decoded_io = (mach64->block_decoded_io & 0xff00fc00) | (val << 16); + if (mach64->pci_regs[PCI_REG_COMMAND] & PCI_COMMAND_IO) + mach64_io_set(mach64); + } + break; + case 0x17: + if (mach64->type == MACH64_VT2) + { + if (mach64->pci_regs[PCI_REG_COMMAND] & PCI_COMMAND_IO) + mach64_io_remove(mach64); + mach64->block_decoded_io = (mach64->block_decoded_io & 0x00fffc00) | (val << 24); + if (mach64->pci_regs[PCI_REG_COMMAND] & PCI_COMMAND_IO) + mach64_io_set(mach64); + } + break; + case 0x30: case 0x32: case 0x33: mach64->pci_regs[addr] = val; if (mach64->pci_regs[0x30] & 0x01) @@ -2598,9 +3236,8 @@ void mach64_pci_write(int func, int addr, uint8_t val, void *p) } } -void *mach64gx_init() +static void *mach64_common_init() { - int c; mach64_t *mach64 = malloc(sizeof(mach64_t)); memset(mach64, 0, sizeof(mach64_t)); @@ -2611,15 +3248,15 @@ void *mach64gx_init() mach64_recalctimings, mach64_in, mach64_out, mach64_hwcursor_draw, - NULL); + mach64_overlay_draw); - rom_init(&mach64->bios_rom, "roms/mach64gx/bios.bin", 0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL); if (PCI) mem_mapping_disable(&mach64->bios_rom.mapping); - mem_mapping_add(&mach64->linear_mapping, 0, 0, svga_read_linear, svga_readw_linear, svga_readl_linear, svga_write_linear, svga_writew_linear, svga_writel_linear, NULL, 0, &mach64->svga); - mem_mapping_add(&mach64->mmio_linear_mapping, 0, 0, mach64_ext_readb, mach64_ext_readw, mach64_ext_readl, mach64_ext_writeb, mach64_ext_writew, mach64_ext_writel, NULL, 0, mach64); - mem_mapping_add(&mach64->mmio_mapping, 0xbfc00, 0x00400, mach64_ext_readb, mach64_ext_readw, mach64_ext_readl, mach64_ext_writeb, mach64_ext_writew, mach64_ext_writel, NULL, 0, mach64); + mem_mapping_add(&mach64->linear_mapping, 0, 0, svga_read_linear, svga_readw_linear, svga_readl_linear, svga_write_linear, svga_writew_linear, svga_writel_linear, NULL, 0, &mach64->svga); + mem_mapping_add(&mach64->mmio_linear_mapping, 0, 0, mach64_ext_readb, mach64_ext_readw, mach64_ext_readl, mach64_ext_writeb, mach64_ext_writew, mach64_ext_writel, NULL, 0, mach64); + mem_mapping_add(&mach64->mmio_linear_mapping_2, 0, 0, mach64_ext_readb, mach64_ext_readw, mach64_ext_readl, mach64_ext_writeb, mach64_ext_writew, mach64_ext_writel, NULL, 0, mach64); + mem_mapping_add(&mach64->mmio_mapping, 0xbc000, 0x04000, mach64_ext_readb, mach64_ext_readw, mach64_ext_readl, mach64_ext_writeb, mach64_ext_writew, mach64_ext_writel, NULL, 0, mach64); mem_mapping_disable(&mach64->mmio_mapping); mach64_io_set(mach64); @@ -2631,12 +3268,8 @@ void *mach64gx_init() mach64->pci_regs[0x32] = 0x0c; mach64->pci_regs[0x33] = 0x00; - ati_eeprom_load(&mach64->eeprom, "mach64.nvr", 1); - ati68860_ramdac_init(&mach64->ramdac); - mach64->dac_cntl = 5 << 16; /*ATI 68860 RAMDAC*/ - mach64->dst_cntl = 3; mach64->wake_fifo_thread = thread_create_event(); @@ -2646,17 +3279,66 @@ void *mach64gx_init() return mach64; } +static void *mach64gx_init() +{ + mach64_t *mach64 = mach64_common_init(); + + mach64->type = MACH64_GX; + mach64->pci_id = (int)'X' | ((int)'G' << 8); + mach64->config_chip_id = 0x020000d7; + mach64->dac_cntl = 5 << 16; /*ATI 68860 RAMDAC*/ + mach64->config_stat0 = (5 << 9) | (3 << 3); /*ATI-68860, 256Kx16 DRAM*/ + if (PCI) + mach64->config_stat0 |= 0; /*PCI, 256Kx16 DRAM*/ + else + mach64->config_stat0 |= 1; /*VLB, 256Kx16 DRAM*/ + + ati_eeprom_load(&mach64->eeprom, "mach64.nvr", 1); + + rom_init(&mach64->bios_rom, "roms/mach64gx/bios.bin", 0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL); + + return mach64; +} +static void *mach64vt2_init() +{ + mach64_t *mach64 = mach64_common_init(); + svga_t *svga = &mach64->svga; + + mach64->type = MACH64_VT2; + mach64->pci_id = 0x5654; + mach64->config_chip_id = 0x40005654; + mach64->dac_cntl = 1 << 16; /*Internal 24-bit DAC*/ + mach64->config_stat0 = 4; + + ati_eeprom_load(&mach64->eeprom, "mach64vt.nvr", 1); + + rom_init(&mach64->bios_rom, "roms/atimach64vt2pci.bin", 0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL); + + svga->vblank_start = mach64_vblank_start; + + return mach64; +} + int mach64gx_available() { return rom_present("roms/mach64gx/bios.bin"); } +int mach64vt2_available() +{ + return rom_present("roms/atimach64vt2pci.bin"); +} + void mach64_close(void *p) { mach64_t *mach64 = (mach64_t *)p; svga_close(&mach64->svga); + thread_kill(mach64->fifo_thread); + thread_destroy_event(mach64->wake_fifo_thread); + thread_destroy_event(mach64->fifo_not_full_event); + free(mach64); } @@ -2725,31 +3407,45 @@ void mach64_add_status_info(char *s, int max_len, void *p) static device_config_t mach64gx_config[] = { { - .name = "memory", - .description = "Memory size", - .type = CONFIG_SELECTION, - .selection = + "memory", "Memory size", CONFIG_SELECTION, "", 4, { { - .description = "1 MB", - .value = 1 + "1 MB", 1 }, { - .description = "2 MB", - .value = 2 + "2 MB", 2 }, { - .description = "4 MB", - .value = 4 + "4 MB", 4 }, { - .description = "" + "" } - }, - .default_int = 4 + } }, { - .type = -1 + "", "", -1 + } +}; + +static device_config_t mach64vt2_config[] = +{ + { + "memory", "Memory size", CONFIG_SELECTION, "", 4, + { + { + "2 MB", 2 + }, + { + "4 MB", 4 + }, + { + "" + } + } + }, + { + "", "", -1 } }; @@ -2765,3 +3461,16 @@ device_t mach64gx_device = mach64_add_status_info, mach64gx_config }; + +device_t mach64vt2_device = +{ + "ATI Mach64VT2", + DEVICE_PCI, + mach64vt2_init, + mach64_close, + mach64vt2_available, + mach64_speed_changed, + mach64_force_redraw, + mach64_add_status_info, + mach64vt2_config +}; diff --git a/src/vid_ati_mach64.h b/src/vid_ati_mach64.h index 95a7e9744..2db76fa79 100644 --- a/src/vid_ati_mach64.h +++ b/src/vid_ati_mach64.h @@ -1 +1,2 @@ extern device_t mach64gx_device; +extern device_t mach64vt2_device; diff --git a/src/vid_cga.c b/src/vid_cga.c index aeb0d3e73..a665e45d9 100644 --- a/src/vid_cga.c +++ b/src/vid_cga.c @@ -34,7 +34,6 @@ void cga_out(uint16_t addr, uint8_t val, void *p) { cga_t *cga = (cga_t *)p; uint8_t old; -// pclog("CGA_OUT %04X %02X\n", addr, val); switch (addr) { case 0x3D4: @@ -80,7 +79,6 @@ void cga_out(uint16_t addr, uint8_t val, void *p) uint8_t cga_in(uint16_t addr, void *p) { cga_t *cga = (cga_t *)p; -// pclog("CGA_IN %04X\n", addr); switch (addr) { case 0x3D4: @@ -96,7 +94,6 @@ uint8_t cga_in(uint16_t addr, void *p) void cga_write(uint32_t addr, uint8_t val, void *p) { cga_t *cga = (cga_t *)p; -// pclog("CGA_WRITE %04X %02X\n", addr, val); /* Horrible hack, I know, but it's the only way to fix the 440FX BIOS filling the VRAM with garbage until Tom fixes the memory emulation. */ if ((cs == 0xE0000) && (cpu_state.pc == 0xBF2F) && (romset == ROM_440FX)) return; if ((cs == 0xE0000) && (cpu_state.pc == 0xBF77) && (romset == ROM_440FX)) return; @@ -121,7 +118,6 @@ uint8_t cga_read(uint32_t addr, void *p) cga->charbuffer[(((int)(((cga->dispontime - cga->vidtime) * 2) / CGACONST)) & 0xfc) | 1] = cga->vram[addr & 0x3fff]; } egareads++; -// pclog("CGA_READ %04X\n", addr); return cga->vram[addr & 0x3fff]; } @@ -141,10 +137,8 @@ void cga_recalctimings(cga_t *cga) _dispontime = cga->crtc[1] << 1; } _dispofftime = disptime - _dispontime; -// printf("%i %f %f %f %i %i\n",cgamode&1,disptime,dispontime,dispofftime,crtc[0],crtc[1]); _dispontime *= CGACONST; _dispofftime *= CGACONST; -// printf("Timings - on %f off %f frame %f second %f\n",dispontime,dispofftime,(dispontime+dispofftime)*262.0,(dispontime+dispofftime)*262.0*59.92); cga->dispontime = (int)(_dispontime * (1 << TIMER_SHIFT)); cga->dispofftime = (int)(_dispofftime * (1 << TIMER_SHIFT)); } @@ -176,7 +170,6 @@ void cga_poll(void *p) { cga->firstline = cga->displine; video_wait_for_buffer(); -// printf("Firstline %i\n",firstline); } cga->lastline = cga->displine; for (c = 0; c < 8; c++) @@ -507,87 +500,63 @@ void cga_speed_changed(void *p) static device_config_t cga_config[] = { { - .name = "display_type", - .description = "Display type", - .type = CONFIG_SELECTION, - .selection = + "display_type", "Display type", CONFIG_SELECTION, "", CGA_RGB, { { - .description = "RGB", - .value = CGA_RGB + "RGB", CGA_RGB }, { - .description = "Composite", - .value = CGA_COMPOSITE + "Composite", CGA_COMPOSITE }, { - .description = "" + "" } - }, - .default_int = CGA_RGB + } }, { - .name = "composite_type", - .description = "Composite type", - .type = CONFIG_SELECTION, - .selection = + "composite_type", "Composite type", CONFIG_SELECTION, "", COMPOSITE_OLD, { { - .description = "Old", - .value = COMPOSITE_OLD + "Old", COMPOSITE_OLD }, { - .description = "New", - .value = COMPOSITE_NEW + "New", COMPOSITE_NEW }, { - .description = "" + "" } - }, - .default_int = COMPOSITE_OLD + } }, #ifndef __unix { - .name = "rgb_type", - .description = "RGB type", - .type = CONFIG_SELECTION, - .selection = + "rgb_type", "RGB type", CONFIG_SELECTION, "", 0, { { - .description = "Color", - .value = 0 + "Color", 0 }, { - .description = "Green Monochrome", - .value = 1 + "Green Monochrome", 1 }, { - .description = "Amber Monochrome", - .value = 2 + "Amber Monochrome", 2 }, { - .description = "Gray Monochrome", - .value = 3 + "Gray Monochrome", 3 }, { - .description = "Color (no brown)", - .value = 4 + "Color (no brown)", 4 }, { - .description = "" + "" } - }, - .default_int = 0 + } }, #endif { - .name = "snow_enabled", - .description = "Snow emulation", - .type = CONFIG_BINARY, - .default_int = 1 + "snow_enabled", "Snow emulation", CONFIG_BINARY, "", 1 }, { - .type = -1 + "", "", -1 } }; diff --git a/src/vid_cl_gd.c b/src/vid_cl_gd.c index b9b49c141..7c0899a95 100644 --- a/src/vid_cl_gd.c +++ b/src/vid_cl_gd.c @@ -648,6 +648,9 @@ uint8_t cirrus_mmio_blt_read(uint32_t address, void *p) case (CIRRUS_MMIO_BLTTRANSPARENTCOLORMASK + 1): value = svga->gdcreg[0x39]; break; + default: + value = 0xff; + break; } return value; diff --git a/src/vid_cl_gd_blit.c b/src/vid_cl_gd_blit.c index fbf63d72c..b312f0012 100644 --- a/src/vid_cl_gd_blit.c +++ b/src/vid_cl_gd_blit.c @@ -24,6 +24,8 @@ #define glue(a,b) glue_hidden(a,b) #define glue_hidden(a,b) a ## b +static uint8_t rop_to_index[256]; + int cl_gd_ABS(int sval) { if (sval < 0) @@ -65,11 +67,11 @@ bool blit_is_unsafe(clgd_t *clgd, svga_t *svga) return false; } -void cirrus_bitblt_rop_nop(clgd_t *clgd, uint8_t *dst, const uint8_t *src, int dstpitch, int srcpitch, int bltwidth, int bltheight) +void cirrus_bitblt_rop_nop(clgd_t *clgd, svga_t *svga, uint8_t *dst, const uint8_t *src, int dstpitch, int srcpitch, int bltwidth, int bltheight) { } -void cirrus_bitblt_fill_nop(clgd_t *clgd, uint8_t *dst, int dstpitch, int bltwidth, int bltheight) +void cirrus_bitblt_fill_nop(clgd_t *clgd, svga_t *svga, uint8_t *dst, int dstpitch, int bltwidth, int bltheight) { } @@ -346,7 +348,7 @@ const cirrus_fill_t cirrus_fill[16][4] = { ROP2(cirrus_fill_notsrc_and_notdst), }; -static inline void cirrus_bitblt_fgcol(clgd_t *clgd, svga_t *svga) +inline void cirrus_bitblt_fgcol(clgd_t *clgd, svga_t *svga) { unsigned int color; switch (clgd->blt.pixel_width) @@ -369,7 +371,7 @@ static inline void cirrus_bitblt_fgcol(clgd_t *clgd, svga_t *svga) } } -static inline void cirrus_bitblt_bgcol(clgd_t *clgd, svga_t *svga) +inline void cirrus_bitblt_bgcol(clgd_t *clgd, svga_t *svga) { unsigned int color; switch (clgd->blt.pixel_width) @@ -394,7 +396,7 @@ static inline void cirrus_bitblt_bgcol(clgd_t *clgd, svga_t *svga) void cirrus_invalidate_region(clgd_t *clgd, svga_t *svga, int off_begin, int off_pitch, int bytesperline, int lines) { - int y; + int x, y; int off_cur; int off_cur_end; @@ -404,6 +406,10 @@ void cirrus_invalidate_region(clgd_t *clgd, svga_t *svga, int off_begin, int off off_cur_end = ((off_cur + bytesperline) & svga->vrammask); // Memory region set dirty off_begin += off_pitch; + for (x = (off_cur >> 12); x <= (off_cur_end >> 12); x++) + { + svga->changedvram[x]++; + } } } @@ -818,4 +824,4 @@ void init_rops() rop_to_index[CIRRUS_ROP_NOTSRC] = 13; rop_to_index[CIRRUS_ROP_NOTSRC_OR_DST] = 14; rop_to_index[CIRRUS_ROP_NOTSRC_AND_NOTDST] = 15; -} \ No newline at end of file +} diff --git a/src/vid_cl_gd_blit.h b/src/vid_cl_gd_blit.h index c315ff3aa..ebf22eb56 100644 --- a/src/vid_cl_gd_blit.h +++ b/src/vid_cl_gd_blit.h @@ -1,5 +1,3 @@ -static uint8_t rop_to_index[256]; - #define le32_to_cpu(x) (x) #define le16_to_cpu(x) (x) diff --git a/src/vid_cl_gd_vga_rop.h b/src/vid_cl_gd_vga_rop.h index 2b2b263fc..d03516ba3 100644 --- a/src/vid_cl_gd_vga_rop.h +++ b/src/vid_cl_gd_vga_rop.h @@ -22,17 +22,17 @@ * THE SOFTWARE. */ -static inline void glue(rop_8_,ROP_NAME)(uint8_t *dst, uint8_t src) +inline void glue(rop_8_,ROP_NAME)(uint8_t *dst, uint8_t src) { *dst = ROP_FN(*dst, src); } -static inline void glue(rop_16_,ROP_NAME)(uint16_t *dst, uint16_t src) +inline void glue(rop_16_,ROP_NAME)(uint16_t *dst, uint16_t src) { *dst = ROP_FN(*dst, src); } -static inline void glue(rop_32_,ROP_NAME)(uint32_t *dst, uint32_t src) +inline void glue(rop_32_,ROP_NAME)(uint32_t *dst, uint32_t src) { *dst = ROP_FN(*dst, src); } diff --git a/src/vid_colorplus.c b/src/vid_colorplus.c index cb3ab38b3..13a661b04 100644 --- a/src/vid_colorplus.c +++ b/src/vid_colorplus.c @@ -33,7 +33,6 @@ void colorplus_out(uint16_t addr, uint8_t val, void *p) { colorplus_t *colorplus = (colorplus_t *)p; -// pclog("COLORPLUS_OUT %04X %02X\n", addr, val); if (addr == 0x3DD) { colorplus->control = val & 0x70; @@ -55,7 +54,6 @@ void colorplus_write(uint32_t addr, uint8_t val, void *p) { colorplus_t *colorplus = (colorplus_t *)p; -// pclog("COLORPLUS_WRITE %04X %02X\n", addr, val); if ((colorplus->control & COLORPLUS_PLANE_SWAP) && (colorplus->control & COLORPLUS_EITHER_MODE) && (colorplus->cga.cgamode & CGA_GRAPHICS_MODE)) @@ -97,7 +95,6 @@ uint8_t colorplus_read(uint32_t addr, void *p) colorplus->cga.charbuffer[(((int)(((colorplus->cga.dispontime - colorplus->cga.vidtime) * 2) / CGACONST)) & 0xfc) | 1] = colorplus->cga.vram[addr & 0x7fff]; } egareads++; -// pclog("COLORPLUS_READ %04X\n", addr); return colorplus->cga.vram[addr & 0x7fff]; } @@ -145,7 +142,6 @@ void colorplus_poll(void *p) { colorplus->cga.firstline = colorplus->cga.displine; video_wait_for_buffer(); -// printf("Firstline %i\n",firstline); } colorplus->cga.lastline = colorplus->cga.displine; /* Left / right border */ @@ -225,7 +221,7 @@ void colorplus_poll(void *p) for (c = 0; c < x; c++) buffer32->line[colorplus->cga.displine][c] = buffer->line[colorplus->cga.displine][c] & 0xf; - Composite_Process(&colorplus->cga, 0, x >> 2, buffer32->line[colorplus->cga.displine]); + Composite_Process(colorplus->cga.cgamode, 0, x >> 2, buffer32->line[colorplus->cga.displine]); } colorplus->cga.sc = oldsc; @@ -380,7 +376,7 @@ void *colorplus_standalone_init() colorplus->cga.vram = malloc(0x8000); - cga_comp_init(&colorplus->cga); + cga_comp_init(1); timer_add(colorplus_poll, &colorplus->cga.vidtime, TIMER_ALWAYS_ENABLED, colorplus); mem_mapping_add(&colorplus->cga.mapping, 0xb8000, 0x08000, colorplus_read, NULL, NULL, colorplus_write, NULL, NULL, NULL, 0, colorplus); io_sethandler(0x03d0, 0x0010, colorplus_in, NULL, NULL, colorplus_out, NULL, NULL, colorplus); @@ -406,53 +402,38 @@ void colorplus_speed_changed(void *p) static device_config_t colorplus_config[] = { { - .name = "display_type", - .description = "Display type", - .type = CONFIG_SELECTION, - .selection = + "display_type", "Display type", CONFIG_SELECTION, "", CGA_RGB, { { - .description = "RGB", - .value = CGA_RGB + "RGB", CGA_RGB }, { - .description = "Composite", - .value = CGA_COMPOSITE + "Composite", CGA_COMPOSITE }, { - .description = "" + "" } - }, - .default_int = CGA_RGB + } }, { - .name = "composite_type", - .description = "Composite type", - .type = CONFIG_SELECTION, - .selection = + "composite_type", "Composite type", CONFIG_SELECTION, "", COMPOSITE_OLD, { { - .description = "Old", - .value = COMPOSITE_OLD + "Old", COMPOSITE_OLD }, { - .description = "New", - .value = COMPOSITE_NEW + "New", COMPOSITE_NEW }, { - .description = "" + "" } - }, - .default_int = COMPOSITE_OLD + } }, { - .name = "snow_enabled", - .description = "Snow emulation", - .type = CONFIG_BINARY, - .default_int = 1 + "snow_enabled", "Snow emulation", CONFIG_BINARY, "", 1 }, { - .type = -1 + "", "", -1 } }; diff --git a/src/vid_ega.c b/src/vid_ega.c index a900b3e49..2e98235d3 100644 --- a/src/vid_ega.c +++ b/src/vid_ega.c @@ -20,6 +20,8 @@ int egaswitchread,egaswitches=9; /*7=CGA mode (200 lines), 9=EGA mode (350 lines static int old_overscan_color = 0; +int update_overscan = 0; + void ega_out(uint16_t addr, uint8_t val, void *p) { ega_t *ega = (ega_t *)p; @@ -104,7 +106,6 @@ void ega_out(uint16_t addr, uint8_t val, void *p) ega->chain2_read = val & 0x10; break; case 6: -// pclog("Write mapping %02X\n", val); switch (val & 0xc) { case 0x0: /*128k at A0000*/ @@ -128,14 +129,10 @@ void ega_out(uint16_t addr, uint8_t val, void *p) break; case 0x3d0: case 0x3d4: - // pclog("Write 3d4 %02X %04X:%04X\n", val, CS, cpu_state.pc); ega->crtcreg = val & 31; return; case 0x3d1: case 0x3d5: - // pclog("Write 3d5 %02X %02X %02X\n", ega->crtcreg, val, ega->crtc[0x11]); -// if (ega->crtcreg == 1 && val == 0x14) -// fatal("Here\n"); if (ega->crtcreg <= 7 && ega->crtc[0x11] & 0x80) return; old = ega->crtc[ega->crtcreg]; ega->crtc[ega->crtcreg] = val; @@ -177,8 +174,6 @@ uint8_t ega_in(uint16_t addr, void *p) { ega_t *ega = (ega_t *)p; -if (addr != 0x3da && addr != 0x3ba) - // pclog("ega_in %04X\n", addr); if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(ega->miscout & 1)) addr ^= 0x60; @@ -189,7 +184,6 @@ if (addr != 0x3da && addr != 0x3ba) case 0x3c1: return ega->attrregs[ega->attraddr]; case 0x3c2: -// printf("Read egaswitch %02X %02X %i\n",egaswitchread,egaswitches,VGA); return ega_get_input_status_0(ega); break; case 0x3c4: @@ -215,7 +209,6 @@ if (addr != 0x3da && addr != 0x3ba) ega->stat ^= 0x30; /*Fools IBM EGA video BIOS self-test*/ return ega->stat; } -// printf("Bad EGA read %04X %04X:%04X\n",addr,cs>>4,pc); return 0xff; } @@ -250,15 +243,12 @@ void ega_recalctimings(ega_t *ega) ega->rowoffset = ega->crtc[0x13]; - // printf("Recalc! %i %i %i %i %i %02X\n", ega->vtotal, ega->dispend, ega->vsyncstart, ega->split, ega->hdisp, ega->attrregs[0x16]); - if (ega->vidclock) crtcconst = (ega->seqregs[1] & 1) ? MDACONST : (MDACONST * (9.0 / 8.0)); else crtcconst = (ega->seqregs[1] & 1) ? CGACONST : (CGACONST * (9.0 / 8.0)); disptime = ega->crtc[0] + 2; _dispontime = ega->crtc[1] + 1; - // printf("Disptime %f dispontime %f hdisp %i\n", disptime, _dispontime, ega->crtc[1] * 8); if (ega->seqregs[1] & 8) { disptime*=2; @@ -270,11 +260,6 @@ void ega_recalctimings(ega_t *ega) ega->dispontime = (int)(_dispontime * (1 << TIMER_SHIFT)); ega->dispofftime = (int)(_dispofftime * (1 << TIMER_SHIFT)); - /* pclog("dispontime %i (%f) dispofftime %i (%f)\n", ega->dispontime, (float)ega->dispontime / (1 << TIMER_SHIFT), - ega->dispofftime, (float)ega->dispofftime / (1 << TIMER_SHIFT)); */ -// printf("EGA horiz total %i display end %i clock rate %i vidclock %i %i\n",crtc[0],crtc[1],egaswitchread,vidclock,((ega3c2>>2)&3) | ((tridentnewctrl2<<2)&4)); -// printf("EGA vert total %i display end %i max row %i vsync %i\n",ega_vtotal,ega_dispend,(crtc[9]&31)+1,ega_vsyncstart); -// printf("total %f on %f cycles off %f cycles frame %f sec %f %02X\n",disptime*crtcconst,dispontime,dispofftime,(dispontime+dispofftime)*ega_vtotal,(dispontime+dispofftime)*ega_vtotal*70,seqregs[1]); } void ega_poll(void *p) @@ -292,6 +277,7 @@ void ega_poll(void *p) int y_add_ex = enable_overscan ? 28 : 0; int x_add_ex = enable_overscan ? 16 : 0; uint32_t *q, *r, i, j; + int wx = 640, wy = 350; if (!ega->linepos) { @@ -524,7 +510,6 @@ void ega_poll(void *p) else { ega->vidtime += ega->dispontime; -// if (output) printf("Display on %f\n",vidtime); if (ega->dispon) ega->stat &= ~1; ega->linepos = 0; @@ -549,17 +534,14 @@ void ega_poll(void *p) } ega->vc++; ega->vc &= 1023; -// printf("Line now %i %i ma %05X\n",vc,displine,ma); if (ega->vc == ega->split) { -// printf("Split at line %i %i\n",displine,vc); ega->ma = ega->maback = 0; if (ega->attrregs[0x10] & 0x20) ega->scrollcache = 0; } if (ega->vc == ega->dispend) { -// printf("Display over at line %i %i\n",displine,vc); ega->dispon=0; if (ega->crtc[10] & 0x20) ega->cursoron = 0; else ega->cursoron = ega->blink & 16; @@ -572,21 +554,32 @@ void ega_poll(void *p) } if (ega->vc == ega->vsyncstart) { - int wx, wy; ega->dispon = 0; -// printf("Vsync on at line %i %i\n",displine,vc); ega->stat |= 8; if (ega->seqregs[1] & 8) x = ega->hdisp * ((ega->seqregs[1] & 1) ? 8 : 9) * 2; else x = ega->hdisp * ((ega->seqregs[1] & 1) ? 8 : 9); -// pclog("Cursor %02X %02X\n",crtc[10],crtc[11]); -// pclog("Firstline %i Lastline %i wx %i %i\n",firstline,lastline,wx,oddeven); -// doblit(); - if (x != xsize || (ega->lastline - ega->firstline) != ysize) + if ((x != xsize || (ega->lastline - ega->firstline) != ysize) || update_overscan) { xsize = x; ysize = ega->lastline - ega->firstline; - if (xsize < 64) xsize = 656; + if (xsize < 64) xsize = 640; if (ysize < 32) ysize = 200; + y_add = enable_overscan ? 14 : 0; + x_add = enable_overscan ? 8 : 0; + y_add_ex = enable_overscan ? 28 : 0; + x_add_ex = enable_overscan ? 16 : 0; + + if ((xsize > 2032) || (ysize > 2032)) + { + x_add = x_add_ex = 0; + y_add = y_add_ex = 0; + suppress_overscan = 1; + } + else + { + suppress_overscan = 0; + } + if (ega->vres) updatewindowsize(xsize + x_add_ex, (ysize << 1) + y_add_ex); else @@ -646,9 +639,7 @@ void ega_poll(void *p) ega->video_bpp = (ega->gdcreg[5] & 0x20) ? 2 : 4; } -// wakeupblit(); readflash=0; - //framecount++; ega->firstline = 2000; ega->lastline = 0; @@ -700,7 +691,6 @@ void ega_write(uint32_t addr, uint8_t val, void *p) if (!(ega->gdcreg[6] & 1)) fullchange = 2; -// pclog("%i %08X %i %i %02X %02X %02X %02X %02X\n",chain4,addr,writemode,writemask,gdcreg[8],vram[0],vram[1],vram[2],vram[3]); switch (ega->writemode) { case 1: @@ -730,7 +720,6 @@ void ega_write(uint32_t addr, uint8_t val, void *p) else valc = val; if (ega->gdcreg[1] & 8) vald = (ega->gdcreg[0] & 8) ? 0xff : 0; else vald = val; -// pclog("Write %02X %01X %02X %02X %02X %02X %02X\n",gdcreg[3]&0x18,writemask,vala,valb,valc,vald,gdcreg[8]); switch (ega->gdcreg[3] & 0x18) { case 0: /*Set*/ @@ -758,7 +747,6 @@ void ega_write(uint32_t addr, uint8_t val, void *p) if (writemask2 & 8) ega->vram[addr | 0x3] = (vald & ega->gdcreg[8]) ^ ega->ld; break; } -// pclog("- %02X %02X %02X %02X %08X\n",vram[addr],vram[addr|0x1],vram[addr|0x2],vram[addr|0x3],addr); } break; case 2: @@ -816,7 +804,6 @@ uint8_t ega_read(uint32_t addr, void *p) egareads++; cycles -= video_timing_b; cycles_lost += video_timing_b; -// pclog("Readega %06X ",addr); if (addr >= 0xb0000) addr &= 0x7fff; else addr &= 0xffff; @@ -901,11 +888,12 @@ void ega_common_defaults(ega_t *ega) ega->seqregs[4] |= 2; ega->extvram = 1; + + update_overscan = 0; } void *ega_standalone_init() { - int c, d, e; ega_t *ega = malloc(sizeof(ega_t)); memset(ega, 0, sizeof(ega_t)); @@ -944,7 +932,6 @@ void *ega_standalone_init() void *cpqega_standalone_init() { - int c, d, e; ega_t *ega = malloc(sizeof(ega_t)); memset(ega, 0, sizeof(ega_t)); @@ -956,7 +943,6 @@ void *cpqega_standalone_init() if (ega->bios_rom.rom[0x3ffe] == 0xaa && ega->bios_rom.rom[0x3fff] == 0x55) { int c; - // pclog("Read EGA ROM in reverse\n"); for (c = 0; c < 0x2000; c++) { @@ -967,25 +953,21 @@ void *cpqega_standalone_init() } ega->crtc[0] = 63; - // ega->crtc[6] = 255; ega->dispontime = 1000 * (1 << TIMER_SHIFT); ega->dispofftime = 1000 * (1 << TIMER_SHIFT); ega_init(ega); - // ega->attrregs[0x10] |= 0xF7; ega_common_defaults(ega); mem_mapping_add(&ega->mapping, 0xa0000, 0x20000, ega_read, NULL, NULL, ega_write, NULL, NULL, NULL, 0, ega); timer_add(ega_poll, &ega->vidtime, TIMER_ALWAYS_ENABLED, ega); - // io_sethandler(0x03a0, 0x0040, ega_in, NULL, NULL, ega_out, NULL, NULL, ega); io_sethandler(0x03c0, 0x0020, ega_in, NULL, NULL, ega_out, NULL, NULL, ega); return ega; } void *sega_standalone_init() { - int c, d, e; ega_t *ega = malloc(sizeof(ega_t)); memset(ega, 0, sizeof(ega_t)); @@ -997,7 +979,6 @@ void *sega_standalone_init() if (ega->bios_rom.rom[0x3ffe] == 0xaa && ega->bios_rom.rom[0x3fff] == 0x55) { int c; - // pclog("Read EGA ROM in reverse\n"); for (c = 0; c < 0x2000; c++) { @@ -1008,18 +989,15 @@ void *sega_standalone_init() } ega->crtc[0] = 63; - // ega->crtc[6] = 255; ega->dispontime = 1000 * (1 << TIMER_SHIFT); ega->dispofftime = 1000 * (1 << TIMER_SHIFT); ega_init(ega); - // ega->attrregs[0x10] |= 0xF7; ega_common_defaults(ega); mem_mapping_add(&ega->mapping, 0xa0000, 0x20000, ega_read, NULL, NULL, ega_write, NULL, NULL, NULL, 0, ega); timer_add(ega_poll, &ega->vidtime, TIMER_ALWAYS_ENABLED, ega); - // io_sethandler(0x03a0, 0x0040, ega_in, NULL, NULL, ega_out, NULL, NULL, ega); io_sethandler(0x03c0, 0x0020, ega_in, NULL, NULL, ega_out, NULL, NULL, ega); return ega; } diff --git a/src/vid_ega.h b/src/vid_ega.h index 0d3c12439..9b0e215d8 100644 --- a/src/vid_ega.h +++ b/src/vid_ega.h @@ -70,6 +70,8 @@ typedef struct ega_t int video_res_x, video_res_y, video_bpp; } ega_t; +extern int update_overscan; + void *ega_standalone_init(); void ega_out(uint16_t addr, uint8_t val, void *p); uint8_t ega_in(uint16_t addr, void *p); @@ -77,6 +79,7 @@ void ega_poll(void *p); void ega_recalctimings(struct ega_t *ega); void ega_write(uint32_t addr, uint8_t val, void *p); uint8_t ega_read(uint32_t addr, void *p); +void ega_init(ega_t *ega); extern device_t ega_device; extern device_t cpqega_device; diff --git a/src/vid_et4000.c b/src/vid_et4000.c index aae35bdb5..ca845982b 100644 --- a/src/vid_et4000.c +++ b/src/vid_et4000.c @@ -46,8 +46,6 @@ void et4000_out(uint16_t addr, uint8_t val, void *p) if (((addr&0xFFF0) == 0x3D0 || (addr&0xFFF0) == 0x3B0) && !(svga->miscout & 1)) addr ^= 0x60; -// pclog("ET4000 out %04X %02X\n", addr, val); - switch (addr) { case 0x3C6: case 0x3C7: case 0x3C8: case 0x3C9: @@ -58,13 +56,11 @@ void et4000_out(uint16_t addr, uint8_t val, void *p) svga->write_bank = (val & 0xf) * 0x10000; svga->read_bank = ((val >> 4) & 0xf) * 0x10000; et4000->banking = val; -// pclog("Banking write %08X %08X %02X\n", svga->write_bank, svga->read_bank, val); return; case 0x3D4: svga->crtcreg = val & 0x3f; return; case 0x3D5: - // pclog("ET4000 Write: CRTC %02X = %02X\n", svga->crtcreg, val); if ((svga->crtcreg < 7) && (svga->crtc[0x11] & 0x80)) return; if ((svga->crtcreg == 7) && (svga->crtc[0x11] & 0x80)) @@ -92,9 +88,7 @@ uint8_t et4000_in(uint16_t addr, void *p) if (((addr&0xFFF0) == 0x3D0 || (addr&0xFFF0) == 0x3B0) && !(svga->miscout & 1)) addr ^= 0x60; - -// if (addr != 0x3da) pclog("IN ET4000 %04X\n", addr); - + switch (addr) { case 0x3C5: @@ -116,8 +110,6 @@ uint8_t et4000_in(uint16_t addr, void *p) void et4000_recalctimings(svga_t *svga) { - et4000_t *et4000 = (et4000_t *)svga->p; - svga->ma_latch |= (svga->crtc[0x33]&3)<<16; if (svga->crtc[0x35] & 1) svga->vblankstart += 0x400; if (svga->crtc[0x35] & 2) svga->vtotal += 0x400; @@ -128,8 +120,6 @@ void et4000_recalctimings(svga_t *svga) if (svga->crtc[0x3f] & 1) svga->htotal += 256; if (svga->attrregs[0x16] & 0x20) svga->hdisp <<= 1; -// pclog("Rowoffset %i\n",svga_rowoffset); - switch (((svga->miscout >> 2) & 3) | ((svga->crtc[0x34] << 1) & 4)) { case 0: case 1: break; diff --git a/src/vid_et4000w32.c b/src/vid_et4000w32.c index 430bf7347..bac8c5fa7 100644 --- a/src/vid_et4000w32.c +++ b/src/vid_et4000w32.c @@ -120,17 +120,9 @@ void et4000w32p_out(uint16_t addr, uint8_t val, void *p) svga_t *svga = &et4000->svga; uint8_t old; -// pclog("et4000w32p_out: addr %04X val %02X %04X:%04X %02X %02X\n", addr, val, CS, pc, ram[0x487], ram[0x488]); - -/* if (ram[0x487] == 0x62) - fatal("mono\n");*/ -// if (!(addr==0x3D4 && (val&~1)==0xE) && !(addr==0x3D5 && (crtcreg&~1)==0xE)) pclog("ET4000W32p out %04X %02X %04X:%04X ",addr,val,CS,pc); - if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(svga->miscout & 1)) addr ^= 0x60; -// if (!(addr==0x3D4 && (val&~1)==0xE) && !(addr==0x3D5 && (crtcreg&~1)==0xE)) pclog("%04X\n",addr); - switch (addr) { case 0x3c2: @@ -156,7 +148,6 @@ void et4000w32p_out(uint16_t addr, uint8_t val, void *p) { case 6: svga->gdcreg[svga->gdcaddr & 15] = val; - //et4k_b8000=((crtc[0x36]&0x38)==0x28) && ((gdcreg[6]&0xC)==4); et4000w32p_recalcmapping(et4000); return; } @@ -165,7 +156,6 @@ void et4000w32p_out(uint16_t addr, uint8_t val, void *p) svga->crtcreg = val & 63; return; case 0x3D5: -// pclog("Write CRTC R%02X %02X\n", crtcreg, val); if ((svga->crtcreg < 7) && (svga->crtc[0x11] & 0x80)) return; if ((svga->crtcreg == 7) && (svga->crtc[0x11] & 0x80)) @@ -191,8 +181,6 @@ void et4000w32p_out(uint16_t addr, uint8_t val, void *p) { et4000->linearbase = val << 22; } - // et4000->linearbase = val * 0x400000; -// pclog("Linear base now at %08X %02X\n", et4000w32p_linearbase, val); et4000w32p_recalcmapping(et4000); } if (svga->crtcreg == 0x32 || svga->crtcreg == 0x36) @@ -213,7 +201,6 @@ void et4000w32p_out(uint16_t addr, uint8_t val, void *p) svga->hwcursor.ena = et4000->regs[0xF7] & 0x80; svga->hwcursor.xoff = et4000->regs[0xE2] & 63; svga->hwcursor.yoff = et4000->regs[0xE6] & 63; -// pclog("HWCURSOR X %i Y %i\n",svga->hwcursor_x,svga->hwcursor_y); return; } @@ -225,18 +212,10 @@ uint8_t et4000w32p_in(uint16_t addr, void *p) et4000w32p_t *et4000 = (et4000w32p_t *)p; svga_t *svga = &et4000->svga; uint8_t temp; -// if (addr==0x3DA) pclog("In 3DA %04X(%06X):%04X\n",CS,cs,pc); - -// pclog("ET4000W32p in %04X %04X:%04X ",addr,CS,pc); -// if (addr != 0x3da && addr != 0x3ba) -// pclog("et4000w32p_in: addr %04X %04X:%04X %02X %02X\n", addr, CS, pc, ram[0x487], ram[0x488]); - if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(svga->miscout & 1)) addr ^= 0x60; -// pclog("%04X\n",addr); - switch (addr) { case 0x3c5: @@ -254,7 +233,6 @@ uint8_t et4000w32p_in(uint16_t addr, void *p) case 0x3D4: return svga->crtcreg; case 0x3D5: -// pclog("Read CRTC R%02X %02X\n", crtcreg, crtc[crtcreg]); return svga->crtc[svga->crtcreg]; case 0x3DA: @@ -263,7 +241,6 @@ uint8_t et4000w32p_in(uint16_t addr, void *p) temp = svga->cgastat & 0x39; if (svga->hdisp_on) temp |= 2; if (!(svga->cgastat & 8)) temp |= 0x80; -// pclog("3DA in %02X\n",temp); return temp; case 0x210A: case 0x211A: case 0x212A: case 0x213A: @@ -286,9 +263,7 @@ uint8_t et4000w32p_in(uint16_t addr, void *p) void et4000w32p_recalctimings(svga_t *svga) { et4000w32p_t *et4000 = (et4000w32p_t *)svga->p; -// pclog("Recalc %08X ",svga_ma); svga->ma_latch |= (svga->crtc[0x33] & 0x7) << 16; -// pclog("SVGA_MA %08X %i\n", svga_ma, (svga_miscout >> 2) & 3); if (svga->crtc[0x35] & 0x01) svga->vblankstart += 0x400; if (svga->crtc[0x35] & 0x02) svga->vtotal += 0x400; if (svga->crtc[0x35] & 0x04) svga->dispend += 0x400; @@ -321,14 +296,12 @@ void et4000w32p_recalcmapping(et4000w32p_t *et4000) if (!(et4000->pci_regs[PCI_REG_COMMAND] & PCI_COMMAND_MEM)) { - // pclog("Update mapping - PCI disabled\n"); mem_mapping_disable(&svga->mapping); mem_mapping_disable(&et4000->linear_mapping); mem_mapping_disable(&et4000->mmu_mapping); return; } - // pclog("recalcmapping %p\n", svga); if (svga->crtc[0x36] & 0x10) /*Linear frame buffer*/ { mem_mapping_set_addr(&et4000->linear_mapping, et4000->linearbase, 0x200000); @@ -381,7 +354,6 @@ void et4000w32p_recalcmapping(et4000w32p_t *et4000) } mem_mapping_disable(&et4000->linear_mapping); -// pclog("ET4K map %02X\n", map); } et4000->linearbase_old = et4000->linearbase; @@ -472,6 +444,11 @@ static void et4000w32p_accel_write_mmu(et4000w32p_t *et4000, uint32_t addr, uint static void fifo_thread(void *param) { et4000w32p_t *et4000 = (et4000w32p_t *)param; + + uint64_t start_time = 0; + uint64_t end_time = 0; + + fifo_entry_t *fifo; while (1) { @@ -481,10 +458,8 @@ static void fifo_thread(void *param) et4000->blitter_busy = 1; while (!FIFO_EMPTY) { - uint64_t start_time = timer_read(); - uint64_t end_time; - fifo_entry_t *fifo = &et4000->fifo[et4000->fifo_read_idx & FIFO_MASK]; - uint32_t val = fifo->val; + start_time = timer_read(); + fifo = &et4000->fifo[et4000->fifo_read_idx & FIFO_MASK]; switch (fifo->addr_type & FIFO_TYPE) { @@ -509,7 +484,7 @@ static void fifo_thread(void *param) } } -static inline void wake_fifo_thread(et4000w32p_t *et4000) +static __inline void wake_fifo_thread(et4000w32p_t *et4000) { thread_set_event(et4000->wake_fifo_thread); /*Wake up FIFO thread if moving from idle*/ } @@ -526,7 +501,6 @@ static void et4000w32p_wait_fifo_idle(et4000w32p_t *et4000) static void et4000w32p_queue(et4000w32p_t *et4000, uint32_t addr, uint32_t val, uint32_t type) { fifo_entry_t *fifo = &et4000->fifo[et4000->fifo_write_idx & FIFO_MASK]; - int c; if (FIFO_FULL) { @@ -551,8 +525,6 @@ void et4000w32p_mmu_write(uint32_t addr, uint8_t val, void *p) et4000w32p_t *et4000 = (et4000w32p_t *)p; svga_t *svga = &et4000->svga; int bank; -// pclog("ET4K write %08X %02X %02X %04X(%08X):%08X\n",addr,val,et4000->acl.status,et4000->acl.internal.ctrl_routing,CS,cs,pc); -// et4000->acl.status |= ACL_RDST; switch (addr & 0x6000) { case 0x0000: /*MMU 0*/ @@ -603,7 +575,6 @@ uint8_t et4000w32p_mmu_read(uint32_t addr, void *p) svga_t *svga = &et4000->svga; int bank; uint8_t temp; -// pclog("ET4K read %08X %04X(%08X):%08X\n",addr,CS,cs,pc); switch (addr & 0x6000) { case 0x0000: /*MMU 0*/ @@ -650,13 +621,11 @@ uint8_t et4000w32p_mmu_read(uint32_t addr, void *p) case 0x7f36: temp = et4000->acl.status; -// et4000->acl.status &= ~ACL_RDST; temp &= ~0x03; if (!FIFO_EMPTY) temp |= 0x02; if (FIFO_FULL) temp |= 0x01; -// if (et4000->acl.internal.pos_x!=et4000->acl.internal.count_x || et4000->acl.internal.pos_y!=et4000->acl.internal.count_y) return et4000->acl.status | ACL_XYST; return temp; case 0x7f80: return et4000->acl.internal.pattern_addr; case 0x7f81: return et4000->acl.internal.pattern_addr >> 8; @@ -701,10 +670,6 @@ static int et4000w32_wrap_y[8]={1,2,4,8,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFF int bltout=0; void et4000w32_blit_start(et4000w32p_t *et4000) { -// if (et4000->acl.queued.xy_dir&0x80) -// pclog("Blit - %02X %08X (%i,%i) %08X (%i,%i) %08X (%i,%i) %i %i %i %02X %02X %02X\n",et4000->acl.queued.xy_dir,et4000->acl.internal.pattern_addr,(et4000->acl.internal.pattern_addr/3)%640,(et4000->acl.internal.pattern_addr/3)/640,et4000->acl.internal.source_addr,(et4000->acl.internal.source_addr/3)%640,(et4000->acl.internal.source_addr/3)/640,et4000->acl.internal.dest_addr,(et4000->acl.internal.dest_addr/3)%640,(et4000->acl.internal.dest_addr/3)/640,et4000->acl.internal.xy_dir,et4000->acl.internal.count_x,et4000->acl.internal.count_y,et4000->acl.internal.rop_fg,et4000->acl.internal.rop_bg, et4000->acl.internal.ctrl_routing); -// bltout=1; -// bltout=(et4000->acl.internal.count_x==1541); if (!(et4000->acl.queued.xy_dir & 0x20)) et4000->acl.internal.error = et4000->acl.internal.dmaj / 2; et4000->acl.pattern_addr= et4000->acl.internal.pattern_addr; @@ -824,8 +789,6 @@ void et4000w32_blit(int count, uint32_t mix, uint32_t sdat, int cpu_input, et400 int mixdat; if (!(et4000->acl.status & ACL_XYST)) return; -// if (count>400) pclog("New blit - %i,%i %06X (%i,%i) %06X %06X\n",et4000->acl.internal.count_x,et4000->acl.internal.count_y,et4000->acl.dest_addr,et4000->acl.dest_addr%640,et4000->acl.dest_addr/640,et4000->acl.source_addr,et4000->acl.pattern_addr); - //pclog("Blit exec - %i %i %i\n",count,et4000->acl.internal.pos_x,et4000->acl.internal.pos_y); if (et4000->acl.internal.xy_dir & 0x80) /*Line draw*/ { while (count--) @@ -874,7 +837,6 @@ void et4000w32_blit(int count, uint32_t mix, uint32_t sdat, int cpu_input, et400 et4000->acl.cpu_dat_pos++; } -// pclog("%i %i\n",et4000->acl.pix_pos,(et4000->acl.internal.pixel_depth>>4)&3); et4000->acl.pix_pos++; et4000->acl.internal.pos_x++; if (et4000->acl.pix_pos <= ((et4000->acl.internal.pixel_depth >> 4) & 3)) @@ -904,11 +866,9 @@ void et4000w32_blit(int count, uint32_t mix, uint32_t sdat, int cpu_input, et400 break; case 4: case 6: /*X+*/ et4000w32_incx(((et4000->acl.internal.pixel_depth >> 4) & 3) + 1, et4000); - //et4000->acl.internal.pos_x++; break; case 5: case 7: /*X-*/ et4000w32_decx(((et4000->acl.internal.pixel_depth >> 4) & 3) + 1, et4000); - //et4000->acl.internal.pos_x++; break; } et4000->acl.internal.error += et4000->acl.internal.dmin; @@ -939,7 +899,6 @@ void et4000w32_blit(int count, uint32_t mix, uint32_t sdat, int cpu_input, et400 et4000->acl.internal.pos_y > et4000->acl.internal.count_y) { et4000->acl.status &= ~(ACL_XYST | ACL_SSO); -// pclog("Blit line over\n"); return; } } @@ -1022,7 +981,6 @@ void et4000w32_blit(int count, uint32_t mix, uint32_t sdat, int cpu_input, et400 if (et4000->acl.internal.pos_y > et4000->acl.internal.count_y) { et4000->acl.status &= ~(ACL_XYST | ACL_SSO); -// pclog("Blit over\n"); return; } if (cpu_input) return; @@ -1042,9 +1000,10 @@ void et4000w32p_hwcursor_draw(svga_t *svga, int displine) { int x, offset; uint8_t dat; - offset = svga->hwcursor_latch.xoff; int y_add = (enable_overscan && !suppress_overscan) ? 16 : 0; int x_add = (enable_overscan && !suppress_overscan) ? 8 : 0; + offset = svga->hwcursor_latch.xoff; + for (x = 0; x < 64 - svga->hwcursor_latch.xoff; x += 4) { dat = svga->vram[svga->hwcursor_latch.addr + (offset >> 2)]; @@ -1098,12 +1057,9 @@ static void et4000w32p_io_set(et4000w32p_t *et4000) uint8_t et4000w32p_pci_read(int func, int addr, void *p) { et4000w32p_t *et4000 = (et4000w32p_t *)p; - svga_t *svga = &et4000->svga; addr &= 0xff; - // pclog("ET4000 PCI read %08X\n", addr); - switch (addr) { case 0x00: return 0x0c; /*Tseng Labs*/ @@ -1141,12 +1097,9 @@ void et4000w32p_pci_write(int func, int addr, uint8_t val, void *p) { et4000w32p_t *et4000 = (et4000w32p_t *)p; svga_t *svga = &et4000->svga; - uint32_t temp = 0; addr &= 0xff; - // pclog("ET4000 PCI Write: value %02X to address %08X\n"); - switch (addr) { case PCI_REG_COMMAND: @@ -1174,7 +1127,6 @@ void et4000w32p_pci_write(int func, int addr, uint8_t val, void *p) et4000->pci_regs[0x33] &= 0xf0; if (et4000->pci_regs[0x30] & 0x01) { - // uint32_t addr = ((et4000->pci_regs[0x31] & 0x80) << 8) | ((et4000->pci_regs[0x32] & 0x0f) << 16) | (et4000->pci_regs[0x33] << 24); uint32_t addr = (et4000->pci_regs[0x33] << 24); if (!addr) { @@ -1252,6 +1204,10 @@ void et4000w32p_close(void *p) svga_close(&et4000->svga); + thread_kill(et4000->fifo_thread); + thread_destroy_event(et4000->wake_fifo_thread); + thread_destroy_event(et4000->fifo_not_full_event); + free(et4000); } @@ -1288,27 +1244,21 @@ void et4000w32p_add_status_info(char *s, int max_len, void *p) static device_config_t et4000w32p_config[] = { { - .name = "memory", - .description = "Memory size", - .type = CONFIG_SELECTION, - .selection = + "memory", "Memory size", CONFIG_SELECTION, "", 2, { { - .description = "1 MB", - .value = 1 + "1 MB", 1 }, { - .description = "2 MB", - .value = 2 + "2 MB", 2 }, { - .description = "" + "" } - }, - .default_int = 2 + } }, { - .type = -1 + "", "", -1 } }; diff --git a/src/vid_genius.c b/src/vid_genius.c new file mode 100644 index 000000000..bc9ca6e1c --- /dev/null +++ b/src/vid_genius.c @@ -0,0 +1,629 @@ +/* MDSI Genius VHR emulation*/ +#include +#include "ibm.h" +#include "device.h" +#include "io.h" +#include "mem.h" +#include "rom.h" +#include "timer.h" +#include "video.h" +#include "vid_genius.h" + +#define GENIUS_XSIZE 728 +#define GENIUS_YSIZE 1008 + +void updatewindowsize(int x, int y); +void loadfont(char *s, int format); + +extern uint8_t fontdat8x12[256][16]; + +/* I'm at something of a disadvantage writing this emulation: I don't have an + * MDSI Genius card, nor do I have the BIOS extension (VHRBIOS.SYS) that came + * with it. What I do have are the GEM and Windows 1.04 drivers, plus a driver + * for a later MCA version of the card. The latter can be found at + * and is necessary if you + * want the Windows driver to work. + * + * This emulation appears to work correctly with: + * The MCA drivers GMC_ANSI.SYS and INS_ANSI.SYS + * The GEM driver SDGEN9.VGA + * The Windows 1.04 driver GENIUS.DRV + * + * As far as I can see, the card uses a fixed resolution of 728x1008 pixels. + * It has the following modes of operation: + * + * > MDA-compatible: 80x25 text, each character 9x15 pixels. + * > CGA-compatible: 640x200 mono graphics + * > Dual: MDA text in the top half, CGA graphics in the bottom + * > Native text: 80x66 text, each character 9x15 pixels. + * > Native graphics: 728x1008 mono graphics. + * + * Under the covers, this seems to translate to: + * > Text framebuffer. At B000:0000, 16k. Displayed if enable bit is set + * in the MDA control register. + * > Graphics framebuffer. In native modes goes from A000:0000 to A000:FFFF + * and B800:0000 to B800:FFFF. In CGA-compatible + * mode only the section at B800:0000 to B800:7FFF + * is visible. Displayed if enable bit is set in the + * CGA control register. + * + * Two card-specific registers control text and graphics display: + * + * 03B0: Control register. + * Bit 0: Map all graphics framebuffer into memory. + * Bit 2: Unknown. Set by GMC /M; cleared by mode set or GMC /T. + * Bit 4: Set for CGA-compatible graphics, clear for native graphics. + * Bit 5: Set for black on white, clear for white on black. + * + * 03B1: Character height register. + * Bits 0-1: Character cell height (0 => 15, 1 => 14, 2 => 13, 3 => 12) + * Bit 4: Set to double character cell height (scanlines are doubled) + * Bit 7: Unknown, seems to be set for all modes except 80x66 + * + * Not having the card also means I don't have its font. According to the + * card brochure the font is an 8x12 bitmap in a 9x15 character cell. I + * therefore generated it by taking the MDA font, increasing graphics to + * 16 pixels in height and reducing the height of characters so they fit + * in an 8x12 cell if necessary. + */ + + + +typedef struct genius_t +{ + mem_mapping_t mapping; + + uint8_t mda_crtc[32]; /* The 'CRTC' as the host PC sees it */ + int mda_crtcreg; /* Current CRTC register */ + uint8_t genius_control; /* Native control register + * I think bit 0 enables the full + * framebuffer. + */ + uint8_t genius_charh; /* Native character height register: + * 00h => chars are 15 pixels high + * 81h => chars are 14 pixels high + * 83h => chars are 12 pixels high + * 90h => chars are 30 pixels high [15 x 2] + * 93h => chars are 24 pixels high [12 x 2] + */ + uint8_t genius_mode; /* Current mode (see list at top of file) */ + uint8_t cga_ctrl; /* Emulated CGA control register */ + uint8_t mda_ctrl; /* Emulated MDA control register */ + uint8_t cga_colour; /* Emulated CGA colour register (ignored) */ + + uint8_t mda_stat; /* MDA status (IN 0x3BA) */ + uint8_t cga_stat; /* CGA status (IN 0x3DA) */ + + int font; /* Current font, 0 or 1 */ + int enabled; /* Display enabled, 0 or 1 */ + int detach; /* Detach cursor, 0 or 1 */ + + int dispontime, dispofftime; + int vidtime; + + int linepos, displine; + int vc; + int dispon, blink; + int vsynctime; + + uint8_t *vram; +} genius_t; + +/* Mapping of attributes to colours, in MDA emulation mode */ +static int mdacols[256][2][2]; + +void genius_recalctimings(genius_t *genius); +void genius_write(uint32_t addr, uint8_t val, void *p); +uint8_t genius_read(uint32_t addr, void *p); + + +void genius_out(uint16_t addr, uint8_t val, void *p) +{ + genius_t *genius = (genius_t *)p; + + switch (addr) + { + case 0x3b0: /* Command / control register */ + genius->genius_control = val; + if (val & 1) + { + mem_mapping_set_addr(&genius->mapping, 0xa0000, 0x28000); + } + else + { + mem_mapping_set_addr(&genius->mapping, 0xb0000, 0x10000); + } + + break; + + case 0x3b1: + genius->genius_charh = val; + break; + + /* Emulated CRTC, register select */ + case 0x3b2: case 0x3b4: case 0x3b6: + case 0x3d0: case 0x3d2: case 0x3d4: case 0x3d6: + genius->mda_crtcreg = val & 31; + break; + + /* Emulated CRTC, value */ + case 0x3b3: case 0x3b5: case 0x3b7: + case 0x3d1: case 0x3d3: case 0x3d5: case 0x3d7: + genius->mda_crtc[genius->mda_crtcreg] = val; + genius_recalctimings(genius); + return; + + /* Emulated MDA control register */ + case 0x3b8: + genius->mda_ctrl = val; + return; + /* Emulated CGA control register */ + case 0x3D8: + genius->cga_ctrl = val; + return; + /* Emulated CGA colour register */ + case 0x3D9: + genius->cga_colour = val; + return; + } +} + +uint8_t genius_in(uint16_t addr, void *p) +{ + genius_t *genius = (genius_t *)p; + + switch (addr) + { + case 0x3b0: case 0x3b2: case 0x3b4: case 0x3b6: + case 0x3d0: case 0x3d2: case 0x3d4: case 0x3d6: + return genius->mda_crtcreg; + case 0x3b1: case 0x3b3: case 0x3b5: case 0x3b7: + case 0x3d1: case 0x3d3: case 0x3d5: case 0x3d7: + return genius->mda_crtc[genius->mda_crtcreg]; + case 0x3b8: + return genius->mda_ctrl; + case 0x3d9: + return genius->cga_colour; + case 0x3ba: + return genius->mda_stat; + case 0x3d8: + return genius->cga_ctrl; + case 0x3da: + return genius->cga_stat; + } + return 0xff; +} + + + +void genius_write(uint32_t addr, uint8_t val, void *p) +{ + genius_t *genius = (genius_t *)p; + egawrites++; + + if (genius->genius_control & 1) + { + addr = addr % 0x28000; + } + else + /* If hi-res memory is disabled, only visible in the B000 segment */ + { + addr = (addr & 0xFFFF) + 0x10000; + } + genius->vram[addr] = val; +} + + + +uint8_t genius_read(uint32_t addr, void *p) +{ + genius_t *genius = (genius_t *)p; + egareads++; + + if (genius->genius_control & 1) + { + addr = addr % 0x28000; + } + else + /* If hi-res memory is disabled, only visible in the B000 segment */ + { + addr = (addr & 0xFFFF) + 0x10000; + } + return genius->vram[addr]; +} + + + +void genius_recalctimings(genius_t *genius) +{ + double disptime; + double _dispontime, _dispofftime; + + disptime = 0x31; + _dispontime = 0x28; + _dispofftime = disptime - _dispontime; + _dispontime *= MDACONST; + _dispofftime *= MDACONST; + genius->dispontime = (int)(_dispontime * (1 << TIMER_SHIFT)); + genius->dispofftime = (int)(_dispofftime * (1 << TIMER_SHIFT)); +} + + +/* Draw a single line of the screen in either text mode */ +void genius_textline(genius_t *genius, uint8_t background) +{ + int x; + int w = 80; /* 80 characters across */ + int cw = 9; /* Each character is 9 pixels wide */ + uint8_t chr, attr; + uint8_t bitmap[2]; + int blink, c, row; + int drawcursor, cursorline; + uint16_t addr; + uint8_t sc; + int charh; + uint16_t ma = (genius->mda_crtc[13] | (genius->mda_crtc[12] << 8)) & 0x3fff; + uint16_t ca = (genius->mda_crtc[15] | (genius->mda_crtc[14] << 8)) & 0x3fff; + unsigned char *framebuf = genius->vram + 0x10000; + uint8_t col; + + /* Character height is 12-15 */ + charh = 15 - (genius->genius_charh & 3); + if (genius->genius_charh & 0x10) + { + row = ((genius->displine >> 1) / charh); + sc = ((genius->displine >> 1) % charh); + } + else + { + row = (genius->displine / charh); + sc = (genius->displine % charh); + } + addr = ((ma & ~1) + row * w) * 2; + + ma += (row * w); + + if ((genius->mda_crtc[10] & 0x60) == 0x20) + { + cursorline = 0; + } + else + { + cursorline = ((genius->mda_crtc[10] & 0x1F) <= sc) && + ((genius->mda_crtc[11] & 0x1F) >= sc); + } + + for (x = 0; x < w; x++) + { + chr = framebuf[(addr + 2 * x) & 0x3FFF]; + attr = framebuf[(addr + 2 * x + 1) & 0x3FFF]; + drawcursor = ((ma == ca) && cursorline && genius->enabled && + (genius->mda_ctrl & 8)); + + switch (genius->mda_crtc[10] & 0x60) + { + case 0x00: drawcursor = drawcursor && (genius->blink & 16); break; + case 0x60: drawcursor = drawcursor && (genius->blink & 32); break; + } + blink = ((genius->blink & 16) && + (genius->mda_ctrl & 0x20) && + (attr & 0x80) && !drawcursor); + + if (genius->mda_ctrl & 0x20) attr &= 0x7F; + /* MDA underline */ + if (sc == charh && ((attr & 7) == 1)) + { + col = mdacols[attr][blink][1]; + + if (genius->genius_control & 0x20) + { + col ^= 15; + } + + for (c = 0; c < cw; c++) + { + if (col != background) + buffer->line[genius->displine][(x * cw) + c] = col; + } + } + else /* Draw 8 pixels of character */ + { + bitmap[0] = fontdat8x12[chr][sc]; + for (c = 0; c < 8; c++) + { + col = mdacols[attr][blink][(bitmap[0] & (1 << (c ^ 7))) ? 1 : 0]; + if (!(genius->enabled) || !(genius->mda_ctrl & 8)) + col = mdacols[0][0][0]; + + if (genius->genius_control & 0x20) + { + col ^= 15; + } + if (col != background) + { + buffer->line[genius->displine][(x * cw) + c] = col; + } + } + /* The ninth pixel column... */ + if ((chr & ~0x1f) == 0xc0) + { + /* Echo column 8 for the graphics chars */ + col = buffer->line[genius->displine][(x * cw) + 7]; + if (col != background) buffer->line[genius->displine][(x * cw) + 8] = col; + } + else /* Otherwise fill with background */ + { + col = mdacols[attr][blink][0]; + if (genius->genius_control & 0x20) + { + col ^= 15; + } + if (col != background) buffer->line[genius->displine][(x * cw) + 8] = col; + } + if (drawcursor) + { + for (c = 0; c < cw; c++) + buffer->line[genius->displine][(x * cw) + c] ^= mdacols[attr][0][1]; + } + ++ma; + } + } +} + + + + +/* Draw a line in the CGA 640x200 mode */ +void genius_cgaline(genius_t *genius) +{ + int x, c; + uint32_t dat; + uint8_t ink; + uint32_t addr; + + ink = (genius->genius_control & 0x20) ? 16 : 16+15; + /* We draw the CGA at row 600 */ + if (genius->displine < 600) + { + return; + } + addr = 0x18000 + 80 * ((genius->displine - 600) >> 2); + if ((genius->displine - 600) & 2) + { + addr += 0x2000; + } + + for (x = 0; x < 80; x++) + { + dat = genius->vram[addr]; + addr++; + + for (c = 0; c < 8; c++) + { + if (dat & 0x80) + { + buffer->line[genius->displine][x*8 + c] = ink; + } + dat = dat << 1; + } + } +} + + + + +/* Draw a line in the native high-resolution mode */ +void genius_hiresline(genius_t *genius) +{ + int x, c; + uint32_t dat; + uint8_t ink; + uint32_t addr; + + ink = (genius->genius_control & 0x20) ? 16 : 16+15; + /* The first 512 lines live at A0000 */ + if (genius->displine < 512) + { + addr = 128 * genius->displine; + } + else /* The second 496 live at B8000 */ + { + addr = 0x18000 + 128 * (genius->displine - 512); + } + + for (x = 0; x < 91; x++) + { + dat = genius->vram[addr]; + addr++; + + for (c = 0; c < 8; c++) + { + if (dat & 0x80) + { + buffer->line[genius->displine][x*8 + c] = ink; + } + dat = dat << 1; + } + } +} + + + + +void genius_poll(void *p) +{ + genius_t *genius = (genius_t *)p; + int x; + uint8_t background; + + if (!genius->linepos) + { + genius->vidtime += genius->dispofftime; + genius->cga_stat |= 1; + genius->mda_stat |= 1; + genius->linepos = 1; + if (genius->dispon) + { + if (genius->genius_control & 0x20) + { + background = 16 + 15; + } + else + { + background = 16; + } + if (genius->displine == 0) + { + video_wait_for_buffer(); + } + /* Start off with a blank line */ + for (x = 0; x < GENIUS_XSIZE; x++) + { + buffer->line[genius->displine][x] = background; + } + /* If graphics display enabled, draw graphics on top + * of the blanked line */ + if (genius->cga_ctrl & 8) + { + if (genius->genius_control & 8) + { + genius_cgaline(genius); + } + else + { + genius_hiresline(genius); + } + } + /* If MDA display is enabled, draw MDA text on top + * of the lot */ + if (genius->mda_ctrl & 8) + { + genius_textline(genius, background); + } + } + genius->displine++; + /* Hardcode a fixed refresh rate and VSYNC timing */ + if (genius->displine == 1008) /* Start of VSYNC */ + { + genius->cga_stat |= 8; + genius->dispon = 0; + } + if (genius->displine == 1040) /* End of VSYNC */ + { + genius->displine = 0; + genius->cga_stat &= ~8; + genius->dispon = 1; + } + } + else + { + if (genius->dispon) + { + genius->cga_stat &= ~1; + genius->mda_stat &= ~1; + } + genius->vidtime += genius->dispontime; + genius->linepos = 0; + + if (genius->displine == 1008) + { +/* Hardcode GENIUS_XSIZE * GENIUS_YSIZE window size */ + if (GENIUS_XSIZE != xsize || GENIUS_YSIZE != ysize) + { + xsize = GENIUS_XSIZE; + ysize = GENIUS_YSIZE; + if (xsize < 64) xsize = 656; + if (ysize < 32) ysize = 200; + updatewindowsize(xsize, ysize); + } + video_blit_memtoscreen_8(0, 0, xsize, ysize); + + frames++; + /* Fixed 728x1008 resolution */ + video_res_x = GENIUS_XSIZE; + video_res_y = GENIUS_YSIZE; + video_bpp = 1; + genius->blink++; + } + } +} + +void *genius_init() +{ + int c; + genius_t *genius = malloc(sizeof(genius_t)); + memset(genius, 0, sizeof(genius_t)); + + /* 160k video RAM */ + genius->vram = malloc(0x28000); + + timer_add(genius_poll, &genius->vidtime, TIMER_ALWAYS_ENABLED, genius); + + /* Occupy memory between 0xB0000 and 0xBFFFF (moves to 0xA0000 in + * high-resolution modes) */ + mem_mapping_add(&genius->mapping, 0xb0000, 0x10000, genius_read, NULL, NULL, genius_write, NULL, NULL, NULL, 0, genius); + /* Respond to both MDA and CGA I/O ports */ + io_sethandler(0x03b0, 0x000C, genius_in, NULL, NULL, genius_out, NULL, NULL, genius); + io_sethandler(0x03d0, 0x0010, genius_in, NULL, NULL, genius_out, NULL, NULL, genius); + + /* MDA attributes */ + /* I don't know if the Genius's MDA emulation actually does + * emulate bright / non-bright. For the time being pretend it does. */ + for (c = 0; c < 256; c++) + { + mdacols[c][0][0] = mdacols[c][1][0] = mdacols[c][1][1] = 16; + if (c & 8) mdacols[c][0][1] = 15 + 16; + else mdacols[c][0][1] = 7 + 16; + } + mdacols[0x70][0][1] = 16; + mdacols[0x70][0][0] = mdacols[0x70][1][0] = mdacols[0x70][1][1] = 16 + 15; + mdacols[0xF0][0][1] = 16; + mdacols[0xF0][0][0] = mdacols[0xF0][1][0] = mdacols[0xF0][1][1] = 16 + 15; + mdacols[0x78][0][1] = 16 + 7; + mdacols[0x78][0][0] = mdacols[0x78][1][0] = mdacols[0x78][1][1] = 16 + 15; + mdacols[0xF8][0][1] = 16 + 7; + mdacols[0xF8][0][0] = mdacols[0xF8][1][0] = mdacols[0xF8][1][1] = 16 + 15; + mdacols[0x00][0][1] = mdacols[0x00][1][1] = 16; + mdacols[0x08][0][1] = mdacols[0x08][1][1] = 16; + mdacols[0x80][0][1] = mdacols[0x80][1][1] = 16; + mdacols[0x88][0][1] = mdacols[0x88][1][1] = 16; + +/* Start off in 80x25 text mode */ + genius->cga_stat = 0xF4; + genius->genius_mode = 2; + genius->enabled = 1; + genius->genius_charh = 0x90; /* Native character height register */ + return genius; +} + +void genius_close(void *p) +{ + genius_t *genius = (genius_t *)p; + + free(genius->vram); + free(genius); +} + +static int genius_available() +{ + return rom_present("roms/8x12.bin"); +} + +void genius_speed_changed(void *p) +{ + genius_t *genius = (genius_t *)p; + + genius_recalctimings(genius); +} + +device_t genius_device = +{ + "Genius VHR", + 0, + genius_init, + genius_close, + genius_available, + genius_speed_changed, + NULL, + NULL +}; diff --git a/src/vid_genius.h b/src/vid_genius.h new file mode 100644 index 000000000..77dce66f0 --- /dev/null +++ b/src/vid_genius.h @@ -0,0 +1 @@ +extern device_t genius_device; diff --git a/src/vid_hercules.c b/src/vid_hercules.c index 2c96a5654..4a9606b32 100644 --- a/src/vid_hercules.c +++ b/src/vid_hercules.c @@ -6,6 +6,7 @@ #include "ibm.h" #include "device.h" #include "mem.h" +#include "io.h" #include "timer.h" #include "video.h" #include "vid_hercules.h" @@ -131,7 +132,6 @@ void hercules_poll(void *p) int oldvc; uint8_t chr, attr; uint16_t dat; - int cols[4]; int oldsc; int blink; if (!hercules->linepos) @@ -151,8 +151,6 @@ void hercules_poll(void *p) video_wait_for_buffer(); } hercules->lastline = hercules->displine; - cols[0] = 0; - cols[1] = 7; if ((hercules->ctrl & 2) && (hercules->ctrl2 & 1)) { ca = (hercules->sc & 3) * 0x2000; @@ -171,8 +169,8 @@ void hercules_poll(void *p) { for (x = 0; x < hercules->crtc[1]; x++) { - chr = hercules->vram[(hercules->ma << 1) & 0x3fff]; - attr = hercules->vram[((hercules->ma << 1) + 1) & 0x3fff]; + chr = hercules->vram[(hercules->ma << 1) & 0xfff]; + attr = hercules->vram[((hercules->ma << 1) + 1) & 0xfff]; drawcursor = ((hercules->ma == ca) && hercules->con && hercules->cursoron); blink = ((hercules->blink & 16) && (hercules->ctrl & 0x20) && (attr & 0x80) && !drawcursor); if (hercules->sc == 12 && ((attr & 7) == 1)) @@ -376,35 +374,27 @@ void hercules_speed_changed(void *p) static device_config_t hercules_config[] = { { - .name = "rgb_type", - .description = "Display type", - .type = CONFIG_SELECTION, - .selection = + "rgb_type", "Display type", CONFIG_SELECTION, "", 0, { { - .description = "Default", - .value = 0 + "Default", 0 }, { - .description = "Green", - .value = 1 + "Green", 1 }, { - .description = "Amber", - .value = 2 + "Amber", 2 }, { - .description = "Gray", - .value = 3 + "Gray", 3 }, { - .description = "" + "" } - }, - .default_int = 0 + } }, { - .type = -1 + "", "", -1 } }; #endif diff --git a/src/vid_herculesplus.c b/src/vid_herculesplus.c index 6a35c8bcf..7af5d4a9c 100644 --- a/src/vid_herculesplus.c +++ b/src/vid_herculesplus.c @@ -7,6 +7,7 @@ #include "ibm.h" #include "device.h" #include "mem.h" +#include "io.h" #include "timer.h" #include "video.h" #include "vid_herculesplus.h" @@ -171,7 +172,6 @@ static void herculesplus_draw_char_rom(herculesplus_t *herculesplus, int x, uint unsigned val; unsigned ifg, ibg; const unsigned char *fnt; - uint32_t fg, bg; int cw = HERCULESPLUS_CW; blk = 0; @@ -248,9 +248,8 @@ static void herculesplus_draw_char_ram4(herculesplus_t *herculesplus, int x, uin int elg, blk; unsigned ull; unsigned val; - unsigned ifg, ibg, cfg, pmask, plane; + unsigned ifg, ibg, cfg; const unsigned char *fnt; - uint32_t fg; int cw = HERCULESPLUS_CW; int blink = herculesplus->ctrl & HERCULESPLUS_CTRL_BLINK; @@ -318,7 +317,6 @@ static void herculesplus_draw_char_ram4(herculesplus_t *herculesplus, int x, uin { /* Generate pixel colour */ cfg = 0; - pmask = 1; /* cfg = colour of foreground pixels */ if ((attr & 0x77) == 0) cfg = ibg; /* 'blank' attribute */ @@ -332,11 +330,10 @@ static void herculesplus_draw_char_ram48(herculesplus_t *herculesplus, int x, ui { unsigned i; int elg, blk, ul, ol, bld; - unsigned ull, oll, ulc, olc; + unsigned ull, oll, ulc = 0, olc = 0; unsigned val; - unsigned ifg, ibg, cfg, pmask, plane; + unsigned ibg, cfg; const unsigned char *fnt; - uint32_t fg; int cw = HERCULESPLUS_CW; int blink = herculesplus->ctrl & HERCULESPLUS_CTRL_BLINK; int font = (attr & 0x0F); @@ -452,8 +449,8 @@ static void herculesplus_text_line(herculesplus_t *herculesplus, uint16_t ca) for (x = 0; x < herculesplus->crtc[1]; x++) { - chr = herculesplus->vram[(herculesplus->ma << 1) & 0x3fff]; - attr = herculesplus->vram[((herculesplus->ma << 1) + 1) & 0x3fff]; + chr = herculesplus->vram[(herculesplus->ma << 1) & 0xfff]; + attr = herculesplus->vram[((herculesplus->ma << 1) + 1) & 0xfff]; drawcursor = ((herculesplus->ma == ca) && herculesplus->con && herculesplus->cursoron); @@ -488,10 +485,8 @@ static void herculesplus_text_line(herculesplus_t *herculesplus, uint16_t ca) static void herculesplus_graphics_line(herculesplus_t *herculesplus) { - uint8_t mask; uint16_t ca; - int x, c, plane, col; - uint8_t ink; + int x, c, plane = 0; uint16_t val; /* Graphics mode. */ @@ -524,7 +519,6 @@ void herculesplus_poll(void *p) if (!herculesplus->linepos) { -// pclog("InColor poll %i %i\n", herculesplus->vc, herculesplus->sc); herculesplus->vidtime += herculesplus->dispofftime; herculesplus->stat |= 1; herculesplus->linepos = 1; @@ -552,7 +546,6 @@ void herculesplus_poll(void *p) if (herculesplus->vc == herculesplus->crtc[7] && !herculesplus->sc) { herculesplus->stat |= 8; -// printf("VSYNC on %i %i\n",vc,sc); } herculesplus->displine++; if (herculesplus->displine >= 500) @@ -570,7 +563,6 @@ void herculesplus_poll(void *p) if (!herculesplus->vsynctime) { herculesplus->stat &= ~8; -// printf("VSYNC off %i %i\n",vc,sc); } } if (herculesplus->sc == (herculesplus->crtc[11] & 31) || ((herculesplus->crtc[8] & 3) == 3 && herculesplus->sc == ((herculesplus->crtc[11] & 31) >> 1))) @@ -602,7 +594,6 @@ void herculesplus_poll(void *p) herculesplus->dispon = 0; if (oldvc == herculesplus->crtc[4]) { -// printf("Display over at %i\n",displine); herculesplus->vc = 0; herculesplus->vadj = herculesplus->crtc[5]; if (!herculesplus->vadj) herculesplus->dispon=1; @@ -614,10 +605,9 @@ void herculesplus_poll(void *p) { herculesplus->dispon = 0; herculesplus->displine = 0; - herculesplus->vsynctime = 16;//(crtcm[3]>>4)+1; + herculesplus->vsynctime = 16; if (herculesplus->crtc[7]) { -// printf("Lastline %i Firstline %i %i\n",lastline,firstline,lastline-firstline); if ((herculesplus->ctrl & HERCULESPLUS_CTRL_GRAPH) && (herculesplus->ctrl2 & HERCULESPLUS_CTRL2_GRAPH)) { x = herculesplus->crtc[1] << 4; @@ -631,7 +621,6 @@ void herculesplus_poll(void *p) { xsize = x; ysize = herculesplus->lastline - herculesplus->firstline; -// printf("Resize to %i,%i - R1 %i\n",xsize,ysize,crtcm[1]); if (xsize < 64) xsize = 656; if (ysize < 32) ysize = 200; updatewindowsize(xsize, ysize); @@ -665,7 +654,6 @@ void herculesplus_poll(void *p) if ((herculesplus->sc == (herculesplus->crtc[10] & 31) || ((herculesplus->crtc[8] & 3) == 3 && herculesplus->sc == ((herculesplus->crtc[10] & 31) >> 1)))) { herculesplus->con = 1; -// printf("Cursor on - %02X %02X %02X\n",crtcm[8],crtcm[10],crtcm[11]); } } } diff --git a/src/vid_icd2061.c b/src/vid_icd2061.c index 8b57e5bb7..bc75d4999 100644 --- a/src/vid_icd2061.c +++ b/src/vid_icd2061.c @@ -10,10 +10,9 @@ void icd2061_write(icd2061_t *icd2061, int val) { - int q, p, m, i, a; + int q, p, m, a; if ((val & 1) && !(icd2061->state & 1)) { - // pclog("ICD2061 write %02X %i %08X %i\n", val, icd2061->unlock, icd2061->data, icd2061->pos); if (!icd2061->status) { if (val & 2) @@ -35,24 +34,19 @@ void icd2061_write(icd2061_t *icd2061, int val) icd2061->pos++; if (icd2061->pos == 26) { - // pclog("ICD2061 data - %08X\n", icd2061->data); a = (icd2061->data >> 21) & 0x7; if (!(a & 4)) { q = (icd2061->data & 0x7f) - 2; m = 1 << ((icd2061->data >> 7) & 0x7); p = ((icd2061->data >> 10) & 0x7f) - 3; - i = (icd2061->data >> 17) & 0xf; - // pclog("p %i q %i m %i\n", p, q, m); if (icd2061->ctrl & (1 << a)) p <<= 1; icd2061->freq[a] = ((double)p / (double)q) * 2.0 * 14318184.0 / (double)m; - // pclog("ICD2061 freq %i = %f\n", a, icd2061->freq[a]); } else if (a == 6) { icd2061->ctrl = val; - // pclog("ICD2061 ctrl = %08X\n", val); } icd2061->unlock = icd2061->data = 0; icd2061->status = 0; @@ -64,6 +58,5 @@ void icd2061_write(icd2061_t *icd2061, int val) double icd2061_getfreq(icd2061_t *icd2061, int i) { - // pclog("Return freq %f\n", icd2061->freq[i]); return icd2061->freq[i]; } diff --git a/src/vid_ics2595.c b/src/vid_ics2595.c index 024cacd93..15c397729 100644 --- a/src/vid_ics2595.c +++ b/src/vid_ics2595.c @@ -18,12 +18,10 @@ static int ics2595_div[4] = {8, 4, 2, 1}; void ics2595_write(ics2595_t *ics2595, int strobe, int dat) { -// pclog("ics2595_write : %i %i\n", strobe, dat); if (strobe) { if ((dat & 8) && !ics2595->oldfs3) /*Data clock*/ { -// pclog(" - new dat %i\n", dat & 4); switch (ics2595->state) { case ICS2595_IDLE: @@ -38,13 +36,11 @@ void ics2595_write(ics2595_t *ics2595, int strobe, int dat) if (ics2595->pos == 20) { int d, n, l; -// pclog("ICS2595_WRITE : dat %08X\n", ics2595->dat); l = (ics2595->dat >> 2) & 0xf; n = ((ics2595->dat >> 7) & 255) + 257; d = ics2595_div[(ics2595->dat >> 16) & 3]; ics2595->clocks[l] = (14318181.8 * ((double)n / 46.0)) / (double)d; -// pclog("ICS2595 clock set - L %i N %i D %i freq = %f\n", l, n, d, (14318181.8 * ((double)n / 46.0)) / (double)d); ics2595->state = ICS2595_IDLE; } break; diff --git a/src/vid_incolor.c b/src/vid_incolor.c index df81b1636..4185978b0 100644 --- a/src/vid_incolor.c +++ b/src/vid_incolor.c @@ -7,6 +7,7 @@ #include "ibm.h" #include "device.h" #include "mem.h" +#include "io.h" #include "timer.h" #include "video.h" #include "vid_incolor.h" @@ -72,71 +73,71 @@ static uint32_t incolor_rgb[64]; /* Mapping of inks to RGB */ static unsigned char init_rgb[64][3] = { - // rgbRGB - { 0x00, 0x00, 0x00 }, // 000000 - { 0x00, 0x00, 0xaa }, // 000001 - { 0x00, 0xaa, 0x00 }, // 000010 - { 0x00, 0xaa, 0xaa }, // 000011 - { 0xaa, 0x00, 0x00 }, // 000100 - { 0xaa, 0x00, 0xaa }, // 000101 - { 0xaa, 0xaa, 0x00 }, // 000110 - { 0xaa, 0xaa, 0xaa }, // 000111 - { 0x00, 0x00, 0x55 }, // 001000 - { 0x00, 0x00, 0xff }, // 001001 - { 0x00, 0xaa, 0x55 }, // 001010 - { 0x00, 0xaa, 0xff }, // 001011 - { 0xaa, 0x00, 0x55 }, // 001100 - { 0xaa, 0x00, 0xff }, // 001101 - { 0xaa, 0xaa, 0x55 }, // 001110 - { 0xaa, 0xaa, 0xff }, // 001111 - { 0x00, 0x55, 0x00 }, // 010000 - { 0x00, 0x55, 0xaa }, // 010001 - { 0x00, 0xff, 0x00 }, // 010010 - { 0x00, 0xff, 0xaa }, // 010011 - { 0xaa, 0x55, 0x00 }, // 010100 - { 0xaa, 0x55, 0xaa }, // 010101 - { 0xaa, 0xff, 0x00 }, // 010110 - { 0xaa, 0xff, 0xaa }, // 010111 - { 0x00, 0x55, 0x55 }, // 011000 - { 0x00, 0x55, 0xff }, // 011001 - { 0x00, 0xff, 0x55 }, // 011010 - { 0x00, 0xff, 0xff }, // 011011 - { 0xaa, 0x55, 0x55 }, // 011100 - { 0xaa, 0x55, 0xff }, // 011101 - { 0xaa, 0xff, 0x55 }, // 011110 - { 0xaa, 0xff, 0xff }, // 011111 - { 0x55, 0x00, 0x00 }, // 100000 - { 0x55, 0x00, 0xaa }, // 100001 - { 0x55, 0xaa, 0x00 }, // 100010 - { 0x55, 0xaa, 0xaa }, // 100011 - { 0xff, 0x00, 0x00 }, // 100100 - { 0xff, 0x00, 0xaa }, // 100101 - { 0xff, 0xaa, 0x00 }, // 100110 - { 0xff, 0xaa, 0xaa }, // 100111 - { 0x55, 0x00, 0x55 }, // 101000 - { 0x55, 0x00, 0xff }, // 101001 - { 0x55, 0xaa, 0x55 }, // 101010 - { 0x55, 0xaa, 0xff }, // 101011 - { 0xff, 0x00, 0x55 }, // 101100 - { 0xff, 0x00, 0xff }, // 101101 - { 0xff, 0xaa, 0x55 }, // 101110 - { 0xff, 0xaa, 0xff }, // 101111 - { 0x55, 0x55, 0x00 }, // 110000 - { 0x55, 0x55, 0xaa }, // 110001 - { 0x55, 0xff, 0x00 }, // 110010 - { 0x55, 0xff, 0xaa }, // 110011 - { 0xff, 0x55, 0x00 }, // 110100 - { 0xff, 0x55, 0xaa }, // 110101 - { 0xff, 0xff, 0x00 }, // 110110 - { 0xff, 0xff, 0xaa }, // 110111 - { 0x55, 0x55, 0x55 }, // 111000 - { 0x55, 0x55, 0xff }, // 111001 - { 0x55, 0xff, 0x55 }, // 111010 - { 0x55, 0xff, 0xff }, // 111011 - { 0xff, 0x55, 0x55 }, // 111100 - { 0xff, 0x55, 0xff }, // 111101 - { 0xff, 0xff, 0x55 }, // 111110 - { 0xff, 0xff, 0xff }, // 111111 + /* rgbRGB */ + { 0x00, 0x00, 0x00 }, /* 000000 */ + { 0x00, 0x00, 0xaa }, /* 000001 */ + { 0x00, 0xaa, 0x00 }, /* 000010 */ + { 0x00, 0xaa, 0xaa }, /* 000011 */ + { 0xaa, 0x00, 0x00 }, /* 000100 */ + { 0xaa, 0x00, 0xaa }, /* 000101 */ + { 0xaa, 0xaa, 0x00 }, /* 000110 */ + { 0xaa, 0xaa, 0xaa }, /* 000111 */ + { 0x00, 0x00, 0x55 }, /* 001000 */ + { 0x00, 0x00, 0xff }, /* 001001 */ + { 0x00, 0xaa, 0x55 }, /* 001010 */ + { 0x00, 0xaa, 0xff }, /* 001011 */ + { 0xaa, 0x00, 0x55 }, /* 001100 */ + { 0xaa, 0x00, 0xff }, /* 001101 */ + { 0xaa, 0xaa, 0x55 }, /* 001110 */ + { 0xaa, 0xaa, 0xff }, /* 001111 */ + { 0x00, 0x55, 0x00 }, /* 010000 */ + { 0x00, 0x55, 0xaa }, /* 010001 */ + { 0x00, 0xff, 0x00 }, /* 010010 */ + { 0x00, 0xff, 0xaa }, /* 010011 */ + { 0xaa, 0x55, 0x00 }, /* 010100 */ + { 0xaa, 0x55, 0xaa }, /* 010101 */ + { 0xaa, 0xff, 0x00 }, /* 010110 */ + { 0xaa, 0xff, 0xaa }, /* 010111 */ + { 0x00, 0x55, 0x55 }, /* 011000 */ + { 0x00, 0x55, 0xff }, /* 011001 */ + { 0x00, 0xff, 0x55 }, /* 011010 */ + { 0x00, 0xff, 0xff }, /* 011011 */ + { 0xaa, 0x55, 0x55 }, /* 011100 */ + { 0xaa, 0x55, 0xff }, /* 011101 */ + { 0xaa, 0xff, 0x55 }, /* 011110 */ + { 0xaa, 0xff, 0xff }, /* 011111 */ + { 0x55, 0x00, 0x00 }, /* 100000 */ + { 0x55, 0x00, 0xaa }, /* 100001 */ + { 0x55, 0xaa, 0x00 }, /* 100010 */ + { 0x55, 0xaa, 0xaa }, /* 100011 */ + { 0xff, 0x00, 0x00 }, /* 100100 */ + { 0xff, 0x00, 0xaa }, /* 100101 */ + { 0xff, 0xaa, 0x00 }, /* 100110 */ + { 0xff, 0xaa, 0xaa }, /* 100111 */ + { 0x55, 0x00, 0x55 }, /* 101000 */ + { 0x55, 0x00, 0xff }, /* 101001 */ + { 0x55, 0xaa, 0x55 }, /* 101010 */ + { 0x55, 0xaa, 0xff }, /* 101011 */ + { 0xff, 0x00, 0x55 }, /* 101100 */ + { 0xff, 0x00, 0xff }, /* 101101 */ + { 0xff, 0xaa, 0x55 }, /* 101110 */ + { 0xff, 0xaa, 0xff }, /* 101111 */ + { 0x55, 0x55, 0x00 }, /* 110000 */ + { 0x55, 0x55, 0xaa }, /* 110001 */ + { 0x55, 0xff, 0x00 }, /* 110010 */ + { 0x55, 0xff, 0xaa }, /* 110011 */ + { 0xff, 0x55, 0x00 }, /* 110100 */ + { 0xff, 0x55, 0xaa }, /* 110101 */ + { 0xff, 0xff, 0x00 }, /* 110110 */ + { 0xff, 0xff, 0xaa }, /* 110111 */ + { 0x55, 0x55, 0x55 }, /* 111000 */ + { 0x55, 0x55, 0xff }, /* 111001 */ + { 0x55, 0xff, 0x55 }, /* 111010 */ + { 0x55, 0xff, 0xff }, /* 111011 */ + { 0xff, 0x55, 0x55 }, /* 111100 */ + { 0xff, 0x55, 0xff }, /* 111101 */ + { 0xff, 0xff, 0x55 }, /* 111110 */ + { 0xff, 0xff, 0xff }, /* 111111 */ }; @@ -240,7 +241,7 @@ void incolor_write(uint32_t addr, uint8_t val, void *p) unsigned char wmode = incolor->crtc[INCOLOR_CRTC_RWCTRL] & INCOLOR_RWCTRL_WRMODE; unsigned char fg = incolor->crtc[INCOLOR_CRTC_RWCOL] & 0x0F; unsigned char bg = (incolor->crtc[INCOLOR_CRTC_RWCOL] >> 4)&0x0F; - unsigned char w; + unsigned char w = 0; unsigned char vmask; /* Mask of bit within byte */ unsigned char pmask; /* Mask of plane within colour value */ unsigned char latch; @@ -596,9 +597,9 @@ static void incolor_draw_char_ram48(incolor_t *incolor, int x, uint8_t chr, uint { unsigned i; int elg, blk, ul, ol, bld; - unsigned ull, oll, ulc, olc; + unsigned ull, oll, ulc = 0, olc = 0; unsigned val[4]; - unsigned ifg, ibg, cfg, pmask, plane; + unsigned ifg = 0, ibg, cfg, pmask, plane; const unsigned char *fnt; uint32_t fg; int cw = INCOLOR_CW; @@ -764,8 +765,8 @@ static void incolor_text_line(incolor_t *incolor, uint16_t ca) for (x = 0; x < incolor->crtc[1]; x++) { - chr = incolor->vram[(incolor->ma << 1) & 0x3fff]; - attr = incolor->vram[((incolor->ma << 1) + 1) & 0x3fff]; + chr = incolor->vram[(incolor->ma << 1) & 0xfff]; + attr = incolor->vram[((incolor->ma << 1) + 1) & 0xfff]; drawcursor = ((incolor->ma == ca) && incolor->con && incolor->cursoron); @@ -866,7 +867,6 @@ void incolor_poll(void *p) if (!incolor->linepos) { -// pclog("InColor poll %i %i\n", incolor->vc, incolor->sc); incolor->vidtime += incolor->dispofftime; incolor->stat |= 1; incolor->linepos = 1; @@ -894,7 +894,6 @@ void incolor_poll(void *p) if (incolor->vc == incolor->crtc[7] && !incolor->sc) { incolor->stat |= 8; -// printf("VSYNC on %i %i\n",vc,sc); } incolor->displine++; if (incolor->displine >= 500) @@ -912,7 +911,6 @@ void incolor_poll(void *p) if (!incolor->vsynctime) { incolor->stat &= ~8; -// printf("VSYNC off %i %i\n",vc,sc); } } if (incolor->sc == (incolor->crtc[11] & 31) || ((incolor->crtc[8] & 3) == 3 && incolor->sc == ((incolor->crtc[11] & 31) >> 1))) @@ -944,7 +942,6 @@ void incolor_poll(void *p) incolor->dispon = 0; if (oldvc == incolor->crtc[4]) { -// printf("Display over at %i\n",displine); incolor->vc = 0; incolor->vadj = incolor->crtc[5]; if (!incolor->vadj) incolor->dispon=1; @@ -956,10 +953,9 @@ void incolor_poll(void *p) { incolor->dispon = 0; incolor->displine = 0; - incolor->vsynctime = 16;//(crtcm[3]>>4)+1; + incolor->vsynctime = 16; if (incolor->crtc[7]) { -// printf("Lastline %i Firstline %i %i\n",lastline,firstline,lastline-firstline); if ((incolor->ctrl & INCOLOR_CTRL_GRAPH) && (incolor->ctrl2 & INCOLOR_CTRL2_GRAPH)) { x = incolor->crtc[1] << 4; @@ -973,7 +969,6 @@ void incolor_poll(void *p) { xsize = x; ysize = incolor->lastline - incolor->firstline; -// printf("Resize to %i,%i - R1 %i\n",xsize,ysize,crtcm[1]); if (xsize < 64) xsize = 656; if (ysize < 32) ysize = 200; updatewindowsize(xsize, ysize); @@ -1007,7 +1002,6 @@ void incolor_poll(void *p) if ((incolor->sc == (incolor->crtc[10] & 31) || ((incolor->crtc[8] & 3) == 3 && incolor->sc == ((incolor->crtc[10] & 31) >> 1)))) { incolor->con = 1; -// printf("Cursor on - %02X %02X %02X\n",crtcm[8],crtcm[10],crtcm[11]); } } } diff --git a/src/vid_mda.c b/src/vid_mda.c index bf3b9e459..4b45debc3 100644 --- a/src/vid_mda.c +++ b/src/vid_mda.c @@ -117,7 +117,6 @@ void mda_poll(void *p) int x, c; int oldvc; uint8_t chr, attr; - int cols[4]; int oldsc; int blink; if (!mda->linepos) @@ -135,12 +134,10 @@ void mda_poll(void *p) mda->firstline = mda->displine; } mda->lastline = mda->displine; - cols[0] = 0; - cols[1] = 7; for (x = 0; x < mda->crtc[1]; x++) { - chr = mda->vram[(mda->ma << 1) & 0x3fff]; - attr = mda->vram[((mda->ma << 1) + 1) & 0x3fff]; + chr = mda->vram[(mda->ma << 1) & 0xfff]; + attr = mda->vram[((mda->ma << 1) + 1) & 0xfff]; drawcursor = ((mda->ma == ca) && mda->con && mda->cursoron); blink = ((mda->blink & 16) && (mda->ctrl & 0x20) && (attr & 0x80) && !drawcursor); if (mda->sc == 12 && ((attr & 7) == 1)) @@ -167,7 +164,6 @@ void mda_poll(void *p) if (mda->vc == mda->crtc[7] && !mda->sc) { mda->stat |= 8; -// printf("VSYNC on %i %i\n",vc,sc); } mda->displine++; if (mda->displine >= 500) @@ -184,7 +180,6 @@ void mda_poll(void *p) if (!mda->vsynctime) { mda->stat&=~8; -// printf("VSYNC off %i %i\n",vc,sc); } } if (mda->sc == (mda->crtc[11] & 31) || ((mda->crtc[8] & 3) == 3 && mda->sc == ((mda->crtc[11] & 31) >> 1))) @@ -216,7 +211,6 @@ void mda_poll(void *p) mda->dispon=0; if (oldvc == mda->crtc[4]) { -// printf("Display over at %i\n",displine); mda->vc = 0; mda->vadj = mda->crtc[5]; if (!mda->vadj) mda->dispon = 1; @@ -231,14 +225,12 @@ void mda_poll(void *p) mda->vsynctime = 16; if (mda->crtc[7]) { -// printf("Lastline %i Firstline %i %i\n",lastline,firstline,lastline-firstline); x = mda->crtc[1] * 9; mda->lastline++; if (x != xsize || (mda->lastline - mda->firstline) != ysize) { xsize = x; ysize = mda->lastline - mda->firstline; -// printf("Resize to %i,%i - R1 %i\n",xsize,ysize,crtcm[1]); if (xsize < 64) xsize = 656; if (ysize < 32) ysize = 200; updatewindowsize(xsize, ysize); @@ -263,7 +255,6 @@ void mda_poll(void *p) if ((mda->sc == (mda->crtc[10] & 31) || ((mda->crtc[8] & 3) == 3 && mda->sc == ((mda->crtc[10] & 31) >> 1)))) { mda->con = 1; -// printf("Cursor on - %02X %02X %02X\n",crtcm[8],crtcm[10],crtcm[11]); } } } @@ -332,35 +323,27 @@ void mda_speed_changed(void *p) static device_config_t mda_config[] = { { - .name = "rgb_type", - .description = "Display type", - .type = CONFIG_SELECTION, - .selection = + "rgb_type", "Display type", CONFIG_SELECTION, "", 0, { { - .description = "Default", - .value = 0 + "Default", 0 }, { - .description = "Green", - .value = 1 + "Green", 1 }, { - .description = "Amber", - .value = 2 + "Amber", 2 }, { - .description = "Gray", - .value = 3 + "Gray", 3 }, { - .description = "" + "" } - }, - .default_int = 0 + } }, { - .type = -1 + "", "", -1 } }; #endif diff --git a/src/vid_nv_riva128.c b/src/vid_nv_riva128.c index 152b2f963..de8c93fcc 100644 --- a/src/vid_nv_riva128.c +++ b/src/vid_nv_riva128.c @@ -8,6 +8,7 @@ #include "io.h" #include "mem.h" #include "pci.h" +#include "pic.h" #include "rom.h" #include "thread.h" #include "timer.h" @@ -1794,7 +1795,7 @@ static void riva128_pusher_run(int chanid, void *p) { uint32_t dmaget = riva128->pfifo.channels[chanid].dmaget; uint32_t cmd = ((uint32_t*)svga->vram)[dmaget >> 2]; - uint32_t* params = ((uint32_t*)svga->vram)[(dmaget + 4) >> 2]; + uint32_t* params = (uint32_t *)(((uint32_t*)svga->vram)[(dmaget + 4) >> 2]); if(((cmd & 0xe0000003) == 0x20000000) && (riva128->card_id >= 0x04)) { //old nv4 jump command diff --git a/src/vid_olivetti_m24.c b/src/vid_olivetti_m24.c index c60061e62..8b6e62983 100644 --- a/src/vid_olivetti_m24.c +++ b/src/vid_olivetti_m24.c @@ -55,7 +55,6 @@ void m24_out(uint16_t addr, uint8_t val, void *p) { m24_t *m24 = (m24_t *)p; uint8_t old; -// pclog("m24_out %04X %02X\n", addr, val); switch (addr) { case 0x3d4: @@ -129,10 +128,8 @@ void m24_recalctimings(m24_t *m24) _dispontime = m24->crtc[1] << 1; } _dispofftime = disptime - _dispontime; -// printf("%i %f %f %f %i %i\n",cgamode&1,disptime,dispontime,dispofftime,crtc[0],crtc[1]); _dispontime *= CGACONST / 2; _dispofftime *= CGACONST / 2; -// printf("Timings - on %f off %f frame %f second %f\n",dispontime,dispofftime,(dispontime+dispofftime)*262.0,(dispontime+dispofftime)*262.0*59.92); m24->dispontime = (int)(_dispontime * (1 << TIMER_SHIFT)); m24->dispofftime = (int)(_dispofftime * (1 << TIMER_SHIFT)); } @@ -151,7 +148,6 @@ void m24_poll(void *p) int oldsc; if (!m24->linepos) { -// pclog("Line poll %i %i %i %i - %04X %i %i %i\n", m24_lineff, vc, sc, vadj, ma, firstline, lastline, displine); m24->vidtime += m24->dispofftime; m24->stat |= 1; m24->linepos = 1; @@ -160,11 +156,9 @@ void m24_poll(void *p) m24->sc = (m24->sc << 1) & 7; if (m24->dispon) { - // pclog("dispon %i\n", m24->linepos); if (m24->displine < m24->firstline) { m24->firstline = m24->displine; -// printf("Firstline %i\n",firstline); } m24->lastline = m24->displine; for (c = 0; c < 8; c++) @@ -325,7 +319,6 @@ void m24_poll(void *p) } else { -// pclog("Line poll %i %i %i %i\n", m24_lineff, vc, sc, vadj); m24->vidtime += m24->dispontime; if (m24->dispon) m24->stat &= ~1; m24->linepos = 0; @@ -453,7 +446,6 @@ void m24_poll(void *p) void *m24_init() { - int c; m24_t *m24 = malloc(sizeof(m24_t)); memset(m24, 0, sizeof(m24_t)); diff --git a/src/vid_oti067.c b/src/vid_oti067.c index 202da0466..c1f0f0b0c 100644 --- a/src/vid_oti067.c +++ b/src/vid_oti067.c @@ -35,8 +35,6 @@ void oti067_out(uint16_t addr, uint8_t val, void *p) svga_t *svga = &oti067->svga; uint8_t old; -// pclog("oti067_out : %04X %02X %02X %i\n", addr, val, ram[0x489], ins); - if ((((addr&0xFFF0) == 0x3D0 || (addr&0xFFF0) == 0x3B0) && addr < 0x3de) && !(svga->miscout & 1)) addr ^= 0x60; switch (addr) @@ -95,8 +93,6 @@ uint8_t oti067_in(uint16_t addr, void *p) svga_t *svga = &oti067->svga; uint8_t temp; -// if (addr != 0x3da && addr != 0x3ba) pclog("oti067_in : %04X ", addr); - if ((((addr&0xFFF0) == 0x3D0 || (addr&0xFFF0) == 0x3B0) && addr < 0x3de) && !(svga->miscout & 1)) addr ^= 0x60; switch (addr) @@ -110,7 +106,6 @@ uint8_t oti067_in(uint16_t addr, void *p) case 0x3DE: temp = oti067->index | (oti067->chip_id << 5); - // temp = oti067->index | (2 << 5); break; case 0x3DF: if (oti067->index==0x10) temp = 0x18; @@ -121,7 +116,6 @@ uint8_t oti067_in(uint16_t addr, void *p) temp = svga_in(addr, svga); break; } -// if (addr != 0x3da && addr != 0x3ba) pclog("%02X %04X:%04X\n", temp, CS,pc); return temp; } @@ -153,7 +147,6 @@ void oti067_recalctimings(svga_t *svga) if (oti067->regs[0x14] & 0x08) svga->ma_latch |= 0x10000; if (oti067->regs[0x0d] & 0x0c) svga->rowoffset <<= 1; - // svga->interlace = oti067->regs[0x14] & 0x80; if (oti067->regs[0x14] & 0x80) { svga->vtotal *= 2; @@ -265,73 +258,48 @@ void oti067_add_status_info(char *s, int max_len, void *p) static device_config_t oti067_config[] = { { - .name = "memory", - .description = "Memory size", - .type = CONFIG_SELECTION, - .selection = + "memory", "Memory size", CONFIG_SELECTION, "", 512, { { - .description = "256 kB", - .value = 256 + "256 kB", 256 }, { - .description = "512 kB", - .value = 512 + "512 kB", 512 }, { - .description = "" + "" } - }, - .default_int = 512 + } }, { - .type = -1 + "", "", -1 } }; static device_config_t oti077_config[] = { { - .name = "memory", - .description = "Memory size", - .type = CONFIG_SELECTION, - .selection = + "memory", "Memory size", CONFIG_SELECTION, "", 1024, { { - .description = "256 kB", - .value = 256 + "256 kB", 256 }, { - .description = "512 kB", - .value = 512 + "512 kB", 512 }, { - .description = "1 MB", - .value = 1024 + "1 MB", 1024 }, { - .description = "" + "" } - }, - .default_int = 1024 + } }, { - .type = -1 + "", "", -1 } }; -/* device_t oti037_device = -{ - "Oak OTI-037", - 0, - oti037_init, - oti067_close, - oti037_available, - oti067_speed_changed, - oti067_force_redraw, - oti067_add_status_info, - oti067_config -}; */ device_t oti067_device = { "Oak OTI-067", diff --git a/src/vid_paradise.c b/src/vid_paradise.c index e6ce2ee06..859695459 100644 --- a/src/vid_paradise.c +++ b/src/vid_paradise.c @@ -9,6 +9,7 @@ #include #include "ibm.h" #include "device.h" +#include "io.h" #include "mem.h" #include "rom.h" #include "video.h" @@ -45,8 +46,6 @@ void paradise_out(uint16_t addr, uint8_t val, void *p) if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(svga->miscout & 1)) addr ^= 0x60; -// output = 3; -// pclog("Paradise out %04X %02X %04X:%04X\n", addr, val, CS, pc); switch (addr) { case 0x3c5: @@ -71,7 +70,6 @@ void paradise_out(uint16_t addr, uint8_t val, void *p) { if ((svga->gdcreg[6] & 0xc) != (val & 0xc)) { -// pclog("Write mapping %02X\n", val); switch (val&0xC) { case 0x0: /*128k at A0000*/ @@ -151,7 +149,6 @@ uint8_t paradise_in(uint16_t addr, void *p) if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(svga->miscout & 1)) addr ^= 0x60; -// if (addr != 0x3da) pclog("Paradise in %04X\n", addr); switch (addr) { case 0x3c2: @@ -197,7 +194,6 @@ void paradise_remap(paradise_t *paradise) if (svga->seqregs[0x11] & 0x80) { -// pclog("Remap 1\n"); paradise->read_bank[0] = paradise->read_bank[2] = (svga->gdcreg[0x9] & 0x7f) << 12; paradise->read_bank[1] = paradise->read_bank[3] = ((svga->gdcreg[0x9] & 0x7f) << 12) + ((svga->gdcreg[6] & 0x08) ? 0 : 0x8000); paradise->write_bank[0] = paradise->write_bank[2] = (svga->gdcreg[0xa] & 0x7f) << 12; @@ -207,7 +203,6 @@ void paradise_remap(paradise_t *paradise) { if (svga->gdcreg[0x6] & 0xc) { -// pclog("Remap 2\n"); paradise->read_bank[0] = paradise->read_bank[2] = (svga->gdcreg[0xa] & 0x7f) << 12; paradise->write_bank[0] = paradise->write_bank[2] = (svga->gdcreg[0xa] & 0x7f) << 12; paradise->read_bank[1] = paradise->read_bank[3] = ((svga->gdcreg[0x9] & 0x7f) << 12) + ((svga->gdcreg[6] & 0x08) ? 0 : 0x8000); @@ -215,7 +210,6 @@ void paradise_remap(paradise_t *paradise) } else { -// pclog("Remap 3\n"); paradise->read_bank[0] = paradise->write_bank[0] = (svga->gdcreg[0xa] & 0x7f) << 12; paradise->read_bank[1] = paradise->write_bank[1] = ((svga->gdcreg[0xa] & 0x7f) << 12) + ((svga->gdcreg[6] & 0x08) ? 0 : 0x8000); paradise->read_bank[2] = paradise->write_bank[2] = (svga->gdcreg[0x9] & 0x7f) << 12; @@ -224,13 +218,11 @@ void paradise_remap(paradise_t *paradise) } else { - // pclog("Remap 4\n"); paradise->read_bank[0] = paradise->read_bank[2] = (svga->gdcreg[0x9] & 0x7f) << 12; paradise->read_bank[1] = paradise->read_bank[3] = ((svga->gdcreg[0x9] & 0x7f) << 12) + ((svga->gdcreg[6] & 0x08) ? 0 : 0x8000); paradise->write_bank[0] = paradise->write_bank[2] = (svga->gdcreg[0x9] & 0x7f) << 12; paradise->write_bank[1] = paradise->write_bank[3] = ((svga->gdcreg[0x9] & 0x7f) << 12) + ((svga->gdcreg[6] & 0x08) ? 0 : 0x8000); } -// pclog("Remap - %04X %04X\n", paradise->read_bank[0], paradise->write_bank[0]); } void paradise_recalctimings(svga_t *svga) @@ -243,9 +235,8 @@ void paradise_recalctimings(svga_t *svga) void paradise_write(uint32_t addr, uint8_t val, void *p) { paradise_t *paradise = (paradise_t *)p; -// pclog("paradise_write : %05X %02X ", addr, val); addr = (addr & 0x7fff) + paradise->write_bank[(addr >> 15) & 3]; -// pclog("%08X\n", addr); + /* Horrible hack, I know, but it's the only way to fix the 440FX BIOS filling the VRAM with garbage until Tom fixes the memory emulation. */ if ((cs == 0xE0000) && (cpu_state.pc == 0xBF2F) && (romset == ROM_440FX)) return; if ((cs == 0xE0000) && (cpu_state.pc == 0xBF77) && (romset == ROM_440FX)) return; @@ -255,9 +246,7 @@ void paradise_write(uint32_t addr, uint8_t val, void *p) uint8_t paradise_read(uint32_t addr, void *p) { paradise_t *paradise = (paradise_t *)p; -// pclog("paradise_read : %05X ", addr); addr = (addr & 0x7fff) + paradise->read_bank[(addr >> 15) & 3]; -// pclog("%08X\n", addr); return svga_read_linear(addr, ¶dise->svga); } diff --git a/src/vid_paradise.h b/src/vid_paradise.h index e28bb4fae..83dd1042b 100644 --- a/src/vid_paradise.h +++ b/src/vid_paradise.h @@ -5,4 +5,3 @@ extern device_t paradise_pvga1a_pc2086_device; extern device_t paradise_pvga1a_pc3086_device; extern device_t paradise_wd90c11_megapc_device; extern device_t paradise_wd90c11_device; -// extern device_t cpqvga_device; diff --git a/src/vid_pc1512.c b/src/vid_pc1512.c index 5f75ed157..466db6f8f 100644 --- a/src/vid_pc1512.c +++ b/src/vid_pc1512.c @@ -57,7 +57,6 @@ static void pc1512_out(uint16_t addr, uint8_t val, void *p) { pc1512_t *pc1512 = (pc1512_t *)p; uint8_t old; -// pclog("PC1512 out %04X %02X %04X:%04X\n",addr,val,CS,pc); switch (addr) { case 0x3d4: @@ -101,7 +100,6 @@ static void pc1512_out(uint16_t addr, uint8_t val, void *p) static uint8_t pc1512_in(uint16_t addr, void *p) { pc1512_t *pc1512 = (pc1512_t *)p; -// pclog("PC1512 in %04X %02X %04X:%04X\n",addr,CS,pc); switch (addr) { case 0x3d4: @@ -153,10 +151,8 @@ static void pc1512_recalctimings(pc1512_t *pc1512) disptime = 128; /*Fixed on PC1512*/ _dispontime = 80; _dispofftime = disptime - _dispontime; -// printf("%i %f %f %f %i %i\n",cgamode&1,disptime,dispontime,dispofftime,crtc[0],crtc[1]); _dispontime *= CGACONST; _dispofftime *= CGACONST; -// printf("Timings - on %f off %f frame %f second %f\n",dispontime,dispofftime,(dispontime+dispofftime)*262.0,(dispontime+dispofftime)*262.0*59.92); pc1512->dispontime = (int)(_dispontime * (1 << TIMER_SHIFT)); pc1512->dispofftime = (int)(_dispofftime * (1 << TIMER_SHIFT)); } @@ -167,7 +163,6 @@ static void pc1512_poll(void *p) uint16_t ca = (pc1512->crtc[15] | (pc1512->crtc[14] << 8)) & 0x3fff; int drawcursor; int x, c; - int oldvc; uint8_t chr, attr; uint16_t dat, dat2, dat3, dat4; int cols[4]; @@ -338,7 +333,6 @@ static void pc1512_poll(void *p) pc1512->displine++; if (pc1512->displine >= 360) pc1512->displine = 0; -// pclog("Line %i %i %i %i %i %i\n",displine,cgadispon,firstline,lastline,vc,sc); } else { @@ -376,11 +370,10 @@ static void pc1512_poll(void *p) { pc1512->maback = pc1512->ma; pc1512->sc = 0; - oldvc = pc1512->vc; pc1512->vc++; pc1512->vc &= 127; - if (pc1512->displine == 32)//oldvc == (cgamode & 2) ? 127 : 31) + if (pc1512->displine == 32) { pc1512->vc = 0; pc1512->vadj = 6; @@ -388,7 +381,7 @@ static void pc1512_poll(void *p) else pc1512->cursoron = pc1512->blink & 16; } - if (pc1512->displine >= 262)//vc == (cgamode & 2) ? 111 : 27) + if (pc1512->displine >= 262) { pc1512->dispon = 0; pc1512->displine = 0; @@ -409,11 +402,6 @@ static void pc1512_poll(void *p) } video_blit_memtoscreen_8(0, pc1512->firstline - 4, xsize, (pc1512->lastline - pc1512->firstline) + 8); -// blit(buffer,vbuf,0,firstline-4,0,0,xsize,(lastline-firstline)+8+1); -// if (vid_resize) stretch_blit(vbuf,screen,0,0,xsize,(lastline-firstline)+8+1,0,0,winsizex,winsizey); -// else stretch_blit(vbuf,screen,0,0,xsize,(lastline-firstline)+8+1,0,0,xsize,((lastline-firstline)<<1)+16+2); -// if (readflash) rectfill(screen,winsizex-40,8,winsizex-8,14,0xFFFFFFFF); -// readflash=0; video_res_x = xsize - 16; video_res_y = ysize; @@ -457,7 +445,6 @@ static void pc1512_poll(void *p) static void *pc1512_init() { - int c; pc1512_t *pc1512 = malloc(sizeof(pc1512_t)); memset(pc1512, 0, sizeof(pc1512_t)); diff --git a/src/vid_pcjr.c b/src/vid_pcjr.c index de5c1bc94..b10cb475c 100644 --- a/src/vid_pcjr.c +++ b/src/vid_pcjr.c @@ -4,8 +4,10 @@ #include "device.h" #include "io.h" #include "mem.h" +#include "pic.h" #include "timer.h" #include "video.h" +#include "dosbox/vid_cga_comp.h" #include "vid_pcjr.h" #define PCJR_RGB 0 @@ -21,7 +23,7 @@ typedef struct pcjr_t int array_index; uint8_t array[32]; int array_ff; - int memctrl;//=-1; + int memctrl; uint8_t stat; int addr_mode; @@ -53,14 +55,12 @@ void pcjr_out(uint16_t addr, uint8_t val, void *p) { pcjr_t *pcjr = (pcjr_t *)p; uint8_t old; -// pclog("pcjr OUT %04X %02X\n",addr,val); switch (addr) { case 0x3d4: pcjr->crtcreg = val & 0x1f; return; case 0x3d5: -// pclog("CRTC write %02X %02x\n", pcjr->crtcreg, val); old = pcjr->crtc[pcjr->crtcreg]; pcjr->crtc[pcjr->crtcreg] = val & crtcmask[pcjr->crtcreg]; if (old != val) @@ -73,7 +73,6 @@ void pcjr_out(uint16_t addr, uint8_t val, void *p) } return; case 0x3da: -// pclog("Array write %02X %02X\n", pcjr->array_index, val); if (!pcjr->array_ff) pcjr->array_index = val & 0x1f; else @@ -97,7 +96,6 @@ void pcjr_out(uint16_t addr, uint8_t val, void *p) uint8_t pcjr_in(uint16_t addr, void *p) { pcjr_t *pcjr = (pcjr_t *)p; -// if (addr!=0x3DA) pclog("pcjr IN %04X\n",addr); switch (addr) { case 0x3d4: @@ -118,13 +116,11 @@ void pcjr_recalcaddress(pcjr_t *pcjr) { pcjr->vram = &ram[(pcjr->memctrl & 0x06) << 14]; pcjr->b8000 = &ram[(pcjr->memctrl & 0x30) << 11]; -// printf("VRAM at %05X B8000 at %05X\n",((pcjr->memctrl&0x6)<<14)+pcjr->base,((pcjr->memctrl&0x30)<<11)+pcjr->base); } else { pcjr->vram = &ram[(pcjr->memctrl & 0x07) << 14]; pcjr->b8000 = &ram[(pcjr->memctrl & 0x38) << 11]; -// printf("VRAM at %05X B8000 at %05X\n",((pcjr->memctrl&0x7)<<14)+pcjr->base,((pcjr->memctrl&0x38)<<11)+pcjr->base); } } @@ -135,7 +131,6 @@ void pcjr_write(uint32_t addr, uint8_t val, void *p) return; egawrites++; -// pclog("pcjr VRAM write %05X %02X %04X:%04X %04X:%04X\n",addr,val,CS,pc,DS,SI); pcjr->b8000[addr & 0x3fff] = val; } @@ -146,7 +141,6 @@ uint8_t pcjr_read(uint32_t addr, void *p) return 0xff; egareads++; -// pclog("pcjr VRAM read %05X %02X %04X:%04X\n",addr,pcjr->b8000[addr&0x7FFF],CS,pc); return pcjr->b8000[addr & 0x3fff]; } @@ -171,27 +165,8 @@ void pcjr_recalctimings(pcjr_t *pcjr) } -static int ntsc_col[8][8]= -{ - {0,0,0,0,0,0,0,0}, /*Black*/ - {0,0,1,1,1,1,0,0}, /*Blue*/ - {1,0,0,0,0,1,1,1}, /*Green*/ - {0,0,0,0,1,1,1,1}, /*Cyan*/ - {1,1,1,1,0,0,0,0}, /*Red*/ - {0,1,1,1,1,0,0,0}, /*Magenta*/ - {1,1,0,0,0,0,1,1}, /*Yellow*/ - {1,1,1,1,1,1,1,1} /*White*/ -}; - -/*static int cga4pal[8][4]= -{ - {0,2,4,6},{0,3,5,7},{0,3,4,7},{0,3,4,7}, - {0,10,12,14},{0,11,13,15},{0,11,12,15},{0,11,12,15} -};*/ - void pcjr_poll(void *p) { -// int *cgapal=cga4pal[((pcjr->col&0x10)>>2)|((cgamode&4)>>1)|((cgacol&0x20)>>5)]; pcjr_t *pcjr = (pcjr_t *)p; uint16_t ca = (pcjr->crtc[15] | (pcjr->crtc[14] << 8)) & 0x3fff; int drawcursor; @@ -200,16 +175,9 @@ void pcjr_poll(void *p) uint8_t chr, attr; uint16_t dat; int cols[4]; - int col; int oldsc; - int y_buf[8] = {0, 0, 0, 0, 0, 0, 0, 0}, y_val, y_tot; - int i_buf[8] = {0, 0, 0, 0, 0, 0, 0, 0}, i_val, i_tot; - int q_buf[8] = {0, 0, 0, 0, 0, 0, 0, 0}, q_val, q_tot; - int r, g, b; if (!pcjr->linepos) { -// cgapal[0]=pcjr->col&15; -// printf("Firstline %i Lastline %i pcjr->displine %i\n",firstline,lastline,pcjr->displine); pcjr->vidtime += pcjr->dispofftime; pcjr->stat &= ~1; pcjr->linepos = 1; @@ -333,7 +301,6 @@ void pcjr_poll(void *p) for (c = 0; c < 8; c++) buffer->line[pcjr->displine][(x << 3) + c + 8] = cols[(fontdat[chr][pcjr->sc & 7] & (1 << (c ^ 7))) ? 1 : 0]; } -// if (!((ma^(crtc[15]|(crtc[14]<<8)))&0x3FFF)) printf("Cursor match! %04X\n",ma); if (drawcursor) { for (c = 0; c < 8; c++) @@ -424,7 +391,6 @@ void pcjr_poll(void *p) } else { -// cols[0] = ((pcjr->mode & 0x12) == 0x12) ? 0 : (pcjr->col & 0xf) + 16; cols[0] = pcjr->array[0 + 16] + 16; if (pcjr->array[0] & 1) hline(buffer, 0, pcjr->displine, (pcjr->crtc[1] << 3) + 16, cols[0]); else hline(buffer, 0, pcjr->displine, (pcjr->crtc[1] << 4) + 16, cols[0]); @@ -443,7 +409,6 @@ void pcjr_poll(void *p) if (pcjr->vc == pcjr->crtc[7] && !pcjr->sc) { pcjr->stat |= 8; -// printf("VSYNC on %i %i\n",vc,sc); } pcjr->displine++; if (pcjr->displine >= 360) @@ -461,7 +426,6 @@ void pcjr_poll(void *p) if (!pcjr->vsynctime) { pcjr->stat &= ~8; -// printf("VSYNC off %i %i\n",vc,sc); } } if (pcjr->sc == (pcjr->crtc[11] & 31) || ((pcjr->crtc[8] & 3) == 3 && pcjr->sc == ((pcjr->crtc[11] & 31) >> 1))) @@ -480,25 +444,19 @@ void pcjr_poll(void *p) pcjr->dispon = 1; pcjr->ma = pcjr->maback = (pcjr->crtc[13] | (pcjr->crtc[12] << 8)) & 0x3fff; pcjr->sc = 0; -// printf("Display on!\n"); } } else if (pcjr->sc == pcjr->crtc[9] || ((pcjr->crtc[8] & 3) == 3 && pcjr->sc == (pcjr->crtc[9] >> 1))) { pcjr->maback = pcjr->ma; -// con=0; -// coff=0; pcjr->sc = 0; oldvc = pcjr->vc; pcjr->vc++; pcjr->vc &= 127; -// pclog("VC %i %i\n", pcjr->vc, pcjr->crtc[7]); -// printf("VC %i %i %i %i %i\n",vc,crtc[4],crtc[6],crtc[7],pcjr->dispon); if (pcjr->vc == pcjr->crtc[6]) pcjr->dispon = 0; if (oldvc == pcjr->crtc[4]) { -// printf("Display over at %i\n",pcjr->displine); pcjr->vc = 0; pcjr->vadj = pcjr->crtc[5]; if (!pcjr->vadj) @@ -507,19 +465,15 @@ void pcjr_poll(void *p) pcjr->ma = pcjr->maback = (pcjr->crtc[13] | (pcjr->crtc[12] << 8)) & 0x3fff; if ((pcjr->crtc[10] & 0x60) == 0x20) pcjr->cursoron = 0; else pcjr->cursoron = pcjr->blink & 16; -// printf("CRTC10 %02X %i\n",crtc[10],cursoron); } if (pcjr->vc == pcjr->crtc[7]) { pcjr->dispon = 0; pcjr->displine = 0; - pcjr->vsynctime = 16;//(crtc[3]>>4)+1; + pcjr->vsynctime = 16; picint(1 << 5); -// printf("pcjr->vsynctime %i %02X\n",pcjr->vsynctime,crtc[3]); -// pcjr->stat|=8; if (pcjr->crtc[7]) { -// printf("Lastline %i Firstline %i %i %i %i\n",lastline,firstline,lastline-firstline,crtc[1],xsize); if (pcjr->array[0] & 1) x = (pcjr->crtc[1] << 3) + 16; else x = (pcjr->crtc[1] << 4) + 16; pcjr->lastline++; @@ -527,13 +481,10 @@ void pcjr_poll(void *p) { xsize = x; ysize = pcjr->lastline - pcjr->firstline; -// printf("Resize to %i,%i - R1 %i\n",xsize,ysize,crtc[1]); if (xsize < 64) xsize = 656; if (ysize < 32) ysize = 200; updatewindowsize(xsize, (ysize << 1) + 16); } -// printf("Blit %i %i\n",firstline,lastline); -//printf("Xsize is %i\n",xsize); if (pcjr->composite) video_blit_memtoscreen(0, pcjr->firstline-4, 0, (pcjr->lastline - pcjr->firstline) + 8, xsize, (pcjr->lastline - pcjr->firstline) + 8); @@ -606,27 +557,21 @@ device_t pcjr_video_device = static device_config_t pcjr_config[] = { { - .name = "display_type", - .description = "Display type", - .type = CONFIG_SELECTION, - .selection = + "display_type", "Display type", CONFIG_SELECTION, "", PCJR_RGB, { { - .description = "RGB", - .value = PCJR_RGB + "RGB", PCJR_RGB }, { - .description = "Composite", - .value = PCJR_COMPOSITE + "Composite", PCJR_COMPOSITE }, { - .description = "" + "" } - }, - .default_int = PCJR_RGB + } }, { - .type = -1 + "", "", -1 } }; diff --git a/src/vid_ps1_svga.c b/src/vid_ps1_svga.c index 4c0ce9963..86b10c8ec 100644 --- a/src/vid_ps1_svga.c +++ b/src/vid_ps1_svga.c @@ -34,8 +34,6 @@ void ps1_m2121_svga_out(uint16_t addr, uint8_t val, void *p) svga_t *svga = &ps1->svga; uint8_t old; -// pclog("svga_out : %04X %02X %04X:%04X %02X %i\n", addr, val, CS,cpu_state.pc, ram[0x489], ins); - if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(svga->miscout & 1)) addr ^= 0x60; @@ -86,8 +84,6 @@ uint8_t ps1_m2121_svga_in(uint16_t addr, void *p) svga_t *svga = &ps1->svga; uint8_t temp; -// if (addr != 0x3da) pclog("svga_in : %04X ", addr); - if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(svga->miscout & 1)) addr ^= 0x60; @@ -118,7 +114,6 @@ uint8_t ps1_m2121_svga_in(uint16_t addr, void *p) temp = svga_in(addr, svga); break; } -// if (addr != 0x3da) pclog("%02X %04X:%04X\n", temp, CS,pc); return temp; } @@ -136,7 +131,6 @@ void *ps1_m2121_svga_init() io_sethandler(0x0100, 0x0002, ps1_m2121_svga_in, NULL, NULL, ps1_m2121_svga_out, NULL, NULL, ps1); io_sethandler(0x03c0, 0x0020, ps1_m2121_svga_in, NULL, NULL, ps1_m2121_svga_out, NULL, NULL, ps1); io_sethandler(0x2100, 0x0010, ps1_m2121_svga_in, NULL, NULL, ps1_m2121_svga_out, NULL, NULL, ps1); -// io_sethandler(0x210a, 0x0001, ps1_m2121_svga_in, NULL, NULL, ps1_m2121_svga_out, NULL, NULL, ps1); ps1->svga.bpp = 8; ps1->svga.miscout = 1; diff --git a/src/vid_s3.c b/src/vid_s3.c index 18e9a7607..3c0a3371b 100644 --- a/src/vid_s3.c +++ b/src/vid_s3.c @@ -1,6 +1,3 @@ -/* Copyright holders: Sarah Walker, SA1988 - see COPYING for more details -*/ /*S3 emulation*/ #include #include "ibm.h" @@ -14,13 +11,11 @@ #include "vid_s3.h" #include "vid_svga.h" #include "vid_svga_render.h" -#include "vid_bt485_ramdac.h" #include "vid_sdac_ramdac.h" enum { S3_VISION864, - /* S3_VISION964, */ S3_TRIO32, S3_TRIO64 }; @@ -71,7 +66,6 @@ typedef struct s3_t svga_t svga; sdac_ramdac_t ramdac; - // bt485_ramdac_t bt485_ramdac; uint8_t bank; uint8_t ma_ext; @@ -146,7 +140,7 @@ void s3_accel_write_w(uint32_t addr, uint16_t val, void *p); void s3_accel_write_l(uint32_t addr, uint32_t val, void *p); uint8_t s3_accel_read(uint32_t addr, void *p); -static inline void wake_fifo_thread(s3_t *s3) +static __inline void wake_fifo_thread(s3_t *s3) { thread_set_event(s3->wake_fifo_thread); /*Wake up FIFO thread if moving from idle*/ } @@ -407,7 +401,6 @@ static void s3_accel_out_fifo(s3_t *s3, uint16_t port, uint8_t val) static void s3_accel_out_fifo_w(s3_t *s3, uint16_t port, uint16_t val) { -// pclog("Accel out w %04X %04X\n", port, val); if (s3->accel.cmd & 0x100) { if ((s3->accel.multifunc[0xa] & 0xc0) == 0x80) @@ -423,7 +416,6 @@ static void s3_accel_out_fifo_w(s3_t *s3, uint16_t port, uint16_t val) static void s3_accel_out_fifo_l(s3_t *s3, uint16_t port, uint32_t val) { -// pclog("Accel out l %04X %08X\n", port, val); if (s3->accel.cmd & 0x100) { if ((s3->accel.multifunc[0xa] & 0xc0) == 0x80) @@ -467,7 +459,6 @@ static void s3_accel_out_fifo_l(s3_t *s3, uint16_t port, uint32_t val) static void s3_accel_write_fifo(s3_t *s3, uint32_t addr, uint8_t val) { -// pclog("Write S3 accel %08X %02X\n", addr, val); if (s3->packed_mmio) { int addr_lo = addr & 1; @@ -573,7 +564,6 @@ static void s3_accel_write_fifo(s3_t *s3, uint32_t addr, uint8_t val) static void s3_accel_write_fifo_w(s3_t *s3, uint32_t addr, uint16_t val) { -// pclog("Write S3 accel w %08X %04X\n", addr, val); if (addr & 0x8000) { s3_accel_write_fifo(s3, addr, val); @@ -597,7 +587,6 @@ static void s3_accel_write_fifo_w(s3_t *s3, uint32_t addr, uint16_t val) static void s3_accel_write_fifo_l(s3_t *s3, uint32_t addr, uint32_t val) { -// pclog("Write S3 accel l %08X %08X\n", addr, val); if (addr & 0x8000) { s3_accel_write_fifo(s3, addr, val); @@ -664,7 +653,6 @@ static void fifo_thread(void *param) uint64_t start_time = timer_read(); uint64_t end_time; fifo_entry_t *fifo = &s3->fifo[s3->fifo_read_idx & FIFO_MASK]; - uint32_t val = fifo->val; switch (fifo->addr_type & FIFO_TYPE) { @@ -723,39 +711,6 @@ static void s3_queue(s3_t *s3, uint32_t addr, uint32_t val, uint32_t type) wake_fifo_thread(s3); } -void s3_update_linear_size(s3_t *s3) -{ - svga_t *svga = &s3->svga; - - switch (svga->crtc[0x58] & 3) - { - case 0: /*64k*/ - s3->linear_size = 0x10000; - break; - case 1: /*1mb*/ - s3->linear_size = 0x100000; - break; - case 2: /*2mb*/ - s3->linear_size = 0x200000; - break; - case 3: /*8mb*/ - switch(s3->chip) - { - case S3_TRIO32: - s3->linear_size = 0x200000; - svga->crtc[0x58] &= 0xfe; - break; - case S3_TRIO64: - s3->linear_size = 0x400000; - break; - default: - s3->linear_size = 0x800000; - break; - } - break; - } -} - void s3_out(uint16_t addr, uint8_t val, void *p) { s3_t *s3 = (s3_t *)p; @@ -764,8 +719,6 @@ void s3_out(uint16_t addr, uint8_t val, void *p) if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(svga->miscout & 1)) addr ^= 0x60; - -// pclog("S3 out %04X %02X %04x:%08x\n", addr, val, CS, pc); switch (addr) { @@ -788,19 +741,20 @@ void s3_out(uint16_t addr, uint8_t val, void *p) break; case 0x3C6: case 0x3C7: case 0x3C8: case 0x3C9: -// pclog("Write RAMDAC %04X %02X %04X:%04X\n", addr, val, CS, pc); - /* if (s3->chip != S3_VISION964) */ + if (s3->chip < S3_TRIO32) + { sdac_ramdac_out(addr, val, &s3->ramdac, svga); - /* else - bt485_ramdac_out(addr, val, &s3->bt485_ramdac, svga); - return; */ + } + else + { + svga_out(addr, val, svga); + } + return; case 0x3D4: svga->crtcreg = val & 0x7f; return; case 0x3D5: - if (svga->crtcreg <= 0x18) - val &= mask_crtc[svga->crtcreg]; if ((svga->crtcreg < 7) && (svga->crtc[0x11] & 0x80)) return; if ((svga->crtcreg == 7) && (svga->crtc[0x11] & 0x80)) @@ -835,20 +789,17 @@ void s3_out(uint16_t addr, uint8_t val, void *p) case 0x35: s3->bank = (s3->bank & 0x70) | (val & 0xf); -// pclog("CRTC write R35 %02X\n", val); if (svga->chain4) svga->write_bank = svga->read_bank = s3->bank << 16; else svga->write_bank = svga->read_bank = s3->bank << 14; break; case 0x51: s3->bank = (s3->bank & 0x4f) | ((val & 0xc) << 2); -// pclog("CRTC write R51 %02X\n", val); if (svga->chain4) svga->write_bank = svga->read_bank = s3->bank << 16; else svga->write_bank = svga->read_bank = s3->bank << 14; s3->ma_ext = (s3->ma_ext & ~0xc) | ((val & 3) << 2); break; case 0x6a: s3->bank = val; -// pclog("CRTC write R6a %02X\n", val); if (svga->chain4) svga->write_bank = svga->read_bank = s3->bank << 16; else svga->write_bank = svga->read_bank = s3->bank << 14; break; @@ -868,28 +819,12 @@ void s3_out(uint16_t addr, uint8_t val, void *p) svga->hwcursor.xoff = svga->crtc[0x4e] & 63; svga->hwcursor.yoff = svga->crtc[0x4f] & 63; svga->hwcursor.addr = ((((svga->crtc[0x4c] << 8) | svga->crtc[0x4d]) & 0xfff) * 1024) + (svga->hwcursor.yoff * 16); - if ((s3->chip == S3_TRIO32 || s3->chip == S3_TRIO64) && svga->bpp == 32) + if ((s3->chip == S3_TRIO32 || s3->chip == S3_TRIO64) && (svga->bpp == 32) && (s3->id == 0xe1)) svga->hwcursor.x <<= 1; break; case 0x53: - s3_updatemapping(s3); - break; - case 0x58: - s3_update_linear_size(s3); - // s3->linear_base &= ((s3->linear_size - 1) ^ 0xffffffff); - s3_updatemapping(s3); - break; - case 0x59: - s3->linear_base &= 0x00ffffff; - s3->linear_base |= (((uint32_t) val) << 24); - // s3->linear_base &= ((s3->linear_size - 1) ^ 0xffffffff); - s3_updatemapping(s3); - break; - case 0x5a: - s3->linear_base &= 0xff00ffff; - s3->linear_base |= (((uint32_t) val) << 16); - // s3->linear_base &= ((s3->linear_size - 1) ^ 0xffffffff); + case 0x58: case 0x59: case 0x5a: s3_updatemapping(s3); break; @@ -906,25 +841,6 @@ void s3_out(uint16_t addr, uint8_t val, void *p) } } break; -#if 0 - case 0x55: case 0x43: - if (s3->chip == S3_VISION964) - { - if (svga->crtc[0x55] & 3) - { - bt485_set_rs2(svga->crtc[0x55] & 1, &s3->bt485_ramdac); - bt485_set_rs3(svga->crtc[0x55] & 2, &s3->bt485_ramdac); - } - else - { - bt485_set_rs2(svga->crtc[0x43] & 2, &s3->bt485_ramdac); - bt485_set_rs3(0, &s3->bt485_ramdac); - } - pclog("RS2 is now %i, RS3 is now %i\n", s3->bt485_ramdac.rs2, s3->bt485_ramdac.rs3); - } - break; -#endif -// pclog("Write CRTC R%02X %02X\n", crtcreg, val); } if (old != val) { @@ -947,7 +863,6 @@ uint8_t s3_in(uint16_t addr, void *p) if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(svga->miscout & 1)) addr ^= 0x60; -// if (addr != 0x3da) pclog("S3 in %04X %08x:%02x\n", addr, CS, pc); switch (addr) { case 0x3c1: @@ -961,31 +876,33 @@ uint8_t s3_in(uint16_t addr, void *p) break; case 0x3c6: case 0x3c7: case 0x3c8: case 0x3c9: -// pclog("Read RAMDAC %04X %04X:%04X\n", addr, CS, pc); - // if (s3->chip != S3_VISION964) - return sdac_ramdac_in(addr, &s3->ramdac, svga); - /* else - return bt485_ramdac_in(addr, &s3->bt485_ramdac, svga); */ + if (s3->chip < S3_TRIO32) + { + return sdac_ramdac_in(addr, &s3->ramdac, svga); + } + else + { + return svga_in(addr, svga); + } case 0x3d4: return svga->crtcreg; case 0x3d5: -// pclog("Read CRTC R%02X %02x %04X:%04X\n", svga->crtcreg, svga->crtc[svga->crtcreg], CS, pc); switch (svga->crtcreg) { case 0x2d: return 0x88; /*Extended chip ID*/ - case 0x2e: - // if ((s3->chip != S3_TRIO32) && (s3->chip != S3_TRIO64)) return 0xFF; - return s3->id_ext; /*New chip ID*/ + case 0x2e: return s3->id_ext; /*New chip ID*/ case 0x2f: return 0; /*Revision level*/ case 0x30: return s3->id; /*Chip ID*/ case 0x31: return (svga->crtc[0x31] & 0xcf) | ((s3->ma_ext & 3) << 4); case 0x35: return (svga->crtc[0x35] & 0xf0) | (s3->bank & 0xf); case 0x51: return (svga->crtc[0x51] & 0xf0) | ((s3->bank >> 2) & 0xc) | ((s3->ma_ext >> 2) & 3); - case 0x59: return ((s3->linear_base >> 24) & 0xff); - case 0x5a: return ((s3->linear_base >> 16) & 0xff); case 0x69: return s3->ma_ext; case 0x6a: return s3->bank; + case 0x6b: + pclog("Returning value: %02X\n", svga->crtc[0x6b]); + return 0xff; + break; } return svga->crtc[svga->crtcreg]; } @@ -997,10 +914,7 @@ void s3_recalctimings(svga_t *svga) s3_t *s3 = (s3_t *)svga->p; svga->hdisp = svga->hdisp_old; -// pclog("%i %i\n", svga->hdisp, svga->hdisp_time); -// pclog("recalctimings\n"); svga->ma_latch |= (s3->ma_ext << 16); -// pclog("SVGA_MA %08X\n", svga_ma); if (svga->crtc[0x5d] & 0x01) svga->htotal += 0x100; if (svga->crtc[0x5d] & 0x02) { @@ -1057,20 +971,15 @@ void s3_recalctimings(svga_t *svga) void s3_updatemapping(s3_t *s3) { svga_t *svga = &s3->svga; - uint32_t lbase; - -// video_write_a000_w = video_write_a000_l = NULL; if (!(s3->pci_regs[PCI_REG_COMMAND] & PCI_COMMAND_MEM)) { -// pclog("Update mapping - PCI disabled\n"); mem_mapping_disable(&svga->mapping); mem_mapping_disable(&s3->linear_mapping); mem_mapping_disable(&s3->mmio_mapping); return; } -// pclog("Update mapping - bank %02X ", svga->gdcreg[6] & 0xc); switch (svga->gdcreg[6] & 0xc) /*Banked framebuffer*/ { case 0x0: /*128k at A0000*/ @@ -1091,12 +1000,10 @@ void s3_updatemapping(s3_t *s3) break; } -// pclog("Linear framebuffer %02X ", svga->crtc[0x58] & 0x10); if (svga->crtc[0x58] & 0x10) /*Linear framebuffer*/ { mem_mapping_disable(&svga->mapping); -#if 0 s3->linear_base = (svga->crtc[0x5a] << 16) | (svga->crtc[0x59] << 24); switch (svga->crtc[0x58] & 3) { @@ -1110,47 +1017,12 @@ void s3_updatemapping(s3_t *s3) s3->linear_size = 0x200000; break; case 3: /*8mb*/ - switch(s3->chip) - { - case S3_TRIO32: - s3->linear_size = 0x200000; - svga->crtc[0x58] &= 0xfe; - break; - case S3_TRIO64: - s3->linear_size = 0x400000; - break; - default: - s3->linear_size = 0x800000; - break; - } + s3->linear_size = 0x800000; break; } s3->linear_base &= ~(s3->linear_size - 1); -#endif -// pclog("%08X %08X %02X %02X %02X\n", linear_base, linear_size, crtc[0x58], crtc[0x59], crtc[0x5a]); -// pclog("Linear framebuffer at %08X size %08X\n", s3->linear_base, s3->linear_size); - - if ((svga->crtc[0x68] & 0x80) && (s3->chip != S3_TRIO32)) - { - if (s3->linear_base & 0xe0000000) - { - /* If bits 31-29 are not all clear, disable linear base. */ - mem_mapping_disable(&s3->linear_mapping); - return; - } - else - { - lbase = s3->linear_base & 0x1fffffff; - } - } - else - { - lbase = s3->linear_base; - } - - svga->linear_base = lbase & ((s3->linear_size - 1) ^ 0xffffffff); - - if (lbase == 0xa0000) + svga->linear_base = s3->linear_base; + if (s3->linear_base == 0xa0000) { mem_mapping_disable(&s3->linear_mapping); if (!(svga->crtc[0x53] & 0x10)) @@ -1158,15 +1030,13 @@ void s3_updatemapping(s3_t *s3) mem_mapping_set_addr(&svga->mapping, 0xa0000, 0x10000); svga->banked_mask = 0xffff; } -// mem_mapping_set_addr(&s3->linear_mapping, 0xa0000, 0x10000); } else - mem_mapping_set_addr(&s3->linear_mapping, lbase, s3->linear_size); + mem_mapping_set_addr(&s3->linear_mapping, s3->linear_base, s3->linear_size); } else mem_mapping_disable(&s3->linear_mapping); -// pclog("Memory mapped IO %02X\n", svga->crtc[0x53] & 0x10); if (svga->crtc[0x53] & 0x10) /*Memory mapped IO*/ { mem_mapping_disable(&svga->mapping); @@ -1182,14 +1052,12 @@ static float s3_trio64_getclock(int clock, void *p) svga_t *svga = &s3->svga; float t; int m, n1, n2; -// pclog("Trio64_getclock %i %02X %02X\n", clock, svga->seqregs[0x13], svga->seqregs[0x12]); if (clock == 0) return 25175000.0; if (clock == 1) return 28322000.0; m = svga->seqregs[0x13] + 2; n1 = (svga->seqregs[0x12] & 0x1f) + 2; n2 = ((svga->seqregs[0x12] >> 5) & 0x07); t = (14318184.0 * ((float)m / (float)n1)) / (float)(1 << n2); -// pclog("TRIO64 clock %i %i %i %f %f %i\n", m, n1, n2, t, 14318184.0 * ((float)m / (float)n1), 1 << n2); return t; } @@ -1197,8 +1065,7 @@ static float s3_trio64_getclock(int clock, void *p) void s3_accel_out(uint16_t port, uint8_t val, void *p) { s3_t *s3 = (s3_t *)p; -// pclog("Accel out %04X %02X\n", port, val); - + if (port >= 0x8000) { s3_queue(s3, port, val, FIFO_OUT_BYTE); @@ -1222,14 +1089,12 @@ void s3_accel_out(uint16_t port, uint8_t val, void *p) void s3_accel_out_w(uint16_t port, uint16_t val, void *p) { s3_t *s3 = (s3_t *)p; -// pclog("Accel out w %04X %04X\n", port, val); s3_queue(s3, port, val, FIFO_OUT_WORD); } void s3_accel_out_l(uint16_t port, uint32_t val, void *p) { s3_t *s3 = (s3_t *)p; -// pclog("Accel out l %04X %08X\n", port, val); s3_queue(s3, port, val, FIFO_OUT_DWORD); } @@ -1237,7 +1102,6 @@ uint8_t s3_accel_in(uint16_t port, void *p) { s3_t *s3 = (s3_t *)p; int temp; -// pclog("Accel in %04X\n", port); switch (port) { case 0x42e8: @@ -1425,19 +1289,16 @@ uint8_t s3_accel_in(uint16_t port, void *p) void s3_accel_write(uint32_t addr, uint8_t val, void *p) { s3_t *s3 = (s3_t *)p; -// pclog("s3_accel_write %08x %02x\n", addr, val); s3_queue(s3, addr & 0xffff, val, FIFO_WRITE_BYTE); } void s3_accel_write_w(uint32_t addr, uint16_t val, void *p) { s3_t *s3 = (s3_t *)p; -// pclog("s3_accel_write_w %08x %04x\n", addr, val); s3_queue(s3, addr & 0xffff, val, FIFO_WRITE_WORD); } void s3_accel_write_l(uint32_t addr, uint32_t val, void *p) { s3_t *s3 = (s3_t *)p; -// pclog("s3_accel_write_l %08x %08x\n", addr, val); s3_queue(s3, addr & 0xffff, val, FIFO_WRITE_DWORD); } @@ -1499,14 +1360,11 @@ void s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat int clip_b = s3->accel.multifunc[3] & 0xfff; int clip_r = s3->accel.multifunc[4] & 0xfff; int vram_mask = (s3->accel.multifunc[0xa] & 0xc0) == 0xc0; - uint32_t mix_mask; + uint32_t mix_mask = 0; uint16_t *vram_w = (uint16_t *)svga->vram; uint32_t *vram_l = (uint32_t *)svga->vram; uint32_t compare = s3->accel.color_cmp; int compare_mode = (s3->accel.multifunc[0xe] >> 7) & 3; -//return; -// if (!cpu_input) pclog("Start S3 command %i %i, %i %i, %i (clip %i, %i to %i, %i %i)\n", s3->accel.cmd >> 13, s3->accel.cur_x, s3->accel.cur_y, s3->accel.maj_axis_pcnt & 0xfff, s3->accel.multifunc[0] & 0xfff, clip_l, clip_t, clip_r, clip_b, s3->accel.multifunc[0xe] & 0x20); -// else pclog(" S3 command %i, %i, %08x %08x\n", s3->accel.cmd >> 13, count, mix_dat, cpu_dat); if (!cpu_input) s3->accel.dat_count = 0; if (cpu_input && (s3->accel.multifunc[0xa] & 0xc0) != 0x80) @@ -1627,12 +1485,8 @@ void s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat { READ((s3->accel.cy * s3->width) + s3->accel.cx, dest_dat); -// pclog("Line : %04i, %04i (%06X) - %02X (%02X %04X %05X) %02X (%02X %02X) ", s3->accel.cx, s3->accel.cy, s3->accel.dest + s3->accel.cx, src_dat, vram[s3->accel.src + s3->accel.cx], mix_dat & mix_mask, s3->accel.src + s3->accel.cx, dest_dat, s3->accel.frgd_color, s3->accel.bkgd_color); - MIX -// pclog("%02X\n", dest_dat); - WRITE((s3->accel.cy * s3->width) + s3->accel.cx); } } @@ -1642,8 +1496,6 @@ void s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat if (s3->bpp == 0) cpu_dat >>= 8; else cpu_dat >>= 16; -// pclog("%i, %i - %i %i %i %i\n", s3->accel.cx, s3->accel.cy, s3->accel.err_term, s3->accel.maj_axis_pcnt, s3->accel.desty_axstp, s3->accel.destx_distp); - if (!s3->accel.sy) break; @@ -1696,12 +1548,8 @@ void s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat if (s3->accel.cur_y & 0x1000) s3->accel.cy |= ~0xfff; s3->accel.dest = s3->accel.cy * s3->width; - -// pclog("Dest %08X (%i, %i) %04X %04X\n", s3->accel.dest, s3->accel.cx, s3->accel.cy, s3->accel.cur_x, s3->accel.cur_x & 0x1000); } if ((s3->accel.cmd & 0x100) && !cpu_input) return; /*Wait for data from CPU*/ -// if ((s3->accel.multifunc[0xa] & 0xc0) == 0x80 && !cpu_input) /*Mix data from CPU*/ -// return; frgd_mix = (s3->accel.frgd_mix >> 5) & 3; bkgd_mix = (s3->accel.bkgd_mix >> 5) & 3; @@ -1724,14 +1572,9 @@ void s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat compare_mode < 2) { READ(s3->accel.dest + s3->accel.cx, dest_dat); - - -// if (CS != 0xc000) pclog("Write %05X %02X %02X %04X (%02X %02X) ", s3->accel.dest + s3->accel.cx, src_dat, dest_dat, mix_dat, s3->accel.frgd_mix, s3->accel.bkgd_mix); MIX -// if (CS != 0xc000) pclog("%02X\n", dest_dat); - WRITE(s3->accel.dest + s3->accel.cx); } } @@ -1748,10 +1591,8 @@ void s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat { if (s3->accel.cmd & 0x20) s3->accel.cx -= (s3->accel.maj_axis_pcnt & 0xfff) + 1; else s3->accel.cx += (s3->accel.maj_axis_pcnt & 0xfff) + 1; -// s3->accel.dest -= (s3->accel.maj_axis_pcnt & 0xfff) + 1; s3->accel.sx = s3->accel.maj_axis_pcnt & 0xfff; -// s3->accel.dest += s3_width; if (s3->accel.cmd & 0x80) s3->accel.cy++; else s3->accel.cy--; @@ -1787,12 +1628,8 @@ void s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat s3->accel.src = s3->accel.cy * s3->width; s3->accel.dest = s3->accel.dy * s3->width; - -// pclog("Source %08X Dest %08X (%i, %i) - (%i, %i)\n", s3->accel.src, s3->accel.dest, s3->accel.cx, s3->accel.cy, s3->accel.dx, s3->accel.dy); } if ((s3->accel.cmd & 0x100) && !cpu_input) return; /*Wait for data from CPU*/ -// if ((s3->accel.multifunc[0xa] & 0xc0) == 0x80 && !cpu_input) /*Mix data from CPU*/ -// return; if (s3->accel.sy < 0) return; @@ -1866,13 +1703,9 @@ void s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat compare_mode < 2) { READ(s3->accel.dest + s3->accel.dx, dest_dat); - -// pclog("BitBlt : %04i, %04i (%06X) - %02X (%02X %04X %05X) %02X ", s3->accel.dx, s3->accel.dy, s3->accel.dest + s3->accel.dx, src_dat, vram[s3->accel.src + s3->accel.cx], mix_dat, s3->accel.src + s3->accel.cx, dest_dat); MIX -// pclog("%02X\n", dest_dat); - WRITE(s3->accel.dest + s3->accel.dx); } } @@ -1926,8 +1759,6 @@ void s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat if (cpu_input/* && (s3->accel.multifunc[0xa] & 0xc0) == 0x80*/) return; if (s3->accel.sy < 0) { -// s3->accel.cur_x = s3->accel.cx; -// s3->accel.cur_y = s3->accel.cy; return; } } @@ -1952,9 +1783,6 @@ void s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat if (s3->accel.cur_y & 0x1000) s3->accel.cy |= ~0xfff; /*Align source with destination*/ -// s3->accel.cx = (s3->accel.cx & ~7) | (s3->accel.dx & 7); -// s3->accel.cy = (s3->accel.cy & ~7) | (s3->accel.dy & 7); - s3->accel.pattern = (s3->accel.cy * s3->width) + s3->accel.cx; s3->accel.dest = s3->accel.dy * s3->width; @@ -1962,14 +1790,8 @@ void s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat s3->accel.cy = s3->accel.dy & 7; s3->accel.src = s3->accel.pattern + (s3->accel.cy * s3->width); - -// pclog("Source %08X Dest %08X (%i, %i) - (%i, %i)\n", s3->accel.src, s3->accel.dest, s3->accel.cx, s3->accel.cy, s3->accel.dx, s3->accel.dy); -// dumpregs(); -// exit(-1); } if ((s3->accel.cmd & 0x100) && !cpu_input) return; /*Wait for data from CPU*/ -// if ((s3->accel.multifunc[0xa] & 0xc0) == 0x80 && !cpu_input) /*Mix data from CPU*/ -// return; frgd_mix = (s3->accel.frgd_mix >> 5) & 3; bkgd_mix = (s3->accel.bkgd_mix >> 5) & 3; @@ -1997,13 +1819,9 @@ void s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat compare_mode < 2) { READ(s3->accel.dest + s3->accel.dx, dest_dat); - -// pclog("Pattern fill : %04i, %04i (%06X) - %02X (%02X %04X %05X) %02X ", s3->accel.dx, s3->accel.dy, s3->accel.dest + s3->accel.dx, src_dat, vram[s3->accel.src + s3->accel.cx], mix_dat, s3->accel.src + s3->accel.cx, dest_dat); MIX -// pclog("%02X\n", dest_dat); - WRITE(s3->accel.dest + s3->accel.dx); } } @@ -2075,7 +1893,6 @@ void s3_hwcursor_draw(svga_t *svga, int displine) if (svga->interlace && svga->hwcursor_oddeven) svga->hwcursor_latch.addr += 16; -// pclog("HWcursor %i %i\n", svga->hwcursor_latch.x, svga->hwcursor_latch.y); for (x = 0; x < 64; x += 16) { dat[0] = (svga->vram[svga->hwcursor_latch.addr] << 8) | svga->vram[svga->hwcursor_latch.addr + 1]; @@ -2088,7 +1905,6 @@ void s3_hwcursor_draw(svga_t *svga, int displine) ((uint32_t *)buffer32->line[displine + y_add])[offset + 32 + x_add] = (dat[1] & 0x8000) ? 0xffffff : 0; else if (dat[1] & 0x8000) ((uint32_t *)buffer32->line[displine + y_add])[offset + 32 + x_add] ^= 0xffffff; -// pclog("Plot %i, %i (%i %i) %04X %04X\n", offset, displine, x+xx, svga_hwcursor_on, dat[0], dat[1]); } offset++; @@ -2161,7 +1977,7 @@ uint8_t s3_pci_read(int func, int addr, void *p) { s3_t *s3 = (s3_t *)p; svga_t *svga = &s3->svga; -// pclog("S3 PCI read %08X\n", addr); + /* pclog("S3 PCI read %08X\n", addr); */ switch (addr) { case 0x00: return 0x33; /*'S3'*/ @@ -2183,8 +1999,8 @@ uint8_t s3_pci_read(int func, int addr, void *p) case 0x10: return 0x00; /*Linear frame buffer address*/ case 0x11: return 0x00; - case 0x12: return ((s3->linear_base & ((s3->linear_size - 1) ^ 0xffffffff)) >> 16) & 0xff; - case 0x13: return ((s3->linear_base & ((s3->linear_size - 1) ^ 0xffffffff)) >> 24) & 0xff; + case 0x12: return svga->crtc[0x5a] & 0x80; + case 0x13: return svga->crtc[0x59]; case 0x30: return s3->pci_regs[0x30] & 0x01; /*BIOS ROM address*/ case 0x31: return 0x00; @@ -2198,7 +2014,7 @@ void s3_pci_write(int func, int addr, uint8_t val, void *p) { s3_t *s3 = (s3_t *)p; svga_t *svga = &s3->svga; -// pclog("s3_pci_write: addr=%02x val=%02x\n", addr, val); + /* pclog("s3_pci_write: addr=%02x val=%02x\n", addr, val); */ switch (addr) { case PCI_REG_COMMAND: @@ -2211,15 +2027,11 @@ void s3_pci_write(int func, int addr, uint8_t val, void *p) break; case 0x12: - s3->linear_base &= 0xff00ffff; - s3->linear_base |= (((uint32_t) val) << 16); - s3->linear_base &= ((s3->linear_size - 1) ^ 0xffffffff); + svga->crtc[0x5a] = val & 0x80; s3_updatemapping(s3); break; case 0x13: - s3->linear_base &= 0x00ffffff; - s3->linear_base |= (((uint32_t) val) << 24); - s3->linear_base &= ((s3->linear_size - 1) ^ 0xffffffff); + svga->crtc[0x59] = val; s3_updatemapping(s3); break; @@ -2228,12 +2040,10 @@ void s3_pci_write(int func, int addr, uint8_t val, void *p) if (s3->pci_regs[0x30] & 0x01) { uint32_t addr = (s3->pci_regs[0x32] << 16) | (s3->pci_regs[0x33] << 24); -// pclog("S3 bios_rom enabled at %08x\n", addr); mem_mapping_set_addr(&s3->bios_rom.mapping, addr, 0x8000); } else { -// pclog("S3 bios_rom disabled\n"); mem_mapping_disable(&s3->bios_rom.mapping); } return; @@ -2245,10 +2055,10 @@ static int vram_sizes[] = 7, /*512 kB*/ 6, /*1 MB*/ 4, /*2 MB*/ - 2, /*3 MB*/ + 0, 0, /*4 MB*/ 0, - 5, /*6 MB*/ + 0, 0, 3 /*8 MB*/ }; @@ -2259,9 +2069,9 @@ static void *s3_init(char *bios_fn, int chip) svga_t *svga = &s3->svga; int vram; uint32_t vram_size; - + memset(s3, 0, sizeof(s3_t)); - + vram = device_get_config_int("memory"); if (vram) vram_size = vram << 20; @@ -2287,21 +2097,23 @@ static void *s3_init(char *bios_fn, int chip) svga->crtc[0x36] = 2 | (3 << 2) | (1 << 4) | (vram_sizes[vram] << 5); else svga->crtc[0x36] = 1 | (3 << 2) | (1 << 4) | (vram_sizes[vram] << 5); - /* Set video BIOS to 32k (bit 2 = set). */ - svga->crtc[0x37] = 5 | (7 << 5); - // if (s3->chip == S3_VISION964) svga->crtc[0x37] |= 0xe; + svga->crtc[0x37] = 1 | (7 << 5); + + svga->crtc[0x53] = 1 << 3; + svga->crtc[0x59] = 0x70; s3_io_set(s3); - pci_add(s3_pci_read, s3_pci_write, s3); + if (PCI) + { + pci_add(s3_pci_read, s3_pci_write, s3); + } - s3->pci_regs[0x04] = 7; + s3->pci_regs[0x04] = 3; s3->pci_regs[0x30] = 0x00; s3->pci_regs[0x32] = 0x0c; s3->pci_regs[0x33] = 0x00; - - s3->linear_size = 0x10000; s3->chip = chip; @@ -2312,12 +2124,12 @@ static void *s3_init(char *bios_fn, int chip) return s3; } -void *s3_bahamas64_init() +void *s3_vision864_init(char *bios_fn) { - s3_t *s3 = s3_init("roms/bahamas64.BIN", S3_VISION864); + s3_t *s3 = s3_init(bios_fn, S3_VISION864); - s3->id = 0xc0; /*Vision864P*/ - s3->id_ext = s3->id_ext_pci = 0xc0; + s3->id = 0xc1; /*Vision864P*/ + s3->id_ext = s3->id_ext_pci = 0xc1; s3->packed_mmio = 0; s3->getclock = sdac_getclock; @@ -2326,34 +2138,31 @@ void *s3_bahamas64_init() return s3; } +void *s3_bahamas64_init() +{ + s3_t *s3 = s3_vision864_init("roms/bahamas64.BIN"); + return s3; +} + +void *s3_phoenix_vision864_init() +{ + s3_t *s3 = s3_vision864_init("roms/86c864p.bin"); + return s3; +} + int s3_bahamas64_available() { return rom_present("roms/bahamas64.BIN"); } -void *s3_9fx_init() +int s3_phoenix_vision864_available() { - s3_t *s3 = s3_init("roms/s3_764.bin", S3_TRIO64); - - s3->id = 0xe1; /*Trio64*/ - s3->id_ext = s3->id_ext_pci = 0x11; - s3->packed_mmio = 1; - - s3->getclock = s3_trio64_getclock; - s3->getclock_p = s3; - - return s3; -} - -int s3_9fx_available() -{ - return rom_present("roms/s3_764.bin"); + return rom_present("roms/86c864p.bin"); } void *s3_phoenix_trio32_init() { s3_t *s3 = s3_init("roms/86C732P.bin", S3_TRIO32); - svga_t *svga = &s3->svga; s3->id = 0xe1; /*Trio32*/ s3->id_ext = 0x10; @@ -2371,13 +2180,22 @@ int s3_phoenix_trio32_available() return rom_present("roms/86C732P.bin"); } -void *s3_phoenix_trio64_init() +void *s3_trio64_init(char *bios_fn) { - s3_t *s3 = s3_init("roms/86c764x1.bin", S3_TRIO64); - svga_t *svga = &s3->svga; + int card_id = 0; + s3_t *s3 = s3_init(bios_fn, S3_TRIO64); - s3->id = 0xe1; /*Trio64*/ - s3->id_ext = s3->id_ext_pci = 0x11; + card_id = device_get_config_int("card_id"); + + if (card_id) + { + s3->id = 0xc1; /*Vision864P*/ + } + else + { + s3->id = 0xe1; /*Trio64*/ + } + s3->id_ext = s3->id_ext_pci = 0x11; s3->packed_mmio = 1; s3->getclock = s3_trio64_getclock; @@ -2386,43 +2204,32 @@ void *s3_phoenix_trio64_init() return s3; } +void *s3_9fx_init() +{ + s3_t *s3 = s3_trio64_init("roms/s3_764.bin"); + return s3; +} + +void *s3_phoenix_trio64_init() +{ + s3_t *s3 = s3_trio64_init("roms/86C764X1.bin"); + return s3; +} + +void *s3_diamond_stealth64_init() +{ + s3_t *s3 = s3_trio64_init("roms/STEALT64.BIN"); + return s3; +} + +int s3_9fx_available() +{ + return rom_present("roms/s3_764.bin"); +} + int s3_phoenix_trio64_available() { - return rom_present("roms/86c764x1.bin"); -} - -void *s3_phoenix_vision864_init() -{ - s3_t *s3 = s3_init("roms/86c864p.bin", S3_VISION864); - - s3->id = 0xc1; /*Vision864P*/ - s3->id_ext = s3->id_ext_pci = 0xc1; - s3->packed_mmio = 0; - - s3->getclock = sdac_getclock; - s3->getclock_p = &s3->ramdac; - - return s3; -} - -int s3_phoenix_vision864_available() -{ - return rom_present("roms/86c864p.BIN"); -} - -/* void *s3_diamond_stealth64_init() -{ - s3_t *s3 = s3_init("roms/STEALT64.BIN", S3_VISION864); - svga_t *svga = &s3->svga; - - s3->id = 0xc0; - s3->id_ext = s3->id_ext_pci = 0xc1; - s3->packed_mmio = 0; - - s3->getclock = sdac_getclock; - s3->getclock_p = &s3->ramdac; - - return s3; + return rom_present("roms/86C764X1.bin"); } int s3_diamond_stealth64_available() @@ -2430,31 +2237,16 @@ int s3_diamond_stealth64_available() return rom_present("roms/STEALT64.BIN"); } -void *s3_miro_vision964_init() -{ - s3_t *s3 = s3_init("roms/mirocrystal.VBI", S3_VISION964); - - s3->id = 0xd0; - s3->id_ext = s3->id_ext_pci = 0xd1; - s3->packed_mmio = 1; - - s3->getclock = bt485_getclock; - s3->getclock_p = &s3->bt485_ramdac; - - return s3; -} - -int s3_miro_vision964_available() -{ - return rom_present("roms/mirocrystal.VBI"); -} */ - void s3_close(void *p) { s3_t *s3 = (s3_t *)p; svga_close(&s3->svga); + thread_kill(s3->fifo_thread); + thread_destroy_event(s3->wake_fifo_thread); + thread_destroy_event(s3->fifo_not_full_event); + free(s3); } @@ -2493,246 +2285,129 @@ void s3_add_status_info(char *s, int max_len, void *p) static device_config_t s3_bahamas64_config[] = { { - .name = "memory", - .description = "Memory size", - .type = CONFIG_SELECTION, - .selection = + "memory", "Memory size", CONFIG_SELECTION, "", 4, { { - .description = "1 MB", - .value = 1 + "1 MB", 1 }, { - .description = "2 MB", - .value = 2 + "2 MB", 2 }, { - .description = "4 MB", - .value = 4 + "4 MB", 4 }, /*Vision864 also supports 8 MB, however the Paradise BIOS is buggy (VESA modes don't work correctly)*/ { - .description = "" + "" } - }, - .default_int = 4 + } }, { - .type = -1 + "", "", -1 } }; static device_config_t s3_9fx_config[] = { { - .name = "memory", - .description = "Memory size", - .type = CONFIG_SELECTION, - .selection = + "memory", "Memory size", CONFIG_SELECTION, "", 2, { { - .description = "1 MB", - .value = 1 + "1 MB", 1 }, { - .description = "2 MB", - .value = 2 + "2 MB", 2 }, /*Trio64 also supports 4 MB, however the Number Nine BIOS does not*/ { - .description = "" + "" } - }, - .default_int = 2 + } }, { - .type = -1 + "is_pci", "Bus", CONFIG_SELECTION, "", 1, + { + { + "VLB", 0 + }, + { + "PCI", 1 + }, + { + "" + } + } + }, + { + "", "", -1 } }; static device_config_t s3_phoenix_trio32_config[] = { { - .name = "memory", - .description = "Memory size", - .type = CONFIG_SELECTION, - .selection = + "memory", "Memory size", CONFIG_SELECTION, "", 2, { { - .description = "512 KB", - .value = 0 + "512 KB", 0 }, { - .description = "1 MB", - .value = 1 + "1 MB", 1 }, { - .description = "2 MB", - .value = 2 + "2 MB", 2 }, { - .description = "" + "" } - }, - .default_int = 2 + } }, { - .type = -1 + "", "", -1 } }; static device_config_t s3_phoenix_trio64_config[] = { { - .name = "memory", - .description = "Memory size", - .type = CONFIG_SELECTION, - .selection = + "memory", "Memory size", CONFIG_SELECTION, "", 2, { { - .description = "512 KB", - .value = 0 + "512 KB", 0 }, { - .description = "1 MB", - .value = 1 + "1 MB", 1 }, { - .description = "2 MB", - .value = 2 + "2 MB", 2 }, { - .description = "4 MB", - .value = 4 + "4 MB", 4 }, { - .description = "" + "" } - }, - .default_int = 2 + } }, { - .type = -1 + "card_id", "Card ID", CONFIG_SELECTION, "", 1, + { + { + "S3 Trio64", 0 + }, + { + "S3 Vision864", 1 + }, + { + "" + } + } + }, + { + "", "", -1 } }; -static device_config_t s3_phoenix_vision864_config[] = -{ - { - .name = "memory", - .description = "Memory size", - .type = CONFIG_SELECTION, - .selection = - { - { - .description = "512 KB", - .value = 0 - }, - { - .description = "1 MB", - .value = 1 - }, - { - .description = "2 MB", - .value = 2 - }, - { - .description = "4 MB", - .value = 4 - }, - { - .description = "" - } - }, - .default_int = 2 - }, - { - .type = -1 - } -}; - -/* static device_config_t s3_diamond_stealth64_config[] = -{ - { - .name = "memory", - .description = "Memory size", - .type = CONFIG_SELECTION, - .selection = - { - { - .description = "512 KB", - .value = 0 - }, - { - .description = "1 MB", - .value = 1 - }, - { - .description = "2 MB", - .value = 2 - }, - { - .description = "3 MB", - .value = 3 - }, - { - .description = "4 MB", - .value = 4 - }, - { - .description = "" - } - }, - .default_int = 2 - }, - { - .type = -1 - } -}; - -static device_config_t s3_miro_vision964_config[] = -{ - { - .name = "memory", - .description = "Memory size", - .type = CONFIG_SELECTION, - .selection = - { - { - .description = "1 MB", - .value = 1 - }, - { - .description = "2 MB", - .value = 2 - }, - { - .description = "3 MB", - .value = 3 - }, - { - .description = "4 MB", - .value = 4 - }, - { - .description = "6 MB", - .value = 6 - }, - { - .description = "8 MB", - .value = 8 - }, - { - .description = "" - } - }, - .default_int = 4 - }, - { - .type = -1 - } -}; */ - device_t s3_bahamas64_device = { "Paradise Bahamas 64 (S3 Vision864)", @@ -2795,12 +2470,12 @@ device_t s3_phoenix_vision864_device = s3_speed_changed, s3_force_redraw, s3_add_status_info, - s3_phoenix_vision864_config + s3_bahamas64_config }; -/* device_t s3_diamond_stealth64_device = +device_t s3_diamond_stealth64_device = { - "S3 Vision864 (Diamond Stealth64)", + "S3 Trio64 (Diamond Stealth64 DRAM)", 0, s3_diamond_stealth64_init, s3_close, @@ -2808,18 +2483,5 @@ device_t s3_phoenix_vision864_device = s3_speed_changed, s3_force_redraw, s3_add_status_info, - s3_diamond_stealth64_config + s3_phoenix_trio64_config }; - -device_t s3_miro_vision964_device = -{ - "Micro Crystal S3 Vision964", - 0, - s3_miro_vision964_init, - s3_close, - s3_miro_vision964_available, - s3_speed_changed, - s3_force_redraw, - s3_add_status_info, - s3_miro_vision964_config -}; */ diff --git a/src/vid_s3.h b/src/vid_s3.h index 34ae21b47..396e6523b 100644 --- a/src/vid_s3.h +++ b/src/vid_s3.h @@ -6,5 +6,5 @@ device_t s3_9fx_device; device_t s3_phoenix_trio32_device; device_t s3_phoenix_trio64_device; device_t s3_phoenix_vision864_device; -/* device_t s3_diamond_stealth64_device; -device_t s3_miro_vision964_device; */ +device_t s3_diamond_stealth64_device; +/* device_t s3_miro_vision964_device; */ diff --git a/src/vid_s3_virge.c b/src/vid_s3_virge.c index 6319a3950..cecdcb427 100644 --- a/src/vid_s3_virge.c +++ b/src/vid_s3_virge.c @@ -50,7 +50,7 @@ enum FIFO_INVALID = (0x00 << 24), FIFO_WRITE_BYTE = (0x01 << 24), FIFO_WRITE_WORD = (0x02 << 24), - FIFO_WRITE_DWORD = (0x03 << 24), + FIFO_WRITE_DWORD = (0x03 << 24) }; typedef struct @@ -229,7 +229,7 @@ typedef struct virge_t int virge_busy; } virge_t; -static inline void wake_fifo_thread(virge_t *virge) +static __inline void wake_fifo_thread(virge_t *virge) { thread_set_event(virge->wake_fifo_thread); /*Wake up FIFO thread if moving from idle*/ } @@ -300,8 +300,6 @@ static void s3_virge_out(uint16_t addr, uint8_t val, void *p) if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(svga->miscout & 1)) addr ^= 0x60; -// pclog("S3 out %04X %02X %04X:%08X %04X %04X %i\n", addr, val, CS, pc, ES, BX, ins); - switch (addr) { case 0x3c5: @@ -318,16 +316,10 @@ static void s3_virge_out(uint16_t addr, uint8_t val, void *p) } break; - //case 0x3C6: case 0x3C7: case 0x3C8: case 0x3C9: -// pclog("Write RAMDAC %04X %02X %04X:%04X\n", addr, val, CS, pc); - //sdac_ramdac_out(addr,val); - //return; - case 0x3d4: - svga->crtcreg = val;// & 0x7f; + svga->crtcreg = val; return; case 0x3d5: - //pclog("Write CRTC R%02X %02X %04x(%08x):%08x\n", svga->crtcreg, val, CS, cs, pc); if ((svga->crtcreg < 7) && (svga->crtc[0x11] & 0x80)) return; if ((svga->crtcreg == 7) && (svga->crtc[0x11] & 0x80)) @@ -366,7 +358,6 @@ static void s3_virge_out(uint16_t addr, uint8_t val, void *p) case 0x35: virge->bank = (virge->bank & 0x70) | (val & 0xf); -// pclog("CRTC write R35 %02X\n", val); if (svga->chain4) svga->write_bank = svga->read_bank = virge->bank << 16; else svga->write_bank = svga->read_bank = virge->bank << 14; break; @@ -378,7 +369,6 @@ static void s3_virge_out(uint16_t addr, uint8_t val, void *p) break; case 0x6a: virge->bank = val; -// pclog("CRTC write R6a %02X\n", val); if (svga->chain4) svga->write_bank = svga->read_bank = virge->bank << 16; else svga->write_bank = svga->read_bank = virge->bank << 14; break; @@ -420,15 +410,13 @@ static void s3_virge_out(uint16_t addr, uint8_t val, void *p) case 0x67: switch (val >> 4) { - case 3: svga->bpp = 15; break; - case 5: svga->bpp = 16; break; + case 2: case 3: svga->bpp = 15; break; + case 4: case 5: svga->bpp = 16; break; case 7: svga->bpp = 24; break; - case 13: svga->bpp = 32; break; + case 13: svga->bpp = (gfxcard == GFX_VIRGEVX) ? 24 : 32; break; default: svga->bpp = 8; break; } break; - //case 0x55: case 0x43: -// pclog("Write CRTC R%02X %02X\n", crtcreg, val); } if (old != val) { @@ -452,7 +440,6 @@ static uint8_t s3_virge_in(uint16_t addr, void *p) if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(svga->miscout & 1)) addr ^= 0x60; -// if (addr != 0x3da) pclog("S3 in %04X %04X:%08X ", addr, CS, pc); switch (addr) { case 0x3c1: @@ -461,9 +448,6 @@ static uint8_t s3_virge_in(uint16_t addr, void *p) else ret = svga_in(addr, svga); break; - //case 0x3C6: case 0x3C7: case 0x3C8: case 0x3C9: -// pclog("Read RAMDAC %04X %04X:%04X\n", addr, CS, pc); - //return sdac_ramdac_in(addr); case 0x3c5: if (svga->seqaddr >= 8) @@ -478,7 +462,6 @@ static uint8_t s3_virge_in(uint16_t addr, void *p) ret = svga->crtcreg; break; case 0x3D5: - //pclog("Read CRTC R%02X %04X:%04X (%02x)\n", svga->crtcreg, CS, pc, svga->crtc[svga->crtcreg]); switch (svga->crtcreg) { case 0x2d: ret = virge->virge_id_high; break; /*Extended chip ID*/ @@ -500,7 +483,6 @@ static uint8_t s3_virge_in(uint16_t addr, void *p) ret = svga_in(addr, svga); break; } -// if (addr != 0x3da) pclog("%02X\n", ret); return ret; } @@ -520,7 +502,6 @@ static void s3_virge_recalctimings(svga_t *svga) if ((svga->crtc[0x67] & 0xc) != 0xc) /*VGA mode*/ { svga->ma_latch |= (virge->ma_ext << 16); -//pclog("VGA mode\n"); if (svga->crtc[0x51] & 0x30) svga->rowoffset += (svga->crtc[0x51] & 0x30) << 4; else if (svga->crtc[0x43] & 0x04) svga->rowoffset += 0x100; if (!svga->rowoffset) svga->rowoffset = 256; @@ -546,19 +527,20 @@ static void s3_virge_recalctimings(svga_t *svga) break; } } - -// pclog("svga->rowoffset = %i bpp=%i\n", svga->rowoffset, svga->bpp); - if (svga->bpp == 15 || svga->bpp == 16) - { - svga->htotal >>= 1; - svga->hdisp >>= 1; - } - if (svga->bpp == 24) - { - svga->rowoffset = (svga->rowoffset * 3) / 4; /*Hack*/ - } + + if (gfxcard != GFX_VIRGEVX) + { + if ((svga->bpp == 15) || (svga->bpp == 16)) + { + svga->htotal >>= 1; + svga->hdisp >>= 1; + } + if (svga->bpp == 24) + { + svga->rowoffset = (svga->rowoffset * 3) / 4; /*Hack*/ + } + } svga->vrammask = (svga->crtc[0x32] & 0x40) ? 0x3ffff : ((virge->memory_size << 20) - 1); -//pclog("VGA mode x_disp=%i dispend=%i vtotal=%i\n", svga->hdisp, svga->dispend, svga->vtotal); } else /*Streams mode*/ { @@ -582,7 +564,6 @@ static void s3_virge_recalctimings(svga_t *svga) svga->overlay.ena = (svga->overlay.x >= 0); svga->overlay.v_acc = virge->streams.dda_vert_accumulator; -//pclog("Streams mode x_disp=%i dispend=%i vtotal=%i x=%i y=%i ysize=%i\n", svga->hdisp, svga->dispend, svga->vtotal, svga->overlay.x, svga->overlay.y, svga->overlay.ysize); svga->rowoffset = virge->streams.pri_stride >> 3; switch ((virge->streams.pri_ctrl >> 24) & 0x7) @@ -611,7 +592,7 @@ static void s3_virge_recalctimings(svga_t *svga) if (((svga->miscout >> 2) & 3) == 3) { int n = svga->seqregs[0x12] & 0x1f; - int r = (svga->seqregs[0x12] >> 5) & (virge->is_375 ? 7 : 3); + int r = (svga->seqregs[0x12] >> 5) & ((virge->is_375 || (gfxcard == GFX_VIRGEVX)) ? 7 : 3); int m = svga->seqregs[0x13] & 0x7f; double freq = (((double)m + 2) / (((double)n + 2) * (double)(1 << r))) * 14318184.0; @@ -625,7 +606,6 @@ static void s3_virge_updatemapping(virge_t *virge) if (!(virge->pci_regs[PCI_REG_COMMAND] & PCI_COMMAND_MEM)) { -// pclog("Update mapping - PCI disabled\n"); mem_mapping_disable(&svga->mapping); mem_mapping_disable(&virge->linear_mapping); mem_mapping_disable(&virge->mmio_mapping); @@ -676,7 +656,6 @@ static void s3_virge_updatemapping(virge_t *virge) } virge->linear_base &= ~(virge->linear_size - 1); svga->linear_base = virge->linear_base; -// pclog("%08X %08X %02X %02X %02X\n", linear_base, linear_size, crtc[0x58], crtc[0x59], crtc[0x5a]); pclog("Linear framebuffer at %08X size %08X\n", virge->linear_base, virge->linear_size); if (virge->linear_base == 0xa0000) { @@ -726,7 +705,6 @@ static uint8_t s3_virge_mmio_read(uint32_t addr, void *p) uint8_t ret; reg_reads++; -// pclog("New MMIO readb %08X\n", addr); switch (addr & 0xffff) { case 0x8505: @@ -757,7 +735,6 @@ static uint8_t s3_virge_mmio_read(uint32_t addr, void *p) static uint16_t s3_virge_mmio_read_w(uint32_t addr, void *p) { reg_reads++; -// pclog("New MMIO readw %08X\n", addr); switch (addr & 0xfffe) { default: @@ -770,7 +747,6 @@ static uint32_t s3_virge_mmio_read_l(uint32_t addr, void *p) virge_t *virge = (virge_t *)p; uint32_t ret = 0xffffffff; reg_reads++; -// pclog("New MMIO readl %08X %04X(%08X):%08X ", addr, CS, cs, pc); switch (addr & 0xfffc) { case 0x8180: @@ -847,7 +823,6 @@ static uint32_t s3_virge_mmio_read_l(uint32_t addr, void *p) ret = (0x10 << 8) | (1 << 13); if (!virge->virge_busy) wake_fifo_thread(virge); -// pclog("Read status %04x %i\n", ret, virge->s3d_busy); break; case 0xa4d4: s3_virge_wait_fifo_idle(virge); @@ -913,7 +888,6 @@ static uint32_t s3_virge_mmio_read_l(uint32_t addr, void *p) default: ret = s3_virge_mmio_read_w(addr, p) | (s3_virge_mmio_read_w(addr + 2, p) << 16); } -// /*if ((addr & 0xfffc) != 0x8504) */pclog("%02x\n", ret); return ret; } @@ -1270,7 +1244,6 @@ static void fifo_thread(void *param) static void s3_virge_queue(virge_t *virge, uint32_t addr, uint32_t val, uint32_t type) { fifo_entry_t *fifo = &virge->fifo[virge->fifo_write_idx & FIFO_MASK]; - int c; if (FIFO_FULL) { @@ -1295,9 +1268,7 @@ static void s3_virge_queue(virge_t *virge, uint32_t addr, uint32_t val, uint32_t static void s3_virge_mmio_write(uint32_t addr, uint8_t val, void *p) { virge_t *virge = (virge_t *)p; - svga_t *svga = &virge->svga; -// pclog("New MMIO writeb %08X %02X %04x(%08x):%08x\n", addr, val, CS, cs, pc); reg_writes++; if ((addr & 0xfffc) < 0x8000) { @@ -1327,7 +1298,6 @@ static void s3_virge_mmio_write_w(uint32_t addr, uint16_t val, void *p) { virge_t *virge = (virge_t *)p; reg_writes++; -// pclog("New MMIO writew %08X %04X %04x(%08x):%08x\n", addr, val, CS, cs, pc); if ((addr & 0xfffc) < 0x8000) { s3_virge_queue(virge, addr, val, FIFO_WRITE_WORD); @@ -1345,8 +1315,6 @@ static void s3_virge_mmio_write_l(uint32_t addr, uint32_t val, void *p) virge_t *virge = (virge_t *)p; svga_t *svga = &virge->svga; reg_writes++; -// if ((addr & 0xfffc) >= 0xb400 && (addr & 0xfffc) < 0xb800) -// pclog("New MMIO writel %08X %08X %04x(%08x):%08x\n", addr, val, CS, cs, pc); if ((addr & 0xfffc) < 0x8000) { @@ -1389,13 +1357,11 @@ static void s3_virge_mmio_write_l(uint32_t addr, uint32_t val, void *p) virge->streams.blend_ctrl = val; break; case 0x81c0: -// pclog("Write pri_fb0 %08x\n", val); virge->streams.pri_fb0 = val & 0x3fffff; svga_recalctimings(svga); svga->fullchange = changeframecount; break; case 0x81c4: -// pclog("Write pri_fb1 %08x\n", val); virge->streams.pri_fb1 = val & 0x3fffff; svga_recalctimings(svga); svga->fullchange = changeframecount; @@ -1406,7 +1372,6 @@ static void s3_virge_mmio_write_l(uint32_t addr, uint32_t val, void *p) svga->fullchange = changeframecount; break; case 0x81cc: -// pclog("Write buffer_ctrl %08x\n", val); virge->streams.buffer_ctrl = val; svga_recalctimings(svga); svga->fullchange = changeframecount; @@ -1659,11 +1624,6 @@ static void s3_virge_mmio_write_l(uint32_t addr, uint32_t val, void *p) virge->s3d_tri.cmd_set = val; if (!(val & CMD_SET_AE)) queue_triangle(virge); -/* { - thread_set_event(virge->wake_render_thread); - thread_wait_event(virge->wake_main_thread, -1); - } */ -// s3_virge_triangle(virge); break; case 0xb504: virge->s3d_tri.tbv = val & 0xfffff; @@ -1768,12 +1728,6 @@ static void s3_virge_mmio_write_l(uint32_t addr, uint32_t val, void *p) virge->s3d_tri.tlr = val >> 31; if (virge->s3d_tri.cmd_set & CMD_SET_AE) queue_triangle(virge); -/* { - thread_set_event(virge->wake_render_thread); - thread_wait_event(virge->wake_main_thread, -1); - }*/ - -// s3_virge_triangle(virge); break; } } @@ -1874,7 +1828,6 @@ static void s3_virge_mmio_write_l(uint32_t addr, uint32_t val, void *p) static void s3_virge_bitblt(virge_t *virge, int count, uint32_t cpu_dat) { - int cpu_input = (count != -1); uint8_t *vram = virge->svga.vram; uint32_t mono_pattern[64]; int count_mask; @@ -1884,6 +1837,11 @@ static void s3_virge_bitblt(virge_t *virge, int count, uint32_t cpu_dat) int x_mul; int cpu_dat_shift; uint32_t *pattern_data; + uint32_t src_addr; + uint32_t dest_addr; + uint32_t source = 0, dest, pattern; + uint32_t out = 0; + int update; switch (virge->s3d.cmd_set & CMD_SET_FORMAT_MASK) { @@ -1976,11 +1934,10 @@ static void s3_virge_bitblt(virge_t *virge, int count, uint32_t cpu_dat) return; while (count) { - uint32_t src_addr = virge->s3d.src_base + (virge->s3d.src_x * x_mul) + (virge->s3d.src_y * virge->s3d.src_str); - uint32_t dest_addr = virge->s3d.dest_base + (virge->s3d.dest_x * x_mul) + (virge->s3d.dest_y * virge->s3d.dest_str); - uint32_t source, dest, pattern; - uint32_t out = 0; - int update = 1; + src_addr = virge->s3d.src_base + (virge->s3d.src_x * x_mul) + (virge->s3d.src_y * virge->s3d.src_str); + dest_addr = virge->s3d.dest_base + (virge->s3d.dest_x * x_mul) + (virge->s3d.dest_y * virge->s3d.dest_str); + out = 0; + update = 1; switch (virge->s3d.cmd_set & (CMD_SET_MS | CMD_SET_IDS)) { @@ -2221,14 +2178,12 @@ skip_line: virge->s3d.dest_l = virge->s3d.plxstart; virge->s3d.h = virge->s3d.pycnt & 0x7ff; virge->s3d.rop = (virge->s3d.cmd_set >> 17) & 0xff; - //pclog("Start poly - l=%08x r=%08x h=%i rop=%02x\n", virge->s3d.dest_l, virge->s3d.dest_r, virge->s3d.h, virge->s3d.rop); while (virge->s3d.h) { int x = virge->s3d.dest_l >> 20; int xend = virge->s3d.dest_r >> 20; int y = virge->s3d.pystart & 0x7ff; int xdir = (x < xend) ? 1 : -1; - //pclog(" %03i: %i - %i %08x-%08x\n", y, x, xend, virge->s3d.dest_l, virge->s3d.dest_r); do { uint32_t dest_addr = virge->s3d.dest_base + (x * x_mul) + (y * virge->s3d.dest_str); @@ -2894,6 +2849,21 @@ static void tri(virge_t *virge, s3d_t *s3d_tri, s3d_state_t *state, int yc, int3 uint32_t dest_offset, z_offset; + uint32_t src_col; + int src_r = 0, src_g = 0, src_b = 0; + + int x; + int xe; + uint32_t z; + + uint32_t dest_addr, z_addr; + int dx; + int x_offset; + int xz_offset; + + int update; + uint16_t src_z = 0; + if (s3d_tri->cmd_set & CMD_SET_HC) { if (state->y < s3d_tri->clip_t) @@ -2930,21 +2900,20 @@ static void tri(virge_t *virge, s3d_t *s3d_tri, s3d_state_t *state, int yc, int3 for (; y_count > 0; y_count--) { - int x = (state->x1 + ((1 << 20) - 1)) >> 20; - int xe = (state->x2 + ((1 << 20) - 1)) >> 20; - uint32_t z = (state->base_z > 0) ? (state->base_z << 1) : 0; + x = (state->x1 + ((1 << 20) - 1)) >> 20; + xe = (state->x2 + ((1 << 20) - 1)) >> 20; + z = (state->base_z > 0) ? (state->base_z << 1) : 0; if (x_dir < 0) { x--; xe--; } - if (x != xe && (x_dir > 0 && x < xe) || (x_dir < 0 && x > xe)) + if (((x != xe) && ((x_dir > 0) && (x < xe))) || ((x_dir < 0) && (x > xe))) { - uint32_t dest_addr, z_addr; - int dx = (x_dir > 0) ? ((31 - ((state->x1-1) >> 15)) & 0x1f) : (((state->x1-1) >> 15) & 0x1f); - int x_offset = x_dir * (bpp + 1); - int xz_offset = x_dir << 1; + dx = (x_dir > 0) ? ((31 - ((state->x1-1) >> 15)) & 0x1f) : (((state->x1-1) >> 15) & 0x1f); + x_offset = x_dir * (bpp + 1); + xz_offset = x_dir << 1; if (x_dir > 0) dx += 1; state->r = state->base_r + ((s3d_tri->TdRdX * dx) >> 5); @@ -2957,8 +2926,6 @@ static void tri(virge_t *virge, s3d_t *s3d_tri, s3d_state_t *state, int yc, int3 state->d = state->base_d + ((s3d_tri->TdDdX * dx) >> 5); z += ((s3d_tri->TdZdX * dx) >> 5); -// pclog("Draw Y=%i X=%i to XE=%i %i %08x %08x %08x %08x %08x %08x %08x %08x %i %08x\n", state->y, x, xe, dx, state->x1, state->x2, dx1, virge->s3d.TdWdX, state->u, state->v, virge->s3d.TdUdX, virge->s3d.TdUdY, dx, (virge->s3d.TdUdX * dx) >> 4); - if (s3d_tri->cmd_set & CMD_SET_HC) { if (x_dir > 0) @@ -3020,8 +2987,7 @@ static void tri(virge_t *virge, s3d_t *s3d_tri, s3d_state_t *state, int yc, int3 for (; x != xe; x = (x + x_dir) & 0xfff) { - int update = 1; - uint16_t src_z; + update = 1; _x = x; _y = state->y; if (use_z) @@ -3038,9 +3004,6 @@ static void tri(virge_t *virge, s3d_t *s3d_tri, s3d_state_t *state, int yc, int3 if (s3d_tri->cmd_set & CMD_SET_ABC_ENABLE) { - uint32_t src_col; - int src_r, src_g, src_b; - switch (bpp) { case 0: /*8 bpp*/ @@ -3167,7 +3130,6 @@ static void s3_virge_triangle(virge_t *virge, s3d_t *s3d_tri) { case 0: dest_pixel = dest_pixel_gouraud_shaded_triangle; -// pclog("dest_pixel_gouraud_shaded_triangle\n"); break; case 1: case 5: @@ -3175,15 +3137,12 @@ static void s3_virge_triangle(virge_t *virge, s3d_t *s3d_tri) { case 0: dest_pixel = dest_pixel_lit_texture_reflection; -// pclog("dest_pixel_lit_texture_reflection\n"); break; case 1: dest_pixel = dest_pixel_lit_texture_modulate; -// pclog("dest_pixel_lit_texture_modulate\n"); break; case 2: dest_pixel = dest_pixel_lit_texture_decal; -// pclog("dest_pixel_lit_texture_decal\n"); break; default: pclog("bad triangle type %x\n", (s3d_tri->cmd_set >> 27) & 0xf); @@ -3193,7 +3152,6 @@ static void s3_virge_triangle(virge_t *virge, s3d_t *s3d_tri) case 2: case 6: dest_pixel = dest_pixel_unlit_texture_triangle; -// pclog("dest_pixel_unlit_texture_triangle\n"); break; default: pclog("bad triangle type %x\n", (s3d_tri->cmd_set >> 27) & 0xf); @@ -3204,47 +3162,39 @@ static void s3_virge_triangle(virge_t *virge, s3d_t *s3d_tri) { case 0: case 1: tex_sample = tex_sample_mipmap; -// pclog("use tex_sample_mipmap\n"); break; case 2: case 3: tex_sample = virge->bilinear_enabled ? tex_sample_mipmap_filter : tex_sample_mipmap; -// pclog("use tex_sample_mipmap_filter\n"); break; case 4: case 5: tex_sample = tex_sample_normal; -// pclog("use tex_sample_normal\n"); break; case 6: case 7: tex_sample = virge->bilinear_enabled ? tex_sample_normal_filter : tex_sample_normal; -// pclog("use tex_sample_normal_filter\n"); break; case (0 | 8): case (1 | 8): if (virge->is_375) tex_sample = tex_sample_persp_mipmap_375; else tex_sample = tex_sample_persp_mipmap; -// pclog("use tex_sample_persp_mipmap\n"); break; case (2 | 8): case (3 | 8): if (virge->is_375) tex_sample = virge->bilinear_enabled ? tex_sample_persp_mipmap_filter_375 : tex_sample_persp_mipmap_375; else tex_sample = virge->bilinear_enabled ? tex_sample_persp_mipmap_filter : tex_sample_persp_mipmap; -// pclog("use tex_sample_persp_mipmap_filter\n"); break; case (4 | 8): case (5 | 8): if (virge->is_375) tex_sample = tex_sample_persp_normal_375; else tex_sample = tex_sample_persp_normal; -// pclog("use tex_sample_persp_normal\n"); break; case (6 | 8): case (7 | 8): if (virge->is_375) tex_sample = virge->bilinear_enabled ? tex_sample_persp_normal_filter_375 : tex_sample_persp_normal_375; else tex_sample = virge->bilinear_enabled ? tex_sample_persp_normal_filter : tex_sample_persp_normal; -// pclog("use tex_sample_persp_normal_filter\n"); break; } @@ -3255,19 +3205,15 @@ static void s3_virge_triangle(virge_t *virge, s3d_t *s3d_tri) break; case 1: tex_read = (s3d_tri->cmd_set & CMD_SET_TWE) ? tex_ARGB4444 : tex_ARGB4444_nowrap; -// pclog("tex_ARGB4444\n"); break; case 2: tex_read = (s3d_tri->cmd_set & CMD_SET_TWE) ? tex_ARGB1555 : tex_ARGB1555_nowrap; -// pclog("tex_ARGB1555 %i\n", (s3d_tri->cmd_set >> 5) & 7); break; default: pclog("bad texture type %i\n", (s3d_tri->cmd_set >> 5) & 7); tex_read = (s3d_tri->cmd_set & CMD_SET_TWE) ? tex_ARGB1555 : tex_ARGB1555_nowrap; break; } - -// pclog("Triangle %i %i,%i to %i,%i %08x\n", y, x1 >> 20, y, s3d_tri->txend01 >> 20, y - (s3d_tri->ty01 + s3d_tri->ty12), state.cmd_set); state.y = s3d_tri->tys; state.x1 = s3d_tri->txs; @@ -3306,15 +3252,12 @@ static void render_thread(void *param) static void queue_triangle(virge_t *virge) { - int c; -// pclog("queue_triangle: read=%i write=%i RB_ENTRIES=%i RB_FULL=%i\n", virge->s3d_read_idx, virge->s3d_write_idx, RB_ENTRIES, RB_FULL); if (RB_FULL) { thread_reset_event(virge->not_full_event); if (RB_FULL) thread_wait_event(virge->not_full_event, -1); /*Wait for room in ringbuffer*/ } -// pclog(" add at read=%i write=%i %i\n", virge->s3d_read_idx, virge->s3d_write_idx, virge->s3d_write_idx & RB_MASK); virge->s3d_buffer[virge->s3d_write_idx & RB_MASK] = virge->s3d_tri; virge->s3d_write_idx++; if (!virge->s3d_busy) @@ -3331,7 +3274,9 @@ static void s3_virge_hwcursor_draw(svga_t *svga, int displine) int y_add = (enable_overscan && !suppress_overscan) ? 16 : 0; int x_add = (enable_overscan && !suppress_overscan) ? 8 : 0; -// pclog("HWcursor %i %i\n", svga->hwcursor_latch.x, svga->hwcursor_latch.y); + if (svga->interlace && svga->hwcursor_oddeven) + svga->hwcursor_latch.addr += 16; + for (x = 0; x < 64; x += 16) { dat[0] = (svga->vram[svga->hwcursor_latch.addr] << 8) | svga->vram[svga->hwcursor_latch.addr + 1]; @@ -3363,7 +3308,6 @@ static void s3_virge_hwcursor_draw(svga_t *svga, int displine) ((uint32_t *)buffer32->line[displine + y_add])[offset + 32 + x_add] = virge->hwcursor_col[dat[1] >> 15]; else if (dat[1] & 0x8000) ((uint32_t *)buffer32->line[displine + y_add])[offset + 32 + x_add] ^= 0xffffff; -// pclog("Plot %i, %i (%i %i) %04X %04X\n", offset, displine, x+xx, svga->hwcursor_on, dat[0], dat[1]); } offset++; @@ -3373,6 +3317,8 @@ static void s3_virge_hwcursor_draw(svga_t *svga, int displine) } svga->hwcursor_latch.addr += 4; } + if (svga->interlace && !svga->hwcursor_oddeven) + svga->hwcursor_latch.addr += 16; } #define DECODE_YCbCr() \ @@ -3448,18 +3394,18 @@ static void s3_virge_hwcursor_draw(svga_t *svga, int displine) b[x_write+1] = y2 + dB; \ CLAMP(b[x_write+1]); \ \ - r[x_write+2] = y2 + dR; \ + r[x_write+2] = y3 + dR; \ CLAMP(r[x_write+2]); \ - g[x_write+2] = y2 - dG; \ + g[x_write+2] = y3 - dG; \ CLAMP(g[x_write+2]); \ - b[x_write+2] = y2 + dB; \ + b[x_write+2] = y3 + dB; \ CLAMP(b[x_write+2]); \ \ - r[x_write+3] = y2 + dR; \ + r[x_write+3] = y4 + dR; \ CLAMP(r[x_write+3]); \ - g[x_write+3] = y2 - dG; \ + g[x_write+3] = y4 - dG; \ CLAMP(g[x_write+3]); \ - b[x_write+3] = y2 + dB; \ + b[x_write+3] = y4 + dB; \ CLAMP(b[x_write+3]); \ \ x_write = (x_write + 4) & 7; \ @@ -3608,9 +3554,6 @@ static void s3_virge_overlay_draw(svga_t *svga, int displine) int offset = (virge->streams.sec_x - virge->streams.pri_x) + 1; int h_acc = virge->streams.dda_horiz_accumulator; int r[8], g[8], b[8]; - int r_samp[8] = {0, 0, 0, 0, 0, 0, 0, 0}; - int g_samp[8] = {0, 0, 0, 0, 0, 0, 0, 0}; - int b_samp[8] = {0, 0, 0, 0, 0, 0, 0, 0}; int x_size, x_read = 4, x_write = 4; int x; uint32_t *p; @@ -3655,7 +3598,6 @@ static uint8_t s3_virge_pci_read(int func, int addr, void *p) virge_t *virge = (virge_t *)p; svga_t *svga = &virge->svga; uint8_t ret = 0; -// pclog("S3 PCI read %08X ", addr); switch (addr) { case 0x00: ret = 0x33; break; /*'S3'*/ @@ -3694,7 +3636,6 @@ static uint8_t s3_virge_pci_read(int func, int addr, void *p) case 0x3f: ret = 0xff; break; } -// pclog("%02X\n", ret); return ret; } @@ -3702,7 +3643,6 @@ static void s3_virge_pci_write(int func, int addr, uint8_t val, void *p) { virge_t *virge = (virge_t *)p; svga_t *svga = &virge->svga; -// pclog("S3 PCI write %08X %02X %04X:%08X\n", addr, val, CS, pc); switch (addr) { case 0x00: case 0x01: case 0x02: case 0x03: @@ -3738,13 +3678,11 @@ static void s3_virge_pci_write(int func, int addr, uint8_t val, void *p) if (virge->pci_regs[0x30] & 0x01) { uint32_t addr = (virge->pci_regs[0x32] << 16) | (virge->pci_regs[0x33] << 24); -// pclog("Virge bios_rom enabled at %08x\n", addr); mem_mapping_set_addr(&virge->bios_rom.mapping, addr, 0x8000); mem_mapping_enable(&virge->bios_rom.mapping); } else { -// pclog("Virge bios_rom disabled\n"); mem_mapping_disable(&virge->bios_rom.mapping); } return; @@ -3829,7 +3767,102 @@ static void *s3_virge_init() break; } - virge->svga.crtc[0x37] = 1;// | (7 << 5); + virge->svga.crtc[0x37] = 1; + virge->svga.crtc[0x53] = 1 << 3; + virge->svga.crtc[0x59] = 0x70; + + virge->is_375 = 0; + + pci_add(s3_virge_pci_read, s3_virge_pci_write, virge); + + virge->wake_render_thread = thread_create_event(); + virge->wake_main_thread = thread_create_event(); + virge->not_full_event = thread_create_event(); + virge->render_thread = thread_create(render_thread, virge); + + virge->wake_fifo_thread = thread_create_event(); + virge->fifo_not_full_event = thread_create_event(); + virge->fifo_thread = thread_create(fifo_thread, virge); + + return virge; +} + +static void *s3_virge_988_init() +{ + virge_t *virge = malloc(sizeof(virge_t)); + memset(virge, 0, sizeof(virge_t)); + + virge->bilinear_enabled = device_get_config_int("bilinear"); + virge->dithering_enabled = device_get_config_int("dithering"); + virge->memory_size = device_get_config_int("memory"); + + svga_init(&virge->svga, virge, virge->memory_size << 20, + s3_virge_recalctimings, + s3_virge_in, s3_virge_out, + s3_virge_hwcursor_draw, + s3_virge_overlay_draw); + + rom_init(&virge->bios_rom, "roms/diamondstealth3000.VBI", 0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL); + if (PCI) + mem_mapping_disable(&virge->bios_rom.mapping); + + mem_mapping_add(&virge->mmio_mapping, 0, 0, s3_virge_mmio_read, + s3_virge_mmio_read_w, + s3_virge_mmio_read_l, + s3_virge_mmio_write, + s3_virge_mmio_write_w, + s3_virge_mmio_write_l, + NULL, + 0, + virge); + mem_mapping_add(&virge->new_mmio_mapping, 0, 0, s3_virge_mmio_read, + s3_virge_mmio_read_w, + s3_virge_mmio_read_l, + s3_virge_mmio_write, + s3_virge_mmio_write_w, + s3_virge_mmio_write_l, + NULL, + 0, + virge); + mem_mapping_add(&virge->linear_mapping, 0, 0, svga_read_linear, + svga_readw_linear, + svga_readl_linear, + svga_write_linear, + svga_writew_linear, + svga_writel_linear, + NULL, + 0, + &virge->svga); + + io_sethandler(0x03c0, 0x0020, s3_virge_in, NULL, NULL, s3_virge_out, NULL, NULL, virge); + + virge->pci_regs[4] = 3; + virge->pci_regs[5] = 0; + virge->pci_regs[6] = 0; + virge->pci_regs[7] = 2; + virge->pci_regs[0x32] = 0x0c; + virge->pci_regs[0x3c] = device_get_config_int("irq"); + virge->pci_regs[0x3d] = 1; + virge->pci_regs[0x3e] = 4; + virge->pci_regs[0x3f] = 0xff; + + virge->virge_id_high = 0x88; + virge->virge_id_low = 0x3d; + virge->virge_rev = 0; + virge->virge_id = 0xe1; + + switch (virge->memory_size) + { + case 2: + virge->svga.crtc[0x36] = 2 | (0 << 2) | (1 << 4) | (4 << 5); + break; + case 4: + default: + virge->svga.crtc[0x36] = 2 | (0 << 2) | (1 << 4) | (0 << 5); + break; + } + + virge->svga.crtc[0x37] = 1; virge->svga.crtc[0x53] = 1 << 3; virge->svga.crtc[0x59] = 0x70; @@ -3923,8 +3956,7 @@ static void *s3_virge_375_init() virge->svga.crtc[0x36] = 2 | (0 << 2) | (1 << 4) | (0 << 5); break; } -// virge->svga.crtc[0x36] = 2 | (0 << 2) | (1 << 4); - virge->svga.crtc[0x37] = 1;// | (7 << 5); + virge->svga.crtc[0x37] = 1; virge->svga.crtc[0x53] = 1 << 3; virge->svga.crtc[0x59] = 0x70; @@ -3960,6 +3992,10 @@ static void s3_virge_close(void *p) thread_destroy_event(virge->wake_main_thread); thread_destroy_event(virge->wake_render_thread); + thread_kill(virge->fifo_thread); + thread_destroy_event(virge->wake_fifo_thread); + thread_destroy_event(virge->fifo_not_full_event); + svga_close(&virge->svga); free(virge); @@ -3970,6 +4006,11 @@ static int s3_virge_available() return rom_present("roms/s3virge.bin"); } +static int s3_virge_988_available() +{ + return rom_present("roms/diamondstealth3000.VBI"); +} + static int s3_virge_375_available() { return rom_present("roms/86c375_1.bin"); @@ -4013,91 +4054,66 @@ static void s3_virge_add_status_info(char *s, int max_len, void *p) static device_config_t s3_virge_config[] = { { - .name = "memory", - .description = "Memory size", - .type = CONFIG_SELECTION, - .selection = + "memory", "Memory size", CONFIG_SELECTION, "", 4, { { - .description = "2 MB", - .value = 2 + "2 MB", 2 }, { - .description = "4 MB", - .value = 4 + "4 MB", 4 }, { - .description = "" + "" } - }, - .default_int = 4 + } }, { - .name = "bilinear", - .description = "Bilinear filtering", - .type = CONFIG_BINARY, - .default_int = 1 - }, - { - .name = "dithering", - .description = "Dithering", - .type = CONFIG_BINARY, - .default_int = 1 - }, - { - .name = "irq", - .description = "IRQ", - .type = CONFIG_SELECTION, - .selection = + "irq", "IRQ", CONFIG_SELECTION, "", 3, { { - .description = "IRQ 3", - .value = 3 + "IRQ 3", 3 }, { - .description = "IRQ 4", - .value = 4 + "IRQ 4", 4 }, { - .description = "IRQ 5", - .value = 5 + "IRQ 5", 5 }, { - .description = "IRQ 7", - .value = 7 + "IRQ 7", 7 }, { - .description = "IRQ 9", - .value = 9 + "IRQ 9", 9 }, { - .description = "IRQ 10", - .value = 10 + "IRQ 10", 10 }, { - .description = "IRQ 11", - .value = 11 + "IRQ 11", 11 }, { - .description = "IRQ 12", - .value = 12 + "IRQ 12", 12 }, { - .description = "IRQ 14", - .value = 14 + "IRQ 14", 14 }, { - .description = "IRQ 15", - .value = 15 + "IRQ 15", 15 }, { - .description = "" + "" } }, .default_int = 3 }, { - .type = -1 + "bilinear", "Bilinear filtering", CONFIG_BINARY, "", 1 + }, + { + "dithering", "Dithering", CONFIG_BINARY, "", 1 + }, + { + "", "", -1 } }; @@ -4114,6 +4130,19 @@ device_t s3_virge_device = s3_virge_config }; +device_t s3_virge_988_device = +{ + "Diamond Stealth 3D 3000 (S3 ViRGE/VX)", + 0, + s3_virge_988_init, + s3_virge_close, + s3_virge_988_available, + s3_virge_speed_changed, + s3_virge_force_redraw, + s3_virge_add_status_info, + s3_virge_config +}; + device_t s3_virge_375_device = { "S3 ViRGE/DX", diff --git a/src/vid_s3_virge.h b/src/vid_s3_virge.h index 3419b8657..2e8dfbe91 100644 --- a/src/vid_s3_virge.h +++ b/src/vid_s3_virge.h @@ -2,4 +2,5 @@ see COPYING for more details */ extern device_t s3_virge_device; +extern device_t s3_virge_988_device; extern device_t s3_virge_375_device; diff --git a/src/vid_sdac_ramdac.c b/src/vid_sdac_ramdac.c index 412e4836e..c1dad85d2 100644 --- a/src/vid_sdac_ramdac.c +++ b/src/vid_sdac_ramdac.c @@ -25,7 +25,6 @@ int sdac_get_clock_divider(sdac_ramdac_t *ramdac) void sdac_ramdac_out(uint16_t addr, uint8_t val, sdac_ramdac_t *ramdac, svga_t *svga) { -// /*if (CS!=0xC000) */pclog("OUT RAMDAC %04X %02X %i %04X:%04X %i\n",addr,val,sdac_ramdac.magic_count,CS,pc, sdac_ramdac.rs2); switch (addr) { case 0x3C6: @@ -39,19 +38,18 @@ void sdac_ramdac_out(uint16_t addr, uint8_t val, sdac_ramdac_t *ramdac, svga_t * if (ramdac->magic_count == 4) { ramdac->command = val; -// pclog("RAMDAC command reg now %02X\n", val); switch (val >> 4) { case 0x2: case 0x3: case 0x8: case 0xa: svga->bpp = 15; break; case 0x4: case 0x9: case 0xe: svga->bpp = 24; break; case 0x5: case 0x6: case 0xc: svga->bpp = 16; break; - case 0x7: svga->bpp = 32; break; + case 0x7: case 0xd: svga->bpp = 32; break; case 0: case 1: default: svga->bpp = 8; break; } svga_recalctimings(svga); + pclog("RAMDAC: Mode: %i, BPP: %i\n", val >> 4, svga->bpp); } - //ramdac->magic_count = 0; break; case 0x3C7: @@ -71,7 +69,6 @@ void sdac_ramdac_out(uint16_t addr, uint8_t val, sdac_ramdac_t *ramdac, svga_t * if (!ramdac->reg_ff) ramdac->regs[ramdac->windex] = (ramdac->regs[ramdac->windex] & 0xff00) | val; else ramdac->regs[ramdac->windex] = (ramdac->regs[ramdac->windex] & 0x00ff) | (val << 8); ramdac->reg_ff = !ramdac->reg_ff; -// pclog("RAMDAC reg %02X now %04X\n", ramdac->windex, ramdac->regs[ramdac->windex]); if (!ramdac->reg_ff) ramdac->windex++; } break; @@ -82,7 +79,6 @@ void sdac_ramdac_out(uint16_t addr, uint8_t val, sdac_ramdac_t *ramdac, svga_t * uint8_t sdac_ramdac_in(uint16_t addr, sdac_ramdac_t *ramdac, svga_t *svga) { uint8_t temp; -// /*if (CS!=0xC000) */pclog("IN RAMDAC %04X %04X:%04X %i\n",addr,CS,pc, ramdac->rs2); switch (addr) { case 0x3C6: @@ -101,27 +97,15 @@ uint8_t sdac_ramdac_in(uint16_t addr, sdac_ramdac_t *ramdac, svga_t *svga) } return temp; case 0x3C7: -// if (ramdac->magic_count < 4) -// { ramdac->magic_count=0; -// break; -// } if (ramdac->rs2) return ramdac->rindex; break; case 0x3C8: -// if (ramdac->magic_count < 4) -// { ramdac->magic_count=0; -// break; -// } if (ramdac->rs2) return ramdac->windex; break; case 0x3C9: -// if (ramdac->magic_count < 4) -// { ramdac->magic_count=0; -// break; -// } if (ramdac->rs2) { if (!ramdac->reg_ff) temp = ramdac->regs[ramdac->rindex] & 0xff; @@ -144,7 +128,6 @@ float sdac_getclock(int clock, void *p) sdac_ramdac_t *ramdac = (sdac_ramdac_t *)p; float t; int m, n1, n2; -// pclog("SDAC_Getclock %i %04X\n", clock, ramdac->regs[clock]); if (clock == 0) return 25175000.0; if (clock == 1) return 28322000.0; clock ^= 1; /*Clocks 2 and 3 seem to be reversed*/ @@ -152,6 +135,5 @@ float sdac_getclock(int clock, void *p) n1 = ((ramdac->regs[clock] >> 8) & 0x1f) + 2; n2 = ((ramdac->regs[clock] >> 13) & 0x07); t = (14318184.0 * ((float)m / (float)n1)) / (float)(1 << n2); -// pclog("SDAC clock %i %i %i %f %04X %f %i\n", m, n1, n2, t, ramdac->regs[2], 14318184.0 * ((float)m / (float)n1), 1 << n2); return t; } diff --git a/src/vid_stg_ramdac.c b/src/vid_stg_ramdac.c index 7fbd69785..2aa3fee19 100644 --- a/src/vid_stg_ramdac.c +++ b/src/vid_stg_ramdac.c @@ -10,11 +10,9 @@ static int stg_state_read[2][8] = {{1,2,3,4,0,0,0,0}, {1,2,3,4,5,6,7,7}}; static int stg_state_write[8] = {0,0,0,0,0,6,7,7}; -static int stg_state_indexed = 0; void stg_ramdac_set_bpp(svga_t *svga, stg_ramdac_t *ramdac) { - int oldbpp = svga->bpp; if (ramdac->command & 0x8) { switch (ramdac->regs[3]) @@ -43,7 +41,6 @@ void stg_ramdac_set_bpp(svga_t *svga, stg_ramdac_t *ramdac) void stg_ramdac_out(uint16_t addr, uint8_t val, stg_ramdac_t *ramdac, svga_t *svga) { int didwrite, old; - //if (CS!=0xC000) pclog("OUT RAMDAC %04X %02X %i %04X:%04X\n",addr,val,stg_ramdac.magic_count,CS,pc); switch (addr) { case 0x3c6: @@ -65,7 +62,6 @@ void stg_ramdac_out(uint16_t addr, uint8_t val, stg_ramdac_t *ramdac, svga_t *sv stg_ramdac_set_bpp(svga, ramdac); } } - // pclog("Write RAMDAC command %02X\n",val); break; case 5: ramdac->index = (ramdac->index & 0xff00) | val; @@ -74,7 +70,6 @@ void stg_ramdac_out(uint16_t addr, uint8_t val, stg_ramdac_t *ramdac, svga_t *sv ramdac->index = (ramdac->index & 0xff) | (val << 8); break; case 7: - // pclog("Write RAMDAC reg %02X %02X\n", ramdac->index, val); if (ramdac->index < 0x100) { ramdac->regs[ramdac->index] = val; @@ -96,8 +91,7 @@ void stg_ramdac_out(uint16_t addr, uint8_t val, stg_ramdac_t *ramdac, svga_t *sv uint8_t stg_ramdac_in(uint16_t addr, stg_ramdac_t *ramdac, svga_t *svga) { - uint8_t temp; - //if (CS!=0xC000) pclog("IN RAMDAC %04X %04X:%04X\n",addr,CS,pc); + uint8_t temp = 0xff; switch (addr) { case 0x3c6: @@ -116,7 +110,6 @@ uint8_t stg_ramdac_in(uint16_t addr, stg_ramdac_t *ramdac, svga_t *svga) temp = ramdac->index >> 8; break; case 7: - // pclog("Read RAMDAC index %04X\n",ramdac->index); switch (ramdac->index) { case 0: @@ -151,7 +144,6 @@ float stg_getclock(int clock, void *p) float t; int m, n1, n2; float d; -// pclog("STG_Getclock %i %04X\n", clock, ramdac->regs[clock]); if (clock == 0) return 25175000.0; if (clock == 1) return 28322000.0; clock ^= 1; /*Clocks 2 and 3 seem to be reversed*/ @@ -173,8 +165,6 @@ float stg_getclock(int clock, void *p) d = 8.0; break; } - // t = (14318184.0 * ((float)m / (float)n1)) / (float)(1 << n2); t = (14318184.0 * ((float)m / d)) / (float)n1; -// pclog("STG clock %i %i %i %f %04X %f %i\n", m, n1, n2, t, ramdac->regs[2], 14318184.0 * ((float)m / (float)n1), 1 << n2); return t; } diff --git a/src/vid_svga.c b/src/vid_svga.c index 2e2b34da7..9db83a709 100644 --- a/src/vid_svga.c +++ b/src/vid_svga.c @@ -21,9 +21,7 @@ extern uint8_t edatlookup[4][4]; uint8_t svga_rotate[8][256]; -static uint8_t mask_gdc[9] = {0x0F, 0x0F, 0x0F, 0x1F, 0x03, 0x7B, 0xFF, 0x0F, 0xFF}; uint8_t mask_crtc[0x19] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0x7F, 0xEF, 0xFF}; -static uint8_t mask_seq[5] = {0x03, 0x3D, 0x0F, 0x3F, 0x0E}; /*Primary SVGA device. As multiple video cards are not yet supported this is the only SVGA device.*/ @@ -31,8 +29,6 @@ static svga_t *svga_pri; static int old_overscan_color = 0; -static int sense_switches = 0xE; - svga_t *svga_pointer; svga_t *svga_get_pri() @@ -52,21 +48,23 @@ typedef union pci_bar uint8_t bytes[2]; } ichar; +#ifdef DEV_BRANCH ichar char12x24[65536][48]; uint8_t charedit_on = 0; ichar charcode; uint8_t charmode = 0; uint8_t charptr = 0; uint8_t charsettings = 0xEE; +#endif void svga_out(uint16_t addr, uint8_t val, void *p) { svga_t *svga = (svga_t *)p; int c; uint8_t o; - // printf("OUT SVGA %03X %02X %04X:%04X\n",addr,val,CS,cpu_state.pc); switch (addr) { +#ifdef DEV_BRANCH case 0x32CB: printf("Write 32CB: %04X\n", val); charedit_on = (val & 0x10) ? 1 : 0; @@ -81,7 +79,6 @@ void svga_out(uint16_t addr, uint8_t val, void *p) case 0x22CF: printf("Write 22CF: %04X\n", val); - // if (!charedit_on) return; switch(charmode) { case 1: case 2: @@ -100,6 +97,7 @@ void svga_out(uint16_t addr, uint8_t val, void *p) case 0x22CA: case 0x22CE: case 0x32CA: printf("OUT SVGA %03X %02X %04X:%04X\n",addr,val,CS,cpu_state.pc); return; +#endif case 0x3C0: case 0x3C1: @@ -127,7 +125,6 @@ void svga_out(uint16_t addr, uint8_t val, void *p) if (svga->attrregs[0x10] & 0x80) svga->egapal[c] = (svga->attrregs[c] & 0xf) | ((svga->attrregs[0x14] & 3) << 4); else svga->egapal[c] = (svga->attrregs[c] & 0x3f); - // if (svga->attrregs[0x10] & 0x40) svga->egapal[c] |= ((svga->attrregs[0x14] & 0x0c) << 4); /* It seems these should always be enabled. */ svga->egapal[c] |= ((svga->attrregs[0x14] & 0x0c) << 4); } @@ -150,15 +147,13 @@ void svga_out(uint16_t addr, uint8_t val, void *p) svga->miscout = val; svga->enablevram = (val & 2) ? 1 : 0; svga->oddeven_page = (val & 0x20) ? 0 : 1; - svga->vidclock = val & 4;// printf("3C2 write %02X\n",val); + svga->vidclock = val & 4; if (val & 1) { -// pclog("Remove mono handler\n"); io_removehandler(0x03a0, 0x0020, svga->video_in, NULL, NULL, svga->video_out, NULL, NULL, svga->p); } else { -// pclog("Set mono handler\n"); io_sethandler(0x03a0, 0x0020, svga->video_in, NULL, NULL, svga->video_out, NULL, NULL, svga->p); } svga_recalctimings(svga); @@ -269,11 +264,9 @@ void svga_out(uint16_t addr, uint8_t val, void *p) svga->chain2_read = val & 0x10; break; case 6: -// pclog("svga_out recalcmapping %p\n", svga); svga->oddeven_chain = (val & 2) ? 1 : 0; if ((svga->gdcreg[6] & 0xc) != (val & 0xc)) { -// pclog("Write mapping %02X\n", val); switch (val&0xC) { case 0x0: /*128k at A0000*/ @@ -349,22 +342,20 @@ uint8_t svga_in(uint16_t addr, void *p) { svga_t *svga = (svga_t *)p; uint8_t temp; - // if (addr!=0x3da) pclog("Read port %04X\n",addr); switch (addr) { +#ifdef DEV_BRANCH case 0x22CA: pclog("Read port %04X\n", addr); return 0xAA; case 0x22CB: pclog("Read port %04X\n", addr); - // return charmode; return 0xF0 | (charmode & 0x1F); case 0x22CE: pclog("Read port %04X\n", addr); return 0xCC; case 0x22CF: /* Read character bitmap */ pclog("Read port %04X\n", addr); - // if (!charedit_on) return 0xFF; switch(charmode) { case 1: case 2: @@ -384,7 +375,7 @@ uint8_t svga_in(uint16_t addr, void *p) case 0x32CB: pclog("Read port %04X\n", addr); return 0xEE; - // return 0xEE | (charedit_on ? 0x10 : 0); +#endif case 0x3C0: return svga->attraddr | svga->attr_palette_enable; @@ -470,7 +461,6 @@ uint8_t svga_in(uint16_t addr, void *p) svga->cgastat ^= 0x30; return svga->cgastat; } -// printf("Bad EGA read %04X %04X:%04X\n",addr,cs>>4,pc); return 0xFF; } @@ -496,7 +486,6 @@ void svga_recalctimings(svga_t *svga) { double crtcconst; double _dispontime, _dispofftime, disptime; - int hdisp_old; svga->vtotal = svga->crtc[6]; svga->dispend = svga->crtc[0x12]; @@ -632,8 +621,6 @@ void svga_recalctimings(svga_t *svga) } } -// pclog("svga_render %08X : %08X %08X %08X %08X %08X %i %i %02X %i %i\n", svga_render, svga_render_text_40, svga_render_text_80, svga_render_8bpp_lowres, svga_render_8bpp_highres, svga_render_blank, scrblank,gdcreg[6]&1,gdcreg[5]&0x60,bpp,seqregs[1]&8); - svga->linedbl = svga->crtc[9] & 0x80; svga->rowcount = svga->crtc[9] & 31; if (svga->recalctimings_ex) @@ -647,7 +634,6 @@ void svga_recalctimings(svga_t *svga) disptime = svga->htotal; _dispontime = svga->hdisp_time; -// printf("Disptime %f dispontime %f hdisp %i\n",disptime,dispontime,crtc[1]*8); if (svga->seqregs[1] & 8) { disptime *= 2; _dispontime *= 2; } _dispofftime = disptime - _dispontime; _dispontime *= crtcconst; @@ -703,7 +689,6 @@ void svga_poll(void *p) if (!svga->linepos) { -// if (!(vc & 15)) pclog("VC %i %i\n", vc, GetTickCount()); if (svga->displine == svga->hwcursor_latch.y && svga->hwcursor_latch.ena) { svga->hwcursor_on = 64 - svga->hwcursor_latch.yoff; @@ -728,7 +713,6 @@ void svga_poll(void *p) } svga->vidtime += svga->dispofftime; -// if (output) printf("Display off %f\n",vidtime); svga->cgastat |= 1; svga->linepos = 1; @@ -771,27 +755,21 @@ void svga_poll(void *p) svga->lastline = svga->displine; } -// pclog("%03i %06X %06X\n",displine,ma,vrammask); svga->displine++; if (svga->interlace) svga->displine++; if ((svga->cgastat & 8) && ((svga->displine & 15) == (svga->crtc[0x11] & 15)) && svga->vslines) { -// printf("Vsync off at line %i\n",displine); svga->cgastat &= ~8; } svga->vslines++; if (svga->displine > 1500) svga->displine = 0; -// pclog("Col is %08X %08X %08X %i %i %08X\n",((uint32_t *)buffer32->line[displine])[320],((uint32_t *)buffer32->line[displine])[321],((uint32_t *)buffer32->line[displine])[322], -// displine, vc, ma); } else { -// pclog("VC %i ma %05X\n", svga->vc, svga->ma); svga->vidtime += svga->dispontime; -// if (output) printf("Display on %f\n",vidtime); if (svga->dispon) svga->cgastat &= ~1; svga->hdisp_on = 0; @@ -830,14 +808,14 @@ void svga_poll(void *p) if (svga->vc == svga->split) { -// pclog("VC split\n"); svga->ma = svga->maback = 0; if (svga->attrregs[0x10] & 0x20) svga->scrollcache = 0; } if (svga->vc == svga->dispend) { -// pclog("VC dispend\n"); + if (svga->vblank_start) + svga->vblank_start(svga); svga->dispon=0; if (svga->crtc[10] & 0x20) svga->cursoron = 0; else svga->cursoron = svga->blink & 16; @@ -850,14 +828,12 @@ void svga_poll(void *p) if (svga->changedvram[x]) svga->changedvram[x]--; } -// memset(changedvram,0,2048); if (svga->fullchange) svga->fullchange--; } if (svga->vc == svga->vsyncstart) { int wx, wy; -// pclog("VC vsync %i %i\n", svga->firstline_draw, svga->lastline_draw); svga->dispon=0; svga->cgastat |= 8; x = svga->hdisp; @@ -894,7 +870,6 @@ void svga_poll(void *p) svga->video_res_x = wx; svga->video_res_y = wy + 1; -// pclog("%i %i %i\n", svga->video_res_x, svga->video_res_y, svga->lowres); if (!(svga->gdcreg[6] & 1)) /*Text mode*/ { svga->video_res_x /= (svga->seqregs[1] & 1) ? 8 : 9; @@ -918,16 +893,9 @@ void svga_poll(void *p) case 0x40: case 0x60: svga->video_bpp = svga->bpp; break; } } -// if (svga_interlace && oddeven) ma=maback=ma+(svga_rowoffset<<2); - -// pclog("Addr %08X vson %03X vsoff %01X %02X %02X %02X %i %i\n",ma,svga_vsyncstart,crtc[0x11]&0xF,crtc[0xD],crtc[0xC],crtc[0x33], svga_interlace, oddeven); } if (svga->vc == svga->vtotal) { -// pclog("VC vtotal\n"); - - -// printf("Frame over at line %i %i %i %i\n",displine,vc,svga_vsyncstart,svga_dispend); svga->vc = 0; svga->sc = 0; svga->dispon = 1; @@ -940,15 +908,10 @@ void svga_poll(void *p) svga->overlay_on = 0; svga->overlay_latch = svga->overlay; -// pclog("Latch HWcursor addr %08X\n", svga_hwcursor_latch.addr); - -// pclog("ADDR %08X\n",hwcursor_addr); } if (svga->sc == (svga->crtc[10] & 31)) svga->con = 1; } -// printf("2 %i\n",svga_vsyncstart); -//pclog("svga_poll %i %i %i %i %i %i %i\n", ins, svga->dispofftime, svga->dispontime, svga->vidtime, cyc_total, svga->linepos, svga->vc); } int svga_init(svga_t *svga, void *p, int memsize, @@ -993,7 +956,6 @@ int svga_init(svga_t *svga, void *p, int memsize, svga->video_out = video_out; svga->hwcursor_draw = hwcursor_draw; svga->overlay_draw = overlay_draw; -// _svga_recalctimings(svga); mem_mapping_add(&svga->mapping, 0xa0000, 0x20000, svga_read, svga_readw, svga_readl, svga_write, svga_writew, svga_writel, NULL, 0, svga); @@ -1066,7 +1028,6 @@ void svga_write(uint32_t addr, uint8_t val, void *p) { addr<<=2; } - // addr %= svga->vram_limit; if (addr >= svga->vram_limit) return; @@ -1132,7 +1093,6 @@ void svga_write(uint32_t addr, uint8_t val, void *p) if (writemask2 & 8) svga->vram[addr | 0x3] = (vald & svga->gdcreg[8]) ^ svga->ld; break; } -// pclog("- %02X %02X %02X %02X %08X\n",vram[addr],vram[addr|0x1],vram[addr|0x2],vram[addr|0x3],addr); } break; case 2: @@ -1238,19 +1198,12 @@ uint8_t svga_read(uint32_t addr, void *p) cycles_lost += video_timing_b; egareads++; -// pclog("Readega %06X ",addr); addr &= svga->banked_mask; addr += svga->read_bank; - // latch_addr = (addr << 2) % svga->vram_limit; latch_addr = svga_mask_addr(addr << 2, svga); - // latch_addr = (addr << 2); - -// pclog("%05X %i %04X:%04X %02X %02X %i\n",addr,svga->chain4,CS,pc, vram[addr & 0x7fffff], vram[(addr << 2) & 0x7fffff], svga->readmode); -// pclog("%i\n", svga->readmode); if (svga->chain4 || svga->fb_only) { - // addr %= svga->vram_limit; if (addr >= svga->vram_limit) return 0xff; return svga->vram[svga_mask_addr(addr, svga)]; @@ -1263,9 +1216,7 @@ uint8_t svga_read(uint32_t addr, void *p) } else addr<<=2; - - // addr %= svga->vram_limit; - + if (addr >= svga->vram_limit) return 0xff; @@ -1297,7 +1248,6 @@ uint8_t svga_read(uint32_t addr, void *p) temp4 ^= (svga->colourcompare & 8) ? 0xff : 0; return ~(temp | temp2 | temp3 | temp4); } -//pclog("Read %02X %04X %04X\n",vram[addr|svga->readplane],addr,svga->readplane); return svga->vram[addr | readplane]; } @@ -1405,7 +1355,6 @@ void svga_write_linear(uint32_t addr, uint8_t val, void *p) if (writemask2 & 8) svga->vram[addr | 0x3] = (vald & svga->gdcreg[8]) ^ svga->ld; break; } -// pclog("- %02X %02X %02X %02X %08X\n",vram[addr],vram[addr|0x1],vram[addr|0x2],vram[addr|0x3],addr); } break; case 2: @@ -1497,7 +1446,6 @@ uint8_t svga_read_linear(uint32_t addr, void *p) { svga_t *svga = (svga_t *)p; uint8_t temp, temp2, temp3, temp4; - uint32_t latch_addr; int readplane = svga->readplane; cycles -= video_timing_b; @@ -1506,8 +1454,6 @@ uint8_t svga_read_linear(uint32_t addr, void *p) egareads++; addr -= svga->linear_base; - - latch_addr = svga_mask_addr(addr << 2, svga); if (svga->chain4 || svga->fb_only) { @@ -1517,7 +1463,6 @@ uint8_t svga_read_linear(uint32_t addr, void *p) } if (addr >= svga->vram_limit) return 0xff; - // return svga->vram[svga_mask_addr(addr, svga)]; return svga->vram[addr]; } else if (svga->chain2_read) @@ -1537,8 +1482,6 @@ uint8_t svga_read_linear(uint32_t addr, void *p) if (addr >= svga->vram_limit) return 0xff; - // addr = svga_mask_addr(addr, svga); - svga->la = svga->vram[addr]; svga->lb = svga->vram[addr | 0x1]; svga->lc = svga->vram[addr | 0x2]; @@ -1559,7 +1502,6 @@ uint8_t svga_read_linear(uint32_t addr, void *p) temp4 ^= (svga->colourcompare & 8) ? 0xff : 0; return ~(temp | temp2 | temp3 | temp4); } -//printf("Read %02X %04X %04X\n",vram[addr|svga->readplane],addr,svga->readplane); return svga->vram[addr | readplane]; } @@ -1569,10 +1511,7 @@ void svga_doblit(int y1, int y2, int wx, int wy, svga_t *svga) int x_add = (enable_overscan) ? 16 : 0; uint32_t *p, *q, i, j; -// pclog("svga_doblit start\n"); svga->frames++; -// pclog("doblit %i %i\n", y1, y2); -// pclog("svga_doblit %i %i\n", wx, svga->hdisp); if ((xsize > 2032) || (ysize > 2032)) { @@ -1658,7 +1597,6 @@ void svga_doblit(int y1, int y2, int wx, int wy, svga_t *svga) } video_blit_memtoscreen(32, 0, y1, y2 + y_add, xsize + x_add, ysize + y_add); -// pclog("svga_doblit end\n"); } void svga_writew(uint32_t addr, uint16_t val, void *p) @@ -1734,10 +1672,8 @@ uint16_t svga_readw(uint32_t addr, void *p) cycles -= video_timing_w; cycles_lost += video_timing_w; -// pclog("Readw %05X ", addr); addr = (addr & svga->banked_mask) + svga->read_bank; if ((!svga->extvram) && (addr >= 0x10000)) return 0xffff; -// pclog("%08X %04X\n", addr, *(uint16_t *)&vram[addr]); if (addr >= svga->vram_limit) return 0xffff; return *(uint16_t *)&svga->vram[addr]; @@ -1760,10 +1696,8 @@ uint32_t svga_readl(uint32_t addr, void *p) cycles -= video_timing_l; cycles_lost += video_timing_l; -// pclog("Readl %05X ", addr); addr = (addr & svga->banked_mask) + svga->read_bank; if ((!svga->extvram) && (addr >= 0x10000)) return 0xffffffff; -// pclog("%08X %08X\n", addr, *(uint32_t *)&vram[addr]); if (addr >= svga->vram_limit) return 0xffffffff; return *(uint32_t *)&svga->vram[addr]; @@ -1793,7 +1727,6 @@ void svga_writew_linear(uint32_t addr, uint16_t val, void *p) { addr &= 0x7fffff; } - // if ((!svga->extvram) && (addr >= 0x10000)) return; if (addr >= svga->vram_limit) return; svga->changedvram[addr >> 12] = changeframecount; @@ -1826,7 +1759,6 @@ void svga_writel_linear(uint32_t addr, uint32_t val, void *p) { addr &= 0x7fffff; } - // if ((!svga->extvram) && (addr >= 0x10000)) return; if (addr >= svga->vram_limit) return; svga->changedvram[addr >> 12] = changeframecount; @@ -1852,7 +1784,6 @@ uint16_t svga_readw_linear(uint32_t addr, void *p) { addr &= 0x7fffff; } - // if ((!svga->extvram) && (addr >= 0x10000)) return 0xffff; if (addr >= svga->vram_limit) return 0xffff; return *(uint16_t *)&svga->vram[addr]; @@ -1877,7 +1808,6 @@ uint32_t svga_readl_linear(uint32_t addr, void *p) { addr &= 0x7fffff; } - // if ((!svga->extvram) && (addr >= 0x10000)) return 0xffffffff; if (addr >= svga->vram_limit) return 0xffffffff; return *(uint32_t *)&svga->vram[addr]; diff --git a/src/vid_svga.h b/src/vid_svga.h index dce4278be..f7c05906f 100644 --- a/src/vid_svga.h +++ b/src/vid_svga.h @@ -91,8 +91,9 @@ typedef struct svga_t int ena; int x, y; int xoff, yoff; - int ysize; + int xsize, ysize; uint32_t addr; + uint32_t pitch; int v_acc, h_acc; } hwcursor, hwcursor_latch, overlay, overlay_latch; @@ -112,6 +113,8 @@ typedef struct svga_t void (*overlay_draw)(struct svga_t *svga, int displine); + void (*vblank_start)(struct svga_t *svga); + /*If set then another device is driving the monitor output and the SVGA card should not attempt to display anything */ int override; @@ -157,3 +160,10 @@ void svga_set_override(svga_t *svga, int val); void svga_set_ramdac_type(svga_t *svga, int type); extern uint8_t mask_crtc[0x19]; + +void svga_close(svga_t *svga); + +uint32_t svga_mask_addr(uint32_t addr, svga_t *svga); +uint32_t svga_mask_changedaddr(uint32_t addr, svga_t *svga); + +void svga_doblit(int y1, int y2, int wx, int wy, svga_t *svga); diff --git a/src/vid_svga_render.c b/src/vid_svga_render.c index 56907c4ba..cf6caac68 100644 --- a/src/vid_svga_render.c +++ b/src/vid_svga_render.c @@ -531,8 +531,6 @@ void svga_render_8bpp_lowres(svga_t *svga) p += 8; } } - - // return NULL; } void svga_render_8bpp_highres(svga_t *svga) @@ -570,8 +568,6 @@ void svga_render_8bpp_highres(svga_t *svga) p += 8; } } - - // return NULL; } void svga_render_15bpp_lowres(svga_t *svga) diff --git a/src/vid_tandy.c b/src/vid_tandy.c index 0cc52235d..e9deb6798 100644 --- a/src/vid_tandy.c +++ b/src/vid_tandy.c @@ -22,7 +22,7 @@ typedef struct tandy_t int array_index; uint8_t array[32]; - int memctrl;//=-1; + int memctrl; uint32_t base; uint8_t mode, col; uint8_t stat; @@ -56,7 +56,6 @@ void tandy_out(uint16_t addr, uint8_t val, void *p) { tandy_t *tandy = (tandy_t *)p; uint8_t old; -// pclog("Tandy OUT %04X %02X\n",addr,val); switch (addr) { case 0x3d4: @@ -103,7 +102,6 @@ void tandy_out(uint16_t addr, uint8_t val, void *p) uint8_t tandy_in(uint16_t addr, void *p) { tandy_t *tandy = (tandy_t *)p; -// if (addr!=0x3DA) pclog("Tandy IN %04X\n",addr); switch (addr) { case 0x3d4: @@ -123,28 +121,24 @@ void tandy_recalcaddress(tandy_t *tandy) tandy->vram = &ram[((tandy->memctrl & 0x06) << 14) + tandy->base]; tandy->b8000 = &ram[((tandy->memctrl & 0x30) << 11) + tandy->base]; tandy->b8000_mask = 0x7fff; -// printf("VRAM at %05X B8000 at %05X\n",((tandy->memctrl&0x6)<<14)+tandy->base,((tandy->memctrl&0x30)<<11)+tandy->base); } else { tandy->vram = &ram[((tandy->memctrl & 0x07) << 14) + tandy->base]; tandy->b8000 = &ram[((tandy->memctrl & 0x38) << 11) + tandy->base]; tandy->b8000_mask = 0x3fff; -// printf("VRAM at %05X B8000 at %05X\n",((tandy->memctrl&0x7)<<14)+tandy->base,((tandy->memctrl&0x38)<<11)+tandy->base); } } void tandy_ram_write(uint32_t addr, uint8_t val, void *p) { tandy_t *tandy = (tandy_t *)p; -// pclog("Tandy RAM write %05X %02X %04X:%04X\n",addr,val,CS,pc); ram[tandy->base + (addr & 0x1ffff)] = val; } uint8_t tandy_ram_read(uint32_t addr, void *p) { tandy_t *tandy = (tandy_t *)p; -// pclog("Tandy RAM read %05X %02X %04X:%04X\n",addr,ram[tandy->base + (addr & 0x1ffff)],CS,pc); return ram[tandy->base + (addr & 0x1ffff)]; } @@ -155,7 +149,6 @@ void tandy_write(uint32_t addr, uint8_t val, void *p) return; egawrites++; -// pclog("Tandy VRAM write %05X %02X %04X:%04X %04X:%04X\n",addr,val,CS,pc,DS,SI); tandy->b8000[addr & tandy->b8000_mask] = val; } @@ -166,7 +159,6 @@ uint8_t tandy_read(uint32_t addr, void *p) return 0xff; egareads++; -// pclog("Tandy VRAM read %05X %02X %04X:%04X\n",addr,tandy->b8000[addr&0x7FFF],CS,pc); return tandy->b8000[addr & tandy->b8000_mask]; } @@ -190,28 +182,8 @@ void tandy_recalctimings(tandy_t *tandy) tandy->dispofftime = (int)(_dispofftime * (1 << TIMER_SHIFT)); } - -static int ntsc_col[8][8]= -{ - {0,0,0,0,0,0,0,0}, /*Black*/ - {0,0,1,1,1,1,0,0}, /*Blue*/ - {1,0,0,0,0,1,1,1}, /*Green*/ - {0,0,0,0,1,1,1,1}, /*Cyan*/ - {1,1,1,1,0,0,0,0}, /*Red*/ - {0,1,1,1,1,0,0,0}, /*Magenta*/ - {1,1,0,0,0,0,1,1}, /*Yellow*/ - {1,1,1,1,1,1,1,1} /*White*/ -}; - -/*static int cga4pal[8][4]= -{ - {0,2,4,6},{0,3,5,7},{0,3,4,7},{0,3,4,7}, - {0,10,12,14},{0,11,13,15},{0,11,12,15},{0,11,12,15} -};*/ - void tandy_poll(void *p) { -// int *cgapal=cga4pal[((tandy->col&0x10)>>2)|((cgamode&4)>>1)|((cgacol&0x20)>>5)]; tandy_t *tandy = (tandy_t *)p; uint16_t ca = (tandy->crtc[15] | (tandy->crtc[14] << 8)) & 0x3fff; int drawcursor; @@ -222,14 +194,8 @@ void tandy_poll(void *p) int cols[4]; int col; int oldsc; - int y_buf[8] = {0, 0, 0, 0, 0, 0, 0, 0}, y_val, y_tot; - int i_buf[8] = {0, 0, 0, 0, 0, 0, 0, 0}, i_val, i_tot; - int q_buf[8] = {0, 0, 0, 0, 0, 0, 0, 0}, q_val, q_tot; - int r, g, b; if (!tandy->linepos) { -// cgapal[0]=tandy->col&15; -// printf("Firstline %i Lastline %i tandy->displine %i\n",firstline,lastline,tandy->displine); tandy->vidtime += tandy->dispofftime; tandy->stat |= 1; tandy->linepos = 1; @@ -242,7 +208,6 @@ void tandy_poll(void *p) { tandy->firstline = tandy->displine; video_wait_for_buffer(); -// printf("Firstline %i\n",firstline); } tandy->lastline = tandy->displine; cols[0] = (tandy->array[2] & 0xf) + 16; @@ -267,8 +232,6 @@ void tandy_poll(void *p) else buffer->line[tandy->displine][c + (tandy->crtc[1] << 4) + 8] = (tandy->col & 15) + 16; } } -// printf("X %i %i\n",c+(crtc[1]<<4)+8,c+(crtc[1]<<3)+8); -// printf("Drawing %i %i %i\n",tandy->displine,vc,sc); if ((tandy->array[3] & 0x10) && (tandy->mode & 1)) /*320x200x16*/ { for (x = 0; x < tandy->crtc[1]; x++) @@ -356,7 +319,6 @@ void tandy_poll(void *p) for (c = 0; c < 8; c++) buffer->line[tandy->displine][(x << 3) + c + 8] = cols[(fontdat[chr][tandy->sc & 7] & (1 << (c ^ 7))) ? 1 : 0]; } -// if (!((ma^(crtc[15]|(crtc[14]<<8)))&0x3FFF)) printf("Cursor match! %04X\n",ma); if (drawcursor) { for (c = 0; c < 8; c++) @@ -485,7 +447,6 @@ void tandy_poll(void *p) if (tandy->vc == tandy->crtc[7] && !tandy->sc) { tandy->stat |= 8; -// printf("VSYNC on %i %i\n",vc,sc); } tandy->displine++; if (tandy->displine >= 360) @@ -503,7 +464,6 @@ void tandy_poll(void *p) if (!tandy->vsynctime) { tandy->stat &= ~8; -// printf("VSYNC off %i %i\n",vc,sc); } } if (tandy->sc == (tandy->crtc[11] & 31) || ((tandy->crtc[8] & 3) == 3 && tandy->sc == ((tandy->crtc[11] & 31) >> 1))) @@ -522,24 +482,19 @@ void tandy_poll(void *p) tandy->dispon = 1; tandy->ma = tandy->maback = (tandy->crtc[13] | (tandy->crtc[12] << 8)) & 0x3fff; tandy->sc = 0; -// printf("Display on!\n"); } } else if (tandy->sc == tandy->crtc[9] || ((tandy->crtc[8] & 3) == 3 && tandy->sc == (tandy->crtc[9] >> 1))) { tandy->maback = tandy->ma; -// con=0; -// coff=0; tandy->sc = 0; oldvc = tandy->vc; tandy->vc++; tandy->vc &= 127; -// printf("VC %i %i %i %i %i\n",vc,crtc[4],crtc[6],crtc[7],tandy->dispon); if (tandy->vc == tandy->crtc[6]) tandy->dispon = 0; if (oldvc == tandy->crtc[4]) { -// printf("Display over at %i\n",tandy->displine); tandy->vc = 0; tandy->vadj = tandy->crtc[5]; if (!tandy->vadj) @@ -548,18 +503,14 @@ void tandy_poll(void *p) tandy->ma = tandy->maback = (tandy->crtc[13] | (tandy->crtc[12] << 8)) & 0x3fff; if ((tandy->crtc[10] & 0x60) == 0x20) tandy->cursoron = 0; else tandy->cursoron = tandy->blink & 16; -// printf("CRTC10 %02X %i\n",crtc[10],cursoron); } if (tandy->vc == tandy->crtc[7]) { tandy->dispon = 0; tandy->displine = 0; - tandy->vsynctime = 16;//(crtc[3]>>4)+1; -// printf("tandy->vsynctime %i %02X\n",tandy->vsynctime,crtc[3]); -// tandy->stat|=8; + tandy->vsynctime = 16; if (tandy->crtc[7]) { -// printf("Lastline %i Firstline %i %i %i %i\n",lastline,firstline,lastline-firstline,crtc[1],xsize); if (tandy->mode & 1) x = (tandy->crtc[1] << 3) + 16; else x = (tandy->crtc[1] << 4) + 16; tandy->lastline++; @@ -567,13 +518,10 @@ void tandy_poll(void *p) { xsize = x; ysize = tandy->lastline - tandy->firstline; -// printf("Resize to %i,%i - R1 %i\n",xsize,ysize,crtc[1]); if (xsize < 64) xsize = 656; if (ysize < 32) ysize = 200; updatewindowsize(xsize, (ysize << 1) + 16); } -// printf("Blit %i %i\n",firstline,lastline); -//printf("Xsize is %i\n",xsize); if (tandy->composite) video_blit_memtoscreen(0, tandy->firstline-4, 0, (tandy->lastline - tandy->firstline) + 8, xsize, (tandy->lastline - tandy->firstline) + 8); @@ -685,27 +633,21 @@ device_t tandy_device = static device_config_t tandy_config[] = { { - .name = "display_type", - .description = "Display type", - .type = CONFIG_SELECTION, - .selection = + "display_type", "Display type", CONFIG_SELECTION, "", TANDY_RGB, { { - .description = "RGB", - .value = TANDY_RGB + "RGB", TANDY_RGB }, { - .description = "Composite", - .value = TANDY_COMPOSITE + "Composite", TANDY_COMPOSITE }, { - .description = "" + "" } - }, - .default_int = TANDY_RGB + } }, { - .type = -1 + "", "", -1 } }; diff --git a/src/vid_tandysl.c b/src/vid_tandysl.c index 48d53d496..0ad656aaf 100644 --- a/src/vid_tandysl.c +++ b/src/vid_tandysl.c @@ -22,7 +22,7 @@ typedef struct tandysl_t int array_index; uint8_t array[32]; - int memctrl;//=-1; + int memctrl; uint32_t base; uint8_t mode, col; uint8_t stat; @@ -60,17 +60,14 @@ static void tandysl_out(uint16_t addr, uint8_t val, void *p) { tandysl_t *tandy = (tandysl_t *)p; uint8_t old; -// pclog("TandySL OUT %04X %02X\n",addr,val); switch (addr) { case 0x3d4: tandy->crtcreg = val & 0x1f; return; case 0x3d5: -// pclog("Write CRTC R%02x %02x ",tandy->crtcreg, val); old = tandy->crtc[tandy->crtcreg]; tandy->crtc[tandy->crtcreg] = val & crtcmask[tandy->crtcreg]; -// pclog("now %02x\n", tandy->crtc[tandy->crtcreg]); if (old != val) { if (tandy->crtcreg < 0xe || tandy->crtcreg > 0x10) @@ -101,7 +98,6 @@ static void tandysl_out(uint16_t addr, uint8_t val, void *p) break; case 0x3df: tandy->memctrl = val; -// pclog("tandy 3df write %02x\n", val); tandysl_recalcaddress(tandy); break; case 0x65: @@ -123,7 +119,6 @@ static void tandysl_out(uint16_t addr, uint8_t val, void *p) static uint8_t tandysl_in(uint16_t addr, void *p) { tandysl_t *tandy = (tandysl_t *)p; -// if (addr!=0x3DA) pclog("Tandy IN %04X\n",addr); switch (addr) { case 0x3d4: @@ -133,7 +128,6 @@ static uint8_t tandysl_in(uint16_t addr, void *p) case 0x3da: return tandy->stat; } -// pclog("Bad Tandy IN %04x\n", addr); return 0xFF; } @@ -149,13 +143,11 @@ static void tandysl_recalcaddress(tandysl_t *tandy) { tandy->vram = &ram[((tandy->memctrl & 0x06) << 14) + tandy->base]; tandy->b8000 = &ram[((tandy->memctrl & 0x30) << 11) + tandy->base]; -// printf("VRAM at %05X B8000 at %05X\n",((tandy->memctrl&0x6)<<14)+tandy->base,((tandy->memctrl&0x30)<<11)+tandy->base); } else { tandy->vram = &ram[((tandy->memctrl & 0x07) << 14) + tandy->base]; tandy->b8000 = &ram[((tandy->memctrl & 0x38) << 11) + tandy->base]; -// printf("VRAM at %05X B8000 at %05X\n",((tandy->memctrl&0x7)<<14)+tandy->base,((tandy->memctrl&0x38)<<11)+tandy->base); if ((tandy->memctrl & 0x38) == 0x38) tandy->b8000_limit = 0x4000; } @@ -167,40 +159,32 @@ static void tandysl_recalcmapping(tandysl_t *tandy) io_removehandler(0x03d0, 0x0010, tandysl_in, NULL, NULL, tandysl_out, NULL, NULL, tandy); if (tandy->planar_ctrl & 4) { -// pclog("Enable VRAM mapping\n"); mem_mapping_enable(&tandy->mapping); if (tandy->array[5] & 1) { -// pclog("Tandy mapping at A0000 %p %p\n", tandy_ram_write, tandy_write); mem_mapping_set_addr(&tandy->mapping, 0xa0000, 0x10000); } else { -// pclog("Tandy mapping at B8000\n"); mem_mapping_set_addr(&tandy->mapping, 0xb8000, 0x8000); } -// mem_mapping_enable(&tandy->vram_mapping); io_sethandler(0x03d0, 0x0010, tandysl_in, NULL, NULL, tandysl_out, NULL, NULL, tandy); } else { -// pclog("Disable VRAM mapping\n"); mem_mapping_disable(&tandy->mapping); -// mem_mapping_disable(&tandy->vram_mapping); io_removehandler(0x03d0, 0x0010, tandysl_in, NULL, NULL, tandysl_out, NULL, NULL, tandy); } } static void tandysl_ram_write(uint32_t addr, uint8_t val, void *p) { tandysl_t *tandy = (tandysl_t *)p; -// pclog("Tandy RAM write %05X %02X %04X:%04X %08x\n",addr,val,CS,pc, tandy->base); ram[tandy->base + (addr & 0x1ffff)] = val; } static uint8_t tandysl_ram_read(uint32_t addr, void *p) { tandysl_t *tandy = (tandysl_t *)p; -// if (!nopageerrors) pclog("Tandy RAM read %05X %02X %04X:%04X\n",addr,ram[tandy->base + (addr & 0x1ffff)],CS,pc); return ram[tandy->base + (addr & 0x1ffff)]; } @@ -211,7 +195,6 @@ static void tandysl_write(uint32_t addr, uint8_t val, void *p) return; egawrites++; -// pclog("Tandy VRAM write %05X %02X %04X:%04X %02x %x\n",addr,val,CS,pc,tandy->array[5], (uintptr_t)&tandy->b8000[addr & 0xffff] - (uintptr_t)ram); if (tandy->array[5] & 1) tandy->b8000[addr & 0xffff] = val; else @@ -229,7 +212,6 @@ static uint8_t tandysl_read(uint32_t addr, void *p) return 0xff; egareads++; -// if (!nopageerrors) pclog("Tandy VRAM read %05X %02X %04X:%04X\n",addr,tandy->b8000[addr&0x7FFF],CS,pc); if (tandy->array[5] & 1) return tandy->b8000[addr & 0xffff]; if ((addr & 0x7fff) >= tandy->b8000_limit) @@ -273,9 +255,6 @@ static void tandysl_poll(void *p) if (!tandy->linepos) { -// pclog("tandy_poll vc=%i sc=%i dispon=%i\n", tandy->vc, tandy->sc, tandy->dispon); -// cgapal[0]=tandy->col&15; -// printf("Firstline %i Lastline %i tandy->displine %i\n",firstline,lastline,tandy->displine); tandy->vidtime += tandy->dispofftime; tandy->stat |= 1; tandy->linepos = 1; @@ -288,7 +267,6 @@ static void tandysl_poll(void *p) { tandy->firstline = tandy->displine; video_wait_for_buffer(); -// printf("Firstline %i\n",firstline); } tandy->lastline = tandy->displine; cols[0] = (tandy->array[2] & 0xf) + 16; @@ -413,7 +391,6 @@ static void tandysl_poll(void *p) for (c = 0; c < 8; c++) buffer->line[tandy->displine][(x << 3) + c + 8] = cols[(fontdat[chr][tandy->sc & 7] & (1 << (c ^ 7))) ? 1 : 0]; } -// if (!((ma^(crtc[15]|(crtc[14]<<8)))&0x3FFF)) printf("Cursor match! %04X\n",ma); if (drawcursor) { for (c = 0; c < 8; c++) @@ -533,7 +510,6 @@ static void tandysl_poll(void *p) if (tandy->vc == tandy->crtc[7] && !tandy->sc) { tandy->stat |= 8; -// printf("VSYNC on %i %i\n",vc,sc); } tandy->displine++; if (tandy->displine >= 360) @@ -551,7 +527,6 @@ static void tandysl_poll(void *p) if (!tandy->vsynctime) { tandy->stat &= ~8; -// printf("VSYNC off %i %i\n",vc,sc); } } if (tandy->sc == (tandy->crtc[11] & 31) || ((tandy->crtc[8] & 3) == 3 && tandy->sc == ((tandy->crtc[11] & 31) >> 1))) @@ -573,28 +548,21 @@ static void tandysl_poll(void *p) else tandy->ma = tandy->maback = (tandy->crtc[13] | (tandy->crtc[12] << 8)) & 0x3fff; tandy->sc = 0; -// printf("Display on!\n"); } } else if (tandy->sc == tandy->crtc[9] || ((tandy->crtc[8] & 3) == 3 && tandy->sc == (tandy->crtc[9] >> 1))) { tandy->maback = tandy->ma; -// con=0; -// coff=0; tandy->sc = 0; oldvc = tandy->vc; tandy->vc++; tandy->vc &= 255; -// printf("VC %i %i %i %i %i\n",vc,crtc[4],crtc[6],crtc[7],tandy->dispon); if (tandy->vc == tandy->crtc[6]) { -// pclog("Display off\n"); tandy->dispon = 0; } if (oldvc == tandy->crtc[4]) { -// pclog("Display over\n"); -// printf("Display over at %i\n",tandy->displine); tandy->vc = 0; tandy->vadj = tandy->crtc[5]; if (!tandy->vadj) @@ -608,18 +576,14 @@ static void tandysl_poll(void *p) } if ((tandy->crtc[10] & 0x60) == 0x20) tandy->cursoron = 0; else tandy->cursoron = tandy->blink & 16; -// printf("CRTC10 %02X %i\n",crtc[10],cursoron); } if (tandy->vc == tandy->crtc[7]) { tandy->dispon = 0; tandy->displine = 0; - tandy->vsynctime = 16;//(crtc[3]>>4)+1; -// printf("tandy->vsynctime %i %02X\n",tandy->vsynctime,crtc[3]); -// tandy->stat|=8; + tandy->vsynctime = 16; if (tandy->crtc[7]) { -// printf("Lastline %i Firstline %i %i %i %i\n",lastline,firstline,lastline-firstline,crtc[1],xsize); if (tandy->mode & 1) x = (tandy->crtc[1] << 3) + 16; else x = (tandy->crtc[1] << 4) + 16; tandy->lastline++; @@ -627,13 +591,10 @@ static void tandysl_poll(void *p) { xsize = x; ysize = tandy->lastline - tandy->firstline; -// printf("Resize to %i,%i - R1 %i\n",xsize,ysize,crtc[1]); if (xsize < 64) xsize = 656; if (ysize < 32) ysize = 200; updatewindowsize(xsize, (ysize << 1) + 16); } -// printf("Blit %i %i\n",firstline,lastline); -//printf("Xsize is %i\n",xsize); video_blit_memtoscreen_8(0, tandy->firstline-4, xsize, (tandy->lastline - tandy->firstline) + 8); @@ -690,7 +651,6 @@ static void tandysl_poll(void *p) static void *tandysl_init() { - int c; tandysl_t *tandy = malloc(sizeof(tandysl_t)); memset(tandy, 0, sizeof(tandysl_t)); diff --git a/src/vid_tgui9440.c b/src/vid_tgui9440.c index d6ce6ad8b..f369c8370 100644 --- a/src/vid_tgui9440.c +++ b/src/vid_tgui9440.c @@ -7,6 +7,7 @@ #include "device.h" #include "io.h" #include "mem.h" +#include "pci.h" #include "rom.h" #include "thread.h" #include "video.h" @@ -120,7 +121,6 @@ void tgui_out(uint16_t addr, uint8_t val, void *p) uint8_t old; -// pclog("tgui_out : %04X %02X %04X:%04X %i\n", addr, val, CS,pc, svga->bpp); if (((addr&0xFFF0) == 0x3D0 || (addr&0xFFF0) == 0x3B0) && !(svga->miscout & 1)) addr ^= 0x60; switch (addr) @@ -211,7 +211,6 @@ void tgui_out(uint16_t addr, uint8_t val, void *p) val = (svga->crtc[7] & ~0x10) | (val & 0x10); old = svga->crtc[svga->crtcreg]; svga->crtc[svga->crtcreg] = val; -// if (svga->crtcreg != 0xE && svga->crtcreg != 0xF) pclog("CRTC R%02X = %02X\n", svga->crtcreg, val); if (old != val) { if (svga->crtcreg < 0xE || svga->crtcreg > 0x10) @@ -253,11 +252,9 @@ void tgui_out(uint16_t addr, uint8_t val, void *p) if (svga->gdcreg[0xf] & 4) { svga->write_bank = (val & 0x1f) * 65536; -// pclog("SVGAWBANK 3D8 %08X %04X:%04X\n",svgawbank,CS,pc); if (!(svga->gdcreg[0xf] & 1)) { svga->read_bank = (val & 0x1f) * 65536; -// pclog("SVGARBANK 3D8 %08X %04X:%04X\n",svgarbank,CS,pc); } } return; @@ -266,7 +263,6 @@ void tgui_out(uint16_t addr, uint8_t val, void *p) if ((svga->gdcreg[0xf] & 5) == 5) { svga->read_bank = (val & 0x1F) * 65536; -// pclog("SVGARBANK 3D9 %08X %04X:%04X\n",svgarbank,CS,pc); } return; @@ -287,8 +283,6 @@ uint8_t tgui_in(uint16_t addr, void *p) tgui_t *tgui = (tgui_t *)p; svga_t *svga = &tgui->svga; -// if (addr != 0x3da) pclog("tgui_in : %04X %04X:%04X\n", addr, CS,pc); - if (((addr&0xFFF0) == 0x3D0 || (addr&0xFFF0) == 0x3B0) && !(svga->miscout & 1)) addr ^= 0x60; switch (addr) @@ -296,15 +290,9 @@ uint8_t tgui_in(uint16_t addr, void *p) case 0x3C5: if ((svga->seqaddr & 0xf) == 0xb) { -// printf("Read Trident ID %04X:%04X %04X\n",CS,pc,readmemw(ss,SP)); tgui->oldmode = 0; return 0xe3; /*TGUI9440AGi*/ } - if ((svga->seqaddr & 0xf) == 0xc) - { -// printf("Read Trident Power Up 1 %04X:%04X %04X\n",CS,pc,readmemw(ss,SP)); -// return 0x20; /*2 DRAM banks*/ - } if ((svga->seqaddr & 0xf) == 0xd) { if (tgui->oldmode) return tgui->oldctrl2; @@ -355,10 +343,8 @@ void tgui_recalctimings(svga_t *svga) svga->lowres = !(svga->crtc[0x2a] & 0x40); - // svga->interlace = svga->crtc[0x1e] & 4; if (svga->crtc[0x1e] & 4) { - // svga->rowoffset >>= 1; svga->vtotal *= 2; svga->dispend *= 2; svga->vblankstart *= 2; @@ -397,20 +383,16 @@ void tgui_recalctimings(svga_t *svga) void tgui_recalcmapping(tgui_t *tgui) { svga_t *svga = &tgui->svga; - -// pclog("tgui_recalcmapping : %02X %02X\n", svga->crtc[0x21], svga->gdcreg[6]); if (svga->crtc[0x21] & 0x20) { mem_mapping_disable(&svga->mapping); mem_mapping_set_addr(&tgui->linear_mapping, tgui->linear_base, tgui->linear_size); svga->linear_base = tgui->linear_base; -// pclog("Trident linear framebuffer at %08X - size %06X\n", tgui->linear_base, tgui->linear_size); mem_mapping_enable(&tgui->accel_mapping); } else { -// pclog("Write mapping %02X\n", val); mem_mapping_disable(&tgui->linear_mapping); mem_mapping_disable(&tgui->accel_mapping); switch (svga->gdcreg[6] & 0xC) @@ -454,7 +436,6 @@ void tgui_hwcursor_draw(svga_t *svga, int displine) ((uint32_t *)buffer32->line[displine + y_add])[offset + 32 + x_add] = (dat[1] & 0x80000000) ? 0xffffff : 0; else if (dat[1] & 0x80000000) ((uint32_t *)buffer32->line[displine + y_add])[offset + 32 + x_add] ^= 0xffffff; -// pclog("Plot %i, %i (%i %i) %04X %04X\n", offset, displine, x+xx, svga_hwcursor_on, dat[0], dat[1]); } offset++; @@ -467,9 +448,6 @@ void tgui_hwcursor_draw(svga_t *svga, int displine) uint8_t tgui_pci_read(int func, int addr, void *p) { tgui_t *tgui = (tgui_t *)p; - svga_t *svga = &tgui->svga; - -// pclog("Trident PCI read %08X\n", addr); switch (addr) { @@ -507,8 +485,6 @@ void tgui_pci_write(int func, int addr, uint8_t val, void *p) tgui_t *tgui = (tgui_t *)p; svga_t *svga = &tgui->svga; -// pclog("Trident PCI write %08X %02X\n", addr, val); - switch (addr) { case 0x12: @@ -569,6 +545,10 @@ void tgui_close(void *p) svga_close(&tgui->svga); + thread_kill(tgui->fifo_thread); + thread_destroy_event(tgui->wake_fifo_thread); + thread_destroy_event(tgui->fifo_not_full_event); + free(tgui); } @@ -658,7 +638,6 @@ void tgui_accel_command(int count, uint32_t cpu_dat, tgui_t *tgui) } if (tgui->accel.flags & TGUI_SOLIDFILL) { -// pclog("SOLIDFILL\n"); for (y = 0; y < 8; y++) { for (x = 0; x < 8; x++) @@ -669,7 +648,6 @@ void tgui_accel_command(int count, uint32_t cpu_dat, tgui_t *tgui) } else if (tgui->accel.flags & TGUI_PATMONO) { -// pclog("PATMONO\n"); for (y = 0; y < 8; y++) { for (x = 0; x < 8; x++) @@ -682,7 +660,6 @@ void tgui_accel_command(int count, uint32_t cpu_dat, tgui_t *tgui) { if (tgui->accel.bpp == 0) { -// pclog("OTHER 8-bit\n"); for (y = 0; y < 8; y++) { for (x = 0; x < 8; x++) @@ -693,7 +670,6 @@ void tgui_accel_command(int count, uint32_t cpu_dat, tgui_t *tgui) } else { -// pclog("OTHER 16-bit\n"); for (y = 0; y < 8; y++) { for (x = 0; x < 8; x++) @@ -703,15 +679,9 @@ void tgui_accel_command(int count, uint32_t cpu_dat, tgui_t *tgui) } } } -/* for (y = 0; y < 8; y++) - { - if (count == -1) pclog("Pattern %i : %02X %02X %02X %02X %02X %02X %02X %02X\n", y, tgui->accel.tgui_pattern[y][0], tgui->accel.tgui_pattern[y][1], tgui->accel.tgui_pattern[y][2], tgui->accel.tgui_pattern[y][3], tgui->accel.tgui_pattern[y][4], tgui->accel.tgui_pattern[y][5], tgui->accel.tgui_pattern[y][6], tgui->accel.tgui_pattern[y][7]); - }*/ -// if (count == -1) pclog("Command %i %i %p\n", tgui->accel.command, TGUI_BITBLT, tgui); switch (tgui->accel.command) { case TGUI_BITBLT: -// if (count == -1) pclog("BITBLT src %i,%i dst %i,%i size %i,%i flags %04X\n", tgui->accel.src_x, tgui->accel.src_y, tgui->accel.dst_x, tgui->accel.dst_y, tgui->accel.size_x, tgui->accel.size_y, tgui->accel.flags); if (count == -1) { tgui->accel.src = tgui->accel.src_old = tgui->accel.src_x + (tgui->accel.src_y * tgui->accel.pitch); @@ -725,7 +695,6 @@ void tgui_accel_command(int count, uint32_t cpu_dat, tgui_t *tgui) case TGUI_SRCCPU: if (count == -1) { -// pclog("Blit start TGUI_SRCCPU\n"); if (svga->crtc[0x21] & 0x20) mem_mapping_set_handler(&tgui->linear_mapping, svga_read_linear, svga_readw_linear, svga_readl_linear, tgui_accel_write_fb_b, tgui_accel_write_fb_w, tgui_accel_write_fb_l); @@ -734,7 +703,6 @@ void tgui_accel_command(int count, uint32_t cpu_dat, tgui_t *tgui) } else count >>= 3; -// pclog("TGUI_SRCCPU\n"); while (count) { if (tgui->accel.bpp == 0) @@ -758,8 +726,6 @@ void tgui_accel_command(int count, uint32_t cpu_dat, tgui_t *tgui) WRITE(tgui->accel.dst, out); } -// pclog(" %i,%i %02X %02X %02X %02X\n", tgui->accel.x, tgui->accel.y, src_dat,dst_dat,pat_dat, out); - tgui->accel.src += xdir; tgui->accel.dst += xdir; tgui->accel.pat_x += xdir; @@ -780,7 +746,6 @@ void tgui_accel_command(int count, uint32_t cpu_dat, tgui_t *tgui) { if (svga->crtc[0x21] & 0x20) { -// pclog("Blit end\n"); mem_mapping_set_handler(&tgui->linear_mapping, svga_read_linear, svga_readw_linear, svga_readl_linear, svga_write_linear, svga_writew_linear, svga_writel_linear); } return; @@ -795,15 +760,12 @@ void tgui_accel_command(int count, uint32_t cpu_dat, tgui_t *tgui) case TGUI_SRCMONO | TGUI_SRCCPU: if (count == -1) { -// pclog("Blit start TGUI_SRCMONO | TGUI_SRCCPU\n"); if (svga->crtc[0x21] & 0x20) mem_mapping_set_handler(&tgui->linear_mapping, svga_read_linear, svga_readw_linear, svga_readl_linear, tgui_accel_write_fb_b, tgui_accel_write_fb_w, tgui_accel_write_fb_l); -// pclog(" %i\n", tgui->accel.command); if (tgui->accel.use_src) return; } -// pclog("TGUI_SRCMONO | TGUI_SRCCPU\n"); while (count) { src_dat = ((cpu_dat >> 31) ? tgui->accel.fg_col : tgui->accel.bg_col); @@ -819,7 +781,6 @@ void tgui_accel_command(int count, uint32_t cpu_dat, tgui_t *tgui) WRITE(tgui->accel.dst, out); } -// pclog(" %i,%i %02X %02X %02X %02X %i\n", tgui->accel.x, tgui->accel.y, src_dat,dst_dat,pat_dat, out, (!(tgui->accel.flags & TGUI_TRANSENA) || src_dat != trans_col)); cpu_dat <<= 1; tgui->accel.src += xdir; tgui->accel.dst += xdir; @@ -841,7 +802,6 @@ void tgui_accel_command(int count, uint32_t cpu_dat, tgui_t *tgui) { if (svga->crtc[0x21] & 0x20) { -// pclog("Blit end\n"); mem_mapping_set_handler(&tgui->linear_mapping, svga_read_linear, svga_readw_linear, svga_readl_linear, svga_write_linear, svga_writew_linear, svga_writel_linear); } return; @@ -866,7 +826,6 @@ void tgui_accel_command(int count, uint32_t cpu_dat, tgui_t *tgui) WRITE(tgui->accel.dst, out); } -// pclog(" %i,%i %02X %02X %02X %02X\n", tgui->accel.x, tgui->accel.y, src_dat,dst_dat,pat_dat, out); tgui->accel.src += xdir; tgui->accel.dst += xdir; @@ -914,7 +873,6 @@ static void tgui_accel_write_fifo(tgui_t *tgui, uint32_t addr, uint8_t val) case 0x27: /*ROP*/ tgui->accel.rop = val; tgui->accel.use_src = (val & 0x33) ^ ((val >> 2) & 0x33); -// pclog("Write ROP %02X %i\n", val, tgui->accel.use_src); break; case 0x28: /*Flags*/ @@ -1034,6 +992,9 @@ static void tgui_accel_write_fifo_fb_l(tgui_t *tgui, uint32_t addr, uint32_t val static void fifo_thread(void *param) { tgui_t *tgui = (tgui_t *)param; + uint64_t start_time; + uint64_t end_time; + fifo_entry_t *fifo; while (1) { @@ -1043,10 +1004,8 @@ static void fifo_thread(void *param) tgui->blitter_busy = 1; while (!FIFO_EMPTY) { - uint64_t start_time = timer_read(); - uint64_t end_time; - fifo_entry_t *fifo = &tgui->fifo[tgui->fifo_read_idx & FIFO_MASK]; - uint32_t val = fifo->val; + start_time = timer_read(); + fifo = &tgui->fifo[tgui->fifo_read_idx & FIFO_MASK]; switch (fifo->addr_type & FIFO_TYPE) { @@ -1077,7 +1036,7 @@ static void fifo_thread(void *param) } } -static inline void wake_fifo_thread(tgui_t *tgui) +static __inline void wake_fifo_thread(tgui_t *tgui) { thread_set_event(tgui->wake_fifo_thread); /*Wake up FIFO thread if moving from idle*/ } @@ -1094,7 +1053,6 @@ static void tgui_wait_fifo_idle(tgui_t *tgui) static void tgui_queue(tgui_t *tgui, uint32_t addr, uint32_t val, uint32_t type) { fifo_entry_t *fifo = &tgui->fifo[tgui->fifo_write_idx & FIFO_MASK]; - int c; if (FIFO_FULL) { @@ -1118,7 +1076,6 @@ static void tgui_queue(tgui_t *tgui, uint32_t addr, uint32_t val, uint32_t type) void tgui_accel_write(uint32_t addr, uint8_t val, void *p) { tgui_t *tgui = (tgui_t *)p; -// pclog("tgui_accel_write : %08X %02X %04X(%08X):%08X %02X\n", addr, val, CS,cs,pc, opcode); if ((addr & ~0xff) != 0xbff00) return; tgui_queue(tgui, addr, val, FIFO_WRITE_BYTE); @@ -1127,7 +1084,6 @@ void tgui_accel_write(uint32_t addr, uint8_t val, void *p) void tgui_accel_write_w(uint32_t addr, uint16_t val, void *p) { tgui_t *tgui = (tgui_t *)p; -// pclog("tgui_accel_write_w %08X %04X\n", addr, val); tgui_accel_write(addr, val, tgui); tgui_accel_write(addr + 1, val >> 8, tgui); } @@ -1135,7 +1091,6 @@ void tgui_accel_write_w(uint32_t addr, uint16_t val, void *p) void tgui_accel_write_l(uint32_t addr, uint32_t val, void *p) { tgui_t *tgui = (tgui_t *)p; -// pclog("tgui_accel_write_l %08X %08X\n", addr, val); tgui_accel_write(addr, val, tgui); tgui_accel_write(addr + 1, val >> 8, tgui); tgui_accel_write(addr + 2, val >> 16, tgui); @@ -1145,7 +1100,6 @@ void tgui_accel_write_l(uint32_t addr, uint32_t val, void *p) uint8_t tgui_accel_read(uint32_t addr, void *p) { tgui_t *tgui = (tgui_t *)p; -// pclog("tgui_accel_read : %08X\n", addr); if ((addr & ~0xff) != 0xbff00) return 0xff; if ((addr & 0xff) != 0x20) @@ -1245,14 +1199,12 @@ uint8_t tgui_accel_read(uint32_t addr, void *p) uint16_t tgui_accel_read_w(uint32_t addr, void *p) { tgui_t *tgui = (tgui_t *)p; -// pclog("tgui_accel_read_w %08X\n", addr); return tgui_accel_read(addr, tgui) | (tgui_accel_read(addr + 1, tgui) << 8); } uint32_t tgui_accel_read_l(uint32_t addr, void *p) { tgui_t *tgui = (tgui_t *)p; -// pclog("tgui_accel_read_l %08X\n", addr); return tgui_accel_read_w(addr, tgui) | (tgui_accel_read_w(addr + 2, tgui) << 16); } @@ -1260,7 +1212,6 @@ void tgui_accel_write_fb_b(uint32_t addr, uint8_t val, void *p) { svga_t *svga = (svga_t *)p; tgui_t *tgui = (tgui_t *)svga->p; -// pclog("tgui_accel_write_fb_b %08X %02X\n", addr, val); tgui_queue(tgui, addr, val, FIFO_WRITE_FB_BYTE); } @@ -1268,7 +1219,6 @@ void tgui_accel_write_fb_w(uint32_t addr, uint16_t val, void *p) { svga_t *svga = (svga_t *)p; tgui_t *tgui = (tgui_t *)svga->p; -// pclog("tgui_accel_write_fb_w %08X %04X\n", addr, val); tgui_queue(tgui, addr, val, FIFO_WRITE_FB_WORD); } @@ -1276,7 +1226,6 @@ void tgui_accel_write_fb_l(uint32_t addr, uint32_t val, void *p) { svga_t *svga = (svga_t *)p; tgui_t *tgui = (tgui_t *)svga->p; -// pclog("tgui_accel_write_fb_l %08X %08X\n", addr, val); tgui_queue(tgui, addr, val, FIFO_WRITE_FB_LONG); } @@ -1299,27 +1248,21 @@ void tgui_add_status_info(char *s, int max_len, void *p) static device_config_t tgui9440_config[] = { { - .name = "memory", - .description = "Memory size", - .type = CONFIG_SELECTION, - .selection = + "memory", "Memory size", CONFIG_SELECTION, "", 2, { { - .description = "1 MB", - .value = 1 + "1 MB", 1 }, { - .description = "2 MB", - .value = 2 + "2 MB", 2 }, { - .description = "" + "" } - }, - .default_int = 2 + } }, { - .type = -1 + "", "", -1 } }; diff --git a/src/vid_tkd8001_ramdac.c b/src/vid_tkd8001_ramdac.c index de75edaaa..3d22d987c 100644 --- a/src/vid_tkd8001_ramdac.c +++ b/src/vid_tkd8001_ramdac.c @@ -8,12 +8,8 @@ #include "vid_svga.h" #include "vid_tkd8001_ramdac.h" -static int tkd8001_state=0; -static uint8_t tkd8001_ctrl; - void tkd8001_ramdac_out(uint16_t addr, uint8_t val, tkd8001_ramdac_t *ramdac, svga_t *svga) { -// pclog("OUT RAMDAC %04X %02X %04X:%04X\n",addr,val,CS,pc); switch (addr) { case 0x3C6: @@ -38,7 +34,6 @@ void tkd8001_ramdac_out(uint16_t addr, uint8_t val, tkd8001_ramdac_t *ramdac, sv } return; } - // tkd8001_state = 0; break; case 0x3C7: case 0x3C8: case 0x3C9: ramdac->state = 0; @@ -49,13 +44,11 @@ void tkd8001_ramdac_out(uint16_t addr, uint8_t val, tkd8001_ramdac_t *ramdac, sv uint8_t tkd8001_ramdac_in(uint16_t addr, tkd8001_ramdac_t *ramdac, svga_t *svga) { -// pclog("IN RAMDAC %04X %04X:%04X\n",addr,CS,pc); switch (addr) { case 0x3C6: if (ramdac->state == 4) { - //tkd8001_state = 0; return ramdac->ctrl; } ramdac->state++; diff --git a/src/vid_tvga.c b/src/vid_tvga.c index f5fa8f4bb..3e70422cb 100644 --- a/src/vid_tvga.c +++ b/src/vid_tvga.c @@ -53,7 +53,6 @@ void tvga_out(uint16_t addr, uint8_t val, void *p) uint8_t old; -// pclog("tvga_out : %04X %02X %04X:%04X %i\n", addr, val, CS,pc, svga->bpp); if (((addr&0xFFF0) == 0x3D0 || (addr&0xFFF0) == 0x3B0) && !(svga->miscout & 1)) addr ^= 0x60; switch (addr) @@ -119,7 +118,6 @@ void tvga_out(uint16_t addr, uint8_t val, void *p) old = svga->crtc[svga->crtcreg]; val &= crtc_mask[svga->crtcreg]; svga->crtc[svga->crtcreg] = val; -// if (svga->crtcreg != 0xC && svga->crtcreg != 0xE && svga->crtcreg != 0xF) pclog("CRTC R%02X = %02X %04X:%04X\n", svga->crtcreg, val, CS, pc); if (old != val) { if (svga->crtcreg < 0xE || svga->crtcreg > 0x10) @@ -158,8 +156,6 @@ uint8_t tvga_in(uint16_t addr, void *p) tvga_t *tvga = (tvga_t *)p; svga_t *svga = &tvga->svga; -// if (addr != 0x3da) pclog("tvga_in : %04X %04X:%04X\n", addr, CS,pc); - if (((addr&0xFFF0) == 0x3D0 || (addr&0xFFF0) == 0x3B0) && !(svga->miscout & 1)) addr ^= 0x60; switch (addr) @@ -167,15 +163,9 @@ uint8_t tvga_in(uint16_t addr, void *p) case 0x3C5: if ((svga->seqaddr & 0xf) == 0xb) { -// printf("Read Trident ID %04X:%04X %04X\n",CS,pc,readmemw(ss,SP)); tvga->oldmode = 0; return 0x33; /*TVGA8900D*/ } - if ((svga->seqaddr & 0xf) == 0xc) - { -// printf("Read Trident Power Up 1 %04X:%04X %04X\n",CS,pc,readmemw(ss,SP)); -// return 0x20; /*2 DRAM banks*/ - } if ((svga->seqaddr & 0xf) == 0xd) { if (tvga->oldmode) return tvga->oldctrl2; @@ -213,8 +203,6 @@ static void tvga_recalcbanking(tvga_t *tvga) svga->read_bank = (tvga->tvga_3d9 & 0x1f) * 65536; else svga->read_bank = svga->write_bank; - -// pclog("recalcbanking: write_bank=%08x read_bank=%08x GDC[E]=%02x GDC[F]=%02x SEQ[E]=%02x 3d8=%02x 3d9=%02x\n", svga->read_bank, svga->write_bank, svga->gdcreg[0xe], svga->gdcreg[0xf], svga->seqregs[0xe], tvga->tvga_3d8, tvga->tvga_3d9); } void tvga_recalctimings(svga_t *svga) @@ -245,7 +233,6 @@ void tvga_recalctimings(svga_t *svga) svga->hdisp_time *= 2; } - // svga->interlace = svga->crtc[0x1e] & 4; if (svga->crtc[0x1e] & 4) { svga->rowoffset >>= 1; @@ -349,32 +336,25 @@ void tvga_add_status_info(char *s, int max_len, void *p) static device_config_t tvga_config[] = { { - .name = "memory", - .description = "Memory size", - .type = CONFIG_SELECTION, - .selection = + "memory", "Memory size", CONFIG_SELECTION, "", 1024, { { - .description = "256 kB", - .value = 256 + "256 kB", 256 }, { - .description = "512 kB", - .value = 512 + "512 kB", 512 }, { - .description = "1 MB", - .value = 1024 + "1 MB", 1024 }, /*Chip supports 2mb, but drivers are buggy*/ { - .description = "" + "" } - }, - .default_int = 1024 + } }, { - .type = -1 + "", "", -1 } }; diff --git a/src/vid_unk_ramdac.c b/src/vid_unk_ramdac.c index cc57b3bb5..0b6fc6aea 100644 --- a/src/vid_unk_ramdac.c +++ b/src/vid_unk_ramdac.c @@ -13,7 +13,6 @@ void unk_ramdac_out(uint16_t addr, uint8_t val, unk_ramdac_t *ramdac, svga_t *svga) { - // pclog("OUT RAMDAC %04X %02X\n",addr,val); int oldbpp = 0; switch (addr) { @@ -63,7 +62,6 @@ void unk_ramdac_out(uint16_t addr, uint8_t val, unk_ramdac_t *ramdac, svga_t *sv { svga_recalctimings(svga); } - // pclog("unk_ramdac: set to %02X (b5 = %i) [%02X], %i bpp\n", (val&1)|((val&0xC0)>>5), val & 0x20 ? 1 : 0, val, svga->bpp); return; } ramdac->state = 0; @@ -77,7 +75,6 @@ void unk_ramdac_out(uint16_t addr, uint8_t val, unk_ramdac_t *ramdac, svga_t *sv uint8_t unk_ramdac_in(uint16_t addr, unk_ramdac_t *ramdac, svga_t *svga) { - // pclog("IN RAMDAC %04X\n",addr); switch (addr) { case 0x3C6: diff --git a/src/vid_vga.c b/src/vid_vga.c index da010a595..f5ff18ed6 100644 --- a/src/vid_vga.c +++ b/src/vid_vga.c @@ -24,9 +24,7 @@ void vga_out(uint16_t addr, uint8_t val, void *p) vga_t *vga = (vga_t *)p; svga_t *svga = &vga->svga; uint8_t old; - -// pclog("vga_out : %04X %02X %04X:%04X %02X %i\n", addr, val, CS,pc, ram[0x489], ins); - + if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(svga->miscout & 1)) addr ^= 0x60; @@ -63,8 +61,6 @@ uint8_t vga_in(uint16_t addr, void *p) svga_t *svga = &vga->svga; uint8_t temp; -// if (addr != 0x3da) pclog("vga_in : %04X ", addr); - if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(svga->miscout & 1)) addr ^= 0x60; @@ -80,7 +76,6 @@ uint8_t vga_in(uint16_t addr, void *p) temp = svga_in(addr, svga); break; } -// if (addr != 0x3da) pclog("%02X %04X:%04X\n", temp, CS,pc); return temp; } @@ -128,6 +123,7 @@ void *vga_chips_init() } #endif +#ifdef DEV_BRANCH void *trigem_unk_init() { vga_t *vga = malloc(sizeof(vga_t)); @@ -152,6 +148,7 @@ void *trigem_unk_init() return vga; } +#endif /*PS/1 uses a standard VGA controller, but with no option ROM*/ void *ps1vga_init() @@ -178,10 +175,10 @@ static int vga_available() return rom_present("roms/ibm_vga.bin"); } -static int vga_chips_available() +/* static int vga_chips_available() { return rom_present("roms/SD620.04M"); -} +} */ void vga_close(void *p) { @@ -235,6 +232,7 @@ device_t vga_device = vga_force_redraw, vga_add_status_info }; */ +#ifdef DEV_BRANCH device_t trigem_unk_device = { "VGA", @@ -246,6 +244,7 @@ device_t trigem_unk_device = vga_force_redraw, vga_add_status_info }; +#endif device_t ps1vga_device = { "PS/1 VGA", diff --git a/src/vid_vga.h b/src/vid_vga.h index 1f8fbe700..5ee66fc0b 100644 --- a/src/vid_vga.h +++ b/src/vid_vga.h @@ -2,6 +2,5 @@ see COPYING for more details */ extern device_t vga_device; -// extern device_t vga_chips_device; extern device_t trigem_unk_device; extern device_t ps1vga_device; diff --git a/src/vid_voodoo.c b/src/vid_voodoo.c index 98b21e7c7..a1a5e93e7 100644 --- a/src/vid_voodoo.c +++ b/src/vid_voodoo.c @@ -380,9 +380,9 @@ typedef struct voodoo_t int wake_timer; - uint8_t thefilter[256][256]; // pixel filter, feeding from one or two - uint8_t thefilterg[256][256]; // for green - uint8_t thefilterb[256][256]; // for blue + uint8_t thefilter[256][256]; /* pixel filter, feeding from one or two */ + uint8_t thefilterg[256][256]; /* for green */ + uint8_t thefilterb[256][256]; /* for blue */ /* the voodoo adds purple lines for some reason */ uint16_t purpleline[256][3]; @@ -398,7 +398,7 @@ typedef struct voodoo_t void *codegen_data; } voodoo_t; -static inline void wait_for_render_thread_idle(voodoo_t *voodoo); +static __inline void wait_for_render_thread_idle(voodoo_t *voodoo); enum { @@ -549,6 +549,7 @@ enum SST_fbiInit4 = 0x200, + SST_vRetrace = 0x204, SST_backPorch = 0x208, SST_videoDimensions = 0x20c, SST_fbiInit0 = 0x210, @@ -710,7 +711,7 @@ enum SST_remap_fdAdY = 0x00d8 | 0x400, SST_remap_fdSdY = 0x00e4 | 0x400, SST_remap_fdTdY = 0x00f0 | 0x400, - SST_remap_fdWdY = 0x00fc | 0x400, + SST_remap_fdWdY = 0x00fc | 0x400 }; enum @@ -1238,7 +1239,6 @@ static void use_texture(voodoo_t *voodoo, voodoo_params_t *params, int tmu) lod_min = (params->tLOD[tmu] >> 2) & 15; lod_max = (params->tLOD[tmu] >> 8) & 15; -// pclog(" add new texture to %i tformat=%i %08x LOD=%i-%i\n", c, voodoo->params.tformat[tmu], params->texBaseAddr[tmu], lod_min, lod_max); for (lod = lod_min; lod <= lod_max; lod++) { @@ -1247,10 +1247,7 @@ static void use_texture(voodoo_t *voodoo, voodoo_params_t *params, int tmu) int x, y; int shift = 8 - params->tex_lod[tmu][lod]; rgba_u *pal; - - //pclog(" LOD %i : %08x - %08x %i %i,%i\n", lod, params->tex_base[tmu][lod] & voodoo->texture_mask, addr, voodoo->params.tformat[tmu], voodoo->params.tex_w_mask[tmu][lod],voodoo->params.tex_h_mask[tmu][lod]); - switch (params->tformat[tmu]) { case TEX_RGB332: @@ -1488,7 +1485,6 @@ static void flush_texture_cache(voodoo_t *voodoo, uint32_t dirty_addr, int tmu) int c; memset(voodoo->texture_present[tmu], 0, sizeof(voodoo->texture_present[0])); -// pclog("Evict %08x %i\n", dirty_addr, sizeof(voodoo->texture_present)); for (c = 0; c < TEX_CACHE_MAX; c++) { if (voodoo->texture_cache[tmu][c].base != -1) @@ -1500,7 +1496,6 @@ static void flush_texture_cache(voodoo_t *voodoo, uint32_t dirty_addr, int tmu) if (dirty_addr >= (addr_start & voodoo->texture_mask & ~0x3ff) && dirty_addr < (((addr_end & voodoo->texture_mask) + 0x3ff) & ~0x3ff)) { -// pclog(" Evict texture %i %08x\n", c, voodoo->texture_cache[tmu][c].base); if (voodoo->texture_cache[tmu][c].refcount != voodoo->texture_cache[tmu][c].refcount_r[0] || (voodoo->render_threads == 2 && voodoo->texture_cache[tmu][c].refcount != voodoo->texture_cache[tmu][c].refcount_r[1])) @@ -1595,7 +1590,7 @@ static uint8_t logtable[256] = 0xf4,0xf5,0xf5,0xf6,0xf7,0xf7,0xf8,0xf9,0xfa,0xfa,0xfb,0xfc,0xfd,0xfd,0xfe,0xff }; -static inline int fastlog(uint64_t val) +static __inline int fastlog(uint64_t val) { uint64_t oldval = val; int exp = 63; @@ -1604,32 +1599,32 @@ static inline int fastlog(uint64_t val) if (!val || val & (1ULL << 63)) return 0x80000000; - if (!(val & 0xffffffff00000000)) + if (!(val & 0xffffffff00000000ll)) { exp -= 32; val <<= 32; } - if (!(val & 0xffff000000000000)) + if (!(val & 0xffff000000000000ll)) { exp -= 16; val <<= 16; } - if (!(val & 0xff00000000000000)) + if (!(val & 0xff00000000000000ll)) { exp -= 8; val <<= 8; } - if (!(val & 0xf000000000000000)) + if (!(val & 0xf000000000000000ll)) { exp -= 4; val <<= 4; } - if (!(val & 0xc000000000000000)) + if (!(val & 0xc000000000000000ll)) { exp -= 2; val <<= 2; } - if (!(val & 0x8000000000000000)) + if (!(val & 0x8000000000000000ll)) { exp -= 1; val <<= 1; @@ -1643,11 +1638,10 @@ static inline int fastlog(uint64_t val) return (exp << 8) | logtable[frac]; } -static inline int fls(uint16_t val) +static __inline int fls(uint16_t val) { int num = 0; -//pclog("fls(%04x) = ", val); if (!(val & 0xff00)) { num += 8; @@ -1668,7 +1662,6 @@ static inline int fls(uint16_t val) num += 1; val <<= 1; } -//pclog("%i %04x\n", num, val); return num; } @@ -1679,7 +1672,7 @@ typedef struct voodoo_texture_state_t int tex_shift; } voodoo_texture_state_t; -static inline void tex_read(voodoo_state_t *state, voodoo_texture_state_t *texture_state, int tmu) +static __inline void tex_read(voodoo_state_t *state, voodoo_texture_state_t *texture_state, int tmu) { uint32_t dat; @@ -1719,7 +1712,7 @@ static inline void tex_read(voodoo_state_t *state, voodoo_texture_state_t *textu #define LOW4(x) ((x & 0x0f) | ((x & 0x0f) << 4)) #define HIGH4(x) ((x & 0xf0) | ((x & 0xf0) >> 4)) -static inline void tex_read_4(voodoo_state_t *state, voodoo_texture_state_t *texture_state, int s, int t, int *d, int tmu, int x) +static __inline void tex_read_4(voodoo_state_t *state, voodoo_texture_state_t *texture_state, int s, int t, int *d, int tmu, int x) { rgba_u dat[4]; @@ -1772,7 +1765,7 @@ static inline void tex_read_4(voodoo_state_t *state, voodoo_texture_state_t *tex state->tex_a[tmu] = (dat[0].rgba.a * d[0] + dat[1].rgba.a * d[1] + dat[2].rgba.a * d[2] + dat[3].rgba.a * d[3]) >> 8; } -static inline void voodoo_get_texture(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *state, int tmu, int x) +static __inline void voodoo_get_texture(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *state, int tmu, int x) { rgba_u tex_samples[4]; voodoo_texture_state_t texture_state; @@ -1810,54 +1803,26 @@ static inline void voodoo_get_texture(voodoo_t *voodoo, voodoo_params_t *params, s >>= 4; t >>= 4; -//if (x == 80) -//if (voodoo_output) -// pclog("s=%08x t=%08x _ds=%02x _dt=%02x\n", s, t, _ds, dt); + d[0] = (16 - _ds) * (16 - dt); d[1] = _ds * (16 - dt); d[2] = (16 - _ds) * dt; d[3] = _ds * dt; -// texture_state.s = s; -// texture_state.t = t; tex_read_4(state, &texture_state, s, t, d, tmu, x); - - -/* state->tex_r = (tex_samples[0].rgba.r * d[0] + tex_samples[1].rgba.r * d[1] + tex_samples[2].rgba.r * d[2] + tex_samples[3].rgba.r * d[3]) >> 8; - state->tex_g = (tex_samples[0].rgba.g * d[0] + tex_samples[1].rgba.g * d[1] + tex_samples[2].rgba.g * d[2] + tex_samples[3].rgba.g * d[3]) >> 8; - state->tex_b = (tex_samples[0].rgba.b * d[0] + tex_samples[1].rgba.b * d[1] + tex_samples[2].rgba.b * d[2] + tex_samples[3].rgba.b * d[3]) >> 8; - state->tex_a = (tex_samples[0].rgba.a * d[0] + tex_samples[1].rgba.a * d[1] + tex_samples[2].rgba.a * d[2] + tex_samples[3].rgba.a * d[3]) >> 8;*/ -/* state->tex_r = tex_samples[0].r; - state->tex_g = tex_samples[0].g; - state->tex_b = tex_samples[0].b; - state->tex_a = tex_samples[0].a;*/ } else { - // rgba_t tex_samples; - // voodoo_texture_state_t texture_state; -// int s = state->tex_s >> (18+state->lod); -// int t = state->tex_t >> (18+state->lod); - // int s, t; - -// state->tex_s -= 1 << (17+state->lod); -// state->tex_t -= 1 << (17+state->lod); - s = state->tex_s >> (4+tex_lod); t = state->tex_t >> (4+tex_lod); texture_state.s = s; texture_state.t = t; tex_read(state, &texture_state, tmu); - -/* state->tex_r = tex_samples[0].rgba.r; - state->tex_g = tex_samples[0].rgba.g; - state->tex_b = tex_samples[0].rgba.b; - state->tex_a = tex_samples[0].rgba.a;*/ } } -static inline void voodoo_tmu_fetch(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *state, int tmu, int x) +static __inline void voodoo_tmu_fetch(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *state, int tmu, int x) { if (params->textureMode[tmu] & 1) { @@ -2247,7 +2212,7 @@ static inline void voodoo_tmu_fetch(voodoo_t *voodoo, voodoo_params_t *params, v #define dither2x2 (params->fbzMode & FBZ_DITHER_2x2) /*Perform texture fetch and blending for both TMUs*/ -static inline voodoo_tmu_fetch_and_blend(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *state, int x) +static __inline voodoo_tmu_fetch_and_blend(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *state, int x) { int r,g,b,a; int c_reverse, a_reverse; @@ -2538,8 +2503,6 @@ static void voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, vood state->clamp_t[0] = params->textureMode[0] & TEXTUREMODE_TCLAMPT; state->clamp_s[1] = params->textureMode[1] & TEXTUREMODE_TCLAMPS; state->clamp_t[1] = params->textureMode[1] & TEXTUREMODE_TCLAMPT; -// int last_x; -// pclog("voodoo_triangle : bottom-half %X %X %X %X %X %i %i %i %i\n", xstart, xend, dx1, dx2, dx2 * 36, xdir, y, yend, ydir); for (c = 0; c <= LOD_MAX; c++) { @@ -2584,7 +2547,6 @@ static void voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, vood yend = params->clipHighY; state->y = ystart; -// yend--; #ifndef NO_CODEGEN if (voodoo->use_recompiler) @@ -2593,7 +2555,6 @@ static void voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, vood if (voodoo_output) pclog("dxAB=%08x dxBC=%08x dxAC=%08x\n", state->dxAB, state->dxBC, state->dxAC); -// pclog("Start %i %i\n", ystart, voodoo->fbzMode & (1 << 17)); for (; state->y < yend; state->y++) { int x, x2; @@ -2745,7 +2706,6 @@ static void voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, vood if (voodoo_output) pclog(" X=%03i T=%08x\n", x, state->tmu0_t); -// if (voodoo->fbzMode & FBZ_RGB_WMASK) { int update = 1; uint8_t cother_r, cother_g, cother_b, aother; @@ -2771,8 +2731,6 @@ static void voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, vood w_depth = 0xffff; } -// w_depth = CLAMP16(w_depth); - if (params->fbzMode & FBZ_W_BUFFER) new_depth = w_depth; else @@ -3321,14 +3279,14 @@ static void voodoo_triangle(voodoo_t *voodoo, voodoo_params_t *params, int odd_e voodoo_half_triangle(voodoo, params, &state, vertexAy_adjusted, vertexCy_adjusted, odd_even); } -static inline void wake_render_thread(voodoo_t *voodoo) +static __inline void wake_render_thread(voodoo_t *voodoo) { thread_set_event(voodoo->wake_render_thread[0]); /*Wake up render thread if moving from idle*/ if (voodoo->render_threads == 2) thread_set_event(voodoo->wake_render_thread[1]); /*Wake up render thread if moving from idle*/ } -static inline void wait_for_render_thread_idle(voodoo_t *voodoo) +static __inline void wait_for_render_thread_idle(voodoo_t *voodoo) { while (!PARAM_EMPTY_1 || (voodoo->render_threads == 2 && !PARAM_EMPTY_2) || voodoo->render_voodoo_busy[0] || (voodoo->render_threads == 2 && voodoo->render_voodoo_busy[1])) { @@ -3381,7 +3339,7 @@ static void render_thread_2(void *param) render_thread(param, 1); } -static inline void queue_triangle(voodoo_t *voodoo, voodoo_params_t *params) +static __inline void queue_triangle(voodoo_t *voodoo, voodoo_params_t *params) { voodoo_params_t *params_new = &voodoo->params_buffer[voodoo->params_write_idx & PARAM_MASK]; @@ -3856,7 +3814,7 @@ skip_pixel_fill: case BLIT_COMMAND_SGRAM_FILL: /*32x32 tiles - 2kb*/ dst_y = voodoo->bltDstY & 0x3ff; - size_x = voodoo->bltSizeX & 0x1ff; //512*8 = 4kb + size_x = voodoo->bltSizeX & 0x1ff; size_y = voodoo->bltSizeY & 0x3ff; dat64 = voodoo->bltColorFg | ((uint64_t)voodoo->bltColorFg << 16) | @@ -4071,7 +4029,6 @@ static void voodoo_reg_writel(uint32_t addr, uint32_t val, void *p) chip = 0xf; tempif.i = val; -//pclog("voodoo_reg_write_l: addr=%08x val=%08x(%f) chip=%x\n", addr, val, tempif.f, chip); addr &= 0x3fc; if ((voodoo->fbiInit3 & FBIINIT3_REMAP) && addr < 0x100 && ad21) @@ -4079,7 +4036,6 @@ static void voodoo_reg_writel(uint32_t addr, uint32_t val, void *p) switch (addr) { case SST_swapbufferCMD: -// pclog(" start swap buffer command\n"); if (TRIPLE_BUFFER) { @@ -4096,7 +4052,6 @@ static void voodoo_reg_writel(uint32_t addr, uint32_t val, void *p) voodoo->params.swapbufferCMD = val; pclog("Swap buffer %08x %d %p\n", val, voodoo->swap_count, &voodoo->swap_count); -// voodoo->front_offset = params->front_offset; wait_for_render_thread_idle(voodoo); if (!(val & 1)) { @@ -4554,12 +4509,10 @@ static void voodoo_reg_writel(uint32_t addr, uint32_t val, void *p) case SST_sVx: tempif.i = val; voodoo->verts[3].sVx = tempif.f; -// pclog("sVx[%i]=%f\n", voodoo->vertex_num, tempif.f); break; case SST_sVy: tempif.i = val; voodoo->verts[3].sVy = tempif.f; -// pclog("sVy[%i]=%f\n", voodoo->vertex_num, tempif.f); break; case SST_sARGB: voodoo->verts[3].sBlue = (float)(val & 0xff); @@ -4617,13 +4570,11 @@ static void voodoo_reg_writel(uint32_t addr, uint32_t val, void *p) break; case SST_sBeginTriCMD: -// pclog("sBeginTriCMD %i %f\n", voodoo->vertex_num, voodoo->verts[4].sVx); voodoo->verts[0] = voodoo->verts[3]; voodoo->vertex_num = 1; voodoo->num_verticies = 1; break; case SST_sDrawTriCMD: -// pclog("sDrawTriCMD %i %i %i\n", voodoo->num_verticies, voodoo->vertex_num, voodoo->sSetupMode & SETUPMODE_STRIP_MODE); if (voodoo->vertex_num == 3) voodoo->vertex_num = (voodoo->sSetupMode & SETUPMODE_STRIP_MODE) ? 1 : 0; voodoo->verts[voodoo->vertex_num] = voodoo->verts[3]; @@ -4632,7 +4583,6 @@ static void voodoo_reg_writel(uint32_t addr, uint32_t val, void *p) voodoo->vertex_num++; if (voodoo->num_verticies == 3) { -// pclog("triangle_setup\n"); triangle_setup(voodoo); voodoo->num_verticies = 2; @@ -4645,13 +4595,11 @@ static void voodoo_reg_writel(uint32_t addr, uint32_t val, void *p) voodoo->bltSrcBaseAddr = val & 0x3fffff; break; case SST_bltDstBaseAddr: -// pclog("Write bltDstBaseAddr %08x\n", val); voodoo->bltDstBaseAddr = val & 0x3fffff; break; case SST_bltXYStrides: voodoo->bltSrcXYStride = val & 0xfff; voodoo->bltDstXYStride = (val >> 16) & 0xfff; -// pclog("Write bltXYStrides %08x\n", val); break; case SST_bltSrcChromaRange: voodoo->bltSrcChromaRange = val; @@ -4685,14 +4633,12 @@ static void voodoo_reg_writel(uint32_t addr, uint32_t val, void *p) voodoo->bltSrcY = (val >> 16) & 0x7ff; break; case SST_bltDstXY: -// pclog("Write bltDstXY %08x\n", val); voodoo->bltDstX = val & 0x7ff; voodoo->bltDstY = (val >> 16) & 0x7ff; if (val & (1 << 31)) blit_start(voodoo); break; case SST_bltSize: -// pclog("Write bltSize %08x\n", val); voodoo->bltSizeX = val & 0xfff; if (voodoo->bltSizeX & 0x800) voodoo->bltSizeX |= 0xfffff000; @@ -4709,14 +4655,12 @@ static void voodoo_reg_writel(uint32_t addr, uint32_t val, void *p) voodoo->bltRop[3] = (val >> 12) & 0xf; break; case SST_bltColor: -// pclog("Write bltColor %08x\n", val); voodoo->bltColorFg = val & 0xffff; voodoo->bltColorBg = (val >> 16) & 0xffff; break; case SST_bltCommand: voodoo->bltCommand = val; -// pclog("Write bltCommand %08x\n", val); if (val & (1 << 31)) blit_start(voodoo); break; @@ -5187,7 +5131,6 @@ static uint16_t voodoo_fb_readw(uint32_t addr, void *p) temp = *(uint16_t *)(&voodoo->fb_mem[read_addr & voodoo->fb_mask]); -// pclog("voodoo_fb_readw : %08X %08X %i %i %08X %08X %08x:%08x %i\n", addr, temp, x, y, read_addr, *(uint32_t *)(&voodoo->fb_mem[4]), cs, pc, fb_reads++); return temp; } static uint32_t voodoo_fb_readl(uint32_t addr, void *p) @@ -5206,11 +5149,10 @@ static uint32_t voodoo_fb_readl(uint32_t addr, void *p) temp = *(uint32_t *)(&voodoo->fb_mem[read_addr & voodoo->fb_mask]); -// pclog("voodoo_fb_readl : %08X %08x %08X x=%i y=%i %08X %08X %08x:%08x %i ro=%08x rw=%i\n", addr, read_addr, temp, x, y, read_addr, *(uint32_t *)(&voodoo->fb_mem[4]), cs, pc, fb_reads++, voodoo->fb_read_offset, voodoo->row_width); return temp; } -static inline uint16_t do_dither(voodoo_params_t *params, rgba8_t col, int x, int y) +static __inline uint16_t do_dither(voodoo_params_t *params, rgba8_t col, int x, int y) { int r, g, b; @@ -5252,13 +5194,7 @@ static void voodoo_fb_writew(uint32_t addr, uint16_t val, void *p) depth_data = voodoo->params.zaColor & 0xffff; alpha_data = voodoo->params.zaColor >> 24; - -// while (!RB_EMPTY) -// thread_reset_event(voodoo->not_full_event); - -// pclog("voodoo_fb_writew : %08X %04X\n", addr, val); - - + switch (voodoo->lfbMode & LFB_FORMAT_MASK) { case LFB_FORMAT_RGB565: @@ -5293,8 +5229,6 @@ static void voodoo_fb_writew(uint32_t addr, uint16_t val, void *p) write_addr = voodoo->fb_write_offset + x + (y * voodoo->row_width); write_addr_aux = voodoo->params.aux_offset + x + (y * voodoo->row_width); - -// pclog("fb_writew %08x %i %i %i %08x\n", addr, x, y, voodoo->row_width, write_addr); if (voodoo->lfbMode & 0x100) { @@ -5375,11 +5309,7 @@ static void voodoo_fb_writel(uint32_t addr, uint32_t val, void *p) depth_data[0] = depth_data[1] = voodoo->params.zaColor & 0xffff; alpha_data[0] = alpha_data[1] = voodoo->params.zaColor >> 24; -// while (!RB_EMPTY) -// thread_reset_event(voodoo->not_full_event); - -// pclog("voodoo_fb_writel : %08X %08X\n", addr, val); - + switch (voodoo->lfbMode & LFB_FORMAT_MASK) { case LFB_FORMAT_RGB565: @@ -5431,8 +5361,6 @@ static void voodoo_fb_writel(uint32_t addr, uint32_t val, void *p) write_addr = voodoo->fb_write_offset + x + (y * voodoo->row_width); write_addr_aux = voodoo->params.aux_offset + x + (y * voodoo->row_width); - -// pclog("fb_writel %08x x=%i y=%i rw=%i %08x wo=%08x\n", addr, x, y, voodoo->row_width, write_addr, voodoo->fb_write_offset); if (voodoo->lfbMode & 0x100) { @@ -5525,8 +5453,6 @@ static void voodoo_tex_writel(uint32_t addr, uint32_t val, void *p) if (tmu && !voodoo->dual_tmus) return; -// pclog("voodoo_tex_writel : %08X %08X %i\n", addr, val, voodoo->params.tformat); - lod = (addr >> 17) & 0xf; t = (addr >> 9) & 0xff; if (voodoo->params.tformat[tmu] & 8) @@ -5541,24 +5467,20 @@ static void voodoo_tex_writel(uint32_t addr, uint32_t val, void *p) if (lod > LOD_MAX) return; - -// if (addr >= 0x200000) -// return; - + if (voodoo->params.tformat[tmu] & 8) addr = voodoo->params.tex_base[tmu][lod] + s*2 + (t << voodoo->params.tex_shift[tmu][lod])*2; else addr = voodoo->params.tex_base[tmu][lod] + s + (t << voodoo->params.tex_shift[tmu][lod]); if (voodoo->texture_present[tmu][(addr & voodoo->texture_mask) >> TEX_DIRTY_SHIFT]) { -// pclog("texture_present at %08x %i\n", addr, (addr & voodoo->texture_mask) >> TEX_DIRTY_SHIFT); flush_texture_cache(voodoo, addr & voodoo->texture_mask, tmu); } *(uint32_t *)(&voodoo->tex_mem[tmu][addr & voodoo->texture_mask]) = val; } #define WAKE_DELAY (TIMER_USEC * 100) -static inline void wake_fifo_thread(voodoo_t *voodoo) +static __inline void wake_fifo_thread(voodoo_t *voodoo) { if (!voodoo->wake_timer) { @@ -5572,7 +5494,7 @@ static inline void wake_fifo_thread(voodoo_t *voodoo) } } -static inline void wake_fifo_thread_now(voodoo_t *voodoo) +static __inline void wake_fifo_thread_now(voodoo_t *voodoo) { thread_set_event(voodoo->wake_fifo_thread); /*Wake up FIFO thread if moving from idle*/ } @@ -5586,7 +5508,7 @@ static void voodoo_wake_timer(void *p) thread_set_event(voodoo->wake_fifo_thread); /*Wake up FIFO thread if moving from idle*/ } -static inline void queue_command(voodoo_t *voodoo, uint32_t addr_type, uint32_t val) +static __inline void queue_command(voodoo_t *voodoo, uint32_t addr_type, uint32_t val) { fifo_entry_t *fifo = &voodoo->fifo[voodoo->fifo_write_idx & FIFO_MASK]; int c; @@ -5769,6 +5691,10 @@ static uint32_t voodoo_readl(uint32_t addr, void *p) temp = voodoo->fbiInit3; break; + case SST_vRetrace: + timer_clock(); + temp = voodoo->line & 0x1fff; + break; case SST_hvRetrace: timer_clock(); temp = voodoo->line & 0x1fff; @@ -5842,9 +5768,7 @@ static void voodoo_pixelclock_update(voodoo_t *voodoo) t /= 2.0f; line_length = (voodoo->hSync & 0xff) + ((voodoo->hSync >> 16) & 0x3ff); - -// pclog("Pixel clock %f MHz hsync %08x line_length %d\n", t, voodoo->hSync, line_length); - + voodoo->pixel_clock = t; clock_const = cpuclock / t; @@ -5882,7 +5806,6 @@ static void voodoo_writel(uint32_t addr, uint32_t val, void *p) } else if ((addr & 0x200000) && (voodoo->fbiInit7 & FBIINIT7_CMDFIFO_ENABLE)) { -// pclog("Write CMDFIFO %08x(%08x) %08x %08x\n", addr, voodoo->cmdfifo_base + (addr & 0x3fffc), val, (voodoo->cmdfifo_base + (addr & 0x3fffc)) & voodoo->fb_mask); *(uint32_t *)&voodoo->fb_mem[(voodoo->cmdfifo_base + (addr & 0x3fffc)) & voodoo->fb_mask] = val; voodoo->cmdfifo_depth_wr++; if ((voodoo->cmdfifo_depth_wr - voodoo->cmdfifo_depth_rd) < 20) @@ -5945,7 +5868,6 @@ static void voodoo_writel(uint32_t addr, uint32_t val, void *p) { voodoo->fbiInit4 = val; voodoo->read_time = pci_nonburst_time + pci_burst_time * ((voodoo->fbiInit4 & 1) ? 2 : 1); -// pclog("fbiInit4 write %08x - read_time=%i\n", val, voodoo->read_time); } break; case SST_backPorch: @@ -5978,7 +5900,6 @@ static void voodoo_writel(uint32_t addr, uint32_t val, void *p) voodoo->fbiInit1 = val; voodoo->write_time = pci_nonburst_time + pci_burst_time * ((voodoo->fbiInit1 & 2) ? 1 : 0); voodoo->burst_time = pci_burst_time * ((voodoo->fbiInit1 & 2) ? 2 : 1); -// pclog("fbiInit1 write %08x - write_time=%i burst_time=%i\n", val, voodoo->write_time, voodoo->burst_time); } break; case SST_fbiInit2: @@ -6021,7 +5942,6 @@ static void voodoo_writel(uint32_t addr, uint32_t val, void *p) voodoo->dac_readdata = 0xff; if (val & 0x800) { -// pclog(" dacData read %i %02X\n", voodoo->dac_reg, voodoo->dac_data[7]); if (voodoo->dac_reg == 5) { switch (voodoo->dac_data[7]) @@ -6042,7 +5962,6 @@ static void voodoo_writel(uint32_t addr, uint32_t val, void *p) voodoo->dac_pll_regs[voodoo->dac_data[4] & 0xf] = (voodoo->dac_pll_regs[voodoo->dac_data[4] & 0xf] & 0xff00) | val; else voodoo->dac_pll_regs[voodoo->dac_data[4] & 0xf] = (voodoo->dac_pll_regs[voodoo->dac_data[4] & 0xf] & 0xff) | (val << 8); -// pclog("Write PLL reg %x %04x\n", voodoo->dac_data[4] & 0xf, voodoo->dac_pll_regs[voodoo->dac_data[4] & 0xf]); voodoo->dac_reg_ff = !voodoo->dac_reg_ff; if (!voodoo->dac_reg_ff) voodoo->dac_data[4]++; @@ -6086,7 +6005,6 @@ static void voodoo_writel(uint32_t addr, uint32_t val, void *p) case SST_cmdFifoBaseAddr: voodoo->cmdfifo_base = (val & 0x3ff) << 12; voodoo->cmdfifo_end = ((val >> 16) & 0x3ff) << 12; -// pclog("CMDFIFO base=%08x end=%08x\n", voodoo->cmdfifo_base, voodoo->cmdfifo_end); break; case SST_cmdFifoRdPtr: @@ -6131,11 +6049,10 @@ static uint32_t cmdfifo_get(voodoo_t *voodoo) voodoo->cmdfifo_depth_rd++; voodoo->cmdfifo_rp += 4; -// pclog(" CMDFIFO get %08x\n", val); return val; } -static inline float cmdfifo_get_f(voodoo_t *voodoo) +static __inline float cmdfifo_get_f(voodoo_t *voodoo) { union { @@ -6216,13 +6133,10 @@ static void fifo_thread(void *param) int num; int num_verticies; int v_num; - -// pclog(" CMDFIFO header %08x at %08x\n", header, voodoo->cmdfifo_rp); - + switch (header & 7) { case 0: -// pclog("CMDFIFO0\n"); switch ((header >> 3) & 7) { case 0: /*NOP*/ @@ -6230,7 +6144,6 @@ static void fifo_thread(void *param) case 3: /*JMP local frame buffer*/ voodoo->cmdfifo_rp = (header >> 4) & 0xfffffc; -// pclog("JMP to %08x %04x\n", voodoo->cmdfifo_rp, header); break; default: @@ -6241,7 +6154,6 @@ static void fifo_thread(void *param) case 1: num = header >> 16; addr = (header & 0x7ff8) >> 1; -// pclog("CMDFIFO1 addr=%08x\n",addr); while (num--) { uint32_t val = cmdfifo_get(voodoo); @@ -6258,15 +6170,13 @@ static void fifo_thread(void *param) case 3: num = (header >> 29) & 7; - mask = header;//(header >> 10) & 0xff; + mask = header; smode = (header >> 22) & 0xf; voodoo_reg_writel(SST_sSetupMode, ((header >> 10) & 0xff) | (smode << 16), voodoo); num_verticies = (header >> 6) & 0xf; v_num = 0; if (((header >> 3) & 7) == 2) v_num = 1; -// pclog("CMDFIFO3: num=%i verts=%i mask=%02x\n", num, num_verticies, (header >> 10) & 0xff); -// pclog("CMDFIFO3 %02x %i\n", (header >> 10), (header >> 3) & 7); while (num_verticies--) { @@ -6323,7 +6233,6 @@ static void fifo_thread(void *param) num = (header >> 29) & 7; mask = (header >> 15) & 0x3fff; addr = (header & 0x7ff8) >> 1; -// pclog("CMDFIFO4 addr=%08x\n",addr); while (mask) { if (mask & 1) @@ -6348,7 +6257,6 @@ static void fifo_thread(void *param) fatal("CMDFIFO packet 5 has byte disables set %08x\n", header); num = (header >> 3) & 0x7ffff; addr = cmdfifo_get(voodoo) & 0xffffff; -// pclog("CMDFIFO5 addr=%08x num=%i\n", addr, num); switch (header >> 30) { case 2: /*Framebuffer*/ @@ -6406,8 +6314,6 @@ uint8_t voodoo_pci_read(int func, int addr, void *p) if (func) return 0; -// pclog("Voodoo PCI read %08X PC=%08x\n", addr, cpu_state.pc); - switch (addr) { case 0x00: return 0x1a; /*3dfx*/ @@ -6453,8 +6359,6 @@ void voodoo_pci_write(int func, int addr, uint8_t val, void *p) if (func) return; -// pclog("Voodoo PCI write %04X %02X PC=%08x\n", addr, val, cpu_state.pc); - switch (addr) { case 0x04: @@ -6501,10 +6405,7 @@ static void voodoo_calc_clutData(voodoo_t *voodoo) int r = (c >> 8) & 0xf8; int g = (c >> 3) & 0xfc; int b = (c << 3) & 0xf8; -// r |= (r >> 5); -// g |= (g >> 6); -// b |= (b >> 5); - + voodoo->video_16to32[c] = (voodoo->clutData256[r].r << 16) | (voodoo->clutData256[g].g << 8) | voodoo->clutData256[b].b; } } @@ -6526,9 +6427,9 @@ static void voodoo_generate_filter_v1(voodoo_t *voodoo) fcg = FILTCAPG * 6; fcb = FILTCAPB * 5; - for (g=0;g -fcr)) thiscol = g + (difference / 2); if ((diffg < fcg) || (-diffg > -fcg)) @@ -6604,7 +6500,7 @@ static void voodoo_generate_filter_v2(voodoo_t *voodoo) float clr, clg, clb = 0; float fcr, fcg, fcb = 0; - // pre-clamping + /* pre-clamping */ fcr = FILTCAP; fcg = FILTCAPG; @@ -6614,9 +6510,9 @@ static void voodoo_generate_filter_v2(voodoo_t *voodoo) if (fcg > 32) fcg = 32; if (fcb > 32) fcb = 32; - for (g=0;g<256;g++) // pixel 1 - our target pixel we want to bleed into + for (g=0;g<256;g++) /* pixel 1 - our target pixel we want to bleed into */ { - for (h=0;h<256;h++) // pixel 2 - our main pixel + for (h=0;h<256;h++) /* pixel 2 - our main pixel */ { float avg; float avgdiff; @@ -6629,7 +6525,7 @@ static void voodoo_generate_filter_v2(voodoo_t *voodoo) thiscol = thiscolg = thiscolb = g; - // try lighten + /* try lighten */ if (h > g) { clr = clg = clb = avgdiff; @@ -6667,7 +6563,7 @@ static void voodoo_generate_filter_v2(voodoo_t *voodoo) if (difference > FILTCAPB) thiscolb = g; - // clamp + /* clamp */ if (thiscol < 0) thiscol = 0; if (thiscolg < 0) thiscolg = 0; if (thiscolb < 0) thiscolb = 0; @@ -6676,14 +6572,10 @@ static void voodoo_generate_filter_v2(voodoo_t *voodoo) if (thiscolg > 255) thiscolg = 255; if (thiscolb > 255) thiscolb = 255; - // add to the table + /* add to the table */ voodoo->thefilter[g][h] = (thiscol); voodoo->thefilterg[g][h] = (thiscolg); voodoo->thefilterb[g][h] = (thiscolb); - - // debug the ones that don't give us much of a difference - //if (difference < FILTCAP) - //pclog("Voodoofilter: %ix%i - %f difference, %f average difference, R=%f, G=%f, B=%f\n", g, h, difference, avgdiff, thiscol, thiscolg, thiscolb); } lined = g + 3; @@ -6728,7 +6620,7 @@ static void voodoo_filterline_v1(voodoo_t *voodoo, uint8_t *fil, int column, uin { int x; - // Scratchpad for avoiding feedback streaks + /* Scratchpad for avoiding feedback streaks */ uint8_t fil3[(voodoo->h_disp) * 3]; /* 16 to 32-bit */ @@ -6738,7 +6630,7 @@ static void voodoo_filterline_v1(voodoo_t *voodoo, uint8_t *fil, int column, uin fil[x*3+1] = (((src[x] >> 5) & 63) << 2); fil[x*3+2] = (((src[x] >> 11) & 31) << 3); - // Copy to our scratchpads + /* Copy to our scratchpads */ fil3[x*3+0] = fil[x*3+0]; fil3[x*3+1] = fil[x*3+1]; fil3[x*3+2] = fil[x*3+2]; @@ -6794,13 +6686,13 @@ static void voodoo_filterline_v2(voodoo_t *voodoo, uint8_t *fil, int column, uin { int x; - // Scratchpad for blending filter + /* Scratchpad for blending filter */ uint8_t fil3[(voodoo->h_disp) * 3]; /* 16 to 32-bit */ for (x=0; x> 5) & 63) << 2); fil3[x*3+2] = fil[x*3+2] = (((src[x] >> 11) & 31) << 3); @@ -6827,7 +6719,7 @@ static void voodoo_filterline_v2(voodoo_t *voodoo, uint8_t *fil, int column, uin fil[(x-1)*3+2] = voodoo->thefilter [fil3[(x-1)*3+2]][(((src[x] >> 11) & 31) << 3)]; } - // unroll for edge cases + /* unroll for edge cases */ fil3[(column-3)*3] = voodoo->thefilterb [((src[column-3] & 31) << 3)] [((src[column] & 31) << 3)]; fil3[(column-3)*3+1] = voodoo->thefilterg [(((src[column-3] >> 5) & 63) << 2)] [(((src[column] >> 5) & 63) << 2)]; @@ -6908,7 +6800,6 @@ void voodoo_callback(void *p) } if (voodoo->line == voodoo->v_disp) { -// pclog("retrace %i %i %08x %i\n", voodoo->retrace_count, voodoo->swap_interval, voodoo->swap_offset, voodoo->swap_pending); voodoo->retrace_count++; if (voodoo->swap_pending && (voodoo->retrace_count > voodoo->swap_interval)) { @@ -7003,7 +6894,6 @@ static void voodoo_speed_changed(void *p) voodoo->read_time = pci_nonburst_time + pci_burst_time * ((voodoo->fbiInit4 & 1) ? 2 : 1); voodoo->write_time = pci_nonburst_time + pci_burst_time * ((voodoo->fbiInit1 & 2) ? 1 : 0); voodoo->burst_time = pci_burst_time * ((voodoo->fbiInit1 & 2) ? 2 : 1); -// pclog("Voodoo read_time=%i write_time=%i burst_time=%i %08x %08x\n", voodoo->read_time, voodoo->write_time, voodoo->burst_time, voodoo->fbiInit1, voodoo->fbiInit4); } void *voodoo_init() @@ -7192,118 +7082,84 @@ void voodoo_close(void *p) static device_config_t voodoo_config[] = { { - .name = "type", - .description = "Voodoo type", - .type = CONFIG_SELECTION, - .selection = + "type", "Voodoo type", CONFIG_SELECTION, "", 0, { { - .description = "Voodoo Graphics", - .value = VOODOO_1 + "Voodoo Graphics", VOODOO_1 }, { - .description = "Obsidian SB50 + Amethyst (2 TMUs)", - .value = VOODOO_SB50 + "Obsidian SB50 + Amethyst (2 TMUs)", VOODOO_SB50 }, { - .description = "Voodoo 2", - .value = VOODOO_2 + "Voodoo 2", VOODOO_2 }, { - .description = "" + "" } - }, - .default_int = 0 + } }, { - .name = "framebuffer_memory", - .description = "Framebuffer memory size", - .type = CONFIG_SELECTION, - .selection = + "framebuffer_memory", "Framebuffer memory size", CONFIG_SELECTION, "", 2, { { - .description = "2 MB", - .value = 2 + "2 MB", 2 }, { - .description = "4 MB", - .value = 4 + "4 MB", 4 }, { - .description = "" + "" } - }, - .default_int = 2 + } }, { - .name = "texture_memory", - .description = "Texture memory size", - .type = CONFIG_SELECTION, - .selection = + "texture_memory", "Texture memory size", CONFIG_SELECTION, "", 2, { { - .description = "2 MB", - .value = 2 + "2 MB", 2 }, { - .description = "4 MB", - .value = 4 + "4 MB",4 }, { - .description = "" + "" } - }, - .default_int = 2 + } }, { - .name = "bilinear", - .description = "Bilinear filtering", - .type = CONFIG_BINARY, - .default_int = 1 - }, - { - .name = "dacfilter", - .description = "Screen Filter", - .type = CONFIG_BINARY, - .default_int = 0 - }, - { - .name = "render_threads", - .description = "Render threads", - .type = CONFIG_SELECTION, - .selection = + "render_threads", "Render threads", CONFIG_SELECTION, "", 2, { { - .description = "1", - .value = 1 + "1", 1 }, { - .description = "2", - .value = 2 + "2", 2 }, { - .description = "" + "" } - }, - .default_int = 2 + } + }, + { + "bilinear", "Bilinear filtering", CONFIG_BINARY, "", 1 + }, + { + "dacfilter", "Screen Filter", CONFIG_BINARY, "", 0 }, #ifndef NO_CODEGEN { - .name = "recompiler", - .description = "Recompiler", - .type = CONFIG_BINARY, - .default_int = 1 + "recompiler", "Recompiler", CONFIG_BINARY, "", 1 }, #endif { - .type = -1 + "", "", -1 } }; device_t voodoo_device = { "3DFX Voodoo Graphics", - 0, + DEVICE_PCI, voodoo_init, voodoo_close, NULL, diff --git a/src/vid_voodoo_codegen_x86.h b/src/vid_voodoo_codegen_x86.h index f0aba4a59..fd3d09587 100644 --- a/src/vid_voodoo_codegen_x86.h +++ b/src/vid_voodoo_codegen_x86.h @@ -63,20 +63,20 @@ static int next_block_to_write[2] = {0, 0}; fatal("Over!\n") -static __m128i xmm_01_w;// = 0x0001000100010001ull; -static __m128i xmm_ff_w;// = 0x00ff00ff00ff00ffull; -static __m128i xmm_ff_b;// = 0x00000000ffffffffull; +static __m128i xmm_01_w; +static __m128i xmm_ff_w; +static __m128i xmm_ff_b; static uint32_t zero = 0; static double const_1_48 = (double)(1ull << 4); static __m128i alookup[257], aminuslookup[256]; -static __m128i minus_254;// = 0xff02ff02ff02ff02ull; +static __m128i minus_254; static __m128i bilinear_lookup[256*2]; static __m128i xmm_00_ff_w[2]; static uint32_t i_00_ff_w[2] = {0, 0xff}; -static inline int codegen_texture_fetch(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *state, int block_pos, int tmu) +static __inline int codegen_texture_fetch(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *state, int block_pos, int tmu) { if (params->textureMode[tmu] & 1) { @@ -653,7 +653,7 @@ static inline int codegen_texture_fetch(uint8_t *code_block, voodoo_t *voodoo, v return block_pos; } -static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *state, int depthop) +static __inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *state, int depthop) { int block_pos = 0; int z_skip_pos = 0; @@ -662,24 +662,10 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo int depth_jump_pos = 0; int depth_jump_pos2 = 0; int loop_jump_pos = 0; -// xmm_01_w = (__m128i)0x0001000100010001ull; -// xmm_ff_w = (__m128i)0x00ff00ff00ff00ffull; -// xmm_ff_b = (__m128i)0x00000000ffffffffull; xmm_01_w = _mm_set_epi32(0, 0, 0x00010001, 0x00010001); xmm_ff_w = _mm_set_epi32(0, 0, 0x00ff00ff, 0x00ff00ff); xmm_ff_b = _mm_set_epi32(0, 0, 0, 0x00ffffff); minus_254 = _mm_set_epi32(0, 0, 0xff02ff02, 0xff02ff02); -// *(uint64_t *)&const_1_48 = 0x45b0000000000000ull; -// block_pos = 0; -// voodoo_get_depth = &code_block[block_pos]; - /*W at (%esp+4) - Z at (%esp+12) - new_depth at (%esp+16)*/ -// if ((params->fbzMode & FBZ_DEPTH_ENABLE) && (depth_op == DEPTHOP_NEVER)) -// { -// addbyte(0xC3); /*RET*/ -// return; -// } addbyte(0x55); /*PUSH EBP*/ addbyte(0x57); /*PUSH EDI*/ addbyte(0x56); /*PUSH ESI*/ @@ -711,7 +697,6 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo addbyte(0x75); /*JNZ got_depth*/ depth_jump_pos = block_pos; addbyte(0); -// addbyte(4+5+2+3+2+5+5+3+2+2+2+/*3+*/3+2+6+4+5+2+3); addbyte(0x8b); /*MOV EDX, w*/ addbyte(0x97); addlong(offsetof(voodoo_state_t, w)); @@ -725,7 +710,6 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo addbyte(0x74); /*JZ got_depth*/ depth_jump_pos2 = block_pos; addbyte(0); -// addbyte(5+5+3+2+2+2+/*3+*/3+2+6+4+5+2+3); addbyte(0xb9); /*MOV ECX, 19*/ addlong(19); addbyte(0x0f); /*BSR EAX, EDX*/ @@ -891,17 +875,8 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo else if ((params->fbzMode & FBZ_DEPTH_ENABLE) && (depthop == DEPTHOP_NEVER)) { addbyte(0xC3); /*RET*/ -// addbyte(0x30); /*XOR EAX, EAX*/ -// addbyte(0xc0); } -// else -// { -// addbyte(0xb0); /*MOV AL, 1*/ -// addbyte(1); -// } - -// voodoo_combine = &code_block[block_pos]; /*XMM0 = colour*/ /*XMM2 = 0 (for unpacking*/ @@ -2172,12 +2147,6 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo addbyte(0x05); addlong(&xmm_ff_b); } -//#if 0 -// addbyte(0x66); /*MOVD state->out[EDI], XMM0*/ -// addbyte(0x0f); -// addbyte(0x7e); -// addbyte(0x87); -// addlong(offsetof(voodoo_state_t, out)); if (params->fogMode & FOG_ENABLE) { if (params->fogMode & FOG_CONSTANT) @@ -2272,11 +2241,6 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo addbyte(10); addbyte(0x01); /*ADD EAX, EBX*/ addbyte(0xd8); - -/* int fog_idx = (w_depth >> 10) & 0x3f; - - fog_a = params->fogTable[fog_idx].fog; - fog_a += (params->fogTable[fog_idx].dfog * ((w_depth >> 2) & 0xff)) >> 10;*/ break; case FOG_Z: @@ -2288,7 +2252,6 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo addbyte(12); addbyte(0x25); /*AND EAX, 0xff*/ addlong(0xff); -// fog_a = (z >> 20) & 0xff; break; case FOG_ALPHA: @@ -2310,7 +2273,6 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo addbyte(0x0f); /*CMOVAE EAX, EBX*/ addbyte(0x43); addbyte(0xc3); -// fog_a = CLAMP(ia >> 12); break; case FOG_W: @@ -2331,12 +2293,10 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo addbyte(0x0f); /*CMOVAE EAX, EBX*/ addbyte(0x43); addbyte(0xc3); -// fog_a = CLAMP(w >> 32); break; } addbyte(0x01); /*ADD EAX, EAX*/ addbyte(0xc0); -// fog_a++; addbyte(0x66); /*PMULLW XMM3, alookup+4[EAX*8]*/ addbyte(0x0f); @@ -2808,13 +2768,6 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo addbyte(0x67); addbyte(0xc0); } -//#endif - -// addbyte(0x8b); /*MOV EDX, x (ESP+12)*/ -// addbyte(0x54); -// addbyte(0x24); -// addbyte(12); - addbyte(0x8b); /*MOV EDX, state->x[EDI]*/ addbyte(0x97); @@ -2827,10 +2780,6 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo if (params->fbzMode & FBZ_RGB_WMASK) { -// addbyte(0x89); /*MOV state->rgb_out[EDI], EAX*/ -// addbyte(0x87); -// addlong(offsetof(voodoo_state_t, rgb_out)); - if (dither) { addbyte(0x8b); /*MOV ESI, real_y (ESP+16)*/ @@ -3232,7 +3181,7 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo } static int voodoo_recomp = 0; -static inline void *voodoo_get_block(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *state, int odd_even) +static __inline void *voodoo_get_block(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *state, int odd_even) { int c; int b = last_block[odd_even]; @@ -3262,7 +3211,6 @@ static inline void *voodoo_get_block(voodoo_t *voodoo, voodoo_params_t *params, } voodoo_recomp++; data = &codegen_data[odd_even + next_block_to_write[odd_even]*2]; -// code_block = data->code_block; voodoo_generate(data->code_block, voodoo, params, state, depth_op); @@ -3300,7 +3248,7 @@ static void voodoo_codegen_init(voodoo_t *voodoo) #ifdef __linux__ start = (void *)((long)voodoo->codegen_data & pagemask); - len = ((sizeof(voodoo_x86_data_t) * BLOCK_NUM) + pagesize) & pagemask; + len = ((sizeof(voodoo_x86_data_t) * BLOCK_NUM*2) + pagesize) & pagemask; if (mprotect(start, len, PROT_READ | PROT_WRITE | PROT_EXEC) != 0) { perror("mprotect"); diff --git a/src/vid_wy700.c b/src/vid_wy700.c index 41bb73ffb..80def235f 100644 --- a/src/vid_wy700.c +++ b/src/vid_wy700.c @@ -3,6 +3,7 @@ #include "ibm.h" #include "device.h" #include "mem.h" +#include "io.h" #include "timer.h" #include "video.h" #include "vid_wy700.h" @@ -499,7 +500,7 @@ void wy700_textline(wy700_t *wy700) int x; int w = (wy700->wy700_mode == 0) ? 40 : 80; int cw = (wy700->wy700_mode == 0) ? 32 : 16; - uint8_t chr, attr, fg, bg; + uint8_t chr, attr; uint8_t bitmap[2]; uint8_t *fontbase = &fontdatw[0][0]; int blink, c; @@ -591,7 +592,7 @@ void wy700_cgaline(wy700_t *wy700) { int x, c; uint32_t dat; - uint8_t bitmap, ink; + uint8_t ink; uint16_t addr; uint16_t ma = (wy700->cga_crtc[13] | (wy700->cga_crtc[12] << 8)) & 0x3fff; @@ -651,7 +652,7 @@ void wy700_medresline(wy700_t *wy700) { int x, c; uint32_t dat; - uint8_t bitmap, ink; + uint8_t ink; uint32_t addr; addr = (wy700->displine >> 1) * 80 + 4 * wy700->wy700_base; @@ -709,7 +710,7 @@ void wy700_hiresline(wy700_t *wy700) { int x, c; uint32_t dat; - uint8_t bitmap, ink; + uint8_t ink; uint32_t addr; addr = (wy700->displine >> 1) * 160 + 4 * wy700->wy700_base; @@ -765,10 +766,6 @@ void wy700_hiresline(wy700_t *wy700) void wy700_poll(void *p) { wy700_t *wy700 = (wy700_t *)p; - int x, c; - int oldvc; - uint8_t chr, attr; - uint16_t dat; int mode; if (!wy700->linepos) diff --git a/src/video.c b/src/video.c index 9ac3a3040..1176824ee 100644 --- a/src/video.c +++ b/src/video.c @@ -24,17 +24,22 @@ #include "vid_ati28800.h" #include "vid_ati_mach64.h" #include "vid_cga.h" -#include "vid_cl_ramdac.h" //vid_cl_gd.c needs this +#ifdef DEV_BRANCH +#include "vid_cl_ramdac.h" /* vid_cl_gd.c needs this */ #include "vid_cl_gd.h" +#endif #include "vid_ega.h" #include "vid_et4000.h" #include "vid_et4000w32.h" +#include "vid_genius.h" #include "vid_hercules.h" #include "vid_herculesplus.h" #include "vid_incolor.h" #include "vid_colorplus.h" #include "vid_mda.h" +#ifdef DEV_BRANCH #include "vid_nv_riva128.h" +#endif #include "vid_olivetti_m24.h" #include "vid_oti067.h" #include "vid_paradise.h" @@ -65,29 +70,25 @@ typedef struct static VIDEO_CARD video_cards[] = { {"ATI Graphics Pro Turbo (Mach64 GX)", "mach64x", &mach64gx_device, GFX_MACH64GX}, + {"ATI Video Xpression (Mach64 VT2)", "mach64vt2", &mach64vt2_device, GFX_MACH64VT2}, {"ATI VGA Charger (ATI-28800-5)", "ati28800", &ati28800_device, GFX_VGACHARGER}, {"ATI VGA Wonder XL24 (ATI-28800-6)", "ati28800w", &ati28800_wonderxl24_device, GFX_VGAWONDERXL24}, {"ATI VGA Edge-16 (ATI-18800)", "ati18800", &ati18800_device, GFX_VGAEDGE16}, {"CGA", "cga", &cga_device, GFX_CGA}, - {"Cirrus Logic CL-GD5429", "cl_gd5429", &gd5429_device, GFX_CL_GD5429}, {"Diamond Stealth 32 (Tseng ET4000/w32p)", "stealth32", &et4000w32p_device, GFX_ET4000W32}, - /* {"Diamond Stealth 64 DRAM (S3 Vision864)", "stealth64d", &s3_diamond_stealth64_device,GFX_STEALTH64}, */ + {"Diamond Stealth 64 DRAM (S3 Trio64)", "stealth64d", &s3_diamond_stealth64_device,GFX_STEALTH64}, {"Diamond Stealth 3D 2000 (S3 ViRGE)", "stealth3d_2000", &s3_virge_device, GFX_VIRGE}, + {"Diamond Stealth 3D 3000 (S3 ViRGE/VX)", "stealth3d_3000", &s3_virge_988_device, GFX_VIRGEVX}, {"EGA", "ega", &ega_device, GFX_EGA}, {"Chips & Technologies SuperEGA", "superega", &sega_device, GFX_SUPER_EGA}, {"Compaq ATI VGA Wonder XL (ATI-28800-5)", "compaq_ati28800", &compaq_ati28800_device, GFX_VGAWONDERXL}, {"Compaq EGA", "compaq_ega", &cpqega_device, GFX_COMPAQ_EGA}, - /* {"Compaq/Paradise VGA", "compaq_vga", &cpqvga_device, GFX_COMPAQ_VGA}, */ {"Hercules", "hercules", &hercules_device, GFX_HERCULES}, {"Hercules Plus", "hercules_plus", &herculesplus_device, GFX_HERCULESPLUS}, {"Hercules InColor", "incolor", &incolor_device, GFX_INCOLOR}, {"MDA", "mda", &mda_device, GFX_MDA}, - /* {"Miro Crystal S3 Vision964", "mc_vision964", &s3_miro_vision964_device, GFX_MIRO_VISION964}, */ + {"MDSI Genius", "genius", &genius_device, GFX_GENIUS}, {"Number Nine 9FX (S3 Trio64)", "n9_9fx", &s3_9fx_device, GFX_N9_9FX}, - {"nVidia RIVA 128 (Experimental)", "nv_riva128", &riva128_device, GFX_RIVA128}, - {"nVidia RIVA TNT (Experimental)", "nv_rivatnt", &rivatnt_device, GFX_RIVATNT}, - {"nVidia RIVA TNT2 (Experimental)", "nv_rivatnt2", &rivatnt2_device, GFX_RIVATNT2}, - {"OAK OTI-067", "oti067", &oti067_device, GFX_OTI067}, {"OAK OTI-077", "oti077", &oti077_device, GFX_OTI077}, {"Paradise Bahamas 64 (S3 Vision864)", "bahamas64", &s3_bahamas64_device, GFX_BAHAMAS64}, @@ -99,7 +100,6 @@ static VIDEO_CARD video_cards[] = {"S3 ViRGE/DX", "virge375", &s3_virge_375_device, GFX_VIRGEDX}, {"Trident TGUI9440", "tgui9440", &tgui9440_device, GFX_TGUI9440}, {"Trident TVGA8900D", "tvga8900d", &tvga8900d_device, GFX_TVGA}, - {"TriGem Unknown Adapter", "trigem_unk", &trigem_unk_device, GFX_TRIGEM_UNK}, {"Tseng ET4000AX", "et4000ax", &et4000_device, GFX_ET4000}, {"VGA", "vga", &vga_device, GFX_VGA}, {"Wyse 700", "wy700", &wy700_device, GFX_WY700}, @@ -332,6 +332,10 @@ void video_init() return; case ROM_IBMPS1_2011: + case ROM_IBMPS2_M30_286: + case ROM_IBMPS2_M50: + case ROM_IBMPS2_M55SX: + case ROM_IBMPS2_M80: device_add(&ps1vga_device); return; @@ -348,6 +352,7 @@ BITMAP *buffer, *buffer32; uint8_t fontdat[256][8]; uint8_t fontdatm[256][16]; uint8_t fontdatw[512][32]; /* Wyse700 font */ +uint8_t fontdat8x12[256][16]; /* MDSI Genius font */ int xsize=1,ysize=1; @@ -431,6 +436,16 @@ void loadfont(char *s, int format) } } break; + case 4: /* MDSI Genius */ + for (c=0;c<256;c++) + { + for (d=0;d<16;d++) + { + fontdat8x12[c][d]=getc(f); + } + } + break; + } fclose(f); } @@ -452,7 +467,7 @@ static void blit_thread(void *param); int calc_6to8(int c) { int ic, i8; - double dc, d8; + double d8; ic = c; if (ic == 64) { @@ -462,7 +477,6 @@ int calc_6to8(int c) { ic &= 0x3f; } - dc = (double) ic; d8 = (ic / 63.0) * 255.0; i8 = (int) d8; return i8 & 0xff; @@ -542,7 +556,6 @@ void initvideo() if (d & 1) edatlookup[c][d] |= 2; if (c & 2) edatlookup[c][d] |= 0x10; if (d & 2) edatlookup[c][d] |= 0x20; -// printf("Edat %i,%i now %02X\n",c,d,edatlookup[c][d]); } } diff --git a/src/video.h b/src/video.h index c01bb812b..7461f130b 100644 --- a/src/video.h +++ b/src/video.h @@ -112,3 +112,12 @@ void ddraw_fs_take_screenshot(char *fn); #endif extern int cga_palette; + +void loadfont(char *s, int format); +void initvideo(); +void video_init(); +void closevideo(); +void video_updatetiming(); + +void hline(BITMAP *b, int x1, int y, int x2, uint32_t col); +void updatewindowsize(int x, int y); diff --git a/src/w83877f.c b/src/w83877f.c index 0096b998d..ebb22513d 100644 --- a/src/w83877f.c +++ b/src/w83877f.c @@ -203,7 +203,6 @@ static void w83877f_remap() winbond_port = (HEFRAS ? 0x3f0 : 0x250); winbond_key_times = HEFRAS + 1; winbond_key = (HEFRAS ? 0x86 : 0x88) | HEFERE; - // pclog("W83877F mapped to %04X, with key %02X required %i times\n", winbond_port, winbond_key, winbond_key_times); } static uint8_t is_in_array(uint16_t *port_array, uint8_t max, uint16_t port) @@ -267,7 +266,6 @@ static uint16_t make_port(uint8_t reg) break; } - // pclog("Made port %04X (reg %02X)\n", p, reg); return p; } @@ -276,21 +274,16 @@ void w83877f_write(uint16_t port, uint8_t val, void *priv) uint8_t index = (port & 1) ? 0 : 1; uint8_t valxor = 0; uint8_t max = 0x2A; - int temp; if (index) { - // pclog("w83877f_write : port=%04x = %02X locked=%i\n", port, val, w83877f_locked); - if ((val == winbond_key) && !w83877f_locked) { if (winbond_key_times == 2) { if (tries) { - // pclog("W83877F Locked (2 tries)\n"); w83877f_locked = 1; - // fdc_3f1_enable(0); tries = 0; } else @@ -300,23 +293,18 @@ void w83877f_write(uint16_t port, uint8_t val, void *priv) } else { - // pclog("W83877F Locked (1 try)\n"); w83877f_locked = 1; - // fdc_3f1_enable(0); tries = 0; } } else { - // pclog("w83877f_write : port=%04x reg %02X = %02X locked=%i\n", port, w83877f_curreg, val, w83877f_locked); - if (w83877f_locked) { if (val < max) w83877f_curreg = val; if (val == 0xaa) { w83877f_locked = 0; - // fdc_3f1_enable(1); } } else @@ -328,8 +316,6 @@ void w83877f_write(uint16_t port, uint8_t val, void *priv) } else { - // pclog("w83877f_write : port=%04x reg %02X = %02X locked=%i\n", port, w83877f_curreg, val, w83877f_locked); - if (w83877f_locked) { if (w83877f_rw_locked) return; @@ -379,20 +365,17 @@ process_value: } break; case 7: - // pclog("W83877F Write [Reg. %02X]: %02X\n", w83877f_curreg, val); if (valxor & 3) fdc_update_rwc(0, FDDA_TYPE); if (valxor & 0xC) fdc_update_rwc(1, FDDB_TYPE); if (valxor & 0x30) fdc_update_rwc(2, FDDC_TYPE); if (valxor & 0xC0) fdc_update_rwc(3, FDDD_TYPE); break; case 8: - // pclog("W83877F Write [Reg. %02X]: %02X\n", w83877f_curreg, val); if (valxor & 3) fdc_update_boot_drive(FD_BOOT); if (valxor & 0x10) swwp = SWWP ? 1 : 0; if (valxor & 0x20) disable_write = DISFDDWR ? 1 : 0; break; case 9: - // pclog("W83877F Write [Reg. %02X]: %02X\n", w83877f_curreg, val); if (valxor & 0x20) { fdc_update_enh_mode(EN3MODE ? 1 : 0); @@ -403,7 +386,6 @@ process_value: } break; case 0xB: - // pclog("W83877F Write [Reg. %02X]: %02X\n", w83877f_curreg, val); if (valxor & 1) fdc_update_drv2en(DRV2EN_NEG ? 0 : 1); if (valxor & 2) fdc_update_densel_polarity(INVERTZ ? 1 : 0); break; @@ -459,13 +441,11 @@ uint8_t w83877f_read(uint16_t port, void *priv) if (!w83877f_locked) { - // pclog("w83877f_read : port=%04x = FF locked=%i\n", port, w83877f_locked); return 0xff; } if (index) { - // pclog("w83877f_read : port=%04x = %02X locked=%i\n", port, w83877f_curreg, w83877f_locked); return w83877f_curreg; } else @@ -473,10 +453,8 @@ uint8_t w83877f_read(uint16_t port, void *priv) if ((w83877f_curreg < 0x18) && w83877f_rw_locked) return 0xff; if (w83877f_curreg == 7) { - // pclog("w83877f_read : port=%04x reg %02X = %02X locked=%i\n", port, w83877f_curreg, (fdc_get_rwc(0) | (fdc_get_rwc(1) << 2)), w83877f_locked); return (fdc_get_rwc(0) | (fdc_get_rwc(1) << 2)); } - // pclog("w83877f_read : port=%04x reg %02X = %02X locked=%i\n", port, w83877f_curreg, w83877f_regs[w83877f_curreg], w83877f_locked); return w83877f_regs[w83877f_curreg]; } } diff --git a/src/win-cgapal.h b/src/win-cgapal.h index 40056a2b1..d6ac7ffd8 100644 --- a/src/win-cgapal.h +++ b/src/win-cgapal.h @@ -7,6 +7,7 @@ extern uint32_t pal_lookup[256]; extern "C" { #endif void cgapal_rebuild(); +void destroy_bitmap(BITMAP *b); #ifdef __cplusplus } #endif diff --git a/src/win-config.c b/src/win-config.c deleted file mode 100644 index 66c99315c..000000000 --- a/src/win-config.c +++ /dev/null @@ -1,923 +0,0 @@ -/* Copyright holders: Sarah Walker, Tenshi - see COPYING for more details -*/ -#define BITMAP WINDOWS_BITMAP -#include -#include -#undef BITMAP - -#include - -#include "nethandler.h" -#include "ibm.h" -#include "ide.h" -#include "cpu.h" -#include "device.h" -#include "buslogic.h" -#include "fdd.h" -#include "gameport.h" -#include "hdd.h" -#include "model.h" -#include "mouse.h" -#include "nvr.h" -#include "resources.h" -#include "sound.h" -#include "video.h" -#include "vid_voodoo.h" -#include "win.h" - -extern int is486; -static int romstolist[ROM_MAX], listtomodel[ROM_MAX], romstomodel[ROM_MAX], modeltolist[ROM_MAX]; -static int settings_sound_to_list[20], settings_list_to_sound[20]; -static int settings_mouse_to_list[20], settings_list_to_mouse[20]; -static int settings_network_to_list[20], settings_list_to_network[20]; -static char *hdd_names[16]; - -static int mouse_valid(int type, int model) -{ - if (((type & MOUSE_TYPE_IF_MASK) == MOUSE_TYPE_PS2) && !(models[model].flags & MODEL_PS2)) - return 0; - if (((type & MOUSE_TYPE_IF_MASK) == MOUSE_TYPE_AMSTRAD) && !(models[model].flags & MODEL_AMSTRAD)) - return 0; - if (((type & MOUSE_TYPE_IF_MASK) == MOUSE_TYPE_OLIM24) && !(models[model].flags & MODEL_OLIM24)) - return 0; - return 1; -} - -static void recalc_hdd_list(HWND hdlg, int model, int use_selected_hdd) -{ - HWND h; - - h = GetDlgItem(hdlg, IDC_COMBOHDD); - - if (models[model].flags & MODEL_PS2_HDD) - { - SendMessage(h, CB_RESETCONTENT, 0, 0); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"XTIDE for PS/2"); - EnableWindow(h, FALSE); - SendMessage(h, CB_SETCURSEL, 0, 0); - } - else if (models[model].flags & MODEL_HAS_IDE) - { - SendMessage(h, CB_RESETCONTENT, 0, 0); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Internal IDE"); - EnableWindow(h, FALSE); - SendMessage(h, CB_SETCURSEL, 0, 0); - } - else - { - char *s; - int valid = 0; - char old_name[16]; - int c, d; - - if (use_selected_hdd) - { - c = SendMessage(h, CB_GETCURSEL, 0, 0); - - if (c != -1 && hdd_names[c]) - strncpy(old_name, hdd_names[c], sizeof(old_name)-1); - else - strcpy(old_name, "none"); - } - else - strncpy(old_name, hdd_controller_name, sizeof(old_name)-1); - - SendMessage(h, CB_RESETCONTENT, 0, 0); - c = d = 0; - while (1) - { - s = hdd_controller_get_name(c); - if (s[0] == 0) - break; - if ((hdd_controller_get_flags(c) & DEVICE_AT) && !(models[model].flags & MODEL_AT)) - { - c++; - continue; - } - if (!hdd_controller_available(c)) - { - c++; - continue; - } - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)s); - hdd_names[d] = hdd_controller_get_internal_name(c); - if (!strcmp(old_name, hdd_names[d])) - { - SendMessage(h, CB_SETCURSEL, d, 0); - valid = 1; - } - c++; - d++; - } - - if (!valid) - SendMessage(h, CB_SETCURSEL, 0, 0); - } -} - -static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) -{ - char temp_str[256]; - HWND h; - int c, d; - int rom, gfx, mem, fpu; - int temp_cpu, temp_cpu_m, temp_model; - int temp_GAMEBLASTER, temp_GUS, temp_SSI2001, temp_voodoo, temp_buslogic, temp_sound_card_current; - int temp_dynarec; - int cpu_flags; - int temp_fd1_type, temp_fd2_type, temp_fd3_type, temp_fd4_type; - int temp_network_card_current; - int temp_network_interface_current; - int temp_joystick_type; - int temp_mouse_type; - int cpu_type; - int temp_xtide; - int temp_fpu; - - UDACCEL accel; -// pclog("Dialog msg %i %08X\n",message,message); - switch (message) - { - case WM_INITDIALOG: - pause = 1; - h = GetDlgItem(hdlg, IDC_COMBO1); - for (c = 0; c < ROM_MAX; c++) - romstolist[c] = 0; - c = d = 0; - while (models[c].id != -1) - { - pclog("INITDIALOG : %i %i %i\n",c,models[c].id,romspresent[models[c].id]); - if (romspresent[models[c].id]) - { - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)models[c].name); - modeltolist[c] = d; - listtomodel[d] = c; - romstolist[models[c].id] = d; - romstomodel[models[c].id] = c; - d++; - } - c++; - } - SendMessage(h, CB_SETCURSEL, modeltolist[model], 0); - - h = GetDlgItem(hdlg, IDC_COMBOVID); - c = d = 0; - while (1) - { - char *s = video_card_getname(c); - - if (!s[0]) - break; - - if (video_card_available(c) && gfx_present[video_new_to_old(c)]) - { - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)s); - if (video_new_to_old(c) == gfxcard) - SendMessage(h, CB_SETCURSEL, d, 0); - - d++; - } - - c++; - } - if (models[model].fixed_gfxcard) - EnableWindow(h, FALSE); - - h = GetDlgItem(hdlg, IDC_COMBOCPUM); - c = 0; - while (models[romstomodel[romset]].cpu[c].cpus != NULL && c < 4) - { - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)models[romstomodel[romset]].cpu[c].name); - c++; - } - EnableWindow(h, TRUE); - SendMessage(h, CB_SETCURSEL, cpu_manufacturer, 0); - if (c == 1) EnableWindow(h, FALSE); - else EnableWindow(h, TRUE); - - h = GetDlgItem(hdlg, IDC_COMBO3); - c = 0; - while (models[romstomodel[romset]].cpu[cpu_manufacturer].cpus[c].cpu_type != -1) - { - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)models[romstomodel[romset]].cpu[cpu_manufacturer].cpus[c].name); - c++; - } - EnableWindow(h, TRUE); - SendMessage(h, CB_SETCURSEL, cpu, 0); - - h = GetDlgItem(hdlg, IDC_COMBOSND); - c = d = 0; - while (1) - { - char *s = sound_card_getname(c); - - if (!s[0]) - break; - - settings_sound_to_list[c] = d; - - if (sound_card_available(c)) - { - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)s); - settings_list_to_sound[d] = c; - d++; - } - - c++; - } - SendMessage(h, CB_SETCURSEL, settings_sound_to_list[sound_card_current], 0); - - /*NIC config*/ - h = GetDlgItem(hdlg, IDC_COMBONET); - c = d = 0; - while (1) - { - char *s = network_card_getname(c); - - if (!s[0]) - break; - - settings_network_to_list[c] = d; - - if (network_card_available(c)) - { - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)s); - settings_list_to_network[d] = c; - d++; - } - - c++; - } - SendMessage(h, CB_SETCURSEL, settings_network_to_list[network_card_current], 0); - - h=GetDlgItem(hdlg, IDC_CHECK3); - SendMessage(h, BM_SETCHECK, GAMEBLASTER, 0); - - h=GetDlgItem(hdlg, IDC_CHECKGUS); - SendMessage(h, BM_SETCHECK, GUS, 0); - - h=GetDlgItem(hdlg, IDC_CHECKSSI); - SendMessage(h, BM_SETCHECK, SSI2001, 0); - - h=GetDlgItem(hdlg, IDC_CHECKSYNC); - SendMessage(h, BM_SETCHECK, enable_sync, 0); - - h=GetDlgItem(hdlg, IDC_CHECKVOODOO); - SendMessage(h, BM_SETCHECK, voodoo_enabled, 0); - - h=GetDlgItem(hdlg, IDC_CHECKBUSLOGIC); - SendMessage(h, BM_SETCHECK, buslogic_enabled, 0); - - cpu_flags = models[romstomodel[romset]].cpu[cpu_manufacturer].cpus[cpu].cpu_flags; - h=GetDlgItem(hdlg, IDC_CHECKDYNAREC); - if (!(cpu_flags & CPU_SUPPORTS_DYNAREC) || (cpu_flags & CPU_REQUIRES_DYNAREC)) - EnableWindow(h, FALSE); - else - EnableWindow(h, TRUE); - SendMessage(h, BM_SETCHECK, ((cpu_flags & CPU_SUPPORTS_DYNAREC) && cpu_use_dynarec) || (cpu_flags & CPU_REQUIRES_DYNAREC), 0); - - h=GetDlgItem(hdlg, IDC_CHECKXTIDE); - SendMessage(h, BM_SETCHECK, enable_xtide, 0); - - h=GetDlgItem(hdlg, IDC_CHECKFPU); - SendMessage(h, BM_SETCHECK, enable_external_fpu, 0); - - h = GetDlgItem(hdlg, IDC_COMBOSPD); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"8-bit"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Slow 16-bit"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Fast 16-bit"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Slow VLB/PCI"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Mid VLB/PCI"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Fast VLB/PCI"); - SendMessage(h, CB_SETCURSEL, video_speed, 0); - - h = GetDlgItem(hdlg, IDC_MEMSPIN); - SendMessage(h, UDM_SETBUDDY, (WPARAM)GetDlgItem(hdlg, IDC_MEMTEXT), 0); - SendMessage(h, UDM_SETRANGE, 0, (models[romstomodel[romset]].min_ram << 16) | models[romstomodel[romset]].max_ram); - accel.nSec = 0; - accel.nInc = models[model].ram_granularity; - SendMessage(h, UDM_SETACCEL, 1, (LPARAM)&accel); - if (!(models[model].flags & MODEL_AT)) - SendMessage(h, UDM_SETPOS, 0, mem_size); - else - SendMessage(h, UDM_SETPOS, 0, mem_size / 1024); - - h = GetDlgItem(hdlg, IDC_CONFIGUREMOD); - if (model_getdevice(model)) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); - - h = GetDlgItem(hdlg, IDC_CONFIGUREVID); - if (video_card_has_config(video_old_to_new(gfxcard))) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); - - h = GetDlgItem(hdlg, IDC_CONFIGURESND); - if (sound_card_has_config(sound_card_current)) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); - - h = GetDlgItem(hdlg, IDC_CONFIGURENET); - if (network_card_has_config(network_card_current)) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); - - h = GetDlgItem(hdlg, IDC_COMBODR1); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"None"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"5.25\" 360k"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"5.25\" 1.2M"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"5.25\" 1.2M Dual RPM"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"3.5\" 720k"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"3.5\" 1.44M PS/2"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"3.5\" 1.44M"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"3.5\" 1.25M PC-98"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"3.5\" 1.44M 3-Mode"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"3.5\" 2.88M"); - SendMessage(h, CB_SETCURSEL, fdd_get_type(0), 0); - h = GetDlgItem(hdlg, IDC_COMBODR2); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"None"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"5.25\" 360k"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"5.25\" 1.2M"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"5.25\" 1.2M Dual RPM"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"3.5\" 720k"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"3.5\" 1.44M PS/2"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"3.5\" 1.44M"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"3.5\" 1.25M PC-98"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"3.5\" 1.44M 3-Mode"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"3.5\" 2.88M"); - SendMessage(h, CB_SETCURSEL, fdd_get_type(1), 0); - h = GetDlgItem(hdlg, IDC_COMBODR3); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"None"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"5.25\" 360k"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"5.25\" 1.2M"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"5.25\" 1.2M Dual RPM"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"3.5\" 720k"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"3.5\" 1.44M PS/2"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"3.5\" 1.44M"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"3.5\" 1.25M PC-98"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"3.5\" 1.44M 3-Mode"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"3.5\" 2.88M"); - SendMessage(h, CB_SETCURSEL, fdd_get_type(2), 0); - h = GetDlgItem(hdlg, IDC_COMBODR4); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"None"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"5.25\" 360k"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"5.25\" 1.2M"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"5.25\" 1.2M Dual RPM"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"3.5\" 720k"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"3.5\" 1.44M PS/2"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"3.5\" 1.44M"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"3.5\" 1.25M PC-98"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"3.5\" 1.44M 3-Mode"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"3.5\" 2.88M"); - SendMessage(h, CB_SETCURSEL, fdd_get_type(3), 0); - - h = GetDlgItem(hdlg, IDC_TEXT_MB); - if (models[model].flags & MODEL_AT) - SendMessage(h, WM_SETTEXT, 0, (LPARAM)(LPCSTR)"MB"); - else - SendMessage(h, WM_SETTEXT, 0, (LPARAM)(LPCSTR)"KB"); - - h = GetDlgItem(hdlg, IDC_COMBOJOY); - c = 0; - while (joystick_get_name(c)) - { - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)joystick_get_name(c)); - c++; - } - EnableWindow(h, TRUE); - SendMessage(h, CB_SETCURSEL, joystick_type, 0); - - h = GetDlgItem(hdlg, IDC_JOY1); - EnableWindow(h, (joystick_get_max_joysticks(joystick_type) >= 1) ? TRUE : FALSE); - h = GetDlgItem(hdlg, IDC_JOY2); - EnableWindow(h, (joystick_get_max_joysticks(joystick_type) >= 2) ? TRUE : FALSE); - h = GetDlgItem(hdlg, IDC_JOY3); - EnableWindow(h, (joystick_get_max_joysticks(joystick_type) >= 3) ? TRUE : FALSE); - h = GetDlgItem(hdlg, IDC_JOY4); - EnableWindow(h, (joystick_get_max_joysticks(joystick_type) >= 4) ? TRUE : FALSE); - - h = GetDlgItem(hdlg, IDC_COMBOWS); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"System default"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"0 W/S"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"1 W/S"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"2 W/S"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"3 W/S"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"4 W/S"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"5 W/S"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"6 W/S"); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"7 W/S"); - SendMessage(h, CB_SETCURSEL, cpu_waitstates, 0); - cpu_type = models[romstomodel[romset]].cpu[cpu_manufacturer].cpus[cpu].cpu_type; - if ((cpu_type >= CPU_286) && (cpu_type <= CPU_386DX)) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); - - h = GetDlgItem(hdlg, IDC_COMBOMOUSE); - c = d = 0; - while (1) - { - char *s = mouse_get_name(c); - int type; - - if (!s) - break; - - type = mouse_get_type(c); - - settings_mouse_to_list[c] = d; - - if (mouse_valid(type, model)) - { - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)s); - - settings_list_to_mouse[d] = c; - d++; - } - c++; - } - - SendMessage(h, CB_SETCURSEL, settings_mouse_to_list[mouse_type], 0); - - recalc_hdd_list(hdlg, romstomodel[romset], 0); - - return TRUE; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case IDOK: - h = GetDlgItem(hdlg, IDC_COMBO1); - temp_model = listtomodel[SendMessage(h, CB_GETCURSEL, 0, 0)]; - - h = GetDlgItem(hdlg, IDC_MEMTEXT); - SendMessage(h, WM_GETTEXT, 255, (LPARAM)temp_str); - sscanf(temp_str, "%i", &mem); - mem &= ~(models[temp_model].ram_granularity - 1); - if (mem < models[temp_model].min_ram) - mem = models[temp_model].min_ram; - else if (mem > models[temp_model].max_ram) - mem = models[temp_model].max_ram; - if (models[temp_model].flags & MODEL_AT) - mem *= 1024; - - h = GetDlgItem(hdlg, IDC_COMBOVID); - SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM)temp_str); - gfx = video_new_to_old(video_card_getid(temp_str)); - - h = GetDlgItem(hdlg, IDC_COMBOCPUM); - temp_cpu_m = SendMessage(h, CB_GETCURSEL, 0, 0); - h = GetDlgItem(hdlg, IDC_COMBO3); - temp_cpu = SendMessage(h, CB_GETCURSEL, 0, 0); - fpu = (models[temp_model].cpu[temp_cpu_m].cpus[temp_cpu].cpu_type >= CPU_i486DX) ? 1 : 0; - - h = GetDlgItem(hdlg, IDC_CHECK3); - temp_GAMEBLASTER = SendMessage(h, BM_GETCHECK, 0, 0); - - h = GetDlgItem(hdlg, IDC_CHECKGUS); - temp_GUS = SendMessage(h, BM_GETCHECK, 0, 0); - - h = GetDlgItem(hdlg, IDC_CHECKSSI); - temp_SSI2001 = SendMessage(h, BM_GETCHECK, 0, 0); - - h = GetDlgItem(hdlg, IDC_CHECKSYNC); - enable_sync = SendMessage(h, BM_GETCHECK, 0, 0); - - h = GetDlgItem(hdlg, IDC_CHECKVOODOO); - temp_voodoo = SendMessage(h, BM_GETCHECK, 0, 0); - - h = GetDlgItem(hdlg, IDC_CHECKBUSLOGIC); - temp_buslogic = SendMessage(h, BM_GETCHECK, 0, 0); - - h = GetDlgItem(hdlg, IDC_COMBOSND); - temp_sound_card_current = settings_list_to_sound[SendMessage(h, CB_GETCURSEL, 0, 0)]; - - h = GetDlgItem(hdlg, IDC_CHECKDYNAREC); - temp_dynarec = SendMessage(h, BM_GETCHECK, 0, 0); - - h = GetDlgItem(hdlg, IDC_CHECKXTIDE); - temp_xtide = SendMessage(h, BM_GETCHECK, 0, 0); - - h = GetDlgItem(hdlg, IDC_CHECKFPU); - temp_fpu = SendMessage(h, BM_GETCHECK, 0, 0); - - h = GetDlgItem(hdlg, IDC_COMBONET); - temp_network_card_current = settings_list_to_network[SendMessage(h, CB_GETCURSEL, 0, 0)]; - - h = GetDlgItem(hdlg, IDC_COMBODR1); - temp_fd1_type = SendMessage(h, CB_GETCURSEL, 0, 0); - h = GetDlgItem(hdlg, IDC_COMBODR2); - temp_fd2_type = SendMessage(h, CB_GETCURSEL, 0, 0); - h = GetDlgItem(hdlg, IDC_COMBODR3); - temp_fd3_type = SendMessage(h, CB_GETCURSEL, 0, 0); - h = GetDlgItem(hdlg, IDC_COMBODR4); - temp_fd4_type = SendMessage(h, CB_GETCURSEL, 0, 0); - - h = GetDlgItem(hdlg, IDC_COMBOJOY); - temp_joystick_type = SendMessage(h, CB_GETCURSEL, 0, 0); - h = GetDlgItem(hdlg, IDC_COMBOMOUSE); - temp_mouse_type = settings_list_to_mouse[SendMessage(h, CB_GETCURSEL, 0, 0)]; - - h = GetDlgItem(hdlg, IDC_COMBOHDD); - c = SendMessage(h, CB_GETCURSEL, 0, 0); - - if (temp_model != model || gfx != gfxcard || mem != mem_size || temp_cpu != cpu || temp_cpu_m != cpu_manufacturer || - fpu != hasfpu || temp_GAMEBLASTER != GAMEBLASTER || temp_GUS != GUS || temp_fpu != enable_external_fpu || - temp_SSI2001 != SSI2001 || temp_sound_card_current != sound_card_current || temp_xtide != enable_xtide || - temp_voodoo != voodoo_enabled || temp_buslogic != buslogic_enabled || temp_dynarec != cpu_use_dynarec || temp_mouse_type != mouse_type || - temp_fd1_type != fdd_get_type(0) || temp_fd2_type != fdd_get_type(1) || temp_fd3_type != fdd_get_type(2) || temp_fd4_type != fdd_get_type(3) || - temp_network_card_current != network_card_current || strncmp(hdd_names[c], hdd_controller_name, sizeof(hdd_controller_name)-1)) - { - if (MessageBox(NULL,"This will reset 86Box!\nOkay to continue?","86Box",MB_OKCANCEL)==IDOK) - { - savenvr(); - model = temp_model; - romset = model_getromset(); - gfxcard = gfx; - mem_size = mem; - cpu_manufacturer = temp_cpu_m; - cpu = temp_cpu; - GAMEBLASTER = temp_GAMEBLASTER; - GUS = temp_GUS; - SSI2001 = temp_SSI2001; - sound_card_current = temp_sound_card_current; - voodoo_enabled = temp_voodoo; - buslogic_enabled = temp_buslogic; - cpu_use_dynarec = temp_dynarec; - mouse_type = temp_mouse_type; - enable_xtide = temp_xtide; - enable_external_fpu = temp_fpu; - - fdd_set_type(0, temp_fd1_type); - fdd_set_type(1, temp_fd2_type); - fdd_set_type(2, temp_fd3_type); - fdd_set_type(3, temp_fd4_type); - - network_card_current = temp_network_card_current; - - if (hdd_names[c]) - strncpy(hdd_controller_name, hdd_names[c], sizeof(hdd_controller_name)-1); - else - strcpy(hdd_controller_name, "none"); - - mem_resize(); - loadbios(); - resetpchard(); - } - else - { - EndDialog(hdlg, 0); - pause = 0; - return TRUE; - } - } - - h = GetDlgItem(hdlg, IDC_COMBOSPD); - video_speed = SendMessage(h, CB_GETCURSEL, 0, 0); - - cpu_manufacturer = temp_cpu_m; - cpu = temp_cpu; - cpu_set(); - - h = GetDlgItem(hdlg, IDC_COMBOWS); - cpu_waitstates = SendMessage(h, CB_GETCURSEL, 0, 0); - cpu_update_waitstates(); - - saveconfig(); - - speedchanged(); - - joystick_type = temp_joystick_type; - if (joystick_type != 7) gameport_update_joystick_type(); - - case IDCANCEL: - EndDialog(hdlg, 0); - pause=0; - return TRUE; - case IDC_COMBO1: - if (HIWORD(wParam) == CBN_SELCHANGE) - { - h = GetDlgItem(hdlg,IDC_COMBO1); - temp_model = listtomodel[SendMessage(h,CB_GETCURSEL,0,0)]; - - /*Enable/disable gfxcard list*/ - h = GetDlgItem(hdlg, IDC_COMBOVID); - if (!models[temp_model].fixed_gfxcard) - { - char *s = video_card_getname(video_old_to_new(gfxcard)); - - EnableWindow(h, TRUE); - - c = 0; - while (1) - { - SendMessage(h, CB_GETLBTEXT, c, (LPARAM)temp_str); - if (!strcmp(temp_str, s)) - break; - c++; - } - SendMessage(h, CB_SETCURSEL, c, 0); - } - else - EnableWindow(h, FALSE); - - /*Rebuild manufacturer list*/ - h = GetDlgItem(hdlg, IDC_COMBOCPUM); - temp_cpu_m = SendMessage(h, CB_GETCURSEL, 0, 0); - SendMessage(h, CB_RESETCONTENT, 0, 0); - c = 0; - while (models[temp_model].cpu[c].cpus != NULL && c < 4) - { - SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)models[temp_model].cpu[c].name); - c++; - } - if (temp_cpu_m >= c) temp_cpu_m = c - 1; - SendMessage(h, CB_SETCURSEL, temp_cpu_m, 0); - if (c == 1) EnableWindow(h, FALSE); - else EnableWindow(h, TRUE); - - /*Rebuild CPU list*/ - h = GetDlgItem(hdlg, IDC_COMBO3); - temp_cpu = SendMessage(h, CB_GETCURSEL, 0, 0); - SendMessage(h, CB_RESETCONTENT, 0, 0); - c = 0; - while (models[temp_model].cpu[temp_cpu_m].cpus[c].cpu_type != -1) - { - SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)models[temp_model].cpu[temp_cpu_m].cpus[c].name); - c++; - } - if (temp_cpu >= c) temp_cpu = c - 1; - SendMessage(h, CB_SETCURSEL, temp_cpu, 0); - - h = GetDlgItem(hdlg, IDC_CHECKDYNAREC); - temp_dynarec = SendMessage(h, BM_GETCHECK, 0, 0); - - cpu_flags = models[temp_model].cpu[temp_cpu_m].cpus[temp_cpu].cpu_flags; - h=GetDlgItem(hdlg, IDC_CHECKDYNAREC); - if (!(cpu_flags & CPU_SUPPORTS_DYNAREC) || (cpu_flags & CPU_REQUIRES_DYNAREC)) - EnableWindow(h, FALSE); - else - EnableWindow(h, TRUE); - SendMessage(h, BM_SETCHECK, ((cpu_flags & CPU_SUPPORTS_DYNAREC) && temp_dynarec) || (cpu_flags & CPU_REQUIRES_DYNAREC), 0); - - h = GetDlgItem(hdlg, IDC_TEXT_MB); - if (models[temp_model].flags & MODEL_AT) - SendMessage(h, WM_SETTEXT, 0, (LPARAM)(LPCSTR)"MB"); - else - SendMessage(h, WM_SETTEXT, 0, (LPARAM)(LPCSTR)"KB"); - - h = GetDlgItem(hdlg, IDC_MEMTEXT); - SendMessage(h, WM_GETTEXT, 255, (LPARAM)temp_str); - sscanf(temp_str, "%i", &mem); - - h = GetDlgItem(hdlg, IDC_MEMSPIN); - SendMessage(h, UDM_SETRANGE, 0, (models[temp_model].min_ram << 16) | models[temp_model].max_ram); - mem &= ~(models[temp_model].ram_granularity - 1); - if (mem < models[temp_model].min_ram) - mem = models[temp_model].min_ram; - else if (mem > models[temp_model].max_ram) - mem = models[temp_model].max_ram; - SendMessage(h, UDM_SETPOS, 0, mem); - accel.nSec = 0; - accel.nInc = models[temp_model].ram_granularity; - SendMessage(h, UDM_SETACCEL, 1, (LPARAM)&accel); - - h = GetDlgItem(hdlg, IDC_COMBOWS); - cpu_type = models[temp_model].cpu[temp_cpu_m].cpus[temp_cpu].cpu_type; - if (cpu_type >= CPU_286 && cpu_type <= CPU_386DX) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); - - h = GetDlgItem(hdlg, IDC_CONFIGUREMOD); - if (model_getdevice(temp_model)) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); - - h = GetDlgItem(hdlg, IDC_COMBOMOUSE); - temp_mouse_type = settings_list_to_mouse[SendMessage(h, CB_GETCURSEL, 0, 0)]; - SendMessage(h, CB_RESETCONTENT, 0, 0); - c = d = 0; - while (1) - { - char *s = mouse_get_name(c); - int type; - - if (!s) - break; - - type = mouse_get_type(c); - settings_mouse_to_list[c] = d; - - if (mouse_valid(type, temp_model)) - { - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)s); - - settings_list_to_mouse[d] = c; - d++; - } - - c++; - } - if (mouse_valid(temp_mouse_type, temp_model)) - SendMessage(h, CB_SETCURSEL, settings_mouse_to_list[temp_mouse_type], 0); - else - SendMessage(h, CB_SETCURSEL, 0, 0); - - recalc_hdd_list(hdlg, temp_model, 1); - } - break; - case IDC_COMBOCPUM: - if (HIWORD(wParam) == CBN_SELCHANGE) - { - h = GetDlgItem(hdlg, IDC_COMBO1); - temp_model = listtomodel[SendMessage(h, CB_GETCURSEL, 0, 0)]; - h = GetDlgItem(hdlg, IDC_COMBOCPUM); - temp_cpu_m = SendMessage(h, CB_GETCURSEL, 0, 0); - - /*Rebuild CPU list*/ - h=GetDlgItem(hdlg, IDC_COMBO3); - temp_cpu = SendMessage(h, CB_GETCURSEL, 0, 0); - SendMessage(h, CB_RESETCONTENT, 0, 0); - c = 0; - while (models[temp_model].cpu[temp_cpu_m].cpus[c].cpu_type != -1) - { - SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)models[temp_model].cpu[temp_cpu_m].cpus[c].name); - c++; - } - if (temp_cpu >= c) temp_cpu = c - 1; - SendMessage(h, CB_SETCURSEL, temp_cpu, 0); - - h = GetDlgItem(hdlg, IDC_CHECKDYNAREC); - temp_dynarec = SendMessage(h, BM_GETCHECK, 0, 0); - - cpu_flags = models[temp_model].cpu[temp_cpu_m].cpus[temp_cpu].cpu_flags; - h=GetDlgItem(hdlg, IDC_CHECKDYNAREC); - if (!(cpu_flags & CPU_SUPPORTS_DYNAREC) || (cpu_flags & CPU_REQUIRES_DYNAREC)) - EnableWindow(h, FALSE); - else - EnableWindow(h, TRUE); - SendMessage(h, BM_SETCHECK, ((cpu_flags & CPU_SUPPORTS_DYNAREC) && temp_dynarec) || (cpu_flags & CPU_REQUIRES_DYNAREC), 0); - - h = GetDlgItem(hdlg, IDC_COMBOWS); - cpu_type = models[temp_model].cpu[temp_cpu_m].cpus[temp_cpu].cpu_type; - if (cpu_type >= CPU_286 && cpu_type <= CPU_386DX) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); - - } - break; - case IDC_COMBO3: - if (HIWORD(wParam) == CBN_SELCHANGE) - { - h = GetDlgItem(hdlg, IDC_COMBO1); - temp_model = listtomodel[SendMessage(h, CB_GETCURSEL, 0, 0)]; - h = GetDlgItem(hdlg, IDC_COMBOCPUM); - temp_cpu_m = SendMessage(h, CB_GETCURSEL, 0, 0); - h=GetDlgItem(hdlg, IDC_COMBO3); - temp_cpu = SendMessage(h, CB_GETCURSEL, 0, 0); - - h = GetDlgItem(hdlg, IDC_CHECKDYNAREC); - temp_dynarec = SendMessage(h, BM_GETCHECK, 0, 0); - - cpu_flags = models[temp_model].cpu[temp_cpu_m].cpus[temp_cpu].cpu_flags; - h=GetDlgItem(hdlg, IDC_CHECKDYNAREC); - if (!(cpu_flags & CPU_SUPPORTS_DYNAREC) || (cpu_flags & CPU_REQUIRES_DYNAREC)) - EnableWindow(h, FALSE); - else - EnableWindow(h, TRUE); - SendMessage(h, BM_SETCHECK, ((cpu_flags & CPU_SUPPORTS_DYNAREC) && temp_dynarec) || (cpu_flags & CPU_REQUIRES_DYNAREC), 0); - - h = GetDlgItem(hdlg, IDC_COMBOWS); - cpu_type = models[temp_model].cpu[temp_cpu_m].cpus[temp_cpu].cpu_type; - if (cpu_type >= CPU_286 && cpu_type <= CPU_386DX) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); - } - break; - - case IDC_CONFIGUREMOD: - h = GetDlgItem(hdlg, IDC_COMBO1); - temp_model = listtomodel[SendMessage(h, CB_GETCURSEL, 0, 0)]; - - deviceconfig_open(hdlg, (void *)model_getdevice(temp_model)); - break; - - case IDC_CONFIGUREVID: - h = GetDlgItem(hdlg, IDC_COMBOVID); - SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM)temp_str); - - deviceconfig_open(hdlg, (void *)video_card_getdevice(video_card_getid(temp_str))); - break; - - case IDC_COMBOVID: - h = GetDlgItem(hdlg, IDC_COMBOVID); - SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM)temp_str); - gfx = video_card_getid(temp_str); - - h = GetDlgItem(hdlg, IDC_CONFIGUREVID); - if (video_card_has_config(gfx)) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); - break; - - case IDC_CONFIGURESND: - h = GetDlgItem(hdlg, IDC_COMBOSND); - temp_sound_card_current = settings_list_to_sound[SendMessage(h, CB_GETCURSEL, 0, 0)]; - - deviceconfig_open(hdlg, (void *)sound_card_getdevice(temp_sound_card_current)); - break; - - case IDC_COMBOSND: - h = GetDlgItem(hdlg, IDC_COMBOSND); - temp_sound_card_current = settings_list_to_sound[SendMessage(h, CB_GETCURSEL, 0, 0)]; - - h = GetDlgItem(hdlg, IDC_CONFIGURESND); - if (sound_card_has_config(temp_sound_card_current)) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); - break; - - case IDC_CONFIGURENET: - h = GetDlgItem(hdlg, IDC_COMBONET); - temp_network_card_current = settings_list_to_network[SendMessage(h, CB_GETCURSEL, 0, 0)]; - - deviceconfig_open(hdlg, (void *)network_card_getdevice(temp_network_card_current)); - break; - - case IDC_COMBONET: - h = GetDlgItem(hdlg, IDC_COMBONET); - temp_network_card_current = settings_list_to_network[SendMessage(h, CB_GETCURSEL, 0, 0)]; - - h = GetDlgItem(hdlg, IDC_CONFIGURENET); - if (network_card_has_config(temp_network_card_current)) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); - break; - - case IDC_CONFIGUREVOODOO: - deviceconfig_open(hdlg, (void *)&voodoo_device); - break; - - case IDC_CONFIGUREBUSLOGIC: - deviceconfig_open(hdlg, (void *)&BuslogicDevice); - break; - - case IDC_COMBOJOY: - if (HIWORD(wParam) == CBN_SELCHANGE) - { - h = GetDlgItem(hdlg, IDC_COMBOJOY); - temp_joystick_type = SendMessage(h, CB_GETCURSEL, 0, 0); - - h = GetDlgItem(hdlg, IDC_JOY1); - EnableWindow(h, (joystick_get_max_joysticks(temp_joystick_type) >= 1) ? TRUE : FALSE); - h = GetDlgItem(hdlg, IDC_JOY2); - EnableWindow(h, (joystick_get_max_joysticks(temp_joystick_type) >= 2) ? TRUE : FALSE); - h = GetDlgItem(hdlg, IDC_JOY3); - EnableWindow(h, (joystick_get_max_joysticks(temp_joystick_type) >= 3) ? TRUE : FALSE); - h = GetDlgItem(hdlg, IDC_JOY4); - EnableWindow(h, (joystick_get_max_joysticks(temp_joystick_type) >= 4) ? TRUE : FALSE); - } - break; - - case IDC_JOY1: - h = GetDlgItem(hdlg, IDC_COMBOJOY); - temp_joystick_type = SendMessage(h, CB_GETCURSEL, 0, 0); - joystickconfig_open(hdlg, 0, temp_joystick_type); - break; - case IDC_JOY2: - h = GetDlgItem(hdlg, IDC_COMBOJOY); - temp_joystick_type = SendMessage(h, CB_GETCURSEL, 0, 0); - joystickconfig_open(hdlg, 1, temp_joystick_type); - break; - case IDC_JOY3: - h = GetDlgItem(hdlg, IDC_COMBOJOY); - temp_joystick_type = SendMessage(h, CB_GETCURSEL, 0, 0); - joystickconfig_open(hdlg, 2, temp_joystick_type); - break; - case IDC_JOY4: - h = GetDlgItem(hdlg, IDC_COMBOJOY); - temp_joystick_type = SendMessage(h, CB_GETCURSEL, 0, 0); - joystickconfig_open(hdlg, 3, temp_joystick_type); - break; - } - break; - } - return FALSE; -} - -void config_open(HWND hwnd) -{ - DialogBox(hinstance, TEXT("ConfigureDlg"), hwnd, config_dlgproc); -} diff --git a/src/win-d3d-fs.cc b/src/win-d3d-fs.cc index 6a4c2acbb..b3378e1e6 100644 --- a/src/win-d3d-fs.cc +++ b/src/win-d3d-fs.cc @@ -8,7 +8,7 @@ #undef BITMAP #include #include "86box.h" -#include "resources.h" +#include "resource.h" #include "video.h" #include "win-d3d-fs.h" #include "win.h" @@ -210,12 +210,10 @@ static void d3d_fs_close_objects() static void d3d_fs_init_objects() { - HRESULT hr; D3DLOCKED_RECT dr; - int y; RECT r; - hr = d3ddev->CreateVertexBuffer(6*sizeof(CUSTOMVERTEX), + d3ddev->CreateVertexBuffer(6*sizeof(CUSTOMVERTEX), 0, D3DFVF_XYZRHW | D3DFVF_TEX1, D3DPOOL_MANAGED, @@ -373,11 +371,10 @@ static void d3d_fs_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h) VOID* pVoid; D3DLOCKED_RECT dr; RECT window_rect; - uint32_t *p, *src; int yy; double l, t, r, b; - if (y1 == y2) + if ((y1 == y2) || (d3dTexture == NULL)) { video_blit_complete(); return; /*Nothing to do*/ @@ -396,7 +393,7 @@ static void d3d_fs_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h) fatal("LockRect failed\n"); for (yy = y1; yy < y2; yy++) - memcpy(dr.pBits + ((yy - y1) * dr.Pitch), &(((uint32_t *)buffer32->line[yy + y])[x]), w * 4); + memcpy((uint32_t *) &(((uint8_t *) dr.pBits)[(yy - y1) * dr.Pitch]), (uint32_t *) &(buffer32->line[yy + y][x]), w * 4); video_blit_complete(); d3dTexture->UnlockRect(0); @@ -472,11 +469,11 @@ static void d3d_fs_blit_memtoscreen_8(int x, int y, int w, int h) VOID* pVoid; D3DLOCKED_RECT dr; RECT window_rect; - uint32_t *p, *src; + uint32_t *p; int xx, yy; double l, t, r, b; - if (!h) + if (!h || (d3dTexture == NULL)) { video_blit_complete(); return; /*Nothing to do*/ @@ -496,7 +493,7 @@ static void d3d_fs_blit_memtoscreen_8(int x, int y, int w, int h) for (yy = 0; yy < h; yy++) { - uint32_t *p = (uint32_t *)(dr.pBits + (yy * dr.Pitch)); + p = (uint32_t *) &(((uint8_t *) dr.pBits)[yy * dr.Pitch]); if ((y + yy) >= 0 && (y + yy) < buffer->h) { for (xx = 0; xx < w; xx++) @@ -575,13 +572,12 @@ static void d3d_fs_blit_memtoscreen_8(int x, int y, int w, int h) void d3d_fs_take_screenshot(char *fn) { - HRESULT hr = D3D_OK; LPDIRECT3DSURFACE9 d3dSurface = NULL; if (!d3dTexture) return; - hr = d3ddev->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &d3dSurface); - hr = D3DXSaveSurfaceToFile(fn, D3DXIFF_PNG, d3dSurface, NULL, NULL); + d3ddev->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &d3dSurface); + D3DXSaveSurfaceToFile(fn, D3DXIFF_PNG, d3dSurface, NULL, NULL); d3dSurface->Release(); d3dSurface = NULL; diff --git a/src/win-d3d.cc b/src/win-d3d.cc index 03292c61a..561873c58 100644 --- a/src/win-d3d.cc +++ b/src/win-d3d.cc @@ -6,7 +6,7 @@ #include #undef BITMAP #include -#include "resources.h" +#include "resource.h" #include "win-d3d.h" #include "video.h" #include "win-cgapal.h" @@ -49,7 +49,6 @@ static CUSTOMVERTEX d3d_verts[] = int d3d_init(HWND h) { - int c; HRESULT hr; cgapal_rebuild(); @@ -108,12 +107,10 @@ void d3d_close_objects() void d3d_init_objects() { - HRESULT hr; D3DLOCKED_RECT dr; - int y; RECT r; - hr = d3ddev->CreateVertexBuffer(6*sizeof(CUSTOMVERTEX), + d3ddev->CreateVertexBuffer(6*sizeof(CUSTOMVERTEX), 0, D3DFVF_XYZRHW | D3DFVF_TEX1, D3DPOOL_MANAGED, @@ -146,8 +143,6 @@ void d3d_init_objects() void d3d_resize(int x, int y) { - HRESULT hr; - d3dpp.BackBufferWidth = x; d3dpp.BackBufferHeight = y; @@ -219,13 +214,12 @@ void d3d_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h) VOID* pVoid; D3DLOCKED_RECT dr; RECT r; - uint32_t *p, *src; int yy; - if (y1 == y2) - { + if ((w <= 0) || (w > 2048) || (h <= 0) || (h > 2048) || (y1 == y2) || (y1 < 0) || (y1 > 2048) || (y2 < 0) || (y2 > 2048) || (d3dTexture == NULL)) + { video_blit_complete(); - return; /*Nothing to do*/ + return; /*Nothing to do*/ } r.top = y1; @@ -239,7 +233,7 @@ void d3d_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h) fatal("LockRect failed\n"); for (yy = y1; yy < y2; yy++) - memcpy(dr.pBits + ((yy - y1) * dr.Pitch), &(((uint32_t *)buffer32->line[yy + y])[x]), w * 4); + memcpy((uint32_t *) &(((uint8_t *) dr.pBits)[(yy - y1) * dr.Pitch]), &(((uint32_t *)buffer32->line[yy + y])[x]), w * 4); video_blit_complete(); d3dTexture->UnlockRect(0); @@ -301,11 +295,11 @@ void d3d_blit_memtoscreen_8(int x, int y, int w, int h) VOID* pVoid; D3DLOCKED_RECT dr; RECT r; - uint32_t *p, *src; + uint32_t *p; int yy, xx; HRESULT hr = D3D_OK; - if (h == 0) + if ((w <= 0) || (w > 2048) || (h <= 0) || (h > 2048) || (d3dTexture == NULL)) { video_blit_complete(); return; /*Nothing to do*/ @@ -320,10 +314,10 @@ void d3d_blit_memtoscreen_8(int x, int y, int w, int h) { if (FAILED(d3dTexture->LockRect(0, &dr, &r, 0))) fatal("LockRect failed\n"); - + for (yy = 0; yy < h; yy++) { - uint32_t *p = (uint32_t *)(dr.pBits + (yy * dr.Pitch)); + p = (uint32_t *) &((((uint8_t *) dr.pBits)[yy * dr.Pitch])); if ((y + yy) >= 0 && (y + yy) < buffer->h) { for (xx = 0; xx < w; xx++) @@ -388,13 +382,12 @@ void d3d_blit_memtoscreen_8(int x, int y, int w, int h) void d3d_take_screenshot(char *fn) { - HRESULT hr = D3D_OK; LPDIRECT3DSURFACE9 d3dSurface = NULL; if (!d3dTexture) return; - hr = d3ddev->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &d3dSurface); - hr = D3DXSaveSurfaceToFile(fn, D3DXIFF_PNG, d3dSurface, NULL, NULL); + d3ddev->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &d3dSurface); + D3DXSaveSurfaceToFile(fn, D3DXIFF_PNG, d3dSurface, NULL, NULL); d3dSurface->Release(); d3dSurface = NULL; diff --git a/src/win-ddraw-fs.cc b/src/win-ddraw-fs.cc index b64447b51..9c7bedbb0 100644 --- a/src/win-ddraw-fs.cc +++ b/src/win-ddraw-fs.cc @@ -36,8 +36,6 @@ static int ddraw_w, ddraw_h; int ddraw_fs_init(HWND h) { - int c; - ddraw_w = GetSystemMetrics(SM_CXSCREEN); ddraw_h = GetSystemMetrics(SM_CYSCREEN); @@ -180,6 +178,12 @@ static void ddraw_fs_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h HRESULT hr; DDBLTFX ddbltfx; + if (lpdds_back == NULL) + { + video_blit_complete(); + return; /*Nothing to do*/ + } + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); @@ -197,7 +201,7 @@ static void ddraw_fs_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h } for (yy = y1; yy < y2; yy++) { - if ((y + yy) >= 0) memcpy((unsigned char*)ddsd.lpSurface + (yy * ddsd.lPitch), &(((uint32_t *)buffer32->line[y + yy])[x]), w * 4); + if ((y + yy) >= 0) memcpy((unsigned char*)ddsd.lpSurface + (yy * ddsd.lPitch), ((uint32_t *) &(((uint8_t *)buffer32->line[y + yy]))[x]), w * 4); } video_blit_complete(); lpdds_back->Unlock(NULL); @@ -253,6 +257,12 @@ static void ddraw_fs_blit_memtoscreen_8(int x, int y, int w, int h) HRESULT hr; DDBLTFX ddbltfx; + if (lpdds_back == NULL) + { + video_blit_complete(); + return; /*Nothing to do*/ + } + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); @@ -273,7 +283,7 @@ static void ddraw_fs_blit_memtoscreen_8(int x, int y, int w, int h) { if ((y + yy) >= 0 && (y + yy) < buffer->h) { - uint32_t *p = (uint32_t *)(ddsd.lpSurface + (yy * ddsd.lPitch)); + uint32_t *p = (uint32_t *) &(((uint8_t *) ddsd.lpSurface)[yy * ddsd.lPitch]); for (xx = 0; xx < w; xx++) { p[xx] = pal_lookup[buffer->line[y + yy][x + xx]]; diff --git a/src/win-ddraw-screenshot.cc b/src/win-ddraw-screenshot.cc index 353b00705..55c2ff730 100644 --- a/src/win-ddraw-screenshot.cc +++ b/src/win-ddraw-screenshot.cc @@ -122,7 +122,7 @@ void SaveBitmap(char *szFilename,HBITMAP hBitmap) bmpFileHeader.bfSize=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)+bmpInfo.bmiHeader.biSizeImage; - bmpFileHeader.bfType='MB'; + bmpFileHeader.bfType=0x4D42; bmpFileHeader.bfOffBits=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER); diff --git a/src/win-ddraw.cc b/src/win-ddraw.cc index 6b7ca19e9..347c6a752 100644 --- a/src/win-ddraw.cc +++ b/src/win-ddraw.cc @@ -36,8 +36,6 @@ static HWND ddraw_hwnd; int ddraw_init(HWND h) { - int c; - cgapal_rebuild(); if (FAILED(DirectDrawCreate(NULL, &lpdd, NULL))) @@ -136,6 +134,12 @@ static void ddraw_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h) HRESULT hr; // pclog("Blit memtoscreen %i,%i %i %i %i,%i\n", x, y, y1, y2, w, h); + if (lpdds_back == NULL) + { + video_blit_complete(); + return; /*Nothing to do*/ + } + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); @@ -154,7 +158,7 @@ static void ddraw_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h) for (yy = y1; yy < y2; yy++) { if ((y + yy) >= 0 && (y + yy) < buffer->h) - memcpy(ddsd.lpSurface + (yy * ddsd.lPitch), &(((uint32_t *)buffer32->line[y + yy])[x]), w * 4); + memcpy((uint32_t *) &(((uint8_t *) ddsd.lpSurface)[yy * ddsd.lPitch]), &(((uint32_t *)buffer32->line[y + yy])[x]), w * 4); } video_blit_complete(); lpdds_back->Unlock(NULL); @@ -180,6 +184,7 @@ static void ddraw_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h) if (readflash) { readflash = 0; +#ifdef LEGACY_READ_FLASH if (enable_flash) { hr = lpdds_back2->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL); @@ -192,11 +197,12 @@ static void ddraw_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h) if (!ddsd.lpSurface) return; for (yy = 8; yy < 14; yy++) { - p = (uint32_t *)(ddsd.lpSurface + (yy * ddsd.lPitch)); + p = &(((uint32_t *) ddsd.lpSurface)[yy * ddsd.lPitch]); for (xx = (w - 40); xx < (w - 8); xx++) p[xx] = 0xffffffff; } } +#endif } lpdds_back2->Unlock(NULL); @@ -218,6 +224,12 @@ static void ddraw_blit_memtoscreen_8(int x, int y, int w, int h) uint32_t *p; HRESULT hr; + if (lpdds_back == NULL) + { + video_blit_complete(); + return; /*Nothing to do*/ + } + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); @@ -238,14 +250,14 @@ static void ddraw_blit_memtoscreen_8(int x, int y, int w, int h) { if ((y + yy) >= 0 && (y + yy) < buffer->h) { - p = (uint32_t *)(ddsd.lpSurface + (yy * ddsd.lPitch)); + p = (uint32_t *) &(((uint8_t *) ddsd.lpSurface)[yy * ddsd.lPitch]); for (xx = 0; xx < w; xx++) { p[xx] = pal_lookup[buffer->line[y + yy][x + xx]]; } } } - p = (uint32_t *)(ddsd.lpSurface + (4 * ddsd.lPitch)); + p = &(((uint32_t *) ddsd.lpSurface)[4 * ddsd.lPitch]); lpdds_back->Unlock(NULL); video_blit_complete(); @@ -282,7 +294,7 @@ static void ddraw_blit_memtoscreen_8(int x, int y, int w, int h) if (!ddsd.lpSurface) return; for (yy = 8; yy < 14; yy++) { - p = (uint32_t *)(ddsd.lpSurface + (yy * ddsd.lPitch)); + p = (uint32_t *) &(((uint8_t *) ddsd.lpSurface)[yy * ddsd.lPitch]); for (xx = (w - 40); xx < (w - 8); xx++) p[xx] = 0xffffffff; } diff --git a/src/win-deviceconfig.c b/src/win-deviceconfig.c index bff026317..6d00a0050 100644 --- a/src/win-deviceconfig.c +++ b/src/win-deviceconfig.c @@ -9,13 +9,19 @@ #include "ibm.h" #include "config.h" #include "device.h" -#include "resources.h" +#include "plat-midi.h" +#include "resource.h" #include "win.h" static device_t *config_device; static BOOL CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { + HWND h; + int val_int; + int num; + char s[80]; + switch (message) { case WM_INITDIALOG: @@ -27,11 +33,7 @@ static BOOL CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam while (config->type != -1) { device_config_selection_t *selection = config->selection; - HWND h = GetDlgItem(hdlg, id); - int val_int; - char *val_string; - int num; - char s[80]; + h = GetDlgItem(hdlg, id); switch (config->type) { @@ -92,9 +94,7 @@ static BOOL CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam while (config->type != -1) { device_config_selection_t *selection = config->selection; - HWND h = GetDlgItem(hdlg, id); - int val_int; - char *val_string; + h = GetDlgItem(hdlg, id); switch (config->type) { @@ -153,9 +153,7 @@ static BOOL CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam while (config->type != -1) { device_config_selection_t *selection = config->selection; - HWND h = GetDlgItem(hdlg, id); - int val_int; - char *val_string; + h = GetDlgItem(hdlg, id); switch (config->type) { @@ -247,11 +245,11 @@ void deviceconfig_open(HWND hwnd, device_t *device) data = (uint16_t *)(item + 1); *data++ = 0xFFFF; - *data++ = 0x0080; // button class + *data++ = 0x0080; /* button class */ data += MultiByteToWideChar(CP_ACP, 0, config->description, -1, data, 256); - *data++ = 0; // no creation data - + *data++ = 0; /* no creation data */ + y += 20; break; @@ -270,10 +268,10 @@ void deviceconfig_open(HWND hwnd, device_t *device) data = (uint16_t *)(item + 1); *data++ = 0xFFFF; - *data++ = 0x0085; // combo box class + *data++ = 0x0085; /* combo box class */ data += MultiByteToWideChar(CP_ACP, 0, config->description, -1, data, 256); - *data++ = 0; // no creation data + *data++ = 0; /* no creation data */ if (((unsigned long)data) & 2) data++; @@ -291,10 +289,10 @@ void deviceconfig_open(HWND hwnd, device_t *device) data = (uint16_t *)(item + 1); *data++ = 0xFFFF; - *data++ = 0x0082; // static class + *data++ = 0x0082; /* static class */ data += MultiByteToWideChar(CP_ACP, 0, config->description, -1, data, 256); - *data++ = 0; // no creation data + *data++ = 0; /* no creation data */ if (((unsigned long)data) & 2) data++; @@ -311,23 +309,20 @@ void deviceconfig_open(HWND hwnd, device_t *device) dlg->cdit = (id - IDC_CONFIG_BASE) + 2; -// DEFPUSHBUTTON "OK",IDOK,64,232,50,14, WS_TABSTOP -// PUSHBUTTON "Cancel",IDCANCEL,128,232,50,14, WS_TABSTOP - item = (DLGITEMTEMPLATE *)data; item->x = 20; item->y = y; item->cx = 50; item->cy = 14; - item->id = IDOK; // OK button identifier + item->id = IDOK; /* OK button identifier */ item->style = WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON; data = (uint16_t *)(item + 1); *data++ = 0xFFFF; - *data++ = 0x0080; // button class + *data++ = 0x0080; /* button class */ data += MultiByteToWideChar(CP_ACP, 0, "OK", -1, data, 50); - *data++ = 0; // no creation data + *data++ = 0; /* no creation data */ if (((unsigned long)data) & 2) data++; @@ -337,15 +332,15 @@ void deviceconfig_open(HWND hwnd, device_t *device) item->y = y; item->cx = 50; item->cy = 14; - item->id = IDCANCEL; // OK button identifier + item->id = IDCANCEL; /* OK button identifier */ item->style = WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON; data = (uint16_t *)(item + 1); *data++ = 0xFFFF; - *data++ = 0x0080; // button class + *data++ = 0x0080; /* button class */ data += MultiByteToWideChar(CP_ACP, 0, "Cancel", -1, data, 50); - *data++ = 0; // no creation data + *data++ = 0; /* no creation data */ dlg->cy = y + 20; diff --git a/src/win-hdconf.c b/src/win-hdconf.c deleted file mode 100644 index 73df0c97f..000000000 --- a/src/win-hdconf.c +++ /dev/null @@ -1,664 +0,0 @@ -/* Copyright holders: Sarah Walker, Tenshi - see COPYING for more details -*/ -#include -#define BITMAP WINDOWS_BITMAP -#include -#include -#undef BITMAP - -#include "ibm.h" -#include "ide.h" -#include "resources.h" -#include "win.h" - -static int hd_changed = 0; - -static char hd_new_name[512]; -static uint64_t hd_new_spt, hd_new_hpc, hd_new_cyl; -static int hd_new_hdi; -static int new_cdrom_channel; - -int hdnew_no_update = 0; - -hard_disk_t hdnew_temp_hd; - -int hdsize_no_update = 0; - -hard_disk_t hdsize_temp_hd; - -char s[260]; - -static int hdconf_initialize_hdt_combo(HWND hdlg, hard_disk_t *internal_hd) -{ - HWND h; - int i = 0; - uint64_t size = 0; - uint64_t size_mb = 0; - uint64_t size_shift = 11; - int selection = 127; - - h = GetDlgItem(hdlg, IDC_COMBOHDT); - for (i = 0; i < 127; i++) - { - size = hdt[i][0] * hdt[i][1] * hdt[i][2]; - size_mb = size >> size_shift; - sprintf(s, "%" PRIu64 " MB (CHS: %" PRIu64 ", %" PRIu64 ", %" PRIu64 ")", size_mb, hdt[i][0], hdt[i][1], hdt[i][2]); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)s); - if ((internal_hd->tracks == hdt[i][0]) && (internal_hd->hpc == hdt[i][1]) && (internal_hd->spt == hdt[i][2])) - { - selection = i; - } - } - sprintf(s, "Custom..."); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)s); - SendMessage(h, CB_SETCURSEL, selection, 0); - return selection; -} - -static void hdconf_update_text_boxes(HWND hdlg, BOOL enable) -{ - HWND h; - - h=GetDlgItem(hdlg, IDC_EDIT1); - EnableWindow(h, enable); - h=GetDlgItem(hdlg, IDC_EDIT2); - EnableWindow(h, enable); - h=GetDlgItem(hdlg, IDC_EDIT3); - EnableWindow(h, enable); - h=GetDlgItem(hdlg, IDC_EDIT4); - EnableWindow(h, enable); -} - -void hdconf_set_text_boxes(HWND hdlg, hard_disk_t *internal_hd) -{ - HWND h; - - uint64_t size_shift = 11; - - h = GetDlgItem(hdlg, IDC_EDIT1); - sprintf(s, "%" PRIu64, internal_hd->spt); - SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); - h = GetDlgItem(hdlg, IDC_EDIT2); - sprintf(s, "%" PRIu64, internal_hd->hpc); - SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); - h = GetDlgItem(hdlg, IDC_EDIT3); - sprintf(s, "%" PRIu64, internal_hd->tracks); - SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); - - h = GetDlgItem(hdlg, IDC_EDIT4); - sprintf(s, "%" PRIu64, (internal_hd->spt * internal_hd->hpc * internal_hd->tracks) >> size_shift); - SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); -} - -BOOL hdconf_initdialog_common(HWND hdlg, hard_disk_t *internal_hd, int *no_update, uint64_t spt, uint64_t hpc, uint64_t tracks) -{ - HWND h; - int selection = 127; - - internal_hd->spt = spt; - internal_hd->hpc = hpc; - internal_hd->tracks = tracks; - *no_update = 1; - - hdconf_set_text_boxes(hdlg, internal_hd); - - selection = hdconf_initialize_hdt_combo(hdlg, internal_hd); - - if (selection < 127) - { - hdconf_update_text_boxes(hdlg, FALSE); - } - else - { - hdconf_update_text_boxes(hdlg, TRUE); - } - - *no_update = 0; - - return TRUE; -} - -int hdconf_idok_common(HWND hdlg) -{ - HWND h; - - h = GetDlgItem(hdlg, IDC_EDIT1); - SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%" PRIu64, &hd_new_spt); - h = GetDlgItem(hdlg, IDC_EDIT2); - SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%" PRIu64, &hd_new_hpc); - h = GetDlgItem(hdlg, IDC_EDIT3); - SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%" PRIu64, &hd_new_cyl); - - if (hd_new_spt > 63) - { - MessageBox(ghwnd, "Drive has too many sectors (maximum is 63)", "86Box error", MB_OK); - return 1; - } - if (hd_new_hpc > 16) - { - MessageBox(ghwnd, "Drive has too many heads (maximum is 16)", "86Box error", MB_OK); - return 1; - } - if (hd_new_cyl > 266305) - { - MessageBox(ghwnd, "Drive has too many cylinders (maximum is 266305)", "86Box error", MB_OK); - return 1; - } - - return 0; -} - -BOOL hdconf_process_edit_boxes(HWND hdlg, WORD control, uint64_t *var, hard_disk_t *internal_hd, int *no_update) -{ - HWND h; - uint64_t size_shift = 11; - - if (*no_update) - { - return FALSE; - } - - h = GetDlgItem(hdlg, control); - SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%" PRIu64, var); - - *no_update = 1; - if(!(*var)) - { - *var = 1; - sprintf(s, "%" PRIu64, *var); - SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); - } - - if (control == IDC_EDIT4) - { - *var <<= 11; /* Convert to sectors */ - *var /= internal_hd->hpc; - *var /= internal_hd->spt; - internal_hd->tracks = *var; - - h = GetDlgItem(hdlg, IDC_EDIT3); - sprintf(s, "%" PRIu64, internal_hd->tracks); - SendMessage(h, WM_SETTEXT, 1, (LPARAM)s); - } - else if ((control >= IDC_EDIT1) && (control <= IDC_EDIT3)) - { - h = GetDlgItem(hdlg, IDC_EDIT4); - sprintf(s, "%" PRIu64, (internal_hd->spt * internal_hd->hpc * internal_hd->tracks) >> size_shift); - SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); - } - - *no_update = 0; - return TRUE; -} - -BOOL hdconf_process_hdt_combo(HWND hdlg, hard_disk_t *internal_hd, int *no_update, WPARAM wParam) -{ - HWND h; - int selection = 127; - - if (*no_update) - { - return FALSE; - } - - if (HIWORD(wParam) == CBN_SELCHANGE) - { - *no_update = 1; - - h = GetDlgItem(hdlg,IDC_COMBOHDT); - selection = SendMessage(h,CB_GETCURSEL,0,0); - - if (selection < 127) - { - hdconf_update_text_boxes(hdlg, FALSE); - - internal_hd->tracks = hdt[selection][0]; - internal_hd->hpc = hdt[selection][1]; - internal_hd->spt = hdt[selection][2]; - - hdconf_set_text_boxes(hdlg, internal_hd); - } - else - { - hdconf_update_text_boxes(hdlg, TRUE); - } - - *no_update = 0; - } - else - { - return FALSE; - } - - return TRUE; -} - -BOOL CALLBACK hdconf_common_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam, int type, hard_disk_t *internal_hd, int *no_update, uint64_t spt, uint64_t hpc, uint64_t tracks) -{ - HWND h; - uint64_t c; - FILE *f; - uint8_t buf[512]; - int is_hdi; - int is_hdx; - uint64_t size; - uint64_t signature = 0xD778A82044445459; - uint32_t zero = 0; - uint32_t sector_size = 512; - uint32_t base = 0x1000; - uint64_t full_size = 0; - uint64_t full_size_bytes = 0; - uint64_t size_shift = 11; - int selection = 127; - switch (message) - { - case WM_INITDIALOG: - if (!type) - { - h = GetDlgItem(hdlg, IDC_EDITC); - SendMessage(h, WM_SETTEXT, 0, (LPARAM)""); - } - return hdconf_initdialog_common(hdlg, internal_hd, no_update, spt, hpc, tracks); - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case IDOK: - if (!type) - { - h = GetDlgItem(hdlg, IDC_EDITC); - SendMessage(h, WM_GETTEXT, 511, (LPARAM)hd_new_name); - if (!hd_new_name[0]) - { - MessageBox(ghwnd,"Please enter a valid filename","86Box error",MB_OK); - return TRUE; - } - } - - if (hdconf_idok_common(hdlg)) - { - return TRUE; - } - - if (!type) - { - f = fopen64(hd_new_name, "wb"); - if (!f) - { - MessageBox(ghwnd, "Can't open file for write", "86Box error", MB_OK); - return TRUE; - } - full_size = (hd_new_cyl * hd_new_hpc * hd_new_spt); - full_size_bytes = full_size * 512; - if (image_is_hdi(hd_new_name)) - { - if (full_size_bytes >= 0x100000000) - { - MessageBox(ghwnd, "Drive is HDI and 4 GB or bigger (size filed in HDI header is 32-bit)", "86Box error", MB_OK); - fclose(f); - return TRUE; - } - - hd_new_hdi = 1; - - fwrite(&zero, 1, 4, f); /* 00000000: Zero/unknown */ - fwrite(&zero, 1, 4, f); /* 00000004: Zero/unknown */ - fwrite(&base, 1, 4, f); /* 00000008: Offset at which data starts */ - fwrite(&full_size_bytes, 1, 4, f); /* 0000000C: Full size of the data (32-bit) */ - fwrite(§or_size, 1, 4, f); /* 00000010: Sector size in bytes */ - fwrite(&hd_new_spt, 1, 4, f); /* 00000014: Sectors per cylinder */ - fwrite(&hd_new_hpc, 1, 4, f); /* 00000018: Heads per cylinder */ - fwrite(&hd_new_cyl, 1, 4, f); /* 0000001C: Cylinders */ - - for (c = 0; c < 0x3f8; c++) - { - fwrite(&zero, 1, 4, f); - } - } - else if (image_is_hdx(hd_new_name, 0)) - { - if (full_size_bytes > 0xffffffffffffffff) - { - MessageBox(ghwnd, "Drive is HDX and way too big (size filed in HDX header is 64-bit)", "86Box error", MB_OK); - fclose(f); - return TRUE; - } - - hd_new_hdi = 1; - - fwrite(&signature, 1, 8, f); /* 00000000: Signature */ - fwrite(&full_size_bytes, 1, 8, f); /* 00000008: Full size of the data (64-bit) */ - fwrite(§or_size, 1, 4, f); /* 00000010: Sector size in bytes */ - fwrite(&hd_new_spt, 1, 4, f); /* 00000014: Sectors per cylinder */ - fwrite(&hd_new_hpc, 1, 4, f); /* 00000018: Heads per cylinder */ - fwrite(&hd_new_cyl, 1, 4, f); /* 0000001C: Cylinders */ - fwrite(&zero, 1, 4, f); /* 00000020: [Translation] Sectors per cylinder */ - fwrite(&zero, 1, 4, f); /* 00000004: [Translation] Heads per cylinder */ - } - memset(buf, 0, 512); - for (c = 0; c < full_size; c++) - fwrite(buf, 512, 1, f); - fclose(f); - - MessageBox(ghwnd, "Remember to partition and format the new drive", "86Box", MB_OK); - } - - EndDialog(hdlg,1); - return TRUE; - - case IDCANCEL: - EndDialog(hdlg, 0); - return TRUE; - - case IDC_CFILE: - if (!type) - { - if (!getsfile(hdlg, "Hard disc image (*.HDI;*.HDX;*.IMA;*.IMG)\0*.HDI;*.HDX;*.IMA;*.IMG\0All files (*.*)\0*.*\0", "")) - { - h = GetDlgItem(hdlg, IDC_EDITC); - SendMessage(h, WM_SETTEXT, 0, (LPARAM)openfilestring); - } - return TRUE; - } - else - { - break; - } - - case IDC_EDIT1: - return hdconf_process_edit_boxes(hdlg, IDC_EDIT1, &(internal_hd->spt), internal_hd, no_update); - - case IDC_EDIT2: - return hdconf_process_edit_boxes(hdlg, IDC_EDIT2, &(internal_hd->hpc), internal_hd, no_update); - - case IDC_EDIT3: - return hdconf_process_edit_boxes(hdlg, IDC_EDIT3, &(internal_hd->tracks), internal_hd, no_update); - - case IDC_EDIT4: - return hdconf_process_edit_boxes(hdlg, IDC_EDIT4, &size, internal_hd, no_update); - - case IDC_COMBOHDT: - return hdconf_process_hdt_combo(hdlg, internal_hd, no_update, wParam); - } - break; - - } - return FALSE; -} - -static BOOL CALLBACK hdnew_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) -{ - return hdconf_common_dlgproc(hdlg, message, wParam, lParam, 0, &hdnew_temp_hd, &hdnew_no_update, 63, 16, 511); -} - -BOOL CALLBACK hdsize_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) -{ - return hdconf_common_dlgproc(hdlg, message, wParam, lParam, 1, &hdsize_temp_hd, &hdsize_no_update, hd_new_spt, hd_new_hpc, hd_new_cyl); -} - -static void hdconf_eject(HWND hdlg, int drive_num, hard_disk_t *hd) -{ - hd->spt = 0; - hd->hpc = 0; - hd->tracks = 0; - ide_fn[drive_num][0] = 0; - SetDlgItemText(hdlg, IDC_EDIT_C_SPT + drive_num, "0"); - SetDlgItemText(hdlg, IDC_EDIT_C_HPC + drive_num, "0"); - SetDlgItemText(hdlg, IDC_EDIT_C_CYL + drive_num, "0"); - SetDlgItemText(hdlg, IDC_EDIT_C_FN + drive_num, ""); - hd_changed = 1; - return; -} - -static void hdconf_new(HWND hdlg, int drive_num) -{ - HWND h; - - if (DialogBox(hinstance, TEXT("HdNewDlg"), hdlg, hdnew_dlgproc) == 1) - { - h = GetDlgItem(hdlg, IDC_EDIT_C_SPT + drive_num); - sprintf(s, "%" PRIu64, hd_new_spt); - SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); - h = GetDlgItem(hdlg, IDC_EDIT_C_HPC + drive_num); - sprintf(s, "%" PRIu64, hd_new_hpc); - SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); - h = GetDlgItem(hdlg, IDC_EDIT_C_CYL + drive_num); - sprintf(s, "%" PRIu64, hd_new_cyl); - SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); - h = GetDlgItem(hdlg, IDC_EDIT_C_FN + drive_num); - SendMessage(h, WM_SETTEXT, 0, (LPARAM)hd_new_name); - - h= GetDlgItem(hdlg, IDC_TEXT_C_SIZE + drive_num); - sprintf(s, "Size: %" PRIu64 " MB", (hd_new_cyl*hd_new_hpc*hd_new_spt) >> 11); - SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); - - hd_changed = 1; - } - return; -} - -static void hdconf_file(HWND hdlg, int drive_num) -{ - HWND h; - FILE *f; - off64_t sz; - uint32_t sector_size = 512; - uint32_t base = 0x1000; - int ret; - - if (!getfile(hdlg, "Hard disc image (*.HDI;*.HDX;*.IMA;*.IMG;*.VHD)\0*.HDI;*.HDX;*.IMA;*.IMG;*.VHD\0All files (*.*)\0*.*\0", "")) - { - f = fopen64(openfilestring, "rb"); - if (!f) - { - MessageBox(ghwnd,"Can't open file for read","86Box error",MB_OK); - return; - } - - if (image_is_hdi(openfilestring) || image_is_hdx(openfilestring, 1)) - { - fseeko64(f, 0x10, SEEK_SET); - fread(§or_size, 1, 4, f); - if (sector_size != 512) - { - MessageBox(ghwnd,"HDI or HDX image with a sector size that is not 512","86Box error",MB_OK); - fclose(f); - return; - } - fread(&hd_new_spt, 1, 4, f); - fread(&hd_new_hpc, 1, 4, f); - fread(&hd_new_cyl, 1, 4, f); - - ret = 1; - } - else - { - fseeko64(f, -1, SEEK_END); - sz = ftello64(f) + 1; - fclose(f); - hd_new_spt = 63; - hd_new_hpc = 16; - hd_new_cyl = ((sz / 512) / 16) / 63; - - ret = DialogBox(hinstance, TEXT("HdSizeDlg"), hdlg, hdsize_dlgproc); - } - if (ret == 1) - { - h = GetDlgItem(hdlg, IDC_EDIT_C_SPT + drive_num); - sprintf(s, "%" PRIu64, hd_new_spt); - SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); - h = GetDlgItem(hdlg, IDC_EDIT_C_HPC + drive_num); - sprintf(s, "%" PRIu64, hd_new_hpc); - SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); - h = GetDlgItem(hdlg, IDC_EDIT_C_CYL + drive_num); - sprintf(s, "%" PRIu64, hd_new_cyl); - SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); - h = GetDlgItem(hdlg, IDC_EDIT_C_FN + drive_num); - SendMessage(h, WM_SETTEXT, 0, (LPARAM)openfilestring); - - h = GetDlgItem(hdlg, IDC_TEXT_C_SIZE + drive_num); - sprintf(s, "Size: %" PRIu64 " MB", (hd_new_cyl*hd_new_hpc*hd_new_spt) >> 11); - SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); - - hd_changed = 1; - } - } - return; -} - -static void hdconf_edit_boxes(HWND hdlg, int drive_num, hard_disk_t *hd) -{ - HWND h; - - h = GetDlgItem(hdlg, IDC_EDIT_C_SPT + drive_num); - SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%" PRIu64, &(hd->spt)); - h = GetDlgItem(hdlg, IDC_EDIT_C_HPC + drive_num); - SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%" PRIu64, &(hd->hpc)); - h = GetDlgItem(hdlg, IDC_EDIT_C_CYL + drive_num); - SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%" PRIu64, &(hd->tracks)); - - h = GetDlgItem(hdlg, IDC_TEXT_C_SIZE + drive_num); - sprintf(s, "Size: %" PRIu64 " MB", (hd->tracks*hd->hpc*hd->spt) >> 11); - SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); - return; -} - -static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) -{ - HWND h; - hard_disk_t hd[IDE_NUM]; - int drive_num = 0; - switch (message) - { - case WM_INITDIALOG: - pause = 1; - - for (drive_num = 0; drive_num < IDE_NUM; drive_num++) - { - hd[drive_num] = hdc[drive_num]; - - h = GetDlgItem(hdlg, IDC_EDIT_C_SPT + drive_num); - sprintf(s, "%" PRIu64, hdc[drive_num].spt); - SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); - h = GetDlgItem(hdlg, IDC_EDIT_C_HPC + drive_num); - sprintf(s, "%" PRIu64, hdc[drive_num].hpc); - SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); - h = GetDlgItem(hdlg, IDC_EDIT_C_CYL + drive_num); - sprintf(s, "%" PRIu64, hdc[drive_num].tracks); - SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); - h = GetDlgItem(hdlg, IDC_EDIT_C_FN + drive_num); - SendMessage(h, WM_SETTEXT, 0, (LPARAM)ide_fn[drive_num]); - - h = GetDlgItem(hdlg, IDC_TEXT_C_SIZE + drive_num); - sprintf(s, "Size: %" PRIu64 " MB", (hd[drive_num].tracks*hd[drive_num].hpc*hd[drive_num].spt) >> 11); - SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); - } - - hd_changed = 0; - - return TRUE; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case IDOK: - if (hd_changed) - { - if (MessageBox(NULL, "This will reset 86Box!\nOkay to continue?", "86Box", MB_OKCANCEL) == IDOK) - { - for (drive_num = 0; drive_num < IDE_NUM; drive_num++) - { - h = GetDlgItem(hdlg, IDC_EDIT_C_SPT + drive_num); - SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%" PRIu64, &hd[drive_num].spt); - h = GetDlgItem(hdlg, IDC_EDIT_C_HPC + drive_num); - SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%" PRIu64, &hd[drive_num].hpc); - h = GetDlgItem(hdlg, IDC_EDIT_C_CYL + drive_num); - SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%" PRIu64, &hd[drive_num].tracks); - h = GetDlgItem(hdlg, IDC_EDIT_C_FN + drive_num); - SendMessage(h, WM_GETTEXT, 511, (LPARAM)ide_fn[drive_num]); - - hdc[drive_num] = hd[drive_num]; - } - - saveconfig(); - - resetpchard(); - } - } - case IDCANCEL: - EndDialog(hdlg, 0); - pause = 0; - return TRUE; - - case IDC_EJECTC: - case IDC_EJECTD: - case IDC_EJECTE: - case IDC_EJECTF: - case IDC_EJECTG: - case IDC_EJECTH: - case IDC_EJECTI: - case IDC_EJECTJ: - drive_num = LOWORD(wParam) % 10; - hdconf_eject(hdlg, drive_num, &(hd[drive_num])); - return TRUE; - - case IDC_CNEW: - case IDC_DNEW: - case IDC_ENEW: - case IDC_FNEW: - case IDC_GNEW: - case IDC_HNEW: - case IDC_INEW: - case IDC_JNEW: - drive_num = LOWORD(wParam) % 10; - hdconf_new(hdlg, drive_num); - return TRUE; - - case IDC_CFILE: - case IDC_DFILE: - case IDC_EFILE: - case IDC_FFILE: - case IDC_GFILE: - case IDC_HFILE: - case IDC_IFILE: - case IDC_JFILE: - drive_num = LOWORD(wParam) % 10; - hdconf_file(hdlg, drive_num); - return TRUE; - - case IDC_EDIT_C_SPT: case IDC_EDIT_C_HPC: case IDC_EDIT_C_CYL: - case IDC_EDIT_D_SPT: case IDC_EDIT_D_HPC: case IDC_EDIT_D_CYL: - case IDC_EDIT_E_SPT: case IDC_EDIT_E_HPC: case IDC_EDIT_E_CYL: - case IDC_EDIT_F_SPT: case IDC_EDIT_F_HPC: case IDC_EDIT_F_CYL: - case IDC_EDIT_G_SPT: case IDC_EDIT_G_HPC: case IDC_EDIT_G_CYL: - case IDC_EDIT_H_SPT: case IDC_EDIT_H_HPC: case IDC_EDIT_H_CYL: - case IDC_EDIT_I_SPT: case IDC_EDIT_I_HPC: case IDC_EDIT_I_CYL: - case IDC_EDIT_J_SPT: case IDC_EDIT_J_HPC: case IDC_EDIT_J_CYL: - drive_num = LOWORD(wParam) % 10; - hdconf_edit_boxes(hdlg, drive_num, &(hd[drive_num])); - return TRUE; - } - break; - - } - return FALSE; -} - -void hdconf_open(HWND hwnd) -{ - if (hdd_controller_current_is_mfm()) - DialogBox(hinstance, TEXT("HdConfDlgMfm"), hwnd, hdconf_dlgproc); - else - DialogBox(hinstance, TEXT("HdConfDlg"), hwnd, hdconf_dlgproc); -} diff --git a/src/win-joystick.cc b/src/win-joystick.cc index 12c94e396..13cc3c1ff 100644 --- a/src/win-joystick.cc +++ b/src/win-joystick.cc @@ -111,7 +111,6 @@ void joystick_init() DIPROPRANGE joy_axis_range; DIDEVICEINSTANCE device_instance; DIDEVCAPS devcaps; - int d; if (FAILED(lpdi->CreateDevice(joystick_guids[c], &lpdi_joystick_temp, NULL))) fatal("joystick_init : CreateDevice failed\n"); diff --git a/src/win-joystickconfig.c b/src/win-joystickconfig.c index 8c75d303f..cabb75358 100644 --- a/src/win-joystickconfig.c +++ b/src/win-joystickconfig.c @@ -151,14 +151,21 @@ static int get_pov(HWND hdlg, int id) static BOOL CALLBACK joystickconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { + HWND h; + int c; + int id; + int joystick; + int nr_axes; + int nr_povs; + int mapping; + switch (message) { case WM_INITDIALOG: { - HWND h = GetDlgItem(hdlg, IDC_CONFIG_BASE); - int c, d; - int id = IDC_CONFIG_BASE + 2; - int joystick = joystick_state[joystick_nr].plat_joystick_nr; + h = GetDlgItem(hdlg, IDC_CONFIG_BASE); + id = IDC_CONFIG_BASE + 2; + joystick = joystick_state[joystick_nr].plat_joystick_nr; SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"None"); @@ -171,8 +178,8 @@ static BOOL CALLBACK joystickconfig_dlgproc(HWND hdlg, UINT message, WPARAM wPar if (joystick_state[joystick_nr].plat_joystick_nr) { - int nr_axes = plat_joystick_state[joystick-1].nr_axes; - int nr_povs = plat_joystick_state[joystick-1].nr_povs; + nr_axes = plat_joystick_state[joystick-1].nr_axes; + nr_povs = plat_joystick_state[joystick-1].nr_povs; for (c = 0; c < joystick_get_axis_count(joystick_config_type); c++) { int mapping = joystick_state[joystick_nr].axis_mapping[c]; @@ -194,8 +201,6 @@ static BOOL CALLBACK joystickconfig_dlgproc(HWND hdlg, UINT message, WPARAM wPar } for (c = 0; c < joystick_get_pov_count(joystick_config_type); c++) { - int mapping; - h = GetDlgItem(hdlg, id); mapping = joystick_state[joystick_nr].pov_mapping[c][0]; if (mapping & POV_X) @@ -229,10 +234,7 @@ static BOOL CALLBACK joystickconfig_dlgproc(HWND hdlg, UINT message, WPARAM wPar case IDOK: { - HWND h; - int joystick; - int c, d; - int id = IDC_CONFIG_BASE + 2; + id = IDC_CONFIG_BASE + 2; h = GetDlgItem(hdlg, IDC_CONFIG_BASE); joystick_state[joystick_nr].plat_joystick_nr = SendMessage(h, CB_GETCURSEL, 0, 0); @@ -272,7 +274,6 @@ static BOOL CALLBACK joystickconfig_dlgproc(HWND hdlg, UINT message, WPARAM wPar void joystickconfig_open(HWND hwnd, int joy_nr, int type) { -// device_config_t *config = device->config; uint16_t *data_block = malloc(16384); uint16_t *data; DLGTEMPLATE *dlg = (DLGTEMPLATE *)data_block; @@ -318,10 +319,10 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type) data = (uint16_t *)(item + 1); *data++ = 0xFFFF; - *data++ = 0x0085; // combo box class + *data++ = 0x0085; /* combo box class */ data += MultiByteToWideChar(CP_ACP, 0, "Device", -1, data, 256); - *data++ = 0; // no creation data + *data++ = 0; /* no creation data */ if (((unsigned long)data) & 2) data++; @@ -339,10 +340,10 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type) data = (uint16_t *)(item + 1); *data++ = 0xFFFF; - *data++ = 0x0082; // static class + *data++ = 0x0082; /* static class */ data += MultiByteToWideChar(CP_ACP, 0, "Device :", -1, data, 256); - *data++ = 0; // no creation data + *data++ = 0; /* no creation data */ if (((unsigned long)data) & 2) data++; @@ -365,10 +366,10 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type) data = (uint16_t *)(item + 1); *data++ = 0xFFFF; - *data++ = 0x0085; // combo box class + *data++ = 0x0085; /* combo box class */ data += MultiByteToWideChar(CP_ACP, 0, joystick_get_axis_name(type, c), -1, data, 256); - *data++ = 0; // no creation data + *data++ = 0; /* no creation data */ if (((unsigned long)data) & 2) data++; @@ -386,10 +387,10 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type) data = (uint16_t *)(item + 1); *data++ = 0xFFFF; - *data++ = 0x0082; // static class + *data++ = 0x0082; /* static class */ data += MultiByteToWideChar(CP_ACP, 0, joystick_get_axis_name(type, c), -1, data, 256); - *data++ = 0; // no creation data + *data++ = 0; /* no creation data */ if (((unsigned long)data) & 2) data++; @@ -412,10 +413,10 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type) data = (uint16_t *)(item + 1); *data++ = 0xFFFF; - *data++ = 0x0085; // combo box class + *data++ = 0x0085; /* combo box class */ data += MultiByteToWideChar(CP_ACP, 0, joystick_get_button_name(type, c), -1, data, 256); - *data++ = 0; // no creation data + *data++ = 0; /* no creation data */ if (((unsigned long)data) & 2) data++; @@ -433,10 +434,10 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type) data = (uint16_t *)(item + 1); *data++ = 0xFFFF; - *data++ = 0x0082; // static class + *data++ = 0x0082; /* static class */ data += MultiByteToWideChar(CP_ACP, 0, joystick_get_button_name(type, c), -1, data, 256); - *data++ = 0; // no creation data + *data++ = 0; /* no creation data */ if (((unsigned long)data) & 2) data++; @@ -461,14 +462,14 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type) data = (uint16_t *)(item + 1); *data++ = 0xFFFF; - *data++ = 0x0085; // combo box class + *data++ = 0x0085; /* combo box class */ if (c & 1) sprintf(s, "%s (Y axis)", joystick_get_pov_name(type, c/2)); else sprintf(s, "%s (X axis)", joystick_get_pov_name(type, c/2)); data += MultiByteToWideChar(CP_ACP, 0, s, -1, data, 256); - *data++ = 0; // no creation data + *data++ = 0; /* no creation data */ if (((unsigned long)data) & 2) data++; @@ -486,10 +487,10 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type) data = (uint16_t *)(item + 1); *data++ = 0xFFFF; - *data++ = 0x0082; // static class + *data++ = 0x0082; /* static class */ data += MultiByteToWideChar(CP_ACP, 0, s, -1, data, 256); - *data++ = 0; // no creation data + *data++ = 0; /* no creation data */ if (((unsigned long)data) & 2) data++; @@ -499,23 +500,20 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type) dlg->cdit = (id - IDC_CONFIG_BASE) + 2; -// DEFPUSHBUTTON "OK",IDOK,64,232,50,14, WS_TABSTOP -// PUSHBUTTON "Cancel",IDCANCEL,128,232,50,14, WS_TABSTOP - item = (DLGITEMTEMPLATE *)data; item->x = 20; item->y = y; item->cx = 50; item->cy = 14; - item->id = IDOK; // OK button identifier + item->id = IDOK; /* OK button identifier */ item->style = WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON; data = (uint16_t *)(item + 1); *data++ = 0xFFFF; - *data++ = 0x0080; // button class + *data++ = 0x0080; /* button class */ data += MultiByteToWideChar(CP_ACP, 0, "OK", -1, data, 50); - *data++ = 0; // no creation data + *data++ = 0; /* no creation data */ if (((unsigned long)data) & 2) data++; @@ -525,20 +523,18 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type) item->y = y; item->cx = 50; item->cy = 14; - item->id = IDCANCEL; // OK button identifier + item->id = IDCANCEL; /* OK button identifier */ item->style = WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON; data = (uint16_t *)(item + 1); *data++ = 0xFFFF; - *data++ = 0x0080; // button class + *data++ = 0x0080; /* button class */ data += MultiByteToWideChar(CP_ACP, 0, "Cancel", -1, data, 50); - *data++ = 0; // no creation data + *data++ = 0; /* no creation data */ dlg->cy = y + 20; - -// config_device = device; - + DialogBoxIndirect(hinstance, dlg, hwnd, joystickconfig_dlgproc); free(data_block); diff --git a/src/win-language.c b/src/win-language.c new file mode 100644 index 000000000..353fb1302 --- /dev/null +++ b/src/win-language.c @@ -0,0 +1,179 @@ +/* Copyright holders: Sarah Walker, Tenshi + see COPYING for more details +*/ +#include +#define UNICODE +#define BITMAP WINDOWS_BITMAP +#include +#include +#undef BITMAP + +#include + +#include "ibm.h" +#include "device.h" +#include "ide.h" +#include "resource.h" +#include "win.h" +#include "win-language.h" + +LCID dwLanguage; + +uint32_t dwLangID, dwSubLangID; + +#define STRINGS_NUM 148 + +WCHAR lpResourceString[STRINGS_NUM][512]; + +char openfilestring[260]; + +void win_language_set() +{ + SetThreadLocale(dwLanguage); +} + +void win_language_load_common_strings() +{ + int i = 0; + + for (i = 0; i < STRINGS_NUM; i++) + { + LoadString(hinstance, 2048 + i, lpResourceString[i], 512); + } +} + +LPTSTR win_language_get_settings_category(int i) +{ + return lpResourceString[17 + i]; +} + +void win_language_update() +{ + win_language_set(); + win_menu_update(); + win_language_load_common_strings(); +} + +void win_language_check() +{ + LCID dwLanguageNew = MAKELCID(dwLangID, dwSubLangID); + if (dwLanguageNew != dwLanguage) + { + dwLanguage = dwLanguageNew; + win_language_update(); + } +} + +LPTSTR win_language_get_string_from_id(int i) +{ + return lpResourceString[i - 2048]; +} + +LPTSTR win_language_get_string_from_string(char *str) +{ + return lpResourceString[atoi(str) - 2048]; +} + +int msgbox_reset(HWND hwndParent) +{ + return MessageBox(hwndParent, lpResourceString[3], lpResourceString[0], MB_YESNOCANCEL | MB_ICONQUESTION); +} + +int msgbox_reset_yn(HWND hwndParent) +{ + return MessageBox(hwndParent, lpResourceString[3], lpResourceString[0], MB_YESNO | MB_ICONQUESTION); +} + +int msgbox_question(HWND hwndParent, int i) +{ + return MessageBox(hwndParent, win_language_get_string_from_id(i), lpResourceString[0], MB_YESNO | MB_ICONQUESTION); +} + +void msgbox_info(HWND hwndParent, int i) +{ + MessageBox(hwndParent, win_language_get_string_from_id(i), lpResourceString[0], MB_OK | MB_ICONINFORMATION); +} + +void msgbox_error(HWND hwndParent, int i) +{ + MessageBox(hwndParent, win_language_get_string_from_id(i), lpResourceString[1], MB_OK | MB_ICONWARNING); +} + +void msgbox_critical(HWND hwndParent, int i) +{ + MessageBox(hwndParent, win_language_get_string_from_id(i), lpResourceString[2], MB_OK | MB_ICONERROR); +} + +void msgbox_fatal(HWND hwndParent, char *string) +{ + LPTSTR lptsTemp; + lptsTemp = (LPTSTR) malloc(512); + + mbstowcs(lptsTemp, string, strlen(string) + 1); + + MessageBox(hwndParent, lptsTemp, lpResourceString[2], MB_OK | MB_ICONERROR); + + free(lptsTemp); +} + +int file_dlg(HWND hwnd, WCHAR *f, char *fn, int save) +{ + OPENFILENAME ofn; /* common dialog box structure */ + BOOL r; + DWORD err; + WCHAR ufn[260]; + WCHAR uofs[260]; + + /* Convert file name to Unicode */ + mbstowcs(ufn, fn, strlen(fn) + 1); + + /* Initialize OPENFILENAME */ + ZeroMemory(&ofn, sizeof(ofn)); + ofn.lStructSize = sizeof(ofn); + ofn.hwndOwner = hwnd; + ofn.lpstrFile = uofs; + /* + Set lpstrFile[0] to '\0' so that GetOpenFileName does not + use the contents of szFile to initialize itself. + */ + memcpy(ofn.lpstrFile, ufn, (wcslen(ufn) << 1) + 2); + ofn.nMaxFile = 259; + ofn.lpstrFilter = f; + ofn.nFilterIndex = 1; + ofn.lpstrFileTitle = NULL; + ofn.nMaxFileTitle = 0; + ofn.lpstrInitialDir = NULL; + ofn.Flags = OFN_PATHMUSTEXIST; + if (!save) + { + ofn.Flags |= OFN_FILEMUSTEXIST; + } + + /* Display the Open dialog box. */ + + if (save) + { + pclog("GetSaveFileName - lpstrFile = %s\n", ofn.lpstrFile); + r = GetSaveFileName(&ofn); + } + else + { + pclog("GetOpenFileName - lpstrFile = %s\n", ofn.lpstrFile); + r = GetOpenFileName(&ofn); + } + if (r) + { + wcstombs(openfilestring, uofs, 520); + pclog("File dialog return true\n"); + return 0; + } + pclog("File dialog return false\n"); + err = CommDlgExtendedError(); + pclog("CommDlgExtendedError return %04X\n", err); + return 1; +} + +int file_dlg_st(HWND hwnd, int i, char *fn, int save) +{ + file_dlg(hwnd, win_language_get_string_from_id(i), fn, save); +} diff --git a/src/win-language.h b/src/win-language.h new file mode 100644 index 000000000..47fde8df8 --- /dev/null +++ b/src/win-language.h @@ -0,0 +1,19 @@ +int msgbox_reset(HWND hwndParent); +int msgbox_reset_yn(HWND hwndParent); +int msgbox_question(HWND hwndParent, int i); +void msgbox_info(HWND hwndParent, int i); +void msgbox_error(HWND hwndParent, int i); +void msgbox_fatal(HWND hwndParent, char *string); +void msgbox_critical(HWND hwndParent, int i); + +int file_dlg(HWND hwnd, WCHAR *f, char *fn, int save); +int file_dlg_st(HWND hwnd, int i, char *fn, int save); + +void win_language_load_common_strings(); +LPTSTR win_language_get_settings_category(int i); + +void win_language_update(); +void win_language_check(); + +LPTSTR win_language_get_string_from_id(int i); +LPTSTR win_language_get_string_from_string(char *str); diff --git a/src/win-midi.c b/src/win-midi.c index bb0bc2d78..8fa56c768 100644 --- a/src/win-midi.c +++ b/src/win-midi.c @@ -4,6 +4,7 @@ #include #include #include "ibm.h" +#include "config.h" #include "plat-midi.h" static int midi_id; @@ -13,9 +14,6 @@ void midi_close(); void midi_init() { - int c; - int n; - MIDIOUTCAPS ocaps; MMRESULT hr; midi_id = config_get_int(NULL, "midi", 0); @@ -62,12 +60,11 @@ static int midi_pos, midi_len; static uint32_t midi_command; static int midi_lengths[8] = {3, 3, 3, 3, 2, 2, 3, 1}; static int midi_insysex; -static uint8_t midi_sysex_data[1024+2]; +static char midi_sysex_data[1024+2]; static void midi_send_sysex() { MIDIHDR hdr; - int c; hdr.lpData = midi_sysex_data; hdr.dwBufferLength = midi_pos; diff --git a/src/win-settings.c b/src/win-settings.c new file mode 100644 index 000000000..4790ce717 --- /dev/null +++ b/src/win-settings.c @@ -0,0 +1,3502 @@ +/* Copyright holders: Sarah Walker, Tenshi + see COPYING for more details +*/ +#define UNICODE +#define BITMAP WINDOWS_BITMAP +#include +#include +#undef BITMAP + +#include + +#include + +#include "nethandler.h" +#include "ibm.h" +#include "ide.h" +#include "cdrom.h" +#include "cpu.h" +#include "device.h" +#include "scsi_buslogic.h" +#include "disc.h" +#include "fdd.h" +#include "gameport.h" +#include "hdd.h" +#include "mem.h" +#include "model.h" +#include "mouse.h" +#include "nvr.h" +#include "resource.h" +#include "scsi.h" +#include "sound.h" +#include "sound_dbopl.h" +#include "video.h" +#include "vid_voodoo.h" +#include "win.h" +#include "win-language.h" + +#define WM_SAVESETTINGS 0x8888 /* 86Box-specific message, used to tell the child dialog to save the currently specified settings. */ + +/* Machine category */ +int temp_model, temp_cpu_m, temp_cpu, temp_wait_states, temp_mem_size, temp_dynarec, temp_fpu, temp_sync; + +/* Video category */ +int temp_gfxcard, temp_video_speed, temp_voodoo; + +/* Input devices category */ +int temp_mouse, temp_joystick; + +/* Sound category */ +int temp_sound_card, temp_SSI2001, temp_GAMEBLASTER, temp_GUS, temp_opl3_type; + +/* Peripherals category */ +int temp_scsi_card, temp_net_card, hdc_ignore, temp_ide_ter, temp_ide_ter_irq, temp_ide_qua, temp_ide_qua_irq; +int temp_serial[2], temp_lpt, temp_bugger; + +char temp_hdc_name[16]; + +/* Hard disks category */ +hard_disk_t temp_hdc[HDC_NUM]; +char temp_hdd_fn[HDC_NUM][512]; + +/* Removable devices category */ +int temp_fdd_types[FDD_NUM]; +cdrom_drive_t temp_cdrom_drives[CDROM_NUM]; + +static HWND hwndParentDialog, hwndChildDialog; + +int hdd_controller_current; + +int displayed_category = 0; + +extern int is486; +static int romstolist[ROM_MAX], listtomodel[ROM_MAX], romstomodel[ROM_MAX], modeltolist[ROM_MAX]; +static int settings_sound_to_list[20], settings_list_to_sound[20]; +static int settings_mouse_to_list[20], settings_list_to_mouse[20]; +static int settings_scsi_to_list[20], settings_list_to_scsi[20]; +static int settings_network_to_list[20], settings_list_to_network[20]; +static char *hdd_names[16]; + +/* This does the initial read of global variables into the temporary ones. */ +static void win_settings_init() +{ + int i = 0; + + /* Machine category */ + temp_model = model; + temp_cpu_m = cpu_manufacturer; + temp_cpu = cpu; + temp_mem_size = mem_size; + temp_dynarec = cpu_use_dynarec; + temp_fpu = enable_external_fpu; + temp_sync = enable_sync; + + /* Video category */ + temp_gfxcard = gfxcard; + temp_video_speed = video_speed; + temp_voodoo = voodoo_enabled; + + /* Input devices category */ + temp_mouse = mouse_type; + temp_joystick = joystick_type; + + /* Sound category */ + temp_sound_card = sound_card_current; + temp_SSI2001 = SSI2001; + temp_GAMEBLASTER = GAMEBLASTER; + temp_GUS = GUS; + temp_opl3_type = opl3_type; + + /* Peripherals category */ + temp_scsi_card = scsi_card_current; + temp_net_card = network_card_current; + strncpy(temp_hdc_name, hdd_controller_name, sizeof(temp_hdc_name) - 1); + temp_ide_ter = ide_enable[2]; + temp_ide_ter_irq = ide_irq[2]; + temp_ide_qua = ide_enable[3]; + temp_ide_qua_irq = ide_irq[3]; + temp_serial[0] = serial_enabled[0]; + temp_serial[1] = serial_enabled[1]; + temp_lpt = lpt_enabled; + temp_bugger = bugger_enabled; + + /* Hard disks category */ + memcpy(temp_hdc, hdc, HDC_NUM * sizeof(hard_disk_t)); + for (i = 0; i < HDC_NUM; i++) + { + memcpy(temp_hdd_fn[i], hdd_fn[i], 512); + } + + /* Removable devices category */ + for (i = 0; i < FDD_NUM; i++) + { + temp_fdd_types[i] = fdd_get_type(i); + } + memcpy(temp_cdrom_drives, cdrom_drives, CDROM_NUM * sizeof(cdrom_drive_t)); +} + +/* This returns 1 if any variable has changed, 0 if not. */ +static int win_settings_changed() +{ + int i = 0; + int j = 0; + + /* Machine category */ + i = i || (model != temp_model); + i = i || (cpu_manufacturer != temp_cpu_m); + i = i || (cpu != temp_cpu); + i = i || (mem_size != temp_mem_size); + i = i || (temp_dynarec != cpu_use_dynarec); + i = i || (temp_fpu != enable_external_fpu); + i = i || (temp_sync != enable_sync); + + /* Video category */ + i = i || (gfxcard != temp_gfxcard); + i = i || (video_speed != temp_video_speed); + i = i || (voodoo_enabled != temp_voodoo); + + /* Input devices category */ + i = i || (mouse_type != temp_mouse); + i = i || (joystick_type != temp_joystick); + + /* Sound category */ + i = i || (sound_card_current != temp_sound_card); + i = i || (SSI2001 != temp_SSI2001); + i = i || (GAMEBLASTER != temp_GAMEBLASTER); + i = i || (GUS != temp_GUS); + i = i || (opl3_type != temp_opl3_type); + + /* Peripherals category */ + i = i || (scsi_card_current != temp_scsi_card); + i = i || (network_card_current != temp_net_card); + i = i || strncmp(temp_hdc_name, hdd_controller_name, sizeof(temp_hdc_name) - 1); + i = i || (temp_ide_ter != ide_enable[2]); + i = i || (temp_ide_ter_irq != ide_irq[2]); + i = i || (temp_ide_qua != ide_enable[3]); + i = i || (temp_ide_qua_irq != ide_irq[3]); + i = i || (temp_serial[0] != serial_enabled[0]); + i = i || (temp_serial[1] != serial_enabled[1]); + i = i || (temp_lpt != lpt_enabled); + i = i || (temp_bugger != bugger_enabled); + + /* Hard disks category */ + i = i || memcmp(hdc, temp_hdc, HDC_NUM * sizeof(hard_disk_t)); + for (j = 0; j < HDC_NUM; j++) + { + i = i || memcmp(hdd_fn[j], temp_hdd_fn[j], 512); + } + + /* Removable devices category */ + for (j = 0; j < FDD_NUM; j++) + { + i = i || (temp_fdd_types[j] != fdd_get_type(j)); + } + i = i || memcmp(cdrom_drives, temp_cdrom_drives, CDROM_NUM * sizeof(cdrom_drive_t)); + + return i; +} + +static int settings_msgbox_reset() +{ + int i = 0; + int changed = 0; + + changed = win_settings_changed(); + + if (changed) + { + i = msgbox_reset(hwndParentDialog); + + if (i == IDNO) + { + return 1; + } + else if (i == IDCANCEL) + { + return 0; + } + else + { + return 2; + } + } + else +{ + return 1; + } +} + +/* This saves the settings back to the global variables. */ +static void win_settings_save() +{ + int i = 0; + + /* Machine category */ + model = temp_model; + romset = model_getromset(); + cpu_manufacturer = temp_cpu_m; + cpu = temp_cpu; + mem_size = temp_mem_size; + cpu_use_dynarec = temp_dynarec; + enable_external_fpu = temp_fpu; + enable_sync = temp_sync; + + /* Video category */ + gfxcard = temp_gfxcard; + video_speed = temp_video_speed; + voodoo_enabled = temp_voodoo; + + /* Input devices category */ + mouse_type = temp_mouse; + joystick_type = temp_joystick; + + /* Sound category */ + sound_card_current = temp_sound_card; + SSI2001 = temp_SSI2001; + GAMEBLASTER = temp_GAMEBLASTER; + GUS = temp_GUS; + opl3_type = temp_opl3_type; + + /* Peripherals category */ + scsi_card_current = temp_scsi_card; + network_card_current = temp_net_card; + strncpy(hdd_controller_name, temp_hdc_name, sizeof(temp_hdc_name) - 1); + ide_enable[2] = temp_ide_ter; + ide_irq[2] = temp_ide_ter_irq; + ide_enable[3] = temp_ide_qua; + ide_irq[3] = temp_ide_qua_irq; + serial_enabled[0] = temp_serial[0]; + serial_enabled[1] = temp_serial[1]; + lpt_enabled = temp_lpt; + bugger_enabled = temp_bugger; + + /* Hard disks category */ + memcpy(hdc, temp_hdc, HDC_NUM * sizeof(hard_disk_t)); + for (i = 0; i < HDC_NUM; i++) + { + memcpy(hdd_fn[i], temp_hdd_fn[i], 512); + } + + /* Removable devices category */ + for (i = 0; i < FDD_NUM; i++) + { + fdd_set_type(i, temp_fdd_types[i]); + } + memcpy(cdrom_drives, temp_cdrom_drives, CDROM_NUM * sizeof(cdrom_drive_t)); + + mem_resize(); + loadbios(); + + resetpchard(); + + cpu_set(); + + cpu_update_waitstates(); + + saveconfig(); + + speedchanged(); + + if (joystick_type != 7) gameport_update_joystick_type(); + + update_status_bar_panes(hwndStatus); +} + +static void win_settings_machine_recalc_cpu(HWND hdlg) +{ + HWND h; + int temp_romset = 0; + int cpu_flags; + int cpu_type; + + temp_romset = model_getromset_ex(temp_model); + + h = GetDlgItem(hdlg, IDC_COMBO_WS); + cpu_type = models[romstomodel[temp_romset]].cpu[temp_cpu_m].cpus[temp_cpu].cpu_type; + if ((cpu_type >= CPU_286) && (cpu_type <= CPU_386DX)) + { + EnableWindow(h, TRUE); + } + else + { + EnableWindow(h, FALSE); + } + + h=GetDlgItem(hdlg, IDC_CHECK_DYNAREC); + cpu_flags = models[romstomodel[temp_romset]].cpu[temp_cpu_m].cpus[temp_cpu].cpu_flags; + if (!(cpu_flags & CPU_SUPPORTS_DYNAREC) && (cpu_flags & CPU_REQUIRES_DYNAREC)) + { + fatal("Attempting to select a CPU that requires the recompiler and does not support it at the same time\n"); + } + if (!(cpu_flags & CPU_SUPPORTS_DYNAREC) || (cpu_flags & CPU_REQUIRES_DYNAREC)) + { + if (!(cpu_flags & CPU_SUPPORTS_DYNAREC)) + { + temp_dynarec = 0; + } + if (cpu_flags & CPU_REQUIRES_DYNAREC) + { + temp_dynarec = 1; + } + SendMessage(h, BM_SETCHECK, temp_dynarec, 0); + EnableWindow(h, FALSE); + } + else + { + EnableWindow(h, TRUE); + } + + h = GetDlgItem(hdlg, IDC_CHECK_FPU); + cpu_type = models[romstomodel[temp_romset]].cpu[temp_cpu_m].cpus[temp_cpu].cpu_type; + if ((cpu_type < CPU_i486DX) && (cpu_type >= CPU_286)) + { + EnableWindow(h, TRUE); + } + else if (cpu_type < CPU_286) + { + temp_fpu = 0; + EnableWindow(h, FALSE); + } + else + { + temp_fpu = 1; + EnableWindow(h, FALSE); + } + SendMessage(h, BM_SETCHECK, temp_fpu, 0); +} + +static void win_settings_machine_recalc_cpu_m(HWND hdlg) +{ + HWND h; + int c = 0; + int temp_romset = 0; + LPTSTR lptsTemp; + char *stransi; + + temp_romset = model_getromset_ex(temp_model); + lptsTemp = (LPTSTR) malloc(512); + + h = GetDlgItem(hdlg, IDC_COMBO_CPU); + SendMessage(h, CB_RESETCONTENT, 0, 0); + c = 0; + while (models[romstomodel[temp_romset]].cpu[temp_cpu_m].cpus[c].cpu_type != -1) + { + stransi = models[romstomodel[temp_romset]].cpu[temp_cpu_m].cpus[c].name; + mbstowcs(lptsTemp, stransi, strlen(stransi) + 1); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)lptsTemp); + c++; + } + EnableWindow(h, TRUE); + SendMessage(h, CB_SETCURSEL, temp_cpu, 0); + + win_settings_machine_recalc_cpu(hdlg); + + free(lptsTemp); +} + +static void win_settings_machine_recalc_model(HWND hdlg) +{ + HWND h; + int c = 0; + int temp_romset = 0; + LPTSTR lptsTemp; + char *stransi; + UDACCEL accel; + + temp_romset = model_getromset_ex(temp_model); + lptsTemp = (LPTSTR) malloc(512); + + h = GetDlgItem(hdlg, IDC_CONFIGURE_MACHINE); + if (model_getdevice(temp_model)) + { + EnableWindow(h, TRUE); + } + else + { + EnableWindow(h, FALSE); + } + + h = GetDlgItem(hdlg, IDC_COMBO_CPU_TYPE); + SendMessage(h, CB_RESETCONTENT, 0, 0); + c = 0; + while (models[romstomodel[temp_romset]].cpu[c].cpus != NULL && c < 4) + { + stransi = models[romstomodel[temp_romset]].cpu[c].name; + mbstowcs(lptsTemp, stransi, strlen(stransi) + 1); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)lptsTemp); + c++; + } + EnableWindow(h, TRUE); + SendMessage(h, CB_SETCURSEL, temp_cpu_m, 0); + if (c == 1) + { + EnableWindow(h, FALSE); + } + else + { + EnableWindow(h, TRUE); + } + + win_settings_machine_recalc_cpu_m(hdlg); + + h = GetDlgItem(hdlg, IDC_MEMSPIN); + SendMessage(h, UDM_SETRANGE, 0, (models[romstomodel[temp_romset]].min_ram << 16) | models[romstomodel[temp_romset]].max_ram); + accel.nSec = 0; + accel.nInc = models[romstomodel[temp_romset]].ram_granularity; + SendMessage(h, UDM_SETACCEL, 1, (LPARAM)&accel); + if (!(models[romstomodel[temp_romset]].flags & MODEL_AT)) + { + SendMessage(h, UDM_SETPOS, 0, temp_mem_size); + h = GetDlgItem(hdlg, IDC_TEXT_MB); + SendMessage(h, WM_SETTEXT, 0, (LPARAM) win_language_get_string_from_id(2094)); + } + else + { + SendMessage(h, UDM_SETPOS, 0, temp_mem_size / 1024); + h = GetDlgItem(hdlg, IDC_TEXT_MB); + SendMessage(h, WM_SETTEXT, 0, (LPARAM) win_language_get_string_from_id(2087)); + } + + free(lptsTemp); +} + +static BOOL CALLBACK win_settings_machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + HWND h; + int c = 0; + int d = 0; + LPTSTR lptsTemp; + char *stransi; + + switch (message) + { + case WM_INITDIALOG: + lptsTemp = (LPTSTR) malloc(512); + + h = GetDlgItem(hdlg, IDC_COMBO_MACHINE); + for (c = 0; c < ROM_MAX; c++) + { + romstolist[c] = 0; + } + c = d = 0; + while (models[c].id != -1) + { + if (romspresent[models[c].id]) + { + stransi = models[c].name; + mbstowcs(lptsTemp, stransi, strlen(stransi) + 1); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + modeltolist[c] = d; + listtomodel[d] = c; + romstolist[models[c].id] = d; + romstomodel[models[c].id] = c; + d++; + } + c++; + } + SendMessage(h, CB_SETCURSEL, modeltolist[temp_model], 0); + + h = GetDlgItem(hdlg, IDC_COMBO_WS); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(2131)); + + for (c = 0; c < 8; c++) + { + wsprintf(lptsTemp, win_language_get_string_from_id(2132), c); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + } + + SendMessage(h, CB_SETCURSEL, cpu_waitstates, 0); + + h=GetDlgItem(hdlg, IDC_CHECK_DYNAREC); + SendMessage(h, BM_SETCHECK, temp_dynarec, 0); + + h = GetDlgItem(hdlg, IDC_MEMSPIN); + SendMessage(h, UDM_SETBUDDY, (WPARAM)GetDlgItem(hdlg, IDC_MEMTEXT), 0); + + h=GetDlgItem(hdlg, IDC_CHECK_SYNC); + SendMessage(h, BM_SETCHECK, temp_sync, 0); + + win_settings_machine_recalc_model(hdlg); + + free(lptsTemp); + + return TRUE; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_COMBO_MACHINE: + if (HIWORD(wParam) == CBN_SELCHANGE) + { + h = GetDlgItem(hdlg, IDC_COMBO_MACHINE); + temp_model = listtomodel[SendMessage(h,CB_GETCURSEL,0,0)]; + + win_settings_machine_recalc_model(hdlg); + } + break; + case IDC_COMBO_CPU_TYPE: + if (HIWORD(wParam) == CBN_SELCHANGE) + { + h = GetDlgItem(hdlg, IDC_COMBO_CPU_TYPE); + temp_cpu_m = SendMessage(h, CB_GETCURSEL, 0, 0); + + temp_cpu = 0; + win_settings_machine_recalc_cpu_m(hdlg); + } + break; + case IDC_COMBO_CPU: + if (HIWORD(wParam) == CBN_SELCHANGE) + { + h = GetDlgItem(hdlg, IDC_COMBO_CPU); + temp_cpu = SendMessage(h, CB_GETCURSEL, 0, 0); + + win_settings_machine_recalc_cpu(hdlg); + } + break; + case IDC_CONFIGURE_MACHINE: + h = GetDlgItem(hdlg, IDC_COMBO_MACHINE); + temp_model = listtomodel[SendMessage(h, CB_GETCURSEL, 0, 0)]; + + deviceconfig_open(hdlg, (void *)model_getdevice(temp_model)); + break; + } + + return FALSE; + + case WM_SAVESETTINGS: + lptsTemp = (LPTSTR) malloc(512); + stransi = (char *) malloc(512); + + h=GetDlgItem(hdlg, IDC_CHECK_DYNAREC); + temp_dynarec = SendMessage(h, BM_GETCHECK, 0, 0); + + h=GetDlgItem(hdlg, IDC_CHECK_SYNC); + temp_sync = SendMessage(h, BM_GETCHECK, 0, 0); + + h=GetDlgItem(hdlg, IDC_CHECK_FPU); + temp_fpu = SendMessage(h, BM_GETCHECK, 0, 0); + + h = GetDlgItem(hdlg, IDC_COMBO_WS); + temp_wait_states = SendMessage(h, CB_GETCURSEL, 0, 0); + + h = GetDlgItem(hdlg, IDC_MEMTEXT); + SendMessage(h, WM_GETTEXT, 255, (LPARAM) lptsTemp); + wcstombs(stransi, lptsTemp, (wcslen(lptsTemp) * 2) + 2); + sscanf(stransi, "%i", &temp_mem_size); + temp_mem_size &= ~(models[temp_model].ram_granularity - 1); + if (temp_mem_size < models[temp_model].min_ram) + { + temp_mem_size = models[temp_model].min_ram; + } + else if (temp_mem_size > models[temp_model].max_ram) + { + temp_mem_size = models[temp_model].max_ram; + } + if (models[temp_model].flags & MODEL_AT) + { + temp_mem_size *= 1024; + } + + free(stransi); + free(lptsTemp); + + default: + return FALSE; + } + + return FALSE; +} + +static void recalc_vid_list(HWND hdlg) +{ + HWND h = GetDlgItem(hdlg, IDC_COMBO_VIDEO); + int c = 0, d = 0; + int found_card = 0; + WCHAR szText[512]; + + SendMessage(h, CB_RESETCONTENT, 0, 0); + SendMessage(h, CB_SETCURSEL, 0, 0); + + while (1) + { + char *s = video_card_getname(c); + + if (!s[0]) + break; + + if (video_card_available(c) && gfx_present[video_new_to_old(c)] && + ((models[temp_model].flags & MODEL_PCI) || !(video_card_getdevice(c)->flags & DEVICE_PCI))) + { + mbstowcs(szText, s, strlen(s) + 1); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) szText); + if (video_new_to_old(c) == gfxcard) + { + + SendMessage(h, CB_SETCURSEL, d, 0); + found_card = 1; + } + + d++; + } + + c++; + } + if (!found_card) + SendMessage(h, CB_SETCURSEL, 0, 0); + EnableWindow(h, models[temp_model].fixed_gfxcard ? FALSE : TRUE); + + h = GetDlgItem(hdlg, IDC_CHECK_VOODOO); + EnableWindow(h, (models[model].flags & MODEL_PCI) ? TRUE : FALSE); + + h = GetDlgItem(hdlg, IDC_CONFIGURE_VOODOO); + EnableWindow(h, ((models[model].flags & MODEL_PCI) && temp_voodoo) ? TRUE : FALSE); +} + +static BOOL CALLBACK win_settings_video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + HWND h; + int c = 0; + int d = 0; + LPTSTR lptsTemp; + char *stransi; + char *s; + int gfx = 0; + + switch (message) + { + case WM_INITDIALOG: + lptsTemp = (LPTSTR) malloc(512); + stransi = (char *) malloc(512); + + recalc_vid_list(hdlg); + + h = GetDlgItem(hdlg, IDC_COMBO_VIDEO_SPEED); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(2133)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(2134)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(2135)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(2136)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(2137)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(2138)); + SendMessage(h, CB_SETCURSEL, temp_video_speed, 0); + + h=GetDlgItem(hdlg, IDC_CHECK_VOODOO); + SendMessage(h, BM_SETCHECK, temp_voodoo, 0); + + h = GetDlgItem(hdlg, IDC_COMBO_VIDEO); + SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM) lptsTemp); + wcstombs(stransi, lptsTemp, (wcslen(lptsTemp) * 2) + 2); + gfx = video_card_getid(stransi); + + h = GetDlgItem(hdlg, IDC_CONFIGUREVID); + if (video_card_has_config(gfx)) + { + EnableWindow(h, TRUE); + } + else + { + EnableWindow(h, FALSE); + } + + free(stransi); + free(lptsTemp); + + return TRUE; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_COMBO_VIDEO: + lptsTemp = (LPTSTR) malloc(512); + stransi = (char *) malloc(512); + + h = GetDlgItem(hdlg, IDC_COMBO_VIDEO); + SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM) lptsTemp); + wcstombs(stransi, lptsTemp, (wcslen(lptsTemp) * 2) + 2); + gfx = video_card_getid(stransi); + temp_gfxcard = video_new_to_old(gfx); + + h = GetDlgItem(hdlg, IDC_CONFIGUREVID); + if (video_card_has_config(gfx)) + { + EnableWindow(h, TRUE); + } + else + { + EnableWindow(h, FALSE); + } + + free(stransi); + free(lptsTemp); + break; + + case IDC_CHECK_VOODOO: + h = GetDlgItem(hdlg, IDC_CHECK_VOODOO); + temp_voodoo = SendMessage(h, BM_GETCHECK, 0, 0); + + h = GetDlgItem(hdlg, IDC_CONFIGURE_VOODOO); + EnableWindow(h, temp_voodoo ? TRUE : FALSE); + break; + + case IDC_CONFIGURE_VOODOO: + deviceconfig_open(hdlg, (void *)&voodoo_device); + break; + + case IDC_CONFIGUREVID: + lptsTemp = (LPTSTR) malloc(512); + stransi = (char *) malloc(512); + + h = GetDlgItem(hdlg, IDC_COMBO_VIDEO); + SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM) lptsTemp); + wcstombs(stransi, lptsTemp, (wcslen(lptsTemp) * 2) + 2); + deviceconfig_open(hdlg, (void *)video_card_getdevice(video_card_getid(stransi))); + + free(stransi); + free(lptsTemp); + break; + } + return FALSE; + + case WM_SAVESETTINGS: + lptsTemp = (LPTSTR) malloc(512); + stransi = (char *) malloc(512); + + h = GetDlgItem(hdlg, IDC_COMBO_VIDEO); + SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM) lptsTemp); + wcstombs(stransi, lptsTemp, (wcslen(lptsTemp) * 2) + 2); + temp_gfxcard = video_new_to_old(video_card_getid(stransi)); + + h = GetDlgItem(hdlg, IDC_COMBO_VIDEO_SPEED); + temp_video_speed = SendMessage(h, CB_GETCURSEL, 0, 0); + + h = GetDlgItem(hdlg, IDC_CHECK_VOODOO); + temp_voodoo = SendMessage(h, BM_GETCHECK, 0, 0); + + free(stransi); + free(lptsTemp); + + default: + return FALSE; + } + return FALSE; +} + + +static int mouse_valid(int type, int model) +{ + type &= MOUSE_TYPE_MASK; + + if ((type == MOUSE_TYPE_PS2) && + !(models[model].flags & MODEL_PS2)) return(0); + + if ((type == MOUSE_TYPE_AMSTRAD) && + !(models[model].flags & MODEL_AMSTRAD)) return(0); + + if ((type == MOUSE_TYPE_OLIM24) && + !(models[model].flags & MODEL_OLIM24)) return(0); + + return(1); +} + + +static BOOL CALLBACK win_settings_input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + HWND h; + int c = 0; + int d = 0; + int type; + int str_id = 0; + + switch (message) + { + case WM_INITDIALOG: + h = GetDlgItem(hdlg, IDC_COMBO_MOUSE); + c = d = 0; + for (c = 0; c < mouse_get_ndev(); c++) + { + type = mouse_get_type(c); + + settings_mouse_to_list[c] = d; + + if (mouse_valid(type, temp_model)) + { + switch(c) + { + case 0: /* MS Serial */ + default: + str_id = 2139; + break; + case 1: /* MS InPort Bus */ + str_id = 2177; + break; + case 2: /* PS2 2b */ + str_id = 2140; + break; + case 3: /* MS/logi bus 2b */ + str_id = 2161; + break; + case 4: /* PS2 intelli 3b */ + str_id = 2141; + break; + case 5: /* Amstrad */ + str_id = 2142; + break; + case 6: /* Olivetti M24 */ + str_id = 2143; + break; + case 7: /* MouseSystems */ + str_id = 2162; + break; + case 8: /* Genius Bus */ + str_id = 2178; + break; + } + + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(str_id)); + + settings_list_to_mouse[d] = c; + d++; + } + } + + SendMessage(h, CB_SETCURSEL, settings_mouse_to_list[temp_mouse], 0); + + h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK); + c = 0; + while (joystick_get_name(c)) + { + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(2144 + c)); + c++; + } + EnableWindow(h, TRUE); + SendMessage(h, CB_SETCURSEL, temp_joystick, 0); + + h = GetDlgItem(hdlg, IDC_JOY1); + EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 1) ? TRUE : FALSE); + h = GetDlgItem(hdlg, IDC_JOY2); + EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 2) ? TRUE : FALSE); + h = GetDlgItem(hdlg, IDC_JOY3); + EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 3) ? TRUE : FALSE); + h = GetDlgItem(hdlg, IDC_JOY4); + EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 4) ? TRUE : FALSE); + + return TRUE; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_COMBO_JOYSTICK: + if (HIWORD(wParam) == CBN_SELCHANGE) + { + h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK); + temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0); + + h = GetDlgItem(hdlg, IDC_JOY1); + EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 1) ? TRUE : FALSE); + h = GetDlgItem(hdlg, IDC_JOY2); + EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 2) ? TRUE : FALSE); + h = GetDlgItem(hdlg, IDC_JOY3); + EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 3) ? TRUE : FALSE); + h = GetDlgItem(hdlg, IDC_JOY4); + EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 4) ? TRUE : FALSE); + } + break; + + case IDC_JOY1: + h = GetDlgItem(hdlg, IDC_COMBOJOY); + temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0); + joystickconfig_open(hdlg, 0, temp_joystick); + break; + + case IDC_JOY2: + h = GetDlgItem(hdlg, IDC_COMBOJOY); + temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0); + joystickconfig_open(hdlg, 1, temp_joystick); + break; + + case IDC_JOY3: + h = GetDlgItem(hdlg, IDC_COMBOJOY); + temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0); + joystickconfig_open(hdlg, 2, temp_joystick); + break; + + case IDC_JOY4: + h = GetDlgItem(hdlg, IDC_COMBOJOY); + temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0); + joystickconfig_open(hdlg, 3, temp_joystick); + break; + } + return FALSE; + + case WM_SAVESETTINGS: + h = GetDlgItem(hdlg, IDC_COMBO_MOUSE); + temp_mouse = settings_list_to_mouse[SendMessage(h, CB_GETCURSEL, 0, 0)]; + + h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK); + temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0); + + default: + return FALSE; + } + return FALSE; +} + +static void recalc_hdd_list(HWND hdlg, int model, int use_selected_hdd) +{ + HWND h; + + char *s; + int valid = 0; + char old_name[16]; + int c, d; + + LPTSTR lptsTemp; + + lptsTemp = (LPTSTR) malloc(512); + + h = GetDlgItem(hdlg, IDC_COMBO_HDC); + + if (models[model].flags & MODEL_HAS_IDE) + { + hdc_ignore = 1; + + SendMessage(h, CB_RESETCONTENT, 0, 0); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(2154)); + EnableWindow(h, FALSE); + SendMessage(h, CB_SETCURSEL, 0, 0); + } + else + { + hdc_ignore = 0; + + valid = 0; + + if (use_selected_hdd) + { + c = SendMessage(h, CB_GETCURSEL, 0, 0); + + if (c != -1 && hdd_names[c]) + { + strncpy(old_name, hdd_names[c], sizeof(old_name) - 1); + } + else + { + strcpy(old_name, "none"); + } + } + else + { + strncpy(old_name, temp_hdc_name, sizeof(old_name) - 1); + } + + SendMessage(h, CB_RESETCONTENT, 0, 0); + c = d = 0; + while (1) + { + s = hdd_controller_get_name(c); + if (s[0] == 0) + { + break; + } + if ((hdd_controller_get_flags(c) & DEVICE_AT) && !(models[model].flags & MODEL_AT)) + { + c++; + continue; + } + if ((hdd_controller_get_flags(c) & DEVICE_PS2) && !(models[model].flags & MODEL_PS2_HDD)) + { + c++; + continue; + } + if ((hdd_controller_get_flags(c) & DEVICE_MCA) && !(models[model].flags & MODEL_MCA)) + { + c++; + continue; + } + if (!hdd_controller_available(c)) + { + c++; + continue; + } + if (c < 2) + { + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(2152 + c)); + } + else + { + mbstowcs(lptsTemp, s, strlen(s) + 1); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + } + hdd_names[d] = hdd_controller_get_internal_name(c); + if (!strcmp(old_name, hdd_names[d])) + { + SendMessage(h, CB_SETCURSEL, d, 0); + valid = 1; + } + c++; + d++; + } + + if (!valid) + { + SendMessage(h, CB_SETCURSEL, 0, 0); + } + + EnableWindow(h, TRUE); + } + + free(lptsTemp); +} + +int valid_ide_irqs[11] = { 2, 3, 4, 5, 7, 9, 10, 11, 12, 14, 15 }; + +int find_irq_in_array(int irq, int def) +{ + int i = 0; + + for (i = 0; i < 11; i++) + { + if (valid_ide_irqs[i] == irq) + { + return i + 1; + } + } + + return 7 + def; +} + +static BOOL CALLBACK win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + HWND h; + int c = 0; + int d = 0; + LPTSTR lptsTemp; + device_t *sound_dev; + + switch (message) + { + case WM_INITDIALOG: + lptsTemp = (LPTSTR) malloc(512); + + h = GetDlgItem(hdlg, IDC_COMBOSND); + c = d = 0; + while (1) + { + char *s = sound_card_getname(c); + + if (!s[0]) + { + break; + } + + settings_sound_to_list[c] = d; + + if (sound_card_available(c)) + { + sound_dev = sound_card_getdevice(c); + + if (!sound_dev || (sound_dev->flags & DEVICE_MCA) == (models[temp_model].flags & MODEL_MCA)) + { + if (c == 0) + { + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(2152)); + } + else + { + mbstowcs(lptsTemp, s, strlen(s) + 1); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + } + settings_list_to_sound[d] = c; + d++; + } + } + + c++; + } + SendMessage(h, CB_SETCURSEL, settings_sound_to_list[temp_sound_card], 0); + + h = GetDlgItem(hdlg, IDC_CONFIGURESND); + if (sound_card_has_config(temp_sound_card)) + { + EnableWindow(h, TRUE); + } + else + { + EnableWindow(h, FALSE); + } + + h=GetDlgItem(hdlg, IDC_CHECKCMS); + SendMessage(h, BM_SETCHECK, temp_GAMEBLASTER, 0); + + h=GetDlgItem(hdlg, IDC_CHECKGUS); + SendMessage(h, BM_SETCHECK, temp_GUS, 0); + + h=GetDlgItem(hdlg, IDC_CHECKSSI); + SendMessage(h, BM_SETCHECK, temp_SSI2001, 0); + + h=GetDlgItem(hdlg, IDC_CHECKNUKEDOPL); + SendMessage(h, BM_SETCHECK, temp_opl3_type, 0); + + free(lptsTemp); + + return TRUE; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_CONFIGURESND: + h = GetDlgItem(hdlg, IDC_COMBOSND); + temp_sound_card = settings_list_to_sound[SendMessage(h, CB_GETCURSEL, 0, 0)]; + + deviceconfig_open(hdlg, (void *)sound_card_getdevice(temp_sound_card)); + break; + + case IDC_COMBOSND: + h = GetDlgItem(hdlg, IDC_COMBOSND); + temp_sound_card = settings_list_to_sound[SendMessage(h, CB_GETCURSEL, 0, 0)]; + + h = GetDlgItem(hdlg, IDC_CONFIGURESND); + if (sound_card_has_config(temp_sound_card)) + { + EnableWindow(h, TRUE); + } + else + { + EnableWindow(h, FALSE); + } + break; + } + return FALSE; + + case WM_SAVESETTINGS: + h = GetDlgItem(hdlg, IDC_COMBOSND); + temp_sound_card = settings_list_to_sound[SendMessage(h, CB_GETCURSEL, 0, 0)]; + + h = GetDlgItem(hdlg, IDC_CHECKCMS); + temp_GAMEBLASTER = SendMessage(h, BM_GETCHECK, 0, 0); + + h = GetDlgItem(hdlg, IDC_CHECKGUS); + temp_GUS = SendMessage(h, BM_GETCHECK, 0, 0); + + h = GetDlgItem(hdlg, IDC_CHECKSSI); + temp_SSI2001 = SendMessage(h, BM_GETCHECK, 0, 0); + + h = GetDlgItem(hdlg, IDC_CHECKNUKEDOPL); + temp_opl3_type = SendMessage(h, BM_GETCHECK, 0, 0); + + default: + return FALSE; + } + return FALSE; +} + +static BOOL CALLBACK win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + HWND h; + int c = 0; + int d = 0; + LPTSTR lptsTemp; + + switch (message) + { + case WM_INITDIALOG: + lptsTemp = (LPTSTR) malloc(512); + + /*NIC config*/ + h = GetDlgItem(hdlg, IDC_COMBO_SCSI); + c = d = 0; + while (1) + { + char *s = scsi_card_getname(c); + + if (!s[0]) + { + break; + } + + settings_scsi_to_list[c] = d; + + if (scsi_card_available(c)) + { + if (c == 0) + { + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(2152)); + } + else + { + mbstowcs(lptsTemp, s, strlen(s) + 1); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + } + settings_list_to_scsi[d] = c; + d++; + } + + c++; + } + SendMessage(h, CB_SETCURSEL, settings_scsi_to_list[temp_scsi_card], 0); + + h = GetDlgItem(hdlg, IDC_CONFIGURE_SCSI); + if (scsi_card_has_config(temp_scsi_card)) + { + EnableWindow(h, TRUE); + } + else + { + EnableWindow(h, FALSE); + } + + recalc_hdd_list(hdlg, temp_model, 0); + + /*NIC config*/ + h = GetDlgItem(hdlg, IDC_COMBONET); + c = d = 0; + while (1) + { + char *s = network_card_getname(c); + + if (!s[0]) + { + break; + } + + settings_network_to_list[c] = d; + + if (network_card_available(c)) + { + if (c == 0) + { + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(2152)); + } + else + { + mbstowcs(lptsTemp, s, strlen(s) + 1); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + } + settings_list_to_network[d] = c; + d++; + } + + c++; + } + SendMessage(h, CB_SETCURSEL, settings_network_to_list[temp_net_card], 0); + + h = GetDlgItem(hdlg, IDC_CONFIGURENET); + if (network_card_has_config(temp_net_card)) + { + EnableWindow(h, TRUE); + } + else + { + EnableWindow(h, FALSE); + } + + h=GetDlgItem(hdlg, IDC_COMBO_IDE_TER); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(2151)); + + for (c = 0; c < 11; c++) + { + wsprintf(lptsTemp, win_language_get_string_from_id(2155), valid_ide_irqs[c]); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + } + + if (temp_ide_ter) + { + SendMessage(h, CB_SETCURSEL, find_irq_in_array(temp_ide_ter_irq, 0), 0); + } + else + { + SendMessage(h, CB_SETCURSEL, 0, 0); + } + + h=GetDlgItem(hdlg, IDC_COMBO_IDE_QUA); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(2151)); + + for (c = 0; c < 11; c++) + { + wsprintf(lptsTemp, win_language_get_string_from_id(2155), valid_ide_irqs[c]); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + } + + if (temp_ide_qua) + { + SendMessage(h, CB_SETCURSEL, find_irq_in_array(temp_ide_qua_irq, 1), 0); + } + else + { + SendMessage(h, CB_SETCURSEL, 0, 0); + } + + h=GetDlgItem(hdlg, IDC_CHECKSERIAL1); + SendMessage(h, BM_SETCHECK, temp_serial[0], 0); + + h=GetDlgItem(hdlg, IDC_CHECKSERIAL2); + SendMessage(h, BM_SETCHECK, temp_serial[1], 0); + + h=GetDlgItem(hdlg, IDC_CHECKPARALLEL); + SendMessage(h, BM_SETCHECK, temp_lpt, 0); + + h=GetDlgItem(hdlg, IDC_CHECKBUGGER); + SendMessage(h, BM_SETCHECK, temp_bugger, 0); + + free(lptsTemp); + + return TRUE; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_CONFIGURENET: + h = GetDlgItem(hdlg, IDC_COMBONET); + temp_net_card = settings_list_to_network[SendMessage(h, CB_GETCURSEL, 0, 0)]; + + deviceconfig_open(hdlg, (void *)network_card_getdevice(temp_net_card)); + break; + + case IDC_COMBONET: + h = GetDlgItem(hdlg, IDC_COMBONET); + temp_net_card = settings_list_to_network[SendMessage(h, CB_GETCURSEL, 0, 0)]; + + h = GetDlgItem(hdlg, IDC_CONFIGURENET); + if (network_card_has_config(temp_net_card)) + { + EnableWindow(h, TRUE); + } + else + { + EnableWindow(h, FALSE); + } + break; + + case IDC_CONFIGURE_SCSI: + h = GetDlgItem(hdlg, IDC_COMBO_SCSI); + temp_scsi_card = settings_list_to_scsi[SendMessage(h, CB_GETCURSEL, 0, 0)]; + + deviceconfig_open(hdlg, (void *)scsi_card_getdevice(temp_scsi_card)); + break; + + case IDC_COMBO_SCSI: + h = GetDlgItem(hdlg, IDC_COMBO_SCSI); + temp_scsi_card = settings_list_to_scsi[SendMessage(h, CB_GETCURSEL, 0, 0)]; + + h = GetDlgItem(hdlg, IDC_CONFIGURE_SCSI); + if (scsi_card_has_config(temp_scsi_card)) + { + EnableWindow(h, TRUE); + } + else + { + EnableWindow(h, FALSE); + } + break; + } + return FALSE; + + case WM_SAVESETTINGS: + if (hdc_ignore == 0) + { + h = GetDlgItem(hdlg, IDC_COMBO_HDC); + c = SendMessage(h, CB_GETCURSEL, 0, 0); + if (hdd_names[c]) + { + strncpy(temp_hdc_name, hdd_names[c], sizeof(temp_hdc_name) - 1); + } + else + { + strcpy(temp_hdc_name, "none"); + } + } + else + { + strcpy(temp_hdc_name, "none"); + } + + h = GetDlgItem(hdlg, IDC_COMBO_SCSI); + temp_scsi_card = settings_list_to_scsi[SendMessage(h, CB_GETCURSEL, 0, 0)]; + + h = GetDlgItem(hdlg, IDC_COMBONET); + temp_net_card = settings_list_to_network[SendMessage(h, CB_GETCURSEL, 0, 0)]; + + h = GetDlgItem(hdlg, IDC_COMBO_IDE_TER); + temp_ide_ter = SendMessage(h, CB_GETCURSEL, 0, 0); + if (temp_ide_ter > 1) + { + temp_ide_ter_irq = valid_ide_irqs[temp_ide_ter - 1]; + temp_ide_ter = 1; + } + + h = GetDlgItem(hdlg, IDC_COMBO_IDE_QUA); + temp_ide_qua = SendMessage(h, CB_GETCURSEL, 0, 0); + if (temp_ide_qua > 1) + { + temp_ide_qua_irq = valid_ide_irqs[temp_ide_qua - 1]; + temp_ide_qua = 1; + } + + h = GetDlgItem(hdlg, IDC_CHECKSERIAL1); + temp_serial[0] = SendMessage(h, BM_GETCHECK, 0, 0); + + h = GetDlgItem(hdlg, IDC_CHECKSERIAL2); + temp_serial[1] = SendMessage(h, BM_GETCHECK, 0, 0); + + h = GetDlgItem(hdlg, IDC_CHECKPARALLEL); + temp_lpt = SendMessage(h, BM_GETCHECK, 0, 0); + + h = GetDlgItem(hdlg, IDC_CHECKBUGGER); + temp_bugger = SendMessage(h, BM_GETCHECK, 0, 0); + + default: + return FALSE; + } + return FALSE; +} + +static BOOL win_settings_hard_disks_image_list_init(HWND hwndList) +{ + HICON hiconItem; + HIMAGELIST hSmall; + + int i = 0; + + hSmall = ImageList_Create(GetSystemMetrics(SM_CXSMICON), + GetSystemMetrics(SM_CYSMICON), + ILC_MASK | ILC_COLOR32, 1, 1); + + for (i = 0; i < 6; i += 2) + { + hiconItem = LoadIcon(hinstance, (LPCWSTR) (176 + i)); + ImageList_AddIcon(hSmall, hiconItem); + DestroyIcon(hiconItem); + } + + ListView_SetImageList(hwndList, hSmall, LVSIL_SMALL); + + return TRUE; +} + +int next_free_id = 0; + +static void normalize_hd_list() +{ + hard_disk_t ihdc[HDC_NUM]; + char ifn[HDC_NUM][512]; + int i, j; + + j = 0; + memset(ihdc, 0, HDC_NUM * sizeof(hard_disk_t)); + for (i = 0; i < HDC_NUM; i++) + { + memset(ifn[i], 0, 512); + } + for (i = 0; i < HDC_NUM; i++) + { + if ((temp_hdc[i].bus == 3) && (temp_hdc[i].scsi_id == 7)) + { + /* SCSI ID 7 is the host adapter, so any hard disk set to SCSI bus and ID 7 is to be treated as disabled and marked as such. */ + temp_hdc[i].bus = 0; + } + if (temp_hdc[i].bus > 0) + { + memcpy(&(ihdc[j]), &(temp_hdc[i]), sizeof(hard_disk_t)); + memcpy(ifn[j], temp_hdd_fn[i], 512); + j++; + } + } + + memcpy(temp_hdc, ihdc, HDC_NUM * sizeof(hard_disk_t)); + for (i = 0; i < HDC_NUM; i++) + { + memcpy(temp_hdd_fn[i], ifn[i], 512); + } +} + +int hdc_id_to_listview_index[HDC_NUM]; +int hd_listview_items; + +hard_disk_t new_hdc; +int hdlv_current_sel; + +static int get_selected_hard_disk(HWND hdlg) +{ + int hard_disk = -1; + int i, j = 0; + HWND h; + + for (i = 0; i < 6; i++) + { + h = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS); + j = ListView_GetItemState(h, i, LVIS_SELECTED); + if (j) + { + hard_disk = i; + } + } + + return hard_disk; +} + +static void add_locations(HWND hdlg) +{ + LPTSTR lptsTemp; + HWND h; + int i = 0; + + lptsTemp = (LPTSTR) malloc(512); + + h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS); + for (i = 0; i < 3; i++) + { + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(2166 + i)); + } + + h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL); + for (i = 0; i < 8; i++) + { + wsprintf(lptsTemp, win_language_get_string_from_id(2169), i >> 1, i & 1); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + } + + h = GetDlgItem(hdlg, IDC_COMBO_HD_ID); + for (i = 0; i < 16; i++) + { + wsprintf(lptsTemp, win_language_get_string_from_id(2088), i); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + } + + h = GetDlgItem(hdlg, IDC_COMBO_HD_LUN); + for (i = 0; i < 8; i++) + { + wsprintf(lptsTemp, win_language_get_string_from_id(2088), i); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + } + + h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL_IDE); + for (i = 0; i < 8; i++) + { + wsprintf(lptsTemp, win_language_get_string_from_id(2169), i >> 1, i & 1); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + } + + free(lptsTemp); +} + +static void recalc_location_controls(HWND hdlg, int is_add_dlg) +{ + int i = 0; + HWND h; + + int bus = 0; + + for (i = 1799; i < 1803; i++) + { + h = GetDlgItem(hdlg, i); + EnableWindow(h, FALSE); + ShowWindow(h, SW_HIDE); + } + + h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL); + EnableWindow(h, FALSE); + ShowWindow(h, SW_HIDE); + + h = GetDlgItem(hdlg, IDC_COMBO_HD_ID); + EnableWindow(h, FALSE); + ShowWindow(h, SW_HIDE); + + h = GetDlgItem(hdlg, IDC_COMBO_HD_LUN); + EnableWindow(h, FALSE); + ShowWindow(h, SW_HIDE); + + h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL_IDE); + EnableWindow(h, FALSE); + ShowWindow(h, SW_HIDE); + + if ((hd_listview_items > 0) || is_add_dlg) + { + h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS); + bus = SendMessage(h, CB_GETCURSEL, 0, 0); + + switch(bus) + { + case 0: /* MFM/RLL */ + h = GetDlgItem(hdlg, 1799); + ShowWindow(h, SW_SHOW); + EnableWindow(h, TRUE); + + h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL); + ShowWindow(h, SW_SHOW); + EnableWindow(h, TRUE); + SendMessage(h, CB_SETCURSEL, is_add_dlg ? new_hdc.mfm_channel : temp_hdc[hdlv_current_sel].mfm_channel, 0); + break; + case 1: /* IDE */ + h = GetDlgItem(hdlg, 1802); + ShowWindow(h, SW_SHOW); + EnableWindow(h, TRUE); + + h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL_IDE); + ShowWindow(h, SW_SHOW); + EnableWindow(h, TRUE); + SendMessage(h, CB_SETCURSEL, is_add_dlg ? new_hdc.ide_channel : temp_hdc[hdlv_current_sel].ide_channel, 0); + break; + case 2: /* SCSI */ + h = GetDlgItem(hdlg, 1800); + ShowWindow(h, SW_SHOW); + EnableWindow(h, TRUE); + h = GetDlgItem(hdlg, 1801); + ShowWindow(h, SW_SHOW); + EnableWindow(h, TRUE); + + h = GetDlgItem(hdlg, IDC_COMBO_HD_ID); + ShowWindow(h, SW_SHOW); + EnableWindow(h, TRUE); + SendMessage(h, CB_SETCURSEL, is_add_dlg ? new_hdc.scsi_id : temp_hdc[hdlv_current_sel].scsi_id, 0); + + h = GetDlgItem(hdlg, IDC_COMBO_HD_LUN); + ShowWindow(h, SW_SHOW); + EnableWindow(h, TRUE); + SendMessage(h, CB_SETCURSEL, is_add_dlg ? new_hdc.scsi_lun : temp_hdc[hdlv_current_sel].scsi_lun, 0); + break; + } + } + + if ((hd_listview_items == 0) && !is_add_dlg) + { + h = GetDlgItem(hdlg, 1798); + EnableWindow(h, FALSE); + ShowWindow(h, SW_HIDE); + + h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS); + EnableWindow(h, FALSE); + ShowWindow(h, SW_HIDE); + } + else + { + h = GetDlgItem(hdlg, 1798); + ShowWindow(h, SW_SHOW); + EnableWindow(h, TRUE); + + h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS); + ShowWindow(h, SW_SHOW); + EnableWindow(h, TRUE); + } +} + +static void recalc_next_free_id(HWND hdlg) +{ + HWND h; + int i; + + int c_mfm = 0; + int c_ide = 0; + int c_scsi = 0; + int enable_add = 0; + + next_free_id = -1; + + for (i = 0; i < HDC_NUM; i++) + { + if (temp_hdc[i].bus == 1) + { + c_mfm++; + } + else if (temp_hdc[i].bus == 2) + { + c_ide++; + } + else if (temp_hdc[i].bus == 3) + { + c_scsi++; + } + } + + for (i = 0; i < HDC_NUM; i++) + { + if (temp_hdc[i].bus == 0) + { + next_free_id = i; + break; + } + } + + /* pclog("Next free ID: %i\n", next_free_id); */ + + enable_add = enable_add || (next_free_id >= 0); + /* pclog("Enable add: %i\n", enable_add); */ + enable_add = enable_add && ((c_mfm < MFM_NUM) || (c_ide < IDE_NUM) || (c_scsi < SCSI_NUM)); + /* pclog("Enable add: %i\n", enable_add); */ + + h = GetDlgItem(hdlg, IDC_BUTTON_HDD_ADD_NEW); + + if (enable_add) + { + EnableWindow(h, TRUE); + } + else + { + EnableWindow(h, FALSE); + } + + h = GetDlgItem(hdlg, IDC_BUTTON_HDD_ADD); + + if (enable_add) + { + EnableWindow(h, TRUE); + } + else + { + EnableWindow(h, FALSE); + } + + h = GetDlgItem(hdlg, IDC_BUTTON_HDD_REMOVE); + + if ((c_mfm == 0) && (c_ide == 0) && (c_scsi == 0)) + { + EnableWindow(h, FALSE); + } + else + { + EnableWindow(h, TRUE); + } +} + +static void win_settings_hard_disks_update_item(HWND hwndList, int i, int column) +{ + LVITEM lvI; + WCHAR szText[256]; + + lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE; + lvI.stateMask = lvI.iSubItem = lvI.state = 0; + + lvI.iSubItem = column; + lvI.iItem = i; + + if (column == 0) + { + switch(temp_hdc[i].bus) + { + case 1: + wsprintf(szText, win_language_get_string_from_id(2156), temp_hdc[i].mfm_channel >> 1, temp_hdc[i].mfm_channel & 1); + break; + case 2: + wsprintf(szText, win_language_get_string_from_id(2157), temp_hdc[i].ide_channel >> 1, temp_hdc[i].ide_channel & 1); + break; + case 3: + wsprintf(szText, win_language_get_string_from_id(2158), temp_hdc[i].scsi_id, temp_hdc[i].scsi_lun); + break; + } + lvI.pszText = szText; + lvI.iImage = temp_hdc[i].bus - 1; + } + else if (column == 1) + { + mbstowcs(szText, temp_hdd_fn[i], strlen(temp_hdd_fn[i]) + 1); + lvI.pszText = szText; + lvI.iImage = 0; + } + else if (column == 2) + { + wsprintf(szText, win_language_get_string_from_id(2088), temp_hdc[i].tracks); + lvI.pszText = szText; + lvI.iImage = 0; + } + else if (column == 3) + { + wsprintf(szText, win_language_get_string_from_id(2088), temp_hdc[i].hpc); + lvI.pszText = szText; + lvI.iImage = 0; + } + else if (column == 4) + { + wsprintf(szText, win_language_get_string_from_id(2088), temp_hdc[i].spt); + lvI.pszText = szText; + lvI.iImage = 0; + } + else if (column == 5) + { + wsprintf(szText, win_language_get_string_from_id(2088), (temp_hdc[i].tracks * temp_hdc[i].hpc * temp_hdc[i].spt) >> 11); + lvI.pszText = szText; + lvI.iImage = 0; + } + + if (ListView_SetItem(hwndList, &lvI) == -1) + { + return; + } +} + +static BOOL win_settings_hard_disks_recalc_list(HWND hwndList) +{ + LVITEM lvI; + int i = 0; + int j = 0; + WCHAR szText[256]; + + hd_listview_items = 0; + hdlv_current_sel = -1; + + ListView_DeleteAllItems(hwndList); + + lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE; + lvI.stateMask = lvI.iSubItem = lvI.state = 0; + + for (i = 0; i < HDC_NUM; i++) + { + if (temp_hdc[i].bus > 0) + { + hdc_id_to_listview_index[i] = j; + lvI.iSubItem = 0; + switch(temp_hdc[i].bus) + { + case 1: + wsprintf(szText, win_language_get_string_from_id(2156), temp_hdc[i].mfm_channel >> 1, temp_hdc[i].mfm_channel & 1); + break; + case 2: + wsprintf(szText, win_language_get_string_from_id(2157), temp_hdc[i].ide_channel >> 1, temp_hdc[i].ide_channel & 1); + break; + case 3: + wsprintf(szText, win_language_get_string_from_id(2158), temp_hdc[i].scsi_id, temp_hdc[i].scsi_lun); + break; + } + lvI.pszText = szText; + lvI.iItem = j; + lvI.iImage = temp_hdc[i].bus - 1; + + if (ListView_InsertItem(hwndList, &lvI) == -1) + { + return FALSE; + } + + lvI.iSubItem = 1; + mbstowcs(szText, temp_hdd_fn[i], strlen(temp_hdd_fn[i]) + 1); + lvI.pszText = szText; + lvI.iItem = j; + lvI.iImage = 0; + + if (ListView_SetItem(hwndList, &lvI) == -1) + { + return FALSE; + } + + lvI.iSubItem = 2; + wsprintf(szText, win_language_get_string_from_id(2088), temp_hdc[i].tracks); + lvI.pszText = szText; + lvI.iItem = j; + lvI.iImage = 0; + + if (ListView_SetItem(hwndList, &lvI) == -1) + { + return FALSE; + } + + lvI.iSubItem = 3; + wsprintf(szText, win_language_get_string_from_id(2088), temp_hdc[i].hpc); + lvI.pszText = szText; + lvI.iItem = j; + lvI.iImage = 0; + + if (ListView_SetItem(hwndList, &lvI) == -1) + { + return FALSE; + } + + lvI.iSubItem = 4; + wsprintf(szText, win_language_get_string_from_id(2088), temp_hdc[i].spt); + lvI.pszText = szText; + lvI.iItem = j; + lvI.iImage = 0; + + if (ListView_SetItem(hwndList, &lvI) == -1) + { + return FALSE; + } + + lvI.iSubItem = 5; + wsprintf(szText, win_language_get_string_from_id(2088), (temp_hdc[i].tracks * temp_hdc[i].hpc * temp_hdc[i].spt) >> 11); + lvI.pszText = szText; + lvI.iItem = j; + lvI.iImage = 0; + + if (ListView_SetItem(hwndList, &lvI) == -1) + { + return FALSE; + } + + j++; + } + else + { + hdc_id_to_listview_index[i] = -1; + } + } + + hd_listview_items = j; + + return TRUE; +} + +/* Icon, Bus, File, C, H, S, Size */ +#define C_COLUMNS_HARD_DISKS 6 + +static BOOL win_settings_hard_disks_init_columns(HWND hwndList) +{ + LVCOLUMN lvc; + int iCol; + + lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; + + for (iCol = 0; iCol < C_COLUMNS_HARD_DISKS; iCol++) + { + lvc.iSubItem = iCol; + lvc.pszText = win_language_get_string_from_id(2082 + iCol); + + switch(iCol) + { + + case 0: /* Bus */ + lvc.cx = 85; + lvc.fmt = LVCFMT_LEFT; + break; + case 2: /* Cylinders */ + lvc.cx = 51; + lvc.fmt = LVCFMT_RIGHT; + break; + case 3: /* Heads */ + case 4: /* Sectors */ + lvc.cx = 25; + lvc.fmt = LVCFMT_RIGHT; + break; + case 1: /* File */ + lvc.cx = 180; + lvc.fmt = LVCFMT_LEFT; + break; + case 5: /* Size (MB) 8 */ + lvc.cx = 51; + lvc.fmt = LVCFMT_RIGHT; + break; + } + + if (ListView_InsertColumn(hwndList, iCol, &lvc) == -1) + { + return FALSE; + } + } + + return TRUE; +} + +static void get_edit_box_contents(HWND hdlg, int id, uint64_t *val) +{ + HWND h; + WCHAR szText[256]; + char stransi[256]; + + h = GetDlgItem(hdlg, id); + SendMessage(h, WM_GETTEXT, 255, (LPARAM) szText); + wcstombs(stransi, szText, (wcslen(szText) * 2) + 2); + sscanf(stransi, "%" PRIu64, val); +} + +static void get_combo_box_selection(HWND hdlg, int id, uint64_t *val) +{ + HWND h; + + h = GetDlgItem(hdlg, id); + *val = SendMessage(h, CB_GETCURSEL, 0, 0); +} + +static void set_edit_box_contents(HWND hdlg, int id, uint64_t val) +{ + HWND h; + WCHAR szText[256]; + + h = GetDlgItem(hdlg, id); + wsprintf(szText, win_language_get_string_from_id(2160), val); + SendMessage(h, WM_SETTEXT, (WPARAM) wcslen(szText), (LPARAM) szText); +} + +int hard_disk_added = 0; +int max_spt = 63; + +int no_update = 0; + +int existing = 0; +uint64_t selection = 127; + +uint64_t spt, hpc, tracks, size; +char hd_file_name[512]; + +static int hdconf_initialize_hdt_combo(HWND hdlg) +{ + HWND h; + int i = 0; + uint64_t temp_size = 0; + uint64_t size_mb = 0; + WCHAR szText[256]; + + selection = 127; + + h = GetDlgItem(hdlg, IDC_COMBO_HD_TYPE); + for (i = 0; i < 127; i++) + { + temp_size = hdt[i][0] * hdt[i][1] * hdt[i][2]; + size_mb = temp_size >> 11; + wsprintf(szText, win_language_get_string_from_id(2171), size_mb, hdt[i][0], hdt[i][1], hdt[i][2]); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) szText); + if ((tracks == hdt[i][0]) && (hpc == hdt[i][1]) && (spt == hdt[i][2])) + { + selection = i; + } + } + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(2170)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(2187)); + SendMessage(h, CB_SETCURSEL, selection, 0); + return selection; +} + +static void recalc_selection(HWND hdlg) +{ + HWND h; + int i = 0; + + selection = 127; + h = GetDlgItem(hdlg, IDC_COMBO_HD_TYPE); + for (i = 0; i < 127; i++) + { + if ((tracks == hdt[i][0]) && (hpc == hdt[i][1]) && (spt == hdt[i][2])) + { + selection = i; + } + } + if ((selection == 127) && (hpc == 16) && (spt == 63)) + { + selection = 128; + } + SendMessage(h, CB_SETCURSEL, selection, 0); +} + +static BOOL CALLBACK win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + HWND h; + int64_t i = 0; + int bus; + uint64_t temp; + WCHAR szText[256]; + FILE *f; + uint32_t sector_size = 512; + uint32_t zero = 0; + uint32_t base = 0x1000; + uint64_t signature = 0xD778A82044445459ll; + char buf[512]; + + switch (message) + { + case WM_INITDIALOG: + memset(hd_file_name, 0, 512); + + no_update = 1; + spt = existing ? 0 : 17; + set_edit_box_contents(hdlg, IDC_EDIT_HD_SPT, spt); + hpc = existing ? 0 : 15; + set_edit_box_contents(hdlg, IDC_EDIT_HD_HPC, hpc); + tracks = existing ? 0 : 1023; + set_edit_box_contents(hdlg, IDC_EDIT_HD_CYL, tracks); + size = (tracks * hpc * spt) << 9; + set_edit_box_contents(hdlg, IDC_EDIT_HD_SIZE, size >> 20); + hdconf_initialize_hdt_combo(hdlg); + if (existing) + { + h = GetDlgItem(hdlg, IDC_EDIT_HD_SPT); + EnableWindow(h, FALSE); + h = GetDlgItem(hdlg, IDC_EDIT_HD_HPC); + EnableWindow(h, FALSE); + h = GetDlgItem(hdlg, IDC_EDIT_HD_CYL); + EnableWindow(h, FALSE); + h = GetDlgItem(hdlg, IDC_EDIT_HD_SIZE); + EnableWindow(h, FALSE); + h = GetDlgItem(hdlg, IDC_COMBO_HD_TYPE); + EnableWindow(h, FALSE); + } + add_locations(hdlg); + h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS); + SendMessage(h, CB_SETCURSEL, 1, 0); + recalc_location_controls(hdlg, 1); + h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL); + SendMessage(h, CB_SETCURSEL, 0, 0); + h = GetDlgItem(hdlg, IDC_COMBO_HD_ID); + SendMessage(h, CB_SETCURSEL, 0, 0); + h = GetDlgItem(hdlg, IDC_COMBO_HD_LUN); + SendMessage(h, CB_SETCURSEL, 0, 0); + h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL_IDE); + SendMessage(h, CB_SETCURSEL, 0, 0); + no_update = 0; + return TRUE; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDOK: + if (strlen(hd_file_name) == 0) + { + msgbox_error(hwndParentDialog, 2056); + return TRUE; + } + + get_edit_box_contents(hdlg, IDC_EDIT_HD_SPT, &(temp_hdc[next_free_id].spt)); + get_edit_box_contents(hdlg, IDC_EDIT_HD_HPC, &(temp_hdc[next_free_id].hpc)); + get_edit_box_contents(hdlg, IDC_EDIT_HD_CYL, &(temp_hdc[next_free_id].tracks)); + h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS); + temp_hdc[next_free_id].bus = SendMessage(h, CB_GETCURSEL, 0, 0) + 1; + h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL); + temp_hdc[next_free_id].mfm_channel = SendMessage(h, CB_GETCURSEL, 0, 0); + h = GetDlgItem(hdlg, IDC_COMBO_HD_ID); + temp_hdc[next_free_id].scsi_id = SendMessage(h, CB_GETCURSEL, 0, 0); + h = GetDlgItem(hdlg, IDC_COMBO_HD_LUN); + temp_hdc[next_free_id].scsi_lun = SendMessage(h, CB_GETCURSEL, 0, 0); + h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL_IDE); + temp_hdc[next_free_id].ide_channel = SendMessage(h, CB_GETCURSEL, 0, 0); + memset(temp_hdd_fn[next_free_id], 0, 512); + memcpy(temp_hdd_fn[next_free_id], hd_file_name, strlen(hd_file_name) + 1); + + sector_size = 512; + + if (!existing && (strlen(hd_file_name) > 0)) + { + f = fopen(hd_file_name, "wb"); + + if (image_is_hdi(hd_file_name)) + { + if (size >= 0x100000000ll) + { + fclose(f); + msgbox_error(hwndParentDialog, 2058); + return TRUE; + } + + fwrite(&zero, 1, 4, f); /* 00000000: Zero/unknown */ + fwrite(&zero, 1, 4, f); /* 00000004: Zero/unknown */ + fwrite(&base, 1, 4, f); /* 00000008: Offset at which data starts */ + fwrite(&size, 1, 4, f); /* 0000000C: Full size of the data (32-bit) */ + fwrite(§or_size, 1, 4, f); /* 00000010: Sector size in bytes */ + fwrite(&spt, 1, 4, f); /* 00000014: Sectors per cylinder */ + fwrite(&hpc, 1, 4, f); /* 00000018: Heads per cylinder */ + fwrite(&tracks, 1, 4, f); /* 0000001C: Cylinders */ + + for (i = 0; i < 0x3f8; i++) + { + fwrite(&zero, 1, 4, f); + } + } + else if (image_is_hdx(hd_file_name, 0)) + { + if (size > 0xffffffffffffffffll) + { + fclose(f); + msgbox_error(hwndParentDialog, 2163); + return TRUE; + } + + fwrite(&signature, 1, 8, f); /* 00000000: Signature */ + fwrite(&size, 1, 8, f); /* 00000008: Full size of the data (64-bit) */ + fwrite(§or_size, 1, 4, f); /* 00000010: Sector size in bytes */ + fwrite(&spt, 1, 4, f); /* 00000014: Sectors per cylinder */ + fwrite(&hpc, 1, 4, f); /* 00000018: Heads per cylinder */ + fwrite(&tracks, 1, 4, f); /* 0000001C: Cylinders */ + fwrite(&zero, 1, 4, f); /* 00000020: [Translation] Sectors per cylinder */ + fwrite(&zero, 1, 4, f); /* 00000004: [Translation] Heads per cylinder */ + } + + memset(buf, 0, 512); + size >>= 9; + for (i = 0; i < size; i++) + { + fwrite(buf, 512, 1, f); + } + + fclose(f); + msgbox_info(hwndParentDialog, 2059); + } + + hard_disk_added = 1; + EndDialog(hdlg, 0); + return TRUE; + + case IDCANCEL: + hard_disk_added = 0; + EndDialog(hdlg, 0); + return TRUE; + + case IDC_CFILE: + if (!file_dlg(hdlg, win_language_get_string_from_id(2172), "", !existing)) + { + f = fopen(openfilestring, existing ? "rb" : "wb"); + if (f == NULL) + { + msgbox_error(hwndParentDialog, existing ? 2060 : 2057); + return TRUE; + } + if (existing) + { + if (image_is_hdi(openfilestring) || image_is_hdx(openfilestring, 1)) + { + fseeko64(f, 0x10, SEEK_SET); + fread(§or_size, 1, 4, f); + if (sector_size != 512) + { + msgbox_error(hwndParentDialog, 2061); + fclose(f); + return TRUE; + } + spt = hpc = tracks = 0; + fread(&spt, 1, 4, f); + fread(&hpc, 1, 4, f); + fread(&tracks, 1, 4, f); + } + else + { + fseeko64(f, 0, SEEK_END); + size = ftello64(f); + fclose(f); + if (((size % 17) == 0) && (size <= 133693440)) + { + spt = 17; + if (size <= 26738688) + { + hpc = 4; + } + else if (size <= 53477376) + { + hpc = 6; + } + else if (size <= 71303168) + { + hpc = 8; + } + else + { + hpc = 15; + } + } + else + { + spt = 63; + hpc = 16; + } + + tracks = ((size >> 9) / hpc) / spt; + } + + no_update = 1; + + set_edit_box_contents(hdlg, IDC_EDIT_HD_SPT, spt); + set_edit_box_contents(hdlg, IDC_EDIT_HD_HPC, hpc); + set_edit_box_contents(hdlg, IDC_EDIT_HD_CYL, tracks); + set_edit_box_contents(hdlg, IDC_EDIT_HD_SIZE, size >> 20); + recalc_selection(hdlg); + + h = GetDlgItem(hdlg, IDC_EDIT_HD_SPT); + EnableWindow(h, TRUE); + h = GetDlgItem(hdlg, IDC_EDIT_HD_HPC); + EnableWindow(h, TRUE); + h = GetDlgItem(hdlg, IDC_EDIT_HD_CYL); + EnableWindow(h, TRUE); + h = GetDlgItem(hdlg, IDC_EDIT_HD_SIZE); + EnableWindow(h, TRUE); + h = GetDlgItem(hdlg, IDC_COMBO_HD_TYPE); + EnableWindow(h, TRUE); + + no_update = 0; + } + else + { + fclose(f); + } + } + + h = GetDlgItem(hdlg, IDC_EDIT_HD_FILE_NAME); + mbstowcs(szText, openfilestring, strlen(openfilestring) + 1); + SendMessage(h, WM_SETTEXT, 0, (LPARAM) szText); + memcpy(hd_file_name, openfilestring, strlen(openfilestring) + 1); + + return TRUE; + + case IDC_EDIT_HD_CYL: + if (no_update) + { + return FALSE; + } + + no_update = 1; + get_edit_box_contents(hdlg, IDC_EDIT_HD_CYL, &temp); + if (temp != tracks) + { + tracks = temp; + size = (tracks * hpc * spt) << 9; + set_edit_box_contents(hdlg, IDC_EDIT_HD_SIZE, size >> 20); + recalc_selection(hdlg); + } + no_update = 0; + break; + + case IDC_EDIT_HD_HPC: + if (no_update) + { + return FALSE; + } + + no_update = 1; + get_edit_box_contents(hdlg, IDC_EDIT_HD_HPC, &temp); + if (temp != hpc) + { + hpc = temp; + size = (tracks * hpc * spt) << 9; + set_edit_box_contents(hdlg, IDC_EDIT_HD_SIZE, size >> 20); + recalc_selection(hdlg); + } + no_update = 0; + break; + + case IDC_EDIT_HD_SPT: + if (no_update) + { + return FALSE; + } + + no_update = 1; + get_edit_box_contents(hdlg, IDC_EDIT_HD_SPT, &temp); + if (temp != spt) + { + spt = temp; + size = (tracks * hpc * spt) << 9; + set_edit_box_contents(hdlg, IDC_EDIT_HD_SIZE, size >> 20); + recalc_selection(hdlg); + } + no_update = 0; + break; + + case IDC_EDIT_HD_SIZE: + if (no_update) + { + return FALSE; + } + + no_update = 1; + get_edit_box_contents(hdlg, IDC_EDIT_HD_SIZE, &temp); + if (temp != (size >> 20)) + { + size = temp << 20; + tracks = ((size >> 9) / hpc) / spt; + set_edit_box_contents(hdlg, IDC_EDIT_HD_CYL, tracks); + recalc_selection(hdlg); + } + no_update = 0; + break; + + case IDC_COMBO_HD_TYPE: + if (no_update) + { + return FALSE; + } + + no_update = 1; + get_combo_box_selection(hdlg, IDC_COMBO_HD_TYPE, &temp); + if ((temp != selection) && (temp != 127) && (temp != 128)) + { + selection = temp; + tracks = hdt[selection][0]; + hpc = hdt[selection][1]; + spt = hdt[selection][2]; + size = (tracks * hpc * spt) << 9; + set_edit_box_contents(hdlg, IDC_EDIT_HD_CYL, tracks); + set_edit_box_contents(hdlg, IDC_EDIT_HD_HPC, hpc); + set_edit_box_contents(hdlg, IDC_EDIT_HD_SPT, spt); + set_edit_box_contents(hdlg, IDC_EDIT_HD_SIZE, size >> 20); + } + else if ((temp != selection) && (temp == 127)) + { + selection = temp; + } + else if ((temp != selection) && (temp == 128)) + { + selection = temp; + hpc = 16; + spt = 63; + size = (tracks * hpc * spt) << 9; + set_edit_box_contents(hdlg, IDC_EDIT_HD_HPC, hpc); + set_edit_box_contents(hdlg, IDC_EDIT_HD_SPT, spt); + set_edit_box_contents(hdlg, IDC_EDIT_HD_SIZE, size >> 20); + } + no_update = 0; + break; + + case IDC_COMBO_HD_BUS: + if (no_update) + { + return FALSE; + } + + no_update = 1; + recalc_location_controls(hdlg, 1); + h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS); + bus = SendMessage(h, CB_GETCURSEL, 0, 0); + get_edit_box_contents(hdlg, IDC_EDIT_HD_SPT, &spt); + max_spt = (bus == 2) ? 99 : 63; + if (spt > max_spt) + { + spt = max_spt; + size = (tracks * hpc * spt) << 9; + set_edit_box_contents(hdlg, IDC_EDIT_HD_SPT, 17); + set_edit_box_contents(hdlg, IDC_EDIT_HD_SIZE, (size >> 20)); + recalc_selection(hdlg); + } + no_update = 0; + break; + } + + return FALSE; + } + + return FALSE; +} + +void hard_disk_add_open(HWND hwnd, int is_existing) +{ + BOOL ret; + + existing = !!is_existing; + hard_disk_added = 0; + ret = DialogBox(hinstance, (LPCWSTR) CONFIGUREDLG_HARD_DISKS_ADD, hwnd, win_settings_hard_disks_add_proc); +} + +int ignore_change = 0; + +static BOOL CALLBACK win_settings_hard_disks_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + HWND h; + int old_sel = 0; + + switch (message) + { + case WM_INITDIALOG: + ignore_change = 1; + + normalize_hd_list(); /* Normalize the hard disks so that non-disabled hard disks start from index 0, and so they are contiguous. + This will cause an emulator reset prompt on the first opening of this category with a messy hard disk list + (which can only happen by manually editing the configuration file). */ + h = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS); + win_settings_hard_disks_init_columns(h); + win_settings_hard_disks_image_list_init(h); + win_settings_hard_disks_recalc_list(h); + recalc_next_free_id(hdlg); + add_locations(hdlg); + if (hd_listview_items > 0) + { + ListView_SetItemState(h, 0, LVIS_FOCUSED | LVIS_SELECTED, 0x000F); + hdlv_current_sel = 0; + h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS); + SendMessage(h, CB_SETCURSEL, temp_hdc[0].bus - 1, 0); + } + else + { + hdlv_current_sel = -1; + } + recalc_location_controls(hdlg, 0); + + ignore_change = 0; + return TRUE; + + case WM_NOTIFY: + if ((hd_listview_items == 0) || ignore_change) + { + return FALSE; + } + + if ((((LPNMHDR)lParam)->code == LVN_ITEMCHANGED) && (((LPNMHDR)lParam)->idFrom == IDC_LIST_HARD_DISKS)) + { + old_sel = hdlv_current_sel; + hdlv_current_sel = get_selected_hard_disk(hdlg); + if (hdlv_current_sel == old_sel) + { + return FALSE; + } + else if (hdlv_current_sel == -1) + { + ignore_change = 1; + hdlv_current_sel = old_sel; + ListView_SetItemState(h, hdlv_current_sel, LVIS_FOCUSED | LVIS_SELECTED, 0x000F); + ignore_change = 0; + return FALSE; + } + ignore_change = 1; + h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS); + SendMessage(h, CB_SETCURSEL, temp_hdc[hdlv_current_sel].bus - 1, 0); + recalc_location_controls(hdlg, 0); + ignore_change = 0; + } + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_COMBO_HD_BUS: + if (ignore_change) + { + return FALSE; + } + + ignore_change = 1; + recalc_location_controls(hdlg, 0); + h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS); + temp_hdc[hdlv_current_sel].bus = SendMessage(h, CB_GETCURSEL, 0, 0) + 1; + h = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS); + win_settings_hard_disks_update_item(h, hdlv_current_sel, 0); + ignore_change = 0; + return FALSE; + + case IDC_COMBO_HD_CHANNEL: + if (ignore_change) + { + return FALSE; + } + + ignore_change = 1; + h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL); + temp_hdc[hdlv_current_sel].mfm_channel = SendMessage(h, CB_GETCURSEL, 0, 0); + h = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS); + win_settings_hard_disks_update_item(h, hdlv_current_sel, 0); + ignore_change = 0; + return FALSE; + + case IDC_COMBO_HD_CHANNEL_IDE: + if (ignore_change) + { + return FALSE; + } + + ignore_change = 1; + h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL_IDE); + temp_hdc[hdlv_current_sel].ide_channel = SendMessage(h, CB_GETCURSEL, 0, 0); + h = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS); + win_settings_hard_disks_update_item(h, hdlv_current_sel, 0); + ignore_change = 0; + return FALSE; + + case IDC_COMBO_HD_ID: + if (ignore_change) + { + return FALSE; + } + + ignore_change = 1; + h = GetDlgItem(hdlg, IDC_COMBO_HD_ID); + temp_hdc[hdlv_current_sel].scsi_id = SendMessage(h, CB_GETCURSEL, 0, 0); + h = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS); + win_settings_hard_disks_update_item(h, hdlv_current_sel, 0); + ignore_change = 0; + return FALSE; + + case IDC_COMBO_HD_LUN: + if (ignore_change) + { + return FALSE; + } + + ignore_change = 1; + h = GetDlgItem(hdlg, IDC_COMBO_HD_LUN); + temp_hdc[hdlv_current_sel].scsi_lun = SendMessage(h, CB_GETCURSEL, 0, 0); + h = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS); + win_settings_hard_disks_update_item(h, hdlv_current_sel, 0); + ignore_change = 0; + return FALSE; + + case IDC_BUTTON_HDD_ADD: + hard_disk_add_open(hdlg, 1); + if (hard_disk_added) + { + ignore_change = 1; + h = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS); + win_settings_hard_disks_recalc_list(h); + recalc_next_free_id(hdlg); + ignore_change = 0; + } + return FALSE; + + case IDC_BUTTON_HDD_ADD_NEW: + hard_disk_add_open(hdlg, 0); + if (hard_disk_added) + { + ignore_change = 1; + h = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS); + win_settings_hard_disks_recalc_list(h); + recalc_next_free_id(hdlg); + ignore_change = 0; + } + return FALSE; + + case IDC_BUTTON_HDD_REMOVE: + strncpy(temp_hdd_fn[hdlv_current_sel], "", strlen("") + 1); + temp_hdc[hdlv_current_sel].bus = 0; /* Only set the bus to zero, the list normalize code below will take care of turning this entire entry to a complete zero. */ + normalize_hd_list(); /* Normalize the hard disks so that non-disabled hard disks start from index 0, and so they are contiguous. */ + ignore_change = 1; + h = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS); + win_settings_hard_disks_recalc_list(h); + recalc_next_free_id(hdlg); + if (hd_listview_items > 0) + { + ListView_SetItemState(h, 0, LVIS_FOCUSED | LVIS_SELECTED, 0x000F); + hdlv_current_sel = 0; + h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS); + SendMessage(h, CB_SETCURSEL, temp_hdc[0].bus - 1, 0); + } + else + { + hdlv_current_sel = -1; + } + recalc_location_controls(hdlg, 0); + ignore_change = 0; + return FALSE; + } + + default: + return FALSE; + } + + return FALSE; +} + +int fdlv_current_sel; +int cdlv_current_sel; + +static void combo_id_to_bus(int combo_id) +{ + switch (combo_id) + { + case 0: /* Disabled */ + default: + temp_cdrom_drives[cdlv_current_sel].enabled = 0; + break; + case 1: /* Atapi (PIO-only) */ + temp_cdrom_drives[cdlv_current_sel].enabled = 1; + temp_cdrom_drives[cdlv_current_sel].bus_type = 0; + temp_cdrom_drives[cdlv_current_sel].atapi_dma = 0; + break; + case 2: /* Atapi (PIA and DMA) */ + temp_cdrom_drives[cdlv_current_sel].enabled = 1; + temp_cdrom_drives[cdlv_current_sel].bus_type = 0; + temp_cdrom_drives[cdlv_current_sel].atapi_dma = 1; + break; + case 3: /* SCSI */ + temp_cdrom_drives[cdlv_current_sel].enabled = 1; + temp_cdrom_drives[cdlv_current_sel].bus_type = 1; + temp_cdrom_drives[cdlv_current_sel].atapi_dma = 0; + break; + } +} + +static int combo_id_to_string_id(int combo_id) +{ + switch (combo_id) + { + case 0: /* Disabled */ + default: + return 2151; + break; + case 1: /* Atapi (PIO-only) */ + return 2189; + break; + case 2: /* Atapi (PIA and DMA) */ + return 2190; + break; + case 3: /* SCSI */ + return 2168; + break; + } +} + +static int combo_id_to_format_string_id(int combo_id) +{ + switch (combo_id) + { + case 0: /* Disabled */ + default: + return 2151; + break; + case 1: /* Atapi (PIO-only) */ + return 2191; + break; + case 2: /* Atapi (PIA and DMA) */ + return 2192; + break; + case 3: /* SCSI */ + return 2158; + break; + } +} + +static int bus_to_combo_id(int id) +{ + if (temp_cdrom_drives[id].enabled) + { + if (temp_cdrom_drives[id].bus_type) + { + return 3; + } + else + { + if (temp_cdrom_drives[id].atapi_dma) + { + return 2; + } + else + { + return 1; + } + } + } + else + { + return 0; + } + + return 0; +} + +static BOOL win_settings_floppy_drives_image_list_init(HWND hwndList) +{ + HICON hiconItem; + HIMAGELIST hSmall; + + int i = 0; + + hSmall = ImageList_Create(GetSystemMetrics(SM_CXSMICON), + GetSystemMetrics(SM_CYSMICON), + ILC_MASK | ILC_COLOR32, 1, 1); + + for (i = 0; i < 14; i++) + { + hiconItem = LoadIcon(hinstance, (LPCWSTR) fdd_type_to_icon(i)); + ImageList_AddIcon(hSmall, hiconItem); + DestroyIcon(hiconItem); + } + + ListView_SetImageList(hwndList, hSmall, LVSIL_SMALL); + + return TRUE; +} + +static BOOL win_settings_cdrom_drives_image_list_init(HWND hwndList) +{ + HICON hiconItem; + HIMAGELIST hSmall; + + int i = 0; + int j = 0; + + hSmall = ImageList_Create(GetSystemMetrics(SM_CXSMICON), + GetSystemMetrics(SM_CYSMICON), + ILC_MASK | ILC_COLOR32, 1, 1); + + hiconItem = LoadIcon(hinstance, (LPCWSTR) 514); + ImageList_AddIcon(hSmall, hiconItem); + DestroyIcon(hiconItem); + + hiconItem = LoadIcon(hinstance, (LPCWSTR) 160); + ImageList_AddIcon(hSmall, hiconItem); + DestroyIcon(hiconItem); + + hiconItem = LoadIcon(hinstance, (LPCWSTR) 162); + ImageList_AddIcon(hSmall, hiconItem); + DestroyIcon(hiconItem); + + hiconItem = LoadIcon(hinstance, (LPCWSTR) 164); + ImageList_AddIcon(hSmall, hiconItem); + DestroyIcon(hiconItem); + + ListView_SetImageList(hwndList, hSmall, LVSIL_SMALL); + + return TRUE; +} + +static BOOL win_settings_floppy_drives_recalc_list(HWND hwndList) +{ + LVITEM lvI; + int i = 0; + char s[256]; + WCHAR szText[256]; + + lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE; + lvI.stateMask = lvI.iSubItem = lvI.state = 0; + + for (i = 0; i < 4; i++) + { + if (temp_fdd_types[i] > 0) + { + strcpy(s, fdd_getname(temp_fdd_types[i])); + mbstowcs(szText, s, strlen(s) + 1); + lvI.pszText = szText; + } + else + { + lvI.pszText = win_language_get_string_from_id(2151); + } + lvI.iItem = i; + lvI.iImage = temp_fdd_types[i]; + + if (ListView_InsertItem(hwndList, &lvI) == -1) + return FALSE; + } + + return TRUE; +} + +static BOOL win_settings_cdrom_drives_recalc_list(HWND hwndList) +{ + LVITEM lvI; + int i = 0; + char s[256]; + WCHAR szText[256]; + int bid = 0; + int fsid = 0; + + lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE; + lvI.stateMask = lvI.iSubItem = lvI.state = 0; + + for (i = 0; i < 4; i++) + { + bid = bus_to_combo_id(i); + fsid = combo_id_to_format_string_id(bid); + + switch (bid) + { + case 0: + default: + lvI.pszText = win_language_get_string_from_id(fsid); + break; + case 1: + case 2: + wsprintf(szText, win_language_get_string_from_id(fsid), temp_cdrom_drives[i].ide_channel >> 1, temp_cdrom_drives[i].ide_channel & 1); + lvI.pszText = szText; + break; + case 3: + wsprintf(szText, win_language_get_string_from_id(fsid), temp_cdrom_drives[i].scsi_device_id, temp_cdrom_drives[i].scsi_device_lun); + lvI.pszText = szText; + break; + } + + lvI.iItem = i; + lvI.iImage = bid; + + if (ListView_InsertItem(hwndList, &lvI) == -1) + return FALSE; + } + + return TRUE; +} + +static BOOL win_settings_floppy_drives_init_columns(HWND hwndList) +{ + LVCOLUMN lvc; + + lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; + + lvc.iSubItem = 0; + lvc.pszText = win_language_get_string_from_id(2188); + + lvc.cx = 392; + lvc.fmt = LVCFMT_LEFT; + + if (ListView_InsertColumn(hwndList, 0, &lvc) == -1) + { + return FALSE; + } + + return TRUE; +} + +static BOOL win_settings_cdrom_drives_init_columns(HWND hwndList) +{ + LVCOLUMN lvc; + + lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; + + lvc.iSubItem = 0; + lvc.pszText = win_language_get_string_from_id(2082); + + lvc.cx = 392; + lvc.fmt = LVCFMT_LEFT; + + if (ListView_InsertColumn(hwndList, 0, &lvc) == -1) + { + return FALSE; + } + + return TRUE; +} + +static int get_selected_floppy_drive(HWND hdlg) +{ + int floppy_drive = -1; + int i, j = 0; + HWND h; + + for (i = 0; i < 6; i++) + { + h = GetDlgItem(hdlg, IDC_LIST_FLOPPY_DRIVES); + j = ListView_GetItemState(h, i, LVIS_SELECTED); + if (j) + { + floppy_drive = i; + } + } + + return floppy_drive; +} + +static int get_selected_cdrom_drive(HWND hdlg) +{ + int cd_drive = -1; + int i, j = 0; + HWND h; + + for (i = 0; i < 6; i++) + { + h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES); + j = ListView_GetItemState(h, i, LVIS_SELECTED); + if (j) + { + cd_drive = i; + } + } + + return cd_drive; +} + +static void win_settings_floppy_drives_update_item(HWND hwndList, int i) +{ + LVITEM lvI; + char s[256]; + WCHAR szText[256]; + + lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE; + lvI.stateMask = lvI.iSubItem = lvI.state = 0; + + lvI.iSubItem = 0; + lvI.iItem = i; + + if (temp_fdd_types[i] > 0) + { + strcpy(s, fdd_getname(temp_fdd_types[i])); + mbstowcs(szText, s, strlen(s) + 1); + lvI.pszText = szText; + } + else + { + lvI.pszText = win_language_get_string_from_id(2151); + } + lvI.iImage = temp_fdd_types[i]; + + if (ListView_SetItem(hwndList, &lvI) == -1) + { + return; + } +} + +static void win_settings_cdrom_drives_update_item(HWND hwndList, int i) +{ + LVITEM lvI; + char s[256]; + WCHAR szText[256]; + int bid; + int fsid; + + lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE; + lvI.stateMask = lvI.iSubItem = lvI.state = 0; + + lvI.iSubItem = 0; + lvI.iItem = i; + + bid = bus_to_combo_id(i); + fsid = combo_id_to_format_string_id(bid); + + switch (bid) + { + case 0: + default: + lvI.pszText = win_language_get_string_from_id(fsid); + break; + case 1: + case 2: + wsprintf(szText, win_language_get_string_from_id(fsid), temp_cdrom_drives[i].ide_channel >> 1, temp_cdrom_drives[i].ide_channel & 1); + lvI.pszText = szText; + break; + case 3: + wsprintf(szText, win_language_get_string_from_id(fsid), temp_cdrom_drives[i].scsi_device_id, temp_cdrom_drives[i].scsi_device_lun); + lvI.pszText = szText; + break; + } + + lvI.iImage = bid; + + if (ListView_SetItem(hwndList, &lvI) == -1) + { + return; + } +} + +static void cdrom_add_locations(HWND hdlg) +{ + LPTSTR lptsTemp; + HWND h; + int i = 0; + + lptsTemp = (LPTSTR) malloc(512); + + h = GetDlgItem(hdlg, IDC_COMBO_CD_BUS); + for (i = 0; i < 4; i++) + { + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(combo_id_to_string_id(i))); + } + + h = GetDlgItem(hdlg, IDC_COMBO_CD_ID); + for (i = 0; i < 16; i++) + { + wsprintf(lptsTemp, win_language_get_string_from_id(2088), i); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + } + + h = GetDlgItem(hdlg, IDC_COMBO_CD_LUN); + for (i = 0; i < 8; i++) + { + wsprintf(lptsTemp, win_language_get_string_from_id(2088), i); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + } + + h = GetDlgItem(hdlg, IDC_COMBO_CD_CHANNEL_IDE); + for (i = 0; i < 8; i++) + { + wsprintf(lptsTemp, win_language_get_string_from_id(2169), i >> 1, i & 1); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + } + + free(lptsTemp); +} +static void cdrom_recalc_location_controls(HWND hdlg) +{ + int i = 0; + HWND h; + + int bus = bus_to_combo_id(cdlv_current_sel); + + for (i = 1800; i < 1803; i++) + { + h = GetDlgItem(hdlg, i); + EnableWindow(h, FALSE); + ShowWindow(h, SW_HIDE); + } + + h = GetDlgItem(hdlg, IDC_COMBO_CD_ID); + EnableWindow(h, FALSE); + ShowWindow(h, SW_HIDE); + + h = GetDlgItem(hdlg, IDC_COMBO_CD_LUN); + EnableWindow(h, FALSE); + ShowWindow(h, SW_HIDE); + + h = GetDlgItem(hdlg, IDC_COMBO_CD_CHANNEL_IDE); + EnableWindow(h, FALSE); + ShowWindow(h, SW_HIDE); + + switch(bus) + { + case 1: /* ATAPI (PIO-only) */ + case 2: /* ATAPI (PIO and DMA) */ + h = GetDlgItem(hdlg, 1802); + ShowWindow(h, SW_SHOW); + EnableWindow(h, TRUE); + + h = GetDlgItem(hdlg, IDC_COMBO_CD_CHANNEL_IDE); + ShowWindow(h, SW_SHOW); + EnableWindow(h, TRUE); + SendMessage(h, CB_SETCURSEL, temp_cdrom_drives[cdlv_current_sel].ide_channel, 0); + break; + case 3: /* SCSI */ + h = GetDlgItem(hdlg, 1800); + ShowWindow(h, SW_SHOW); + EnableWindow(h, TRUE); + h = GetDlgItem(hdlg, 1801); + ShowWindow(h, SW_SHOW); + EnableWindow(h, TRUE); + + h = GetDlgItem(hdlg, IDC_COMBO_CD_ID); + ShowWindow(h, SW_SHOW); + EnableWindow(h, TRUE); + SendMessage(h, CB_SETCURSEL, temp_cdrom_drives[cdlv_current_sel].scsi_device_id, 0); + + h = GetDlgItem(hdlg, IDC_COMBO_CD_LUN); + ShowWindow(h, SW_SHOW); + EnableWindow(h, TRUE); + SendMessage(h, CB_SETCURSEL, temp_cdrom_drives[cdlv_current_sel].scsi_device_lun, 0); + break; + } +} + + +int rd_ignore_change = 0; + +static BOOL CALLBACK win_settings_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + HWND h; + int i = 0; + int old_sel = 0; + int cid = 0; + WCHAR szText[256]; + + switch (message) + { + case WM_INITDIALOG: + rd_ignore_change = 1; + + fdlv_current_sel = 0; + h = GetDlgItem(hdlg, IDC_LIST_FLOPPY_DRIVES); + win_settings_floppy_drives_init_columns(h); + win_settings_floppy_drives_image_list_init(h); + win_settings_floppy_drives_recalc_list(h); + ListView_SetItemState(h, 0, LVIS_FOCUSED | LVIS_SELECTED, 0x000F); + h = GetDlgItem(hdlg, IDC_COMBO_FD_TYPE); + for (i = 0; i < 14; i++) + { + if (i == 0) + { + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(2151)); + } + else + { + mbstowcs(szText, fdd_getname(i), strlen(fdd_getname(i)) + 1); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) szText); + } + } + SendMessage(h, CB_SETCURSEL, temp_fdd_types[fdlv_current_sel], 0); + + cdlv_current_sel = 0; + h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES); + win_settings_cdrom_drives_init_columns(h); + win_settings_cdrom_drives_image_list_init(h); + win_settings_cdrom_drives_recalc_list(h); + ListView_SetItemState(h, 0, LVIS_FOCUSED | LVIS_SELECTED, 0x000F); + cdrom_add_locations(hdlg); + h = GetDlgItem(hdlg, IDC_COMBO_CD_BUS); + SendMessage(h, CB_SETCURSEL, bus_to_combo_id(cdlv_current_sel), 0); + cdrom_recalc_location_controls(hdlg); + + rd_ignore_change = 0; + return TRUE; + + case WM_NOTIFY: + if (rd_ignore_change) + { + return FALSE; + } + + if ((((LPNMHDR)lParam)->code == LVN_ITEMCHANGED) && (((LPNMHDR)lParam)->idFrom == IDC_LIST_FLOPPY_DRIVES)) + { + old_sel = fdlv_current_sel; + fdlv_current_sel = get_selected_floppy_drive(hdlg); + if (fdlv_current_sel == old_sel) + { + return FALSE; + } + else if (fdlv_current_sel == -1) + { + rd_ignore_change = 1; + fdlv_current_sel = old_sel; + ListView_SetItemState(h, fdlv_current_sel, LVIS_FOCUSED | LVIS_SELECTED, 0x000F); + rd_ignore_change = 0; + return FALSE; + } + rd_ignore_change = 1; + h = GetDlgItem(hdlg, IDC_COMBO_FD_TYPE); + SendMessage(h, CB_SETCURSEL, temp_fdd_types[fdlv_current_sel], 0); + rd_ignore_change = 0; + } + else if ((((LPNMHDR)lParam)->code == LVN_ITEMCHANGED) && (((LPNMHDR)lParam)->idFrom == IDC_LIST_CDROM_DRIVES)) + { + old_sel = cdlv_current_sel; + cdlv_current_sel = get_selected_cdrom_drive(hdlg); + if (cdlv_current_sel == old_sel) + { + return FALSE; + } + else if (cdlv_current_sel == -1) + { + rd_ignore_change = 1; + cdlv_current_sel = old_sel; + ListView_SetItemState(h, cdlv_current_sel, LVIS_FOCUSED | LVIS_SELECTED, 0x000F); + rd_ignore_change = 0; + return FALSE; + } + rd_ignore_change = 1; + h = GetDlgItem(hdlg, IDC_COMBO_CD_BUS); + SendMessage(h, CB_SETCURSEL, bus_to_combo_id(cdlv_current_sel), 0); + cdrom_recalc_location_controls(hdlg); + rd_ignore_change = 0; + } + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_COMBO_FD_TYPE: + if (rd_ignore_change) + { + return FALSE; + } + + rd_ignore_change = 1; + h = GetDlgItem(hdlg, IDC_COMBO_FD_TYPE); + temp_fdd_types[fdlv_current_sel] = SendMessage(h, CB_GETCURSEL, 0, 0); + h = GetDlgItem(hdlg, IDC_LIST_FLOPPY_DRIVES); + win_settings_floppy_drives_update_item(h, fdlv_current_sel); + rd_ignore_change = 0; + return FALSE; + + case IDC_COMBO_CD_BUS: + if (rd_ignore_change) + { + return FALSE; + } + + rd_ignore_change = 1; + h = GetDlgItem(hdlg, IDC_COMBO_CD_BUS); + cid = SendMessage(h, CB_GETCURSEL, 0, 0); + combo_id_to_bus(cid); + cdrom_recalc_location_controls(hdlg); + h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES); + win_settings_cdrom_drives_update_item(h, cdlv_current_sel); + rd_ignore_change = 0; + return FALSE; + + case IDC_COMBO_CD_ID: + if (rd_ignore_change) + { + return FALSE; + } + + rd_ignore_change = 1; + h = GetDlgItem(hdlg, IDC_COMBO_CD_ID); + temp_cdrom_drives[cdlv_current_sel].scsi_device_id = SendMessage(h, CB_GETCURSEL, 0, 0); + h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES); + win_settings_cdrom_drives_update_item(h, cdlv_current_sel); + rd_ignore_change = 0; + return FALSE; + + case IDC_COMBO_CD_LUN: + if (rd_ignore_change) + { + return FALSE; + } + + rd_ignore_change = 1; + h = GetDlgItem(hdlg, IDC_COMBO_CD_LUN); + temp_cdrom_drives[cdlv_current_sel].scsi_device_lun = SendMessage(h, CB_GETCURSEL, 0, 0); + h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES); + win_settings_cdrom_drives_update_item(h, cdlv_current_sel); + rd_ignore_change = 0; + return FALSE; + + case IDC_COMBO_CD_CHANNEL_IDE: + if (rd_ignore_change) + { + return FALSE; + } + + rd_ignore_change = 1; + h = GetDlgItem(hdlg, IDC_COMBO_CD_CHANNEL_IDE); + temp_cdrom_drives[cdlv_current_sel].ide_channel = SendMessage(h, CB_GETCURSEL, 0, 0); + h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES); + win_settings_cdrom_drives_update_item(h, cdlv_current_sel); + rd_ignore_change = 0; + return FALSE; + } + + default: + return FALSE; + } + + return FALSE; +} + +void win_settings_show_child(HWND hwndParent, DWORD child_id) +{ + if (child_id == displayed_category) + { + return; + } + else + { + displayed_category = child_id; + } + + SendMessage(hwndChildDialog, WM_SAVESETTINGS, 0, 0); + + DestroyWindow(hwndChildDialog); + + switch(child_id) + { + case 0: + hwndChildDialog = CreateDialog(hinstance, (LPCWSTR) CONFIGUREDLG_MACHINE, hwndParent, win_settings_machine_proc); + break; + case 1: + hwndChildDialog = CreateDialog(hinstance, (LPCWSTR) CONFIGUREDLG_VIDEO, hwndParent, win_settings_video_proc); + break; + case 2: + hwndChildDialog = CreateDialog(hinstance, (LPCWSTR) CONFIGUREDLG_INPUT, hwndParent, win_settings_input_proc); + break; + case 3: + hwndChildDialog = CreateDialog(hinstance, (LPCWSTR) CONFIGUREDLG_SOUND, hwndParent, win_settings_sound_proc); + break; + case 4: + hwndChildDialog = CreateDialog(hinstance, (LPCWSTR) CONFIGUREDLG_PERIPHERALS, hwndParent, win_settings_peripherals_proc); + break; + case 5: + hwndChildDialog = CreateDialog(hinstance, (LPCWSTR) CONFIGUREDLG_HARD_DISKS, hwndParent, win_settings_hard_disks_proc); + break; + case 6: + hwndChildDialog = CreateDialog(hinstance, (LPCWSTR) CONFIGUREDLG_REMOVABLE_DEVICES, hwndParent, win_settings_removable_devices_proc); + break; + default: + fatal("Invalid child dialog ID\n"); + return; + } + + ShowWindow(hwndChildDialog, SW_SHOWNORMAL); +} + +static BOOL win_settings_main_image_list_init(HWND hwndList) +{ + HICON hiconItem; + HIMAGELIST hSmall; + + int i = 0; + + hSmall = ImageList_Create(GetSystemMetrics(SM_CXSMICON), + GetSystemMetrics(SM_CYSMICON), + ILC_MASK | ILC_COLOR32, 1, 1); + + for (i = 0; i < 7; i++) + { + hiconItem = LoadIcon(hinstance, (LPCWSTR) (256 + i)); + ImageList_AddIcon(hSmall, hiconItem); + DestroyIcon(hiconItem); + } + + ListView_SetImageList(hwndList, hSmall, LVSIL_SMALL); + + return TRUE; +} + +static BOOL win_settings_main_insert_categories(HWND hwndList) +{ + LVITEM lvI; + int i = 0; + + lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE; + lvI.stateMask = lvI.iSubItem = lvI.state = 0; + + for (i = 0; i < 7; i++) + { + lvI.pszText = win_language_get_settings_category(i); + lvI.iItem = i; + lvI.iImage = i; + + if (ListView_InsertItem(hwndList, &lvI) == -1) + return FALSE; + } + + return TRUE; +} + +static BOOL CALLBACK win_settings_main_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + HWND h; + int category; + int i = 0; + int j = 0; + + hwndParentDialog = hdlg; + + switch (message) + { + case WM_INITDIALOG: + pause = 1; + win_settings_init(); + displayed_category = -1; + h = GetDlgItem(hdlg, IDC_SETTINGSCATLIST); + win_settings_main_image_list_init(h); + win_settings_main_insert_categories(h); + ListView_SetItemState(h, 0, LVIS_FOCUSED | LVIS_SELECTED, 0x000F); + h = GetDlgItem(hdlg, IDC_COMBO_LANG); /* This is currently disabled, I am going to add localization options in the future. */ + EnableWindow(h, FALSE); + ShowWindow(h, SW_HIDE); + h = GetDlgItem(hdlg, 2047); + EnableWindow(h, FALSE); + ShowWindow(h, SW_HIDE); + return TRUE; + case WM_NOTIFY: + if ((((LPNMHDR)lParam)->code == LVN_ITEMCHANGED) && (((LPNMHDR)lParam)->idFrom == IDC_SETTINGSCATLIST)) + { + category = -1; + for (i = 0; i < 7; i++) + { + h = GetDlgItem(hdlg, IDC_SETTINGSCATLIST); + j = ListView_GetItemState(h, i, LVIS_SELECTED); + if (j) + { + category = i; + /* pclog("Category %i selected\n", i); */ + } + } + if (category != -1) + { + /* pclog("Showing child: %i\n", category); */ + win_settings_show_child(hdlg, category); + } + } + break; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDOK: + /* pclog("Saving settings...\n"); */ + SendMessage(hwndChildDialog, WM_SAVESETTINGS, 0, 0); + i = settings_msgbox_reset(); + if (i > 0) + { + if (i == 2) + { + win_settings_save(); + } + + /* pclog("Destroying window...\n"); */ + DestroyWindow(hwndChildDialog); + EndDialog(hdlg, 0); + pause = 0; + return TRUE; + } + else + { + return FALSE; + } + case IDCANCEL: + DestroyWindow(hwndChildDialog); + EndDialog(hdlg, 0); + pause=0; + return TRUE; + } + break; + default: + return FALSE; + } + + return FALSE; +} + +void win_settings_open(HWND hwnd) +{ + DialogBox(hinstance, (LPCWSTR) CONFIGUREDLG_MAIN, hwnd, win_settings_main_proc); +} diff --git a/src/win-status.c b/src/win-status.c index 345f9e2e5..b907d6942 100644 --- a/src/win-status.c +++ b/src/win-status.c @@ -9,7 +9,7 @@ #include "ibm.h" #include "device.h" #include "video.h" -#include "resources.h" +#include "resource.h" #include "win.h" #include "x86_ops.h" #include "mem.h" @@ -39,9 +39,6 @@ static BOOL CALLBACK status_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR "CPU speed : %f MIPS\n" "FPU speed : %f MFLOPS\n\n" -/* "Cache misses (read) : %i/sec\n" - "Cache misses (write) : %i/sec\n\n"*/ - "Video throughput (read) : %i bytes/sec\n" "Video throughput (write) : %i bytes/sec\n\n" "Effective clockspeed : %iHz\n\n" @@ -50,13 +47,8 @@ static BOOL CALLBACK status_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR "New blocks : %i\nOld blocks : %i\nRecompiled speed : %f MIPS\nAverage size : %f\n" "Flushes : %i\nEvicted : %i\nReused : %i\nRemoved : %i\nReal speed : %f MIPS" -// "\nFully recompiled ins %% : %f%%" ,mips, flops, -/*#ifndef DYNAREC - sreadlnum, - swritelnum, -#endif*/ segareads, segawrites, clockrate - scycles_lost, @@ -69,13 +61,8 @@ static BOOL CALLBACK status_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR cpu_recomp_reuse_latched, cpu_recomp_removed_latched, ((double)cpu_recomp_ins_latched / 1000000.0) / ((double)main_time / timer_freq) -// ((double)cpu_recomp_full_ins_latched / (double)cpu_recomp_ins_latched) * 100.0 -// cpu_reps_latched, cpu_notreps_latched ); main_time = 0; -/*#ifndef DYNAREC - device_add_status_info(device_s, 4096); -#endif*/ SendDlgItemMessage(hdlg, IDC_STEXT_DEVICE, WM_SETTEXT, (WPARAM)NULL, (LPARAM)device_s); device_s[0] = 0; @@ -104,3 +91,14 @@ void status_open(HWND hwnd) status_hwnd = CreateDialog(hinstance, TEXT("StatusDlg"), hwnd, status_dlgproc); ShowWindow(status_hwnd, SW_SHOW); } + + +#if 0 +void +set_bugui(char *str) +{ + if (str == NULL) + str = "L:R GGGGGGGG-RRRRRRRR"; + SendMessage(status_hwnd, SB_SETTEXT, 2, (WPARAM)str); +} +#endif diff --git a/src/win-video.c b/src/win-video.c index eed0059c6..dd6b3788f 100644 --- a/src/win-video.c +++ b/src/win-video.c @@ -5,6 +5,7 @@ #include #include #include "video.h" +#include "win-cgapal.h" BITMAP *screen; diff --git a/src/win.c b/src/win.c index ac2dd3a19..9c6695efa 100644 --- a/src/win.c +++ b/src/win.c @@ -16,7 +16,12 @@ #include #include #include +#include #include "86box.h" +#include "device.h" +#include "disc.h" +#include "fdd.h" +#include "hdd.h" #include "ibm.h" #include "ide.h" #include "cdrom-null.h" @@ -24,9 +29,10 @@ #include "cdrom-iso.h" #include "config.h" #include "video.h" -#include "resources.h" +#include "resource.h" #include "cpu.h" #include "cdrom.h" +#include "mem.h" #include "model.h" #include "mouse.h" #include "nethandler.h" @@ -34,8 +40,10 @@ #include "sound.h" #include "sound_dbopl.h" #include "thread.h" -#include "disc.h" +#include "rom.h" +#include "vid_ega.h" +#include "plat-mouse.h" #include "plat-midi.h" #include "plat-keyboard.h" @@ -44,8 +52,7 @@ #include "win-ddraw-fs.h" #include "win-d3d.h" #include "win-d3d-fs.h" -//#include "win-opengl.h" -#include "win-crashdump.h" +#include "win-language.h" #ifndef MAPVK_VK_TO_VSC #define MAPVK_VK_TO_VSC 0 @@ -100,6 +107,10 @@ int mousecapture=0; LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK subWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); +LRESULT CALLBACK StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); + +LONG OriginalStatusBarProcedure; + HWND ghwnd; HINSTANCE hinstance; @@ -119,16 +130,23 @@ static int unscaled_size_y = 0; int scale = 0; +HWND hwndRender, hwndStatus; + void updatewindowsize(int x, int y) { - RECT r; + int owsx = winsizex; + int owsy = winsizey; + + int temp_overscan_x = overscan_x; + int temp_overscan_y = overscan_y; + if (vid_resize) return; if (x < 160) x = 160; if (y < 100) y = 100; - int temp_overscan_x = overscan_x; - int temp_overscan_y = overscan_y; + if (x > 2048) x = 2048; + if (y > 2048) y = 2048; if (suppress_overscan) { @@ -189,7 +207,14 @@ void updatewindowsize(int x, int y) break; } - win_doresize = 1; + if ((owsx != winsizex) || (owsy != winsizey)) + { + win_doresize = 1; + } + else + { + win_doresize = 0; + } } void uws_natural() @@ -229,11 +254,12 @@ uint64_t end_time; void mainthread(LPVOID param) { - int t = 0; int frames = 0; DWORD old_time, new_time; -// Sleep(500); + RECT r; + int sb_borders[3]; + drawits=0; old_time = GetTickCount(); while (!quited) @@ -265,15 +291,27 @@ void mainthread(LPVOID param) else Sleep(1); - if (!video_fullscreen && win_doresize) + if (!video_fullscreen && win_doresize && (winsizex > 0) && (winsizey > 0)) { - RECT r; video_wait_for_blit(); + SendMessage(hwndStatus, SB_GETBORDERS, 0, (LPARAM) sb_borders); GetWindowRect(ghwnd, &r); - MoveWindow(ghwnd, r.left, r.top, - winsizex + (GetSystemMetrics(SM_CXFIXEDFRAME) * 2), - winsizey + (GetSystemMetrics(SM_CYFIXEDFRAME) * 2) + GetSystemMetrics(SM_CYMENUSIZE) + GetSystemMetrics(SM_CYCAPTION) + 1, + MoveWindow(hwndRender, 0, 0, + winsizex, + winsizey, TRUE); + GetWindowRect(hwndRender, &r); + MoveWindow(hwndStatus, 0, r.bottom + GetSystemMetrics(SM_CYEDGE), + winsizex, + 17, + TRUE); + GetWindowRect(ghwnd, &r); + + MoveWindow(ghwnd, r.left, r.top, + winsizex + (GetSystemMetrics(vid_resize ? SM_CXSIZEFRAME : SM_CXFIXEDFRAME) * 2), + winsizey + (GetSystemMetrics(SM_CYEDGE) * 2) + (GetSystemMetrics(vid_resize ? SM_CYSIZEFRAME : SM_CYFIXEDFRAME) * 2) + GetSystemMetrics(SM_CYMENUSIZE) + GetSystemMetrics(SM_CYCAPTION) + 17 + sb_borders[1] + 1, + TRUE); + win_doresize = 0; } @@ -353,16 +391,17 @@ void thread_destroy_event(event_t *_event) free(event); } +HMENU smenu; + static void initmenu(void) { int i, c; - HMENU dm, m; + HMENU m; char s[32]; - dm=GetSubMenu(menu,1); /*Disc*/ for (i = 0; i < CDROM_NUM; i++) { - m=GetSubMenu(dm,17+i); /*CD-ROM*/ + m=GetSubMenu(smenu, i + 4); /*CD-ROM*/ /* Loop through each Windows drive letter and test to see if it's a CDROM */ @@ -372,7 +411,7 @@ static void initmenu(void) if (GetDriveType(s)==DRIVE_CDROM) { sprintf(s, "Host CD/DVD Drive (%c:)", c); - AppendMenu(m,MF_STRING,IDM_CDROM_1_REAL+c+(i * 1000),s); + AppendMenu(m,MF_STRING,IDM_CDROM_1_REAL+(c << 2)+i,s); } } } @@ -441,7 +480,7 @@ void get_registry_key_map() { char *keyName = "SYSTEM\\CurrentControlSet\\Control\\Keyboard Layout"; char *valueName = "Scancode Map"; - char buf[32768]; + unsigned char buf[32768]; DWORD bufSize; HKEY hKey; int j; @@ -547,7 +586,6 @@ static void process_command_line() argbuf[i] = 0; i++; } - // pclog("Arg %i - %s\n",argc-1,argv[argc-1]); } } @@ -579,6 +617,467 @@ int find_in_array(int *array, int val, int len, int menu_base) HANDLE hinstAcc; +HICON LoadIconEx(PCTSTR pszIconName) +{ + return (HICON) LoadImage(hinstance, pszIconName, IMAGE_ICON, 16, 16, 0); +} + +HICON LoadIconBig(PCTSTR pszIconName) +{ + return (HICON) LoadImage(hinstance, pszIconName, IMAGE_ICON, 64, 64, 0); +} + +int fdd_type_to_icon(int type) +{ + switch(type) + { + default: + case 0: + return 512; + case 1: + return 128; + case 2: + return 130; + case 3: + return 132; + case 4: + case 5: + case 6: + return 134; + case 7: + return 144; + case 8: + return 146; + case 9: + case 10: + case 11: + case 12: + return 150; + case 13: + return 152; + } +} + +int sb_parts = 10; + +int sb_part_meanings[12]; +int sb_part_icons[12]; + +int sb_icon_width = 24; + +int count_hard_disks(int bus) +{ + int i = 0; + + int c = 0; + + for (i = 0; i < HDC_NUM; i++) + { + if (hdc[i].bus == bus) + { + c++; + } + } + + return c; +} + +HICON hIcon[512]; + +int iStatusWidths[] = { 18, 36, 54, 72, 90, 108, 126, 144, 168, 192, 210, -1 }; + +#define SBI_FLAG_ACTIVE 1 +#define SBI_FLAG_EMPTY 256 + +int sb_icon_flags[512]; + +/* This is for the disk activity indicator. */ +void update_status_bar_icon(int tag, int active) +{ + int i = 0; + int found = -1; + int temp_flags = 0; + + if ((tag & 0xf0) >= 0x30) + { + return; + } + + temp_flags |= active; + + for (i = 0; i < 12; i++) + { + if (sb_part_meanings[i] == tag) + { + found = i; + break; + } + } + + if (found != -1) + { + if (temp_flags != (sb_icon_flags[found] & 1)) + { + sb_icon_flags[found] &= ~1; + sb_icon_flags[found] |= active; + + sb_part_icons[found] &= ~257; + sb_part_icons[found] |= sb_icon_flags[found]; + + DestroyIcon(hIcon[found]); + hIcon[found] = LoadIconEx((PCTSTR) sb_part_icons[found]); + SendMessage(hwndStatus, SB_SETICON, found, (LPARAM) hIcon[found]); + } + } +} + +/* This is for the drive state indicator. */ +void update_status_bar_icon_state(int tag, int state) +{ + int i = 0; + int found = -1; + + if ((tag & 0xf0) >= 0x20) + { + return; + } + + for (i = 0; i < 12; i++) + { + if (sb_part_meanings[i] == tag) + { + found = i; + break; + } + } + + if (found != -1) + { + sb_icon_flags[found] &= ~256; + sb_icon_flags[found] |= state ? 256 : 0; + + sb_part_icons[found] &= ~257; + sb_part_icons[found] |= sb_icon_flags[found]; + + DestroyIcon(hIcon[found]); + hIcon[found] = LoadIconEx((PCTSTR) sb_part_icons[found]); + SendMessage(hwndStatus, SB_SETICON, found, (LPARAM) hIcon[found]); + } +} + +char sbTips[24][512]; + +void create_floppy_tip(int part) +{ + WCHAR *szText; + char ansi_text[2][512]; + + int drive = sb_part_meanings[part] & 0xf; + szText = (WCHAR *) win_language_get_string_from_id(2179); + wcstombs(ansi_text[0], szText, (wcslen(szText) << 1) + 2); + szText = (WCHAR *) win_language_get_string_from_id(2185); + wcstombs(ansi_text[1], szText, (wcslen(szText) << 1) + 2); + if (strlen(discfns[drive]) == 0) + { + sprintf(sbTips[part], ansi_text[0], drive + 1, fdd_getname(fdd_get_type(drive)), ansi_text[1]); + } + else + { + sprintf(sbTips[part], ansi_text[0], drive + 1, fdd_getname(fdd_get_type(drive)), discfns[drive]); + } +} + +void create_cdrom_tip(int part) +{ + WCHAR *szText; + char ansi_text[4][512]; + + int drive = sb_part_meanings[part] & 0xf; + szText = (WCHAR *) win_language_get_string_from_id(2180); + wcstombs(ansi_text[0], szText, (wcslen(szText) << 1) + 2); + szText = (WCHAR *) win_language_get_string_from_id(2185); + wcstombs(ansi_text[1], szText, (wcslen(szText) << 1) + 2); + szText = (WCHAR *) win_language_get_string_from_id(2186); + wcstombs(ansi_text[2], szText, (wcslen(szText) << 1) + 2); + if (cdrom_drives[drive].host_drive == 200) + { + if (strlen(cdrom_iso[drive].iso_path) == 0) + { + sprintf(sbTips[part], ansi_text[0], drive + 1, ansi_text[1]); + } + else + { + sprintf(sbTips[part], ansi_text[0], drive + 1, cdrom_iso[drive].iso_path); + } + } + else if (cdrom_drives[drive].host_drive < 0x41) + { + sprintf(sbTips[part], ansi_text[0], drive + 1, ansi_text[1]); + } + else + { + sprintf(ansi_text[3], ansi_text[2], cdrom_drives[drive].host_drive & ~0x20); + sprintf(sbTips[part], ansi_text[0], drive + 1, ansi_text[3]); + } +} + +void create_hd_tip(int part) +{ + WCHAR *szText; + + int bus = sb_part_meanings[part] & 0xf; + szText = (WCHAR *) win_language_get_string_from_id(2182 + bus); + wcstombs(sbTips[part], szText, (wcslen(szText) << 1) + 2); +} + +void update_tip(int meaning) +{ + int i = 0; + int part = -1; + + for (i = 0; i < sb_parts; i++) + { + if (sb_part_meanings[i] == meaning) + { + part = i; + } + } + + if (part != -1) + { + switch(meaning & 0x30) + { + case 0x00: + create_floppy_tip(part); + break; + case 0x10: + create_cdrom_tip(part); + break; + case 0x20: + create_hd_tip(part); + break; + default: + break; + } + + SendMessage(hwndStatus, SB_SETTIPTEXT, part, (LPARAM) sbTips[part]); + } +} + +static int get_floppy_state(int id) +{ + return (strlen(discfns[id]) == 0) ? 1 : 0; +} + +static int get_cd_state(int id) +{ + if (cdrom_drives[id].host_drive < 0x41) + { + return 1; + } + else + { + if (cdrom_drives[id].host_drive == 0x200) + { + return (strlen(cdrom_iso[id].iso_path) == 0) ? 1 : 0; + } + else + { + return 0; + } + } +} + +void update_status_bar_panes(HWND hwnds) +{ + int i, j, id; + int edge = 0; + + int c_rll = 0; + int c_mfm = 0; + int c_ide = 0; + int c_scsi = 0; + + c_mfm = count_hard_disks(1); + c_ide = count_hard_disks(2); + c_scsi = count_hard_disks(3); + + sb_parts = 0; + memset(sb_part_meanings, 0, 40); + for (i = 0; i < 4; i++) + { + if (fdd_get_type(i) != 0) + { + /* pclog("update_status_bar_panes(): Found floppy drive %c:, type %i\n", 65 + i, fdd_get_type(i)); */ + edge += sb_icon_width; + iStatusWidths[sb_parts] = edge; + sb_part_meanings[sb_parts] = 0x00 | i; + sb_parts++; + } + } + for (i = 0; i < 4; i++) + { + if (cdrom_drives[i].enabled != 0) + { + edge += sb_icon_width; + iStatusWidths[sb_parts] = edge; + sb_part_meanings[sb_parts] = 0x10 | i; + sb_parts++; + } + } + if (c_mfm && !(models[model].flags & MODEL_HAS_IDE) && !!memcmp(hdd_controller_name, "none", 4) && !!memcmp(hdd_controller_name, "xtide", 5)) + { + edge += sb_icon_width; + iStatusWidths[sb_parts] = edge; + sb_part_meanings[sb_parts] = 0x20; + sb_parts++; + } + if (c_ide && (models[model].flags & MODEL_HAS_IDE) || !memcmp(hdd_controller_name, "xtide", 5)) + { + edge += sb_icon_width; + iStatusWidths[sb_parts] = edge; + sb_part_meanings[sb_parts] = 0x21; + sb_parts++; + } + if (c_scsi) + { + edge += sb_icon_width; + iStatusWidths[sb_parts] = edge; + sb_part_meanings[sb_parts] = 0x22; + sb_parts++; + } + if (sb_parts) + { + iStatusWidths[sb_parts - 1] += (24 - sb_icon_width); + } + iStatusWidths[sb_parts] = -1; + sb_part_meanings[sb_parts] = 0x30; + sb_parts++; + + SendMessage(hwnds, SB_SETPARTS, (WPARAM) sb_parts, (LPARAM) iStatusWidths); + + for (i = 0; i < sb_parts; i++) + { + switch (sb_part_meanings[i] & 0x30) + { + case 0x00: + /* Floppy */ + sb_icon_flags[i] = (strlen(discfns[sb_part_meanings[i] & 0xf]) == 0) ? 256 : 0; + sb_part_icons[i] = fdd_type_to_icon(fdd_get_type(sb_part_meanings[i] & 0xf)) | sb_icon_flags[i]; + create_floppy_tip(i); + break; + case 0x10: + /* CD-ROM */ + id = sb_part_meanings[i] & 0xf; + if (cdrom_drives[id].host_drive < 0x41) + { + sb_icon_flags[i] = 256; + } + else + { + if (cdrom_drives[id].host_drive == 0x200) + { + sb_icon_flags[i] = (strlen(cdrom_iso[id].iso_path) == 0) ? 256 : 0; + } + else + { + sb_icon_flags[i] = 0; + } + } + if (cdrom_drives[id].bus_type == 1) + { + j = 164; + } + else + { + j = (cdrom_drives[id].atapi_dma) ? 162 : 160; + } + sb_part_icons[i] = j | sb_icon_flags[i]; + create_cdrom_tip(i); + break; + case 0x20: + /* Hard disk */ + sb_part_icons[i] = 176 + ((sb_part_meanings[i] & 0xf) << 1); + create_hd_tip(i); + break; + case 0x30: + /* Status text */ + SendMessage(hwnds, SB_SETTEXT, i | SBT_NOBORDERS, (LPARAM) "Hello from 86Box UX lab! :p"); + sb_part_icons[i] = -1; + break; + } + if (sb_part_icons[i] != -1) + { + SendMessage(hwnds, SB_SETTEXT, i | SBT_NOBORDERS, (LPARAM) ""); + DestroyIcon(hIcon[i]); + hIcon[i] = LoadIconEx((PCTSTR) sb_part_icons[i]); + SendMessage(hwnds, SB_SETICON, i, (LPARAM) hIcon[i]); + SendMessage(hwnds, SB_SETTIPTEXT, i, (LPARAM) sbTips[i]); + /* pclog("Status bar part found: %02X (%i)\n", sb_part_meanings[i], sb_part_icons[i]); */ + } + else + { + SendMessage(hwnds, SB_SETICON, i, (LPARAM) NULL); + } + } +} + +HWND EmulatorStatusBar(HWND hwndParent, int idStatus, HINSTANCE hinst) +{ + HWND hwndStatus; + int i; + RECT rectDialog; + int dw, dh; + + GetWindowRect(hwndParent, &rectDialog); + dw = rectDialog.right - rectDialog.left; + dh = rectDialog.bottom - rectDialog.top; + + InitCommonControls(); + + hwndStatus = CreateWindowEx( + 0, + STATUSCLASSNAME, + (PCTSTR) NULL, + SBARS_SIZEGRIP | WS_CHILD | WS_VISIBLE | SBT_TOOLTIPS, + 0, dh - 17, dw, 17, + hwndParent, + (HMENU) idStatus, + hinst, + NULL); + + GetWindowRect(hwndStatus, &rectDialog); + + SetWindowPos( + hwndStatus, + HWND_TOPMOST, + rectDialog.left, + rectDialog.top, + rectDialog.right - rectDialog.left, + rectDialog.bottom - rectDialog.top, + SWP_SHOWWINDOW); + + SendMessage(hwndStatus, SB_SETMINHEIGHT, (WPARAM) 17, (LPARAM) 0); + + update_status_bar_panes(hwndStatus); + + return hwndStatus; +} + +void win_menu_update() +{ +#if 0 + menu = LoadMenu(hThisInstance, TEXT("MainMenu")); + + smenu = LoadMenu(hThisInstance, TEXT("StatusBarMenu")); + initmenu(); + + SetMenu(ghwnd, menu); + + win_title_update = 1; +#endif +} + int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, @@ -589,13 +1088,13 @@ int WINAPI WinMain (HINSTANCE hThisInstance, MSG messages; /* Here messages to the application are saved */ WNDCLASSEX wincl; /* Data structure for the windowclass */ int c, d, e, bRet; - char emulator_title[200]; + char emulator_title[200]; LARGE_INTEGER qpc_freq; HACCEL haccel; /* Handle to accelerator table */ - - // InitCrashDump(); // First thing to do before anything else is to make sure crash dumps get created. process_command_line(); + + win_language_load_common_strings(); hinstance=hThisInstance; /* The Window structure */ @@ -606,9 +1105,9 @@ int WINAPI WinMain (HINSTANCE hThisInstance, wincl.cbSize = sizeof (WNDCLASSEX); /* Use default icon and mouse-pointer */ - wincl.hIcon = LoadIcon (hinstance, 100); - wincl.hIconSm = LoadIcon (hinstance, 100); - wincl.hCursor = NULL;//LoadCursor (NULL, IDC_ARROW); + wincl.hIcon = LoadIcon(hinstance, (LPCSTR) 100); + wincl.hIconSm = LoadIcon(hinstance, (LPCSTR) 100); + wincl.hCursor = NULL; wincl.lpszMenuName = NULL; /* No menu */ wincl.cbClsExtra = 0; /* No extra bytes after the window class */ wincl.cbWndExtra = 0; /* structure or the window instance */ @@ -626,7 +1125,6 @@ int WINAPI WinMain (HINSTANCE hThisInstance, return 0; menu = LoadMenu(hThisInstance, TEXT("MainMenu")); - initmenu(); sprintf(emulator_title, "86Box v%s", emulator_version); @@ -635,7 +1133,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance, 0, /* Extended possibilites for variation */ szClassName, /* Classname */ emulator_title, /* Title Text */ - WS_OVERLAPPEDWINDOW&~WS_SIZEBOX, /* default window */ + (WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX)/* | DS_3DLOOK*/, /* default window */ CW_USEDEFAULT, /* Windows decides the position */ CW_USEDEFAULT, /* where the window ends up on the screen */ 640+(GetSystemMetrics(SM_CXFIXEDFRAME)*2), /* The programs width */ @@ -654,8 +1152,6 @@ int WINAPI WinMain (HINSTANCE hThisInstance, if (haccel == NULL) fatal("haccel is null\n"); -// win_set_window(hwnd); - memset(rawinputkey, 0, sizeof(rawinputkey)); device.usUsagePage = 0x01; device.usUsage = 0x06; @@ -673,10 +1169,19 @@ int WINAPI WinMain (HINSTANCE hThisInstance, initpc(argc, argv); - // pclog("Setting video API...\n"); - if (vid_apis[0][vid_api].init(ghwnd) == 0) + hwndRender = CreateWindow("STATIC", NULL, WS_VISIBLE | WS_CHILD | SS_BITMAP, 0, 0, 1, 1, ghwnd, NULL, hinstance, NULL); + + hwndStatus = EmulatorStatusBar(hwnd, IDC_STATUS, hThisInstance); + + OriginalStatusBarProcedure = GetWindowLong(hwndStatus, GWL_WNDPROC); + SetWindowLong(hwndStatus, GWL_WNDPROC, (LONG) &StatusBarProcedure); + + smenu = LoadMenu(hThisInstance, TEXT("StatusBarMenu")); + initmenu(); + + if (vid_apis[0][vid_api].init(hwndRender) == 0) { - if (vid_apis[0][vid_api ^ 1].init(ghwnd) == 0) + if (vid_apis[0][vid_api ^ 1].init(hwndRender) == 0) { fatal("Both DirectDraw and Direct3D renderers failed to initialize\n"); } @@ -686,80 +1191,33 @@ int WINAPI WinMain (HINSTANCE hThisInstance, } } - // pclog("Resizing window...\n"); if (vid_resize) SetWindowLong(hwnd, GWL_STYLE, WS_OVERLAPPEDWINDOW|WS_VISIBLE); else SetWindowLong(hwnd, GWL_STYLE, (WS_OVERLAPPEDWINDOW&~WS_SIZEBOX&~WS_THICKFRAME&~WS_MAXIMIZEBOX)|WS_VISIBLE); SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_MINIMIZEBOX); - // pclog("Checking CD-ROM menu item...\n"); - /* Note by Kiririn: I've redone this since the CD-ROM can be disabled but still have something inside it. */ for (e = 0; e < CDROM_NUM; e++) { - if (cdrom_drives[e].enabled) - CheckMenuItem(menu, IDM_CDROM_1_ENABLED + (e * 1000), MF_CHECKED); - - if (cdrom_drives[e].sound_on) - CheckMenuItem(menu, IDM_CDROM_1_SOUND_ON + (e * 1000), MF_CHECKED); - - if (cdrom_drives[e].bus_type) - CheckMenuItem(menu, IDM_CDROM_1_SCSI + (e * 1000), MF_CHECKED); - - if (cdrom_drives[e].atapi_dma) - CheckMenuItem(menu, IDM_CDROM_1_DMA + (e * 1000), MF_CHECKED); - - if (!find_in_array(valid_ide_channels, cdrom_drives[e].ide_channel, 8, IDM_CDROM_1_C + (e * 1000))) + if (!cdrom_drives[e].sound_on) { - fatal("CD-ROM %i: Invalid IDE channel\n", e); + CheckMenuItem(smenu, IDM_CDROM_1_MUTE + e, MF_CHECKED); } - CheckMenuItem(menu, IDM_CDROM_1_C + (e * 1000) + cdrom_drives[e].ide_channel, MF_CHECKED); - - if (!find_in_array(valid_scsi_ids, cdrom_drives[e].scsi_device_id, 15, IDM_CDROM_1_0 + (e * 1000))) - { - fatal("CD-ROM %i: Invalid SCSI ID\n", e); - } - - CheckMenuItem(menu, IDM_CDROM_1_0 + (e * 1000) + cdrom_drives[e].scsi_device_id, MF_CHECKED); - - if (!find_in_array(valid_scsi_luns, cdrom_drives[e].scsi_device_lun, 8, IDM_CDROM_1_LUN_0 + (e * 1000))) - { - fatal("CD-ROM %i: Invalid SCSI LUN\n", e); - } - - CheckMenuItem(menu, IDM_CDROM_1_LUN_0 + (e * 1000) + cdrom_drives[e].scsi_device_lun, MF_CHECKED); - if (cdrom_drives[e].host_drive == 200) { - CheckMenuItem(menu, IDM_CDROM_1_ISO + (e * 1000), MF_CHECKED); + CheckMenuItem(smenu, IDM_CDROM_1_ISO + e, MF_CHECKED); + } + else if (cdrom_drives[e].host_drive >= 65) + { + CheckMenuItem(smenu, IDM_CDROM_1_REAL + e + (cdrom_drives[e].host_drive << 2), MF_CHECKED); } else { - CheckMenuItem(menu, IDM_CDROM_1_REAL + (e * 1000) + cdrom_drives[e].host_drive, MF_CHECKED); + CheckMenuItem(smenu, IDM_CDROM_1_EMPTY + e, MF_CHECKED); } } - if (ide_enable[2]) - CheckMenuItem(menu, IDM_IDE_TER_ENABLED, MF_CHECKED); - - if (!find_in_array(valid_irqs, ide_irq[2], 6, IDM_IDE_TER_IRQ9 - 9)) - { - fatal("Tertiary IDE controller: Invalid IRQ\n"); - } - - CheckMenuItem(menu, IDM_IDE_TER_IRQ9 - 9 + ide_irq[2], MF_CHECKED); - - if (ide_enable[3]) - CheckMenuItem(menu, IDM_IDE_QUA_ENABLED, MF_CHECKED); - - if (!find_in_array(valid_irqs, ide_irq[3], 6, IDM_IDE_QUA_IRQ9 - 9)) - { - fatal("Quaternary IDE controller: Invalid IRQ\n"); - } - - CheckMenuItem(menu, IDM_IDE_QUA_IRQ9 - 9 + ide_irq[3], MF_CHECKED); - #ifdef ENABLE_LOG_TOGGLES #ifdef ENABLE_BUSLOGIC_LOG CheckMenuItem(menu, IDM_LOG_BUSLOGIC, buslogic_do_log ? MF_CHECKED : MF_UNCHECKED); @@ -781,23 +1239,16 @@ int WINAPI WinMain (HINSTANCE hThisInstance, #endif #endif - CheckMenuItem(menu, IDM_USE_NUKEDOPL, opl3_type ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(menu, IDM_VID_FORCE43, force_43 ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(menu, IDM_VID_OVERSCAN, enable_overscan ? MF_CHECKED : MF_UNCHECKED); - CheckMenuItem(menu, IDM_VID_FLASH, enable_flash ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(menu, IDM_VID_INVERT, invert_display ? MF_CHECKED : MF_UNCHECKED); - // pclog("Checking video resize menu item...\n"); if (vid_resize) CheckMenuItem(menu, IDM_VID_RESIZE, MF_CHECKED); - // pclog("Checking video API menu item...\n"); CheckMenuItem(menu, IDM_VID_DDRAW + vid_api, MF_CHECKED); - // pclog("Checking video fill screen menu item...\n"); CheckMenuItem(menu, IDM_VID_FS_FULL + video_fullscreen_scale, MF_CHECKED); CheckMenuItem(menu, IDM_VID_REMEMBER, window_remember ? MF_CHECKED : MF_UNCHECKED); -// set_display_switch_mode(SWITCH_BACKGROUND); CheckMenuItem(menu, IDM_VID_SCALE_1X + scale, MF_CHECKED); - // pclog("Preparing ROM sets...\n"); d=romset; for (c=0;c= 0; c--) { if (gfx_present[c]) @@ -862,10 +1319,6 @@ int WINAPI WinMain (HINSTANCE hThisInstance, atexit(releasemouse); -// QueryPerformanceFrequency(&counter_base); -/// QueryPerformanceCounter(&counter_posold); -// counter_posold.QuadPart*=100; - ghMutex = CreateMutex(NULL, FALSE, NULL); mainthreadh=(HANDLE)_beginthread(mainthread,0,NULL); SetThreadPriority(mainthreadh, THREAD_PRIORITY_HIGHEST); @@ -876,18 +1329,13 @@ int WINAPI WinMain (HINSTANCE hThisInstance, QueryPerformanceFrequency(&qpc_freq); timer_freq = qpc_freq.QuadPart; -// focus=1; -// setrefresh(100); - -// ShowCursor(TRUE); - if (start_in_fullscreen) { startblit(); mouse_close(); vid_apis[0][vid_api].close(); video_fullscreen = 1; - vid_apis[1][vid_api].init(ghwnd); + vid_apis[1][vid_api].init(hwndRender); mouse_init(); leave_fullscreen_flag = 0; endblit(); @@ -900,29 +1348,21 @@ int WINAPI WinMain (HINSTANCE hThisInstance, window_h, TRUE); } + else + { + MoveWindow(hwndRender, 0, 0, + winsizex, + winsizey, + TRUE); + MoveWindow(hwndStatus, 0, winsizey + 6, + winsizex, + 17, + TRUE); + } /* Run the message loop. It will run until GetMessage() returns 0 */ while (!quited) { -/* if (infocus) - { - if (drawits) - { - drawits--; - if (drawits>10) drawits=0; - runpc(); - } -//; else -// sleep(0); - // if ((recv_key[KEY_LCONTROL] || recv_key[KEY_RCONTROL]) && recv_key[KEY_END] && mousecapture) - // if ((recv_key[KEY_LCONTROL] || recv_key[KEY_RCONTROL]) && recv_key[0x58] && mousecapture) - // if (recv_key[0x58] && recv_key[0x42] && mousecapture) - { - ClipCursor(&oldclip); - mousecapture=0; - } - }*/ - while (((bRet = GetMessage(&messages,NULL,0,0)) != 0) && !quited) { if (bRet == -1) @@ -936,7 +1376,6 @@ int WINAPI WinMain (HINSTANCE hThisInstance, TranslateMessage(&messages); DispatchMessage(&messages); } - // if ((recv_key[KEY_LCONTROL] || recv_key[KEY_RCONTROL]) && recv_key[KEY_END] && mousecapture) if (recv_key[0x58] && recv_key[0x42] && mousecapture) { @@ -955,28 +1394,20 @@ int WINAPI WinMain (HINSTANCE hThisInstance, } quited=1; -// else -// sleep(10); } startblit(); -// pclog("Sleep 1000\n"); Sleep(200); -// pclog("TerminateThread\n"); TerminateThread(mainthreadh,0); -// pclog("Quited? %i\n",quited); -// pclog("Closepc\n"); savenvr(); saveconfig(); if (save_window_pos && window_remember) saveconfig(); closepc(); -// pclog("dumpregs\n"); vid_apis[video_fullscreen][vid_api].close(); timeEndPeriod(1); -// dumpregs(); if (mousecapture) { ClipCursor(&oldclip); @@ -986,114 +1417,29 @@ int WINAPI WinMain (HINSTANCE hThisInstance, UnregisterClass(szSubClassName, hinstance); UnregisterClass(szClassName, hinstance); -// pclog("Ending! %i %i\n",messages.wParam,quited); return messages.wParam; } -char openfilestring[260]; -int getfile(HWND hwnd, char *f, char *fn) -{ - OPENFILENAME ofn; // common dialog box structure - BOOL r; - DWORD err; - - // Initialize OPENFILENAME - ZeroMemory(&ofn, sizeof(ofn)); - ofn.lStructSize = sizeof(ofn); - ofn.hwndOwner = hwnd; - ofn.lpstrFile = openfilestring; - // - // Set lpstrFile[0] to '\0' so that GetOpenFileName does not - // use the contents of szFile to initialize itself. - // -// ofn.lpstrFile[0] = '\0'; - strcpy(ofn.lpstrFile,fn); - ofn.nMaxFile = sizeof(openfilestring); - ofn.lpstrFilter = f;//"All\0*.*\0Text\0*.TXT\0"; - ofn.nFilterIndex = 1; - ofn.lpstrFileTitle = NULL; - ofn.nMaxFileTitle = 0; - ofn.lpstrInitialDir = NULL; - ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; - - // Display the Open dialog box. - - pclog("GetOpenFileName - lpstrFile = %s\n", ofn.lpstrFile); - r = GetOpenFileName(&ofn); - if (r) - { - pclog("GetOpenFileName return true\n"); - return 0; - } - pclog("GetOpenFileName return false\n"); - err = CommDlgExtendedError(); - pclog("CommDlgExtendedError return %04X\n", err); - return 1; -} - -int getsfile(HWND hwnd, char *f, char *fn) -{ - OPENFILENAME ofn; // common dialog box structure - BOOL r; - DWORD err; - - // Initialize OPENFILENAME - ZeroMemory(&ofn, sizeof(ofn)); - ofn.lStructSize = sizeof(ofn); - ofn.hwndOwner = hwnd; - ofn.lpstrFile = openfilestring; - // - // Set lpstrFile[0] to '\0' so that GetOpenFileName does not - // use the contents of szFile to initialize itself. - // -// ofn.lpstrFile[0] = '\0'; - strcpy(ofn.lpstrFile,fn); - ofn.nMaxFile = sizeof(openfilestring); - ofn.lpstrFilter = f;//"All\0*.*\0Text\0*.TXT\0"; - ofn.nFilterIndex = 1; - ofn.lpstrFileTitle = NULL; - ofn.nMaxFileTitle = 0; - ofn.lpstrInitialDir = NULL; - ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; - - // Display the Open dialog box. - - pclog("GetSaveFileName - lpstrFile = %s\n", ofn.lpstrFile); - r = GetSaveFileName(&ofn); - if (r) - { - pclog("GetSaveFileName return true\n"); - return 0; - } - pclog("GetSaveFileName return false\n"); - err = CommDlgExtendedError(); - pclog("CommDlgExtendedError return %04X\n", err); - return 1; -} - - - - HHOOK hKeyboardHook; +int hook_enabled = 0; LRESULT CALLBACK LowLevelKeyboardProc( int nCode, WPARAM wParam, LPARAM lParam ) { BOOL bControlKeyDown; KBDLLHOOKSTRUCT* p; - // if (nCode < 0 || nCode != HC_ACTION || (!mousecapture && !video_fullscreen)) if (nCode < 0 || nCode != HC_ACTION) return CallNextHookEx( hKeyboardHook, nCode, wParam, lParam); p = (KBDLLHOOKSTRUCT*)lParam; - if (p->vkCode == VK_TAB && p->flags & LLKHF_ALTDOWN) return 1; //disable alt-tab - if (p->vkCode == VK_SPACE && p->flags & LLKHF_ALTDOWN) return 1; //disable alt-tab - if((p->vkCode == VK_LWIN) || (p->vkCode == VK_RWIN)) return 1;//disable windows keys - if (p->vkCode == VK_ESCAPE && p->flags & LLKHF_ALTDOWN) return 1;//disable alt-escape - bControlKeyDown = GetAsyncKeyState (VK_CONTROL) >> ((sizeof(SHORT) * 8) - 1);//checks ctrl key pressed - if (p->vkCode == VK_ESCAPE && bControlKeyDown) return 1; //disable ctrl-escape - + if (p->vkCode == VK_TAB && p->flags & LLKHF_ALTDOWN) return 1; /* disable alt-tab */ + if (p->vkCode == VK_SPACE && p->flags & LLKHF_ALTDOWN) return 1; /* disable alt-tab */ + if((p->vkCode == VK_LWIN) || (p->vkCode == VK_RWIN)) return 1; /* disable windows keys */ + if (p->vkCode == VK_ESCAPE && p->flags & LLKHF_ALTDOWN) return 1; /* disable alt-escape */ + bControlKeyDown = GetAsyncKeyState (VK_CONTROL) >> ((sizeof(SHORT) * 8) - 1); /* checks ctrl key pressed */ + if (p->vkCode == VK_ESCAPE && bControlKeyDown) return 1; /* disable ctrl-escape */ + return CallNextHookEx( hKeyboardHook, nCode, wParam, lParam ); } @@ -1113,15 +1459,13 @@ void cdrom_close(uint8_t id) } } -char *floppy_image_extensions = "All floppy images (*.001;*.002;*.003;*.004;*.005;*.006;*.007;*.008;*.009;*.010;*.12;*.144;*.360;*.720;*.86F;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMD;*.IMG;*.TD0;*.VFD;*.XDF)\0*.001;*.002;*.003;*.004;*.005;*.006;*.007;*.008;*.009;*.010;*.12;*.144;*.360;*.720;*.86F;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMD;*.IMG;*.TD0;*.VFD;*.XDF\0Advanced sector-based images (*.IMD;*.TD0)\0*.IMD;*.TD0\0Basic sector-based images (*.001;*.002;*.003;*.004;*.005;*.006;*.007;*.008;*.009;*.010;*.12;*.144;*.360;*.720;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMG;*.VFD;*.XDF)\0*.001;*.002;*.003;*.004;*.005;*.006;*.007;*.008;*.009;*.010;*.12;*.144;*.360;*.720;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMG;*.VFD;*.XDF\0Flux images (*.FDI)\0*.FDI\0Surface-based images (*.86F)\0*.86F\0All files (*.*)\0*.*\0"; - int ide_ter_set_irq(HMENU hmenu, int irq, int id) { if (ide_irq[2] == irq) { return 0; } - if (MessageBox(NULL,"This will reset 86Box!\nOkay to continue?","86Box",MB_OKCANCEL) != IDOK) + if (msgbox_reset_yn(ghwnd) != IDYES) { return 0; } @@ -1147,7 +1491,7 @@ int ide_qua_set_irq(HMENU hmenu, int irq, int id) { return 0; } - if (MessageBox(NULL,"This will reset 86Box!\nOkay to continue?","86Box",MB_OKCANCEL) != IDOK) + if (msgbox_reset_yn(ghwnd) != IDYES) { return 0; } @@ -1177,7 +1521,7 @@ void video_toggle_option(HMENU hmenu, int *val, int id) void win_cdrom_eject(uint8_t id) { HMENU hmenu; - hmenu=GetMenu(ghwnd); + hmenu = GetSubMenu(smenu, id + 4); if (cdrom_drives[id].host_drive == 0) { /* Switch from empty to empty. Do nothing. */ @@ -1191,18 +1535,26 @@ void win_cdrom_eject(uint8_t id) /* Signal disc change to the emulated machine. */ cdrom_insert(id); } - CheckMenuItem(hmenu, IDM_CDROM_1_REAL + (id * 1000) + cdrom_drive, MF_UNCHECKED); - CheckMenuItem(hmenu, IDM_CDROM_1_ISO + (id * 1000), MF_UNCHECKED); + if (cdrom_drives[id].host_drive == 200) + { + CheckMenuItem(hmenu, IDM_CDROM_1_ISO + id, MF_UNCHECKED); + } + else + { + CheckMenuItem(hmenu, IDM_CDROM_1_REAL + id + (cdrom_drive << 2), MF_UNCHECKED); + } cdrom_drives[id].prev_host_drive = cdrom_drives[id].host_drive; cdrom_drives[id].host_drive=0; - CheckMenuItem(hmenu, IDM_CDROM_1_EMPTY + (id * 1000), MF_CHECKED); + CheckMenuItem(hmenu, IDM_CDROM_1_EMPTY + id, MF_CHECKED); + update_status_bar_icon_state(0x10 | id, get_cd_state(id)); + update_tip(0x10 | id); saveconfig(); } void win_cdrom_reload(uint8_t id) { HMENU hmenu; - hmenu=GetMenu(ghwnd); + hmenu = GetSubMenu(smenu, id + 4); int new_cdrom_drive; if ((cdrom_drives[id].host_drive == cdrom_drives[id].prev_host_drive) || (cdrom_drives[id].prev_host_drive == 0) || (cdrom_drives[id].host_drive != 0)) { @@ -1218,10 +1570,9 @@ void win_cdrom_reload(uint8_t id) /* Signal disc change to the emulated machine. */ cdrom_insert(id); } - CheckMenuItem(hmenu, IDM_CDROM_1_EMPTY + (id * 1000), MF_UNCHECKED); + CheckMenuItem(hmenu, IDM_CDROM_1_EMPTY + id, MF_UNCHECKED); cdrom_drives[id].host_drive = 200; - CheckMenuItem(hmenu, IDM_CDROM_1_ISO + (id * 1000), MF_CHECKED); - saveconfig(); + CheckMenuItem(hmenu, IDM_CDROM_1_ISO + id, MF_CHECKED); } else { @@ -1232,30 +1583,46 @@ void win_cdrom_reload(uint8_t id) /* Signal disc change to the emulated machine. */ cdrom_insert(id); } - CheckMenuItem(hmenu, IDM_CDROM_1_EMPTY + (id * 1000), MF_UNCHECKED); + CheckMenuItem(hmenu, IDM_CDROM_1_EMPTY + id, MF_UNCHECKED); cdrom_drive = new_cdrom_drive; - CheckMenuItem(hmenu, IDM_CDROM_1_REAL + (id * 1000) + cdrom_drives[id].host_drive, MF_CHECKED); - saveconfig(); + CheckMenuItem(hmenu, IDM_CDROM_1_REAL + id + (cdrom_drives[id].host_drive << 2), MF_CHECKED); } + update_status_bar_icon_state(0x10 | id, get_cd_state(id)); + update_tip(0x10 | id); + saveconfig(); } -int convert_cdrom_id(int original_id) +static BOOL CALLBACK about_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { - int i = 0; + HWND h; - if (original_id >= (CDROM_NUM * 1000)) - { - return 0; + switch (message) + { + case WM_INITDIALOG: + pause = 1; + h = GetDlgItem(hdlg, IDC_ABOUT_ICON); + SendMessage(h, STM_SETIMAGE, (WPARAM) IMAGE_ICON, (LPARAM) LoadIconBig((PCTSTR) 100)); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDOK: + EndDialog(hdlg, 0); + pause = 0; + return TRUE; + default: + break; + } + break; } - for (i = 0; i < CDROM_NUM; i++) - { - if (original_id == (i * 1000)) - { - return i; - } - } - return 0; + return FALSE; +} + +void about_open(HWND hwnd) +{ + DialogBox(hinstance, (LPCSTR) ABOUTDLG, hwnd, about_dlgproc); } LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) @@ -1263,33 +1630,21 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM HMENU hmenu; RECT rect; uint32_t ri_size = 0; - char temp_iso_path[1024]; - int new_cdrom_drive; - int cdrom_id = 0; - int menu_sub_param = 0; -// pclog("Message %i %08X\n",message,message); + int edgex, edgey; + int sb_borders[3]; + switch (message) { case WM_CREATE: SetTimer(hwnd, TIMER_1SEC, 1000, NULL); hKeyboardHook = SetWindowsHookEx( WH_KEYBOARD_LL, LowLevelKeyboardProc, GetModuleHandle(NULL), 0 ); + hook_enabled = 1; break; case WM_COMMAND: -// pclog("WM_COMMAND %i\n",LOWORD(wParam)); hmenu=GetMenu(hwnd); switch (LOWORD(wParam)) { -#if 0 - case IDM_FILE_RESET: - pause=1; - Sleep(100); - savenvr(); - saveconfig(); - resetpc(); - pause=0; - break; -#endif case IDM_FILE_HRESET: pause=1; Sleep(100); @@ -1309,68 +1664,12 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM case IDM_FILE_EXIT: PostQuitMessage (0); /* send a WM_QUIT to the message queue */ break; - case IDM_DISC_1: - case IDM_DISC_1_WP: - if (!getfile(hwnd, floppy_image_extensions, discfns[0])) - { - disc_close(0); - ui_writeprot[0] = (LOWORD(wParam) == IDM_DISC_1_WP) ? 1 : 0; - disc_load(0, openfilestring); - saveconfig(); - } - break; - case IDM_DISC_2: - case IDM_DISC_2_WP: - if (!getfile(hwnd, floppy_image_extensions, discfns[1])) - { - disc_close(1); - ui_writeprot[1] = (LOWORD(wParam) == IDM_DISC_2_WP) ? 1 : 0; - disc_load(1, openfilestring); - saveconfig(); - } - break; - case IDM_DISC_3: - case IDM_DISC_3_WP: - if (!getfile(hwnd, floppy_image_extensions, discfns[2])) - { - disc_close(2); - ui_writeprot[2] = (LOWORD(wParam) == IDM_DISC_3_WP) ? 1 : 0; - disc_load(2, openfilestring); - saveconfig(); - } - break; - case IDM_DISC_4: - case IDM_DISC_4_WP: - if (!getfile(hwnd, floppy_image_extensions, discfns[3])) - { - disc_close(3); - ui_writeprot[3] = (LOWORD(wParam) == IDM_DISC_4_WP) ? 1 : 0; - disc_load(3, openfilestring); - saveconfig(); - } - break; - case IDM_EJECT_1: - disc_close(0); - saveconfig(); - break; - case IDM_EJECT_2: - disc_close(1); - saveconfig(); - break; - case IDM_EJECT_3: - disc_close(2); - saveconfig(); - break; - case IDM_EJECT_4: - disc_close(3); - saveconfig(); - break; - case IDM_HDCONF: - hdconf_open(hwnd); - break; case IDM_CONFIG: - config_open(hwnd); + win_settings_open(hwnd); break; + case IDM_ABOUT: + about_open(hwnd); + break; case IDM_STATUS: status_open(hwnd); break; @@ -1383,6 +1682,19 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_MINIMIZEBOX); GetWindowRect(hwnd,&rect); SetWindowPos(hwnd, 0, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER | SWP_FRAMECHANGED); + GetWindowRect(hwndStatus,&rect); + SetWindowPos(hwndStatus, 0, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER | SWP_FRAMECHANGED); + if (vid_resize) + { + CheckMenuItem(hmenu, IDM_VID_SCALE_1X + scale, MF_UNCHECKED); + CheckMenuItem(hmenu, IDM_VID_SCALE_2X, MF_CHECKED); + scale = 1; + } + EnableMenuItem(hmenu, IDM_VID_SCALE_1X, vid_resize ? MF_GRAYED : MF_ENABLED); + EnableMenuItem(hmenu, IDM_VID_SCALE_2X, vid_resize ? MF_GRAYED : MF_ENABLED); + EnableMenuItem(hmenu, IDM_VID_SCALE_3X, vid_resize ? MF_GRAYED : MF_ENABLED); + EnableMenuItem(hmenu, IDM_VID_SCALE_4X, vid_resize ? MF_GRAYED : MF_ENABLED); + win_doresize = 1; saveconfig(); break; case IDM_VID_REMEMBER: @@ -1406,7 +1718,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM vid_apis[0][vid_api].close(); vid_api = LOWORD(wParam) - IDM_VID_DDRAW; CheckMenuItem(hmenu, IDM_VID_DDRAW + vid_api, MF_CHECKED); - vid_apis[0][vid_api].init(ghwnd); + vid_apis[0][vid_api].init(hwndRender); endblit(); saveconfig(); device_force_redraw(); @@ -1416,7 +1728,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM if (video_fullscreen_first) { video_fullscreen_first = 0; - MessageBox(hwnd, "Use CTRL + ALT + PAGE DOWN to return to windowed mode", "86Box", MB_OK); + msgbox_info(ghwnd, 2193); } startblit(); video_wait_for_blit(); @@ -1450,20 +1762,6 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM saveconfig(); break; - case IDM_USE_NUKEDOPL: - if (MessageBox(NULL,"This will reset 86Box!\nOkay to continue?","86Box",MB_OKCANCEL) != IDOK) - { - break; - } - pause = 1; - Sleep(100); - opl3_type ^= 1; - CheckMenuItem(hmenu, IDM_USE_NUKEDOPL, opl3_type ? MF_CHECKED : MF_UNCHECKED); - saveconfig(); - resetpchard(); - pause = 0; - break; - case IDM_VID_FORCE43: video_toggle_option(hmenu, &force_43, IDM_VID_FORCE43); break; @@ -1474,6 +1772,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM case IDM_VID_OVERSCAN: video_toggle_option(hmenu, &enable_overscan, IDM_VID_OVERSCAN); + update_overscan = 1; break; case IDM_VID_FLASH: @@ -1536,9 +1835,9 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM case IDM_CONFIG_LOAD: pause = 1; - if (!getfile(hwnd, "Configuration (*.CFG)\0*.CFG\0All files (*.*)\0*.*\0", "")) + if (!file_dlg_st(hwnd, 2174, "", 0)) { - if (MessageBox(NULL, "This will reset 86Box!\nOkay to continue?", "86Box", MB_OKCANCEL) == IDOK) + if (msgbox_reset_yn(ghwnd) == IDYES) { loadconfig(openfilestring); config_save(config_file_default); @@ -1552,314 +1851,10 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM case IDM_CONFIG_SAVE: pause = 1; - if (!getsfile(hwnd, "Configuration (*.CFG)\0*.CFG\0All files (*.*)\0*.*\0", "")) + if (!file_dlg_st(hwnd, 2174, "", 1)) config_save(openfilestring); pause = 0; - break; - - case IDM_CDROM_1_ENABLED: - case IDM_CDROM_2_ENABLED: - case IDM_CDROM_3_ENABLED: - case IDM_CDROM_4_ENABLED: - cdrom_id = convert_cdrom_id(LOWORD(wParam) - IDM_CDROM_1_ENABLED); - if (MessageBox(NULL,"This will reset 86Box!\nOkay to continue?","86Box",MB_OKCANCEL) != IDOK) - { - break; - } - pause = 1; - Sleep(100); - cdrom_drives[cdrom_id].enabled ^= 1; - CheckMenuItem(hmenu, IDM_CDROM_1_ENABLED + (cdrom_id * 1000), cdrom_drives[cdrom_id].enabled ? MF_CHECKED : MF_UNCHECKED); - saveconfig(); - resetpchard(); - pause = 0; - break; - - case IDM_CDROM_1_SOUND_ON: - case IDM_CDROM_2_SOUND_ON: - case IDM_CDROM_3_SOUND_ON: - case IDM_CDROM_4_SOUND_ON: - cdrom_id = convert_cdrom_id(LOWORD(wParam) - IDM_CDROM_1_SOUND_ON); - Sleep(100); - cdrom_drives[cdrom_id].sound_on ^= 1; - CheckMenuItem(hmenu, IDM_CDROM_1_SOUND_ON + (cdrom_id * 1000), cdrom_drives[cdrom_id].sound_on ? MF_CHECKED : MF_UNCHECKED); - saveconfig(); - sound_cd_thread_reset(); - break; - - case IDM_CDROM_1_SCSI: - case IDM_CDROM_2_SCSI: - case IDM_CDROM_3_SCSI: - case IDM_CDROM_4_SCSI: - cdrom_id = convert_cdrom_id(LOWORD(wParam) - IDM_CDROM_1_SCSI); - if (MessageBox(NULL,"This will reset 86Box!\nOkay to continue?","86Box",MB_OKCANCEL) != IDOK) - { - break; - } - pause = 1; - Sleep(100); - cdrom_drives[cdrom_id].bus_type ^= 1; - CheckMenuItem(hmenu, IDM_CDROM_1_SCSI + (cdrom_id * 1000), cdrom_drives[cdrom_id].bus_type ? MF_CHECKED : MF_UNCHECKED); - saveconfig(); - resetpchard(); - pause = 0; - break; - - case IDM_CDROM_1_DMA: - case IDM_CDROM_2_DMA: - case IDM_CDROM_3_DMA: - case IDM_CDROM_4_DMA: - cdrom_id = convert_cdrom_id(LOWORD(wParam) - IDM_CDROM_1_DMA); - if (MessageBox(NULL,"This will reset 86Box!\nOkay to continue?","86Box",MB_OKCANCEL) != IDOK) - { - break; - } - pause = 1; - Sleep(100); - cdrom_drives[cdrom_id].atapi_dma ^= 1; - CheckMenuItem(hmenu, IDM_CDROM_1_DMA + (cdrom_id * 1000), cdrom_drives[cdrom_id].atapi_dma ? MF_CHECKED : MF_UNCHECKED); - saveconfig(); - resetpchard(); - pause = 0; - break; - - case IDM_CDROM_1_C ... IDM_CDROM_1_H: - case IDM_CDROM_2_C ... IDM_CDROM_2_H: - case IDM_CDROM_3_C ... IDM_CDROM_3_H: - case IDM_CDROM_4_C ... IDM_CDROM_4_H: - menu_sub_param = LOWORD(wParam) % 100; - cdrom_id = convert_cdrom_id(LOWORD(wParam) - menu_sub_param - IDM_CDROM_1_C); - if (MessageBox(NULL,"This will reset 86Box!\nOkay to continue?","86Box",MB_OKCANCEL) != IDOK) - { - break; - } - pause = 1; - Sleep(100); - CheckMenuItem(hmenu, IDM_CDROM_1_C + (cdrom_id * 1000) + cdrom_drives[cdrom_id].ide_channel, MF_UNCHECKED); - cdrom_drives[cdrom_id].ide_channel = menu_sub_param; - CheckMenuItem(hmenu, IDM_CDROM_1_C + (cdrom_id * 1000) + cdrom_drives[cdrom_id].ide_channel, MF_CHECKED); - saveconfig(); - resetpchard(); - pause = 0; - break; - - case IDM_CDROM_1_0 ... IDM_CDROM_1_15: - case IDM_CDROM_2_0 ... IDM_CDROM_2_15: - case IDM_CDROM_3_0 ... IDM_CDROM_3_15: - case IDM_CDROM_4_0 ... IDM_CDROM_4_15: - menu_sub_param = LOWORD(wParam) % 100; - cdrom_id = convert_cdrom_id(LOWORD(wParam) - menu_sub_param - IDM_CDROM_1_0); - if (MessageBox(NULL,"This will reset 86Box!\nOkay to continue?","86Box",MB_OKCANCEL) != IDOK) - { - break; - } - pause = 1; - Sleep(100); - CheckMenuItem(hmenu, IDM_CDROM_1_0 + (cdrom_id * 1000) + cdrom_drives[cdrom_id].scsi_device_id, MF_UNCHECKED); - cdrom_drives[cdrom_id].scsi_device_id = menu_sub_param; - CheckMenuItem(hmenu, IDM_CDROM_1_0 + (cdrom_id * 1000) + cdrom_drives[cdrom_id].scsi_device_id, MF_CHECKED); - saveconfig(); - resetpchard(); - pause = 0; - break; - - case IDM_CDROM_1_LUN_0 ... IDM_CDROM_1_LUN_7: - case IDM_CDROM_2_LUN_0 ... IDM_CDROM_2_LUN_7: - case IDM_CDROM_3_LUN_0 ... IDM_CDROM_3_LUN_7: - case IDM_CDROM_4_LUN_0 ... IDM_CDROM_4_LUN_7: - menu_sub_param = LOWORD(wParam) % 100; - cdrom_id = convert_cdrom_id(LOWORD(wParam) - menu_sub_param - IDM_CDROM_1_LUN_0); - if (MessageBox(NULL,"This will reset 86Box!\nOkay to continue?","86Box",MB_OKCANCEL) != IDOK) - { - break; - } - pause = 1; - Sleep(100); - CheckMenuItem(hmenu, IDM_CDROM_1_LUN_0 + (cdrom_id * 1000) + cdrom_drives[cdrom_id].scsi_device_lun, MF_UNCHECKED); - cdrom_drives[cdrom_id].scsi_device_lun = menu_sub_param; - CheckMenuItem(hmenu, IDM_CDROM_1_LUN_0 + (cdrom_id * 1000) + cdrom_drives[cdrom_id].scsi_device_lun, MF_CHECKED); - saveconfig(); - resetpchard(); - pause = 0; - break; - - case IDM_IDE_TER_ENABLED: - if (MessageBox(NULL,"This will reset 86Box!\nOkay to continue?","86Box",MB_OKCANCEL) != IDOK) - { - break; - } - pause = 1; - Sleep(100); - ide_enable[2] ^= 1; - CheckMenuItem(hmenu, IDM_IDE_TER_ENABLED, ide_enable[2] ? MF_CHECKED : MF_UNCHECKED); - saveconfig(); - resetpchard(); - pause = 0; - break; - - case IDM_IDE_TER_IRQ9: - ide_ter_set_irq(hmenu, 9, IDM_IDE_TER_IRQ9); - break; - - case IDM_IDE_TER_IRQ10: - ide_ter_set_irq(hmenu, 10, IDM_IDE_TER_IRQ10); - break; - - case IDM_IDE_TER_IRQ11: - ide_ter_set_irq(hmenu, 11, IDM_IDE_TER_IRQ11); - break; - - case IDM_IDE_TER_IRQ12: - ide_ter_set_irq(hmenu, 12, IDM_IDE_TER_IRQ12); - break; - - case IDM_IDE_TER_IRQ14: - ide_ter_set_irq(hmenu, 14, IDM_IDE_TER_IRQ14); - break; - - case IDM_IDE_TER_IRQ15: - ide_ter_set_irq(hmenu, 15, IDM_IDE_TER_IRQ15); - break; - - case IDM_IDE_QUA_ENABLED: - if (MessageBox(NULL,"This will reset 86Box!\nOkay to continue?","86Box",MB_OKCANCEL) != IDOK) - { - break; - } - pause = 1; - Sleep(100); - ide_enable[3] ^= 1; - CheckMenuItem(hmenu, IDM_IDE_QUA_ENABLED, ide_enable[3] ? MF_CHECKED : MF_UNCHECKED); - saveconfig(); - resetpchard(); - pause = 0; - break; - - case IDM_IDE_QUA_IRQ9: - ide_qua_set_irq(hmenu, 9, IDM_IDE_QUA_IRQ9); - break; - - case IDM_IDE_QUA_IRQ10: - ide_qua_set_irq(hmenu, 10, IDM_IDE_QUA_IRQ10); - break; - - case IDM_IDE_QUA_IRQ11: - ide_qua_set_irq(hmenu, 11, IDM_IDE_QUA_IRQ11); - break; - - case IDM_IDE_QUA_IRQ12: - ide_qua_set_irq(hmenu, 12, IDM_IDE_QUA_IRQ12); - break; - - case IDM_IDE_QUA_IRQ14: - ide_qua_set_irq(hmenu, 14, IDM_IDE_QUA_IRQ14); - break; - - case IDM_IDE_QUA_IRQ15: - ide_qua_set_irq(hmenu, 15, IDM_IDE_QUA_IRQ15); - break; - - case IDM_CDROM_1_EMPTY: - case IDM_CDROM_2_EMPTY: - case IDM_CDROM_3_EMPTY: - case IDM_CDROM_4_EMPTY: - cdrom_id = convert_cdrom_id(LOWORD(wParam) - IDM_CDROM_1_EMPTY); - win_cdrom_eject(cdrom_id); -#if 0 - if (cdrom_drive == 0) - { - /* Switch from empty to empty. Do nothing. */ - break; - } - cdrom->exit(); - cdrom_close(); - cdrom_null_open(0); - if (cdrom_enabled) - { - /* Signal disc change to the emulated machine. */ - SCSICDROM_Insert(); - } - CheckMenuItem(hmenu, IDM_CDROM_REAL + cdrom_drive, MF_UNCHECKED); - CheckMenuItem(hmenu, IDM_CDROM_ISO, MF_UNCHECKED); - old_cdrom_drive = cdrom_drive; - cdrom_drive=0; - CheckMenuItem(hmenu, IDM_CDROM_EMPTY, MF_CHECKED); - saveconfig(); -#endif - break; - - case IDM_CDROM_1_RELOAD: - case IDM_CDROM_2_RELOAD: - case IDM_CDROM_3_RELOAD: - case IDM_CDROM_4_RELOAD: - cdrom_id = convert_cdrom_id(LOWORD(wParam) - IDM_CDROM_1_RELOAD); - win_cdrom_reload(cdrom_id); - break; - - case IDM_CDROM_1_ISO: - case IDM_CDROM_2_ISO: - case IDM_CDROM_3_ISO: - case IDM_CDROM_4_ISO: - cdrom_id = convert_cdrom_id(LOWORD(wParam) - IDM_CDROM_1_ISO); - if (!getfile(hwnd,"CD-ROM image (*.ISO)\0*.ISO\0All files (*.*)\0*.*\0",cdrom_iso[cdrom_id].iso_path)) - { - cdrom_drives[cdrom_id].prev_host_drive = cdrom_drives[cdrom_id].host_drive; - strcpy(temp_iso_path, openfilestring); - if ((strcmp(cdrom_iso[cdrom_id].iso_path, temp_iso_path) == 0) && (cdrom_drives[cdrom_id].host_drive == 200)) - { - /* Switching from ISO to the same ISO. Do nothing. */ - break; - } - cdrom_drives[cdrom_id].handler->exit(cdrom_id); - cdrom_close(cdrom_id); - iso_open(cdrom_id, temp_iso_path); - if (cdrom_drives[cdrom_id].enabled) - { - /* Signal disc change to the emulated machine. */ - cdrom_insert(cdrom_id); - } - CheckMenuItem(hmenu, IDM_CDROM_1_EMPTY + (cdrom_id * 1000), MF_UNCHECKED); - if ((cdrom_drives[cdrom_id].host_drive != 0) && (cdrom_drives[cdrom_id].host_drive != 200)) - { - CheckMenuItem(hmenu, IDM_CDROM_1_REAL + (cdrom_id * 1000) + cdrom_drives[cdrom_id].host_drive, MF_UNCHECKED); - } - cdrom_drives[cdrom_id].host_drive = 200; - CheckMenuItem(hmenu, IDM_CDROM_1_ISO + (cdrom_id * 1000), MF_CHECKED); - saveconfig(); - } - break; - - default: - menu_sub_param = LOWORD(wParam) % 100; - cdrom_id = convert_cdrom_id(LOWORD(wParam) - menu_sub_param - IDM_CDROM_1_REAL); - if ((LOWORD(wParam) > IDM_CDROM_1_REAL + (cdrom_id * 1000)) && (LOWORD(wParam) < (IDM_CDROM_1_REAL + (cdrom_id * 1000) + 100))) - { - new_cdrom_drive = menu_sub_param; - if (cdrom_drives[cdrom_id].host_drive == new_cdrom_drive) - { - /* Switching to the same drive. Do nothing. */ - break; - } - cdrom_drives[cdrom_id].prev_host_drive = cdrom_drives[cdrom_id].host_drive; - cdrom_drives[cdrom_id].handler->exit(cdrom_id); - cdrom_close(cdrom_id); - ioctl_open(cdrom_id, new_cdrom_drive); - if (cdrom_drives[cdrom_id].enabled) - { - /* Signal disc change to the emulated machine. */ - cdrom_insert(cdrom_id); - } - CheckMenuItem(hmenu, IDM_CDROM_1_EMPTY + (cdrom_id * 1000), MF_UNCHECKED); - if ((cdrom_drives[cdrom_id].host_drive != 0) && (cdrom_drives[cdrom_id].host_drive != 200)) - { - CheckMenuItem(hmenu, IDM_CDROM_1_REAL + (cdrom_id * 1000) + cdrom_drives[cdrom_id].host_drive, MF_UNCHECKED); - } - CheckMenuItem(hmenu, IDM_CDROM_1_ISO + (cdrom_id * 1000), MF_UNCHECKED); - cdrom_drives[cdrom_id].host_drive = new_cdrom_drive; - CheckMenuItem(hmenu, IDM_CDROM_1_REAL + (cdrom_id * 1000) + cdrom_drives[cdrom_id].host_drive, MF_CHECKED); - saveconfig(); - } - break; + break; } return 0; @@ -1894,12 +1889,9 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM const RAWKEYBOARD rawKB = raw->data.keyboard; USHORT scancode = rawKB.MakeCode; - // pclog("Keyboard input received: S:%X VK:%X F:%X\n", c, d, e); - /* If it's not a scan code that starts with 0xE1 */ if (!(rawKB.Flags & RI_KEY_E1)) { - // pclog("Non-E1 triggered, make code is %04X\n", rawKB.MakeCode); if (rawKB.Flags & RI_KEY_E0) scancode |= (0xE0 << 8); @@ -1921,7 +1913,6 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM } else { - // pclog("E1 triggered, make code is %04X\n", rawKB.MakeCode); if (rawKB.MakeCode == 0x1D) scancode = 0xFF; if (!(scancode & 0xf00)) @@ -1938,9 +1929,13 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM case WM_SETFOCUS: infocus=1; - // QueryPerformanceCounter(&counter_posold); -// pclog("Set focus!\n"); + if (!hook_enabled) + { + hKeyboardHook = SetWindowsHookEx( WH_KEYBOARD_LL, LowLevelKeyboardProc, GetModuleHandle(NULL), 0 ); + hook_enabled = 1; + } break; + case WM_KILLFOCUS: infocus=0; if (mousecapture) @@ -1949,10 +1944,14 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM ShowCursor(TRUE); mousecapture=0; } -// pclog("Lost focus!\n"); memset(rawinputkey, 0, sizeof(rawinputkey)); if (video_fullscreen) leave_fullscreen_flag = 1; + if (hook_enabled) + { + UnhookWindowsHookEx(hKeyboardHook); + hook_enabled = 0; + } break; case WM_LBUTTONUP: @@ -1968,7 +1967,6 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM pcclip.bottom -= GetSystemMetrics(SM_CXFIXEDFRAME) + 10; ClipCursor(&pcclip); mousecapture = 1; -// ShowCursor(FALSE); while (1) { if (ShowCursor(FALSE) < 0) break; @@ -1982,12 +1980,16 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM break; case WM_ENTERMENULOOP: -// if (key[KEY_ALT] || key[KEY_ALTGR]) return 0; break; case WM_SIZE: - winsizex=lParam&0xFFFF; - winsizey=lParam>>16; + winsizex = (lParam & 0xFFFF); + winsizey = (lParam >> 16) - (17 + 6); + + MoveWindow(hwndRender, 0, 0, + winsizex, + winsizey, + TRUE); if (vid_apis[video_fullscreen][vid_api].resize) { @@ -1997,6 +1999,11 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM endblit(); } + MoveWindow(hwndStatus, 0, winsizey + 6, + winsizex, + 17, + TRUE); + if (mousecapture) { RECT pcclip; @@ -2060,11 +2067,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM case WM_SYSKEYDOWN: case WM_KEYUP: case WM_SYSKEYUP: -// if (mousecapture) return 0; -// return DefWindowProc (hwnd, message, wParam, lParam); - case WM_DESTROY: UnhookWindowsHookEx( hKeyboardHook ); KillTimer(hwnd, TIMER_1SEC); @@ -2072,13 +2076,11 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM break; case WM_SYSCOMMAND: - // if (wParam == SC_KEYMENU && HIWORD(lParam) <= 0 && (video_fullscreen || mousecapture)) /* Disable ALT key *ALWAYS*, I don't think there's any use for reaching the menu that way. */ if (wParam == SC_KEYMENU && HIWORD(lParam) <= 0) return 0; /*disable ALT key for menu*/ default: -// pclog("Def %08X %i\n",message,message); return DefWindowProc (hwnd, message, wParam, lParam); } return 0; @@ -2093,3 +2095,241 @@ LRESULT CALLBACK subWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPAR } return 0; } + +VOID APIENTRY HandlePopupMenu(HWND hwnd, POINT pt, int id) +{ + HMENU pmenu; + int menu_id = -1; + if (id >= (sb_parts - 1)) + { + return; + } + pt.x = id * sb_icon_width; /* Justify to the left. */ + pt.y = 0; /* Justify to the top. */ + ClientToScreen(hwnd, (LPPOINT) &pt); + if ((sb_part_meanings[id] & 0x30) == 0x00) + { + menu_id = sb_part_meanings[id] & 0xf; + } + else if ((sb_part_meanings[id] & 0x30) == 0x10) + { + menu_id = (sb_part_meanings[id] & 0xf) + 4; + } + if (menu_id != -1) + { + pmenu = GetSubMenu(smenu, menu_id); + TrackPopupMenu(pmenu, TPM_LEFTALIGN | TPM_BOTTOMALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, hwndStatus, NULL); + } +} + +LRESULT CALLBACK StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + RECT rc; + POINT pt; + + char temp_iso_path[1024]; + int new_cdrom_drive; + int cdrom_id = 0; + int menu_sub_param = 0; + int menu_super_param = 0; + + HMENU hmenu; + + switch (message) + { + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDM_DISC_1: + case IDM_DISC_1_WP: + if (!file_dlg_st(hwnd, 2173, discfns[0], 0)) + { + disc_close(0); + ui_writeprot[0] = (LOWORD(wParam) == IDM_DISC_1_WP) ? 1 : 0; + disc_load(0, openfilestring); + update_status_bar_icon_state(0x00, 0); + update_tip(0x00); + saveconfig(); + } + break; + case IDM_DISC_2: + case IDM_DISC_2_WP: + if (!file_dlg_st(hwnd, 2173, discfns[0], 0)) + { + disc_close(1); + ui_writeprot[1] = (LOWORD(wParam) == IDM_DISC_2_WP) ? 1 : 0; + disc_load(1, openfilestring); + update_status_bar_icon_state(0x01, 0); + update_tip(0x01); + saveconfig(); + } + break; + case IDM_DISC_3: + case IDM_DISC_3_WP: + if (!file_dlg_st(hwnd, 2173, discfns[0], 0)) + { + disc_close(2); + ui_writeprot[2] = (LOWORD(wParam) == IDM_DISC_3_WP) ? 1 : 0; + disc_load(2, openfilestring); + update_status_bar_icon_state(0x02, 0); + update_tip(0x02); + saveconfig(); + } + break; + case IDM_DISC_4: + case IDM_DISC_4_WP: + if (!file_dlg_st(hwnd, 2173, discfns[0], 0)) + { + disc_close(3); + ui_writeprot[3] = (LOWORD(wParam) == IDM_DISC_4_WP) ? 1 : 0; + disc_load(3, openfilestring); + update_status_bar_icon_state(0x03, 0); + update_tip(0x03); + saveconfig(); + } + break; + case IDM_EJECT_1: + disc_close(0); + update_status_bar_icon_state(0x00, 1); + update_tip(0x00); + saveconfig(); + break; + case IDM_EJECT_2: + disc_close(1); + update_status_bar_icon_state(0x01, 1); + update_tip(0x01); + saveconfig(); + break; + case IDM_EJECT_3: + disc_close(2); + update_status_bar_icon_state(0x02, 1); + update_tip(0x02); + saveconfig(); + break; + case IDM_EJECT_4: + disc_close(3); + update_status_bar_icon_state(0x03, 1); + update_tip(0x03); + saveconfig(); + break; + + case IDM_CDROM_1_MUTE: + case IDM_CDROM_2_MUTE: + case IDM_CDROM_3_MUTE: + case IDM_CDROM_4_MUTE: + cdrom_id = LOWORD(wParam) & 3; + hmenu = GetSubMenu(smenu, cdrom_id + 4); + Sleep(100); + cdrom_drives[cdrom_id].sound_on ^= 1; + CheckMenuItem(hmenu, IDM_CDROM_1_MUTE + (cdrom_id * 1000), cdrom_drives[cdrom_id].sound_on ? MF_UNCHECKED : MF_CHECKED); + saveconfig(); + sound_cd_thread_reset(); + break; + + case IDM_CDROM_1_EMPTY: + case IDM_CDROM_2_EMPTY: + case IDM_CDROM_3_EMPTY: + case IDM_CDROM_4_EMPTY: + cdrom_id = LOWORD(wParam) & 3; + hmenu = GetSubMenu(smenu, cdrom_id + 4); + win_cdrom_eject(cdrom_id); + break; + + case IDM_CDROM_1_RELOAD: + case IDM_CDROM_2_RELOAD: + case IDM_CDROM_3_RELOAD: + case IDM_CDROM_4_RELOAD: + cdrom_id = LOWORD(wParam) & 3; + hmenu = GetSubMenu(smenu, cdrom_id + 4); + win_cdrom_reload(cdrom_id); + break; + + case IDM_CDROM_1_ISO: + case IDM_CDROM_2_ISO: + case IDM_CDROM_3_ISO: + case IDM_CDROM_4_ISO: + cdrom_id = LOWORD(wParam) & 3; + hmenu = GetSubMenu(smenu, cdrom_id + 4); + if (!file_dlg_st(hwnd, 2175, cdrom_iso[cdrom_id].iso_path, 0)) + { + cdrom_drives[cdrom_id].prev_host_drive = cdrom_drives[cdrom_id].host_drive; + strcpy(temp_iso_path, openfilestring); + if ((strcmp(cdrom_iso[cdrom_id].iso_path, temp_iso_path) == 0) && (cdrom_drives[cdrom_id].host_drive == 200)) + { + /* Switching from ISO to the same ISO. Do nothing. */ + break; + } + cdrom_drives[cdrom_id].handler->exit(cdrom_id); + cdrom_close(cdrom_id); + iso_open(cdrom_id, temp_iso_path); + if (cdrom_drives[cdrom_id].enabled) + { + /* Signal disc change to the emulated machine. */ + cdrom_insert(cdrom_id); + } + CheckMenuItem(hmenu, IDM_CDROM_1_EMPTY + cdrom_id, MF_UNCHECKED); + if ((cdrom_drives[cdrom_id].host_drive != 0) && (cdrom_drives[cdrom_id].host_drive != 200)) + { + CheckMenuItem(hmenu, IDM_CDROM_1_REAL + cdrom_id + (cdrom_drives[cdrom_id].host_drive << 2), MF_UNCHECKED); + } + cdrom_drives[cdrom_id].host_drive = 200; + CheckMenuItem(hmenu, IDM_CDROM_1_ISO + cdrom_id, MF_CHECKED); + update_status_bar_icon_state(0x10 | cdrom_id, get_cd_state(cdrom_id)); + update_tip(0x10 | cdrom_id); + saveconfig(); + } + break; + + default: + cdrom_id = LOWORD(wParam) & 3; + hmenu = GetSubMenu(smenu, cdrom_id + 4); + menu_sub_param = ((LOWORD(wParam) - IDM_CDROM_1_REAL) - cdrom_id) >> 2; + /* pclog("[%04X] Guest drive %c [%i]: -> Host drive %c [%i]:\n", LOWORD(wParam), 0x4b + cdrom_id, cdrom_id, menu_sub_param, menu_sub_param); */ + if (((LOWORD(wParam) & ~3) >= (IDM_CDROM_1_REAL + ('A' << 2))) && ((LOWORD(wParam) & ~3) <= (IDM_CDROM_1_REAL + ('Z' << 2)))) + { + new_cdrom_drive = menu_sub_param; + if (cdrom_drives[cdrom_id].host_drive == new_cdrom_drive) + { + /* Switching to the same drive. Do nothing. */ + break; + } + cdrom_drives[cdrom_id].prev_host_drive = cdrom_drives[cdrom_id].host_drive; + cdrom_drives[cdrom_id].handler->exit(cdrom_id); + cdrom_close(cdrom_id); + ioctl_open(cdrom_id, new_cdrom_drive); + if (cdrom_drives[cdrom_id].enabled) + { + /* Signal disc change to the emulated machine. */ + cdrom_insert(cdrom_id); + } + CheckMenuItem(hmenu, IDM_CDROM_1_EMPTY + cdrom_id, MF_UNCHECKED); + if ((cdrom_drives[cdrom_id].host_drive != 0) && (cdrom_drives[cdrom_id].host_drive != 200)) + { + CheckMenuItem(hmenu, IDM_CDROM_1_REAL + cdrom_id + (cdrom_drives[cdrom_id].host_drive << 2), MF_UNCHECKED); + } + CheckMenuItem(hmenu, IDM_CDROM_1_ISO + cdrom_id, MF_UNCHECKED); + cdrom_drives[cdrom_id].host_drive = new_cdrom_drive; + CheckMenuItem(hmenu, IDM_CDROM_1_REAL + cdrom_id + (cdrom_drives[cdrom_id].host_drive << 2), MF_CHECKED); + update_status_bar_icon_state(0x10 | cdrom_id, get_cd_state(cdrom_id)); + update_tip(0x10 | cdrom_id); + saveconfig(); + } + break; + } + return 0; + + case WM_LBUTTONDOWN: + GetClientRect(hwnd, (LPRECT)& rc); + pt.x = GET_X_LPARAM(lParam); + pt.y = GET_Y_LPARAM(lParam); + if (PtInRect((LPRECT) &rc, pt)) + { + HandlePopupMenu(hwnd, pt, (pt.x / sb_icon_width)); + } + break; + + default: + return CallWindowProc((WNDPROC) OriginalStatusBarProcedure, hwnd, message, wParam, lParam); + } + return 0; +} diff --git a/src/win.h b/src/win.h index 5807bb2e9..17316c27a 100644 --- a/src/win.h +++ b/src/win.h @@ -11,6 +11,7 @@ extern "C" { #define szClassName "86BoxMainWnd" #define szSubClassName "86BoxSubWnd" +#define szStatusBarClassName "86BoxStatusBar" void leave_fullscreen(); @@ -23,10 +24,6 @@ void status_open(HWND hwnd); extern HWND status_hwnd; extern int status_is_open; -void hdconf_open(HWND hwnd); - -void config_open(HWND hwnd); - void deviceconfig_open(HWND hwnd, struct device_t *device); void joystickconfig_open(HWND hwnd, int joy_nr, int type); @@ -35,4 +32,19 @@ extern char openfilestring[260]; int getfile(HWND hwnd, char *f, char *fn); int getsfile(HWND hwnd, char *f, char *fn); +void get_executable_name(char *s, int size); +void set_window_title(char *s); + +void startblit(); +void endblit(); + extern int pause; + +void win_settings_open(HWND hwnd); +void win_menu_update(); + +void update_status_bar_panes(HWND hwnds); + +int fdd_type_to_icon(int type); + +extern HWND hwndStatus; diff --git a/src/x86_flags.h b/src/x86_flags.h index f1a394e61..dab54dbf6 100644 --- a/src/x86_flags.h +++ b/src/x86_flags.h @@ -35,10 +35,10 @@ enum FLAGS_DEC8, FLAGS_DEC16, - FLAGS_DEC32, + FLAGS_DEC32 }; -static inline int ZF_SET() +static __inline int ZF_SET() { switch (cpu_state.flags_op) { @@ -70,10 +70,13 @@ static inline int ZF_SET() case FLAGS_UNKNOWN: return flags & Z_FLAG; + + default: + return 0; } } -static inline int NF_SET() +static __inline int NF_SET() { switch (cpu_state.flags_op) { @@ -109,10 +112,13 @@ static inline int NF_SET() case FLAGS_UNKNOWN: return flags & N_FLAG; + + default: + return 0; } } -static inline int PF_SET() +static __inline int PF_SET() { switch (cpu_state.flags_op) { @@ -144,10 +150,13 @@ static inline int PF_SET() case FLAGS_UNKNOWN: return flags & P_FLAG; + + default: + return 0; } } -static inline int VF_SET() +static __inline int VF_SET() { switch (cpu_state.flags_op) { @@ -195,10 +204,13 @@ static inline int VF_SET() case FLAGS_UNKNOWN: return flags & V_FLAG; + + default: + return 0; } } -static inline int AF_SET() +static __inline int AF_SET() { switch (cpu_state.flags_op) { @@ -234,10 +246,13 @@ static inline int AF_SET() case FLAGS_UNKNOWN: return flags & A_FLAG; + + default: + return 0; } } -static inline int CF_SET() +static __inline int CF_SET() { switch (cpu_state.flags_op) { @@ -285,17 +300,13 @@ static inline int CF_SET() case FLAGS_INC32: case FLAGS_UNKNOWN: return flags & C_FLAG; + + default: + return 0; } } -//#define ZF_SET() (flags & Z_FLAG) -//#define NF_SET() (flags & N_FLAG) -//#define PF_SET() (flags & P_FLAG) -//#define VF_SET() (flags & V_FLAG) -//#define CF_SET() (flags & C_FLAG) -//#define AF_SET() (flags & A_FLAG) - -static inline void flags_rebuild() +static __inline void flags_rebuild() { if (cpu_state.flags_op != FLAGS_UNKNOWN) { @@ -311,12 +322,12 @@ static inline void flags_rebuild() } } -static inline void flags_extract() +static __inline void flags_extract() { cpu_state.flags_op = FLAGS_UNKNOWN; } -static inline void flags_rebuild_c() +static __inline void flags_rebuild_c() { if (cpu_state.flags_op != FLAGS_UNKNOWN) { @@ -327,17 +338,17 @@ static inline void flags_rebuild_c() } } -static inline void setznp8(uint8_t val) +static __inline void setznp8(uint8_t val) { cpu_state.flags_op = FLAGS_ZN8; cpu_state.flags_res = val; } -static inline void setznp16(uint16_t val) +static __inline void setznp16(uint16_t val) { cpu_state.flags_op = FLAGS_ZN16; cpu_state.flags_res = val; } -static inline void setznp32(uint32_t val) +static __inline void setznp32(uint32_t val) { cpu_state.flags_op = FLAGS_ZN32; cpu_state.flags_res = val; @@ -349,28 +360,28 @@ static inline void setznp32(uint32_t val) cpu_state.flags_op1 = orig; \ cpu_state.flags_op2 = shift; -static inline void setadd8(uint8_t a, uint8_t b) +static __inline void setadd8(uint8_t a, uint8_t b) { cpu_state.flags_op1 = a; cpu_state.flags_op2 = b; cpu_state.flags_res = (a + b) & 0xff; cpu_state.flags_op = FLAGS_ADD8; } -static inline void setadd16(uint16_t a, uint16_t b) +static __inline void setadd16(uint16_t a, uint16_t b) { cpu_state.flags_op1 = a; cpu_state.flags_op2 = b; cpu_state.flags_res = (a + b) & 0xffff; cpu_state.flags_op = FLAGS_ADD16; } -static inline void setadd32(uint32_t a, uint32_t b) +static __inline void setadd32(uint32_t a, uint32_t b) { cpu_state.flags_op1 = a; cpu_state.flags_op2 = b; cpu_state.flags_res = a + b; cpu_state.flags_op = FLAGS_ADD32; } -static inline void setadd8nc(uint8_t a, uint8_t b) +static __inline void setadd8nc(uint8_t a, uint8_t b) { flags_rebuild_c(); cpu_state.flags_op1 = a; @@ -378,7 +389,7 @@ static inline void setadd8nc(uint8_t a, uint8_t b) cpu_state.flags_res = (a + b) & 0xff; cpu_state.flags_op = FLAGS_INC8; } -static inline void setadd16nc(uint16_t a, uint16_t b) +static __inline void setadd16nc(uint16_t a, uint16_t b) { flags_rebuild_c(); cpu_state.flags_op1 = a; @@ -386,7 +397,7 @@ static inline void setadd16nc(uint16_t a, uint16_t b) cpu_state.flags_res = (a + b) & 0xffff; cpu_state.flags_op = FLAGS_INC16; } -static inline void setadd32nc(uint32_t a, uint32_t b) +static __inline void setadd32nc(uint32_t a, uint32_t b) { flags_rebuild_c(); cpu_state.flags_op1 = a; @@ -395,21 +406,21 @@ static inline void setadd32nc(uint32_t a, uint32_t b) cpu_state.flags_op = FLAGS_INC32; } -static inline void setsub8(uint8_t a, uint8_t b) +static __inline void setsub8(uint8_t a, uint8_t b) { cpu_state.flags_op1 = a; cpu_state.flags_op2 = b; cpu_state.flags_res = (a - b) & 0xff; cpu_state.flags_op = FLAGS_SUB8; } -static inline void setsub16(uint16_t a, uint16_t b) +static __inline void setsub16(uint16_t a, uint16_t b) { cpu_state.flags_op1 = a; cpu_state.flags_op2 = b; cpu_state.flags_res = (a - b) & 0xffff; cpu_state.flags_op = FLAGS_SUB16; } -static inline void setsub32(uint32_t a, uint32_t b) +static __inline void setsub32(uint32_t a, uint32_t b) { cpu_state.flags_op1 = a; cpu_state.flags_op2 = b; @@ -417,7 +428,7 @@ static inline void setsub32(uint32_t a, uint32_t b) cpu_state.flags_op = FLAGS_SUB32; } -static inline void setsub8nc(uint8_t a, uint8_t b) +static __inline void setsub8nc(uint8_t a, uint8_t b) { flags_rebuild_c(); cpu_state.flags_op1 = a; @@ -425,7 +436,7 @@ static inline void setsub8nc(uint8_t a, uint8_t b) cpu_state.flags_res = (a - b) & 0xff; cpu_state.flags_op = FLAGS_DEC8; } -static inline void setsub16nc(uint16_t a, uint16_t b) +static __inline void setsub16nc(uint16_t a, uint16_t b) { flags_rebuild_c(); cpu_state.flags_op1 = a; @@ -433,7 +444,7 @@ static inline void setsub16nc(uint16_t a, uint16_t b) cpu_state.flags_res = (a - b) & 0xffff; cpu_state.flags_op = FLAGS_DEC16; } -static inline void setsub32nc(uint32_t a, uint32_t b) +static __inline void setsub32nc(uint32_t a, uint32_t b) { flags_rebuild_c(); cpu_state.flags_op1 = a; @@ -442,7 +453,7 @@ static inline void setsub32nc(uint32_t a, uint32_t b) cpu_state.flags_op = FLAGS_DEC32; } -static inline void setadc8(uint8_t a, uint8_t b) +static __inline void setadc8(uint8_t a, uint8_t b) { uint16_t c=(uint16_t)a+(uint16_t)b+tempc; cpu_state.flags_op = FLAGS_UNKNOWN; @@ -452,7 +463,7 @@ static inline void setadc8(uint8_t a, uint8_t b) if (!((a^b)&0x80)&&((a^c)&0x80)) flags|=V_FLAG; if (((a&0xF)+(b&0xF))&0x10) flags|=A_FLAG; } -static inline void setadc16(uint16_t a, uint16_t b) +static __inline void setadc16(uint16_t a, uint16_t b) { uint32_t c=(uint32_t)a+(uint32_t)b+tempc; cpu_state.flags_op = FLAGS_UNKNOWN; @@ -463,7 +474,7 @@ static inline void setadc16(uint16_t a, uint16_t b) if (((a&0xF)+(b&0xF))&0x10) flags|=A_FLAG; } -static inline void setsbc8(uint8_t a, uint8_t b) +static __inline void setsbc8(uint8_t a, uint8_t b) { uint16_t c=(uint16_t)a-(((uint16_t)b)+tempc); cpu_state.flags_op = FLAGS_UNKNOWN; @@ -473,7 +484,7 @@ static inline void setsbc8(uint8_t a, uint8_t b) if ((a^b)&(a^c)&0x80) flags|=V_FLAG; if (((a&0xF)-(b&0xF))&0x10) flags|=A_FLAG; } -static inline void setsbc16(uint16_t a, uint16_t b) +static __inline void setsbc16(uint16_t a, uint16_t b) { uint32_t c=(uint32_t)a-(((uint32_t)b)+tempc); cpu_state.flags_op = FLAGS_UNKNOWN; @@ -485,7 +496,7 @@ static inline void setsbc16(uint16_t a, uint16_t b) if (((a&0xF)-(b&0xF))&0x10) flags|=A_FLAG; } -static inline void setadc32(uint32_t a, uint32_t b) +static __inline void setadc32(uint32_t a, uint32_t b) { uint32_t c=(uint32_t)a+(uint32_t)b+tempc; cpu_state.flags_op = FLAGS_UNKNOWN; @@ -496,7 +507,7 @@ static inline void setadc32(uint32_t a, uint32_t b) if (!((a^b)&0x80000000)&&((a^c)&0x80000000)) flags|=V_FLAG; if (((a&0xF)+(b&0xF)+tempc)&0x10) flags|=A_FLAG; } -static inline void setsbc32(uint32_t a, uint32_t b) +static __inline void setsbc32(uint32_t a, uint32_t b) { uint32_t c=(uint32_t)a-(((uint32_t)b)+tempc); cpu_state.flags_op = FLAGS_UNKNOWN; diff --git a/src/x86_ops_arith.h b/src/x86_ops_arith.h index 3a9f96953..3c6b67fa6 100644 --- a/src/x86_ops_arith.h +++ b/src/x86_ops_arith.h @@ -1,12 +1,14 @@ #define OP_ARITH(name, operation, setflags, flagops, gettempc) \ static int op ## name ## _b_rmw_a16(uint32_t fetchdat) \ { \ + uint8_t dst; \ + uint8_t src; \ if (gettempc) tempc = CF_SET() ? 1 : 0; \ fetch_ea_16(fetchdat); \ if (cpu_mod == 3) \ { \ - uint8_t dst = getr8(cpu_rm); \ - uint8_t src = getr8(cpu_reg); \ + dst = getr8(cpu_rm); \ + src = getr8(cpu_reg); \ setflags ## 8 flagops; \ setr8(cpu_rm, operation); \ CLOCK_CYCLES(timing_rr); \ @@ -14,8 +16,8 @@ } \ else \ { \ - uint8_t dst = geteab(); if (cpu_state.abrt) return 1; \ - uint8_t src = getr8(cpu_reg); \ + dst = geteab(); if (cpu_state.abrt) return 1; \ + src = getr8(cpu_reg); \ seteab(operation); if (cpu_state.abrt) return 1; \ setflags ## 8 flagops; \ CLOCK_CYCLES(timing_mr); \ @@ -25,12 +27,14 @@ } \ static int op ## name ## _b_rmw_a32(uint32_t fetchdat) \ { \ + uint8_t dst; \ + uint8_t src; \ if (gettempc) tempc = CF_SET() ? 1 : 0; \ fetch_ea_32(fetchdat); \ if (cpu_mod == 3) \ { \ - uint8_t dst = getr8(cpu_rm); \ - uint8_t src = getr8(cpu_reg); \ + dst = getr8(cpu_rm); \ + src = getr8(cpu_reg); \ setflags ## 8 flagops; \ setr8(cpu_rm, operation); \ CLOCK_CYCLES(timing_rr); \ @@ -38,8 +42,8 @@ } \ else \ { \ - uint8_t dst = geteab(); if (cpu_state.abrt) return 1; \ - uint8_t src = getr8(cpu_reg); \ + dst = geteab(); if (cpu_state.abrt) return 1; \ + src = getr8(cpu_reg); \ seteab(operation); if (cpu_state.abrt) return 1; \ setflags ## 8 flagops; \ CLOCK_CYCLES(timing_mr); \ @@ -50,12 +54,14 @@ \ static int op ## name ## _w_rmw_a16(uint32_t fetchdat) \ { \ + uint16_t dst; \ + uint16_t src; \ if (gettempc) tempc = CF_SET() ? 1 : 0; \ fetch_ea_16(fetchdat); \ if (cpu_mod == 3) \ { \ - uint16_t dst = cpu_state.regs[cpu_rm].w; \ - uint16_t src = cpu_state.regs[cpu_reg].w; \ + dst = cpu_state.regs[cpu_rm].w; \ + src = cpu_state.regs[cpu_reg].w; \ setflags ## 16 flagops; \ cpu_state.regs[cpu_rm].w = operation; \ CLOCK_CYCLES(timing_rr); \ @@ -63,8 +69,8 @@ } \ else \ { \ - uint16_t dst = geteaw(); if (cpu_state.abrt) return 1; \ - uint16_t src = cpu_state.regs[cpu_reg].w; \ + dst = geteaw(); if (cpu_state.abrt) return 1; \ + src = cpu_state.regs[cpu_reg].w; \ seteaw(operation); if (cpu_state.abrt) return 1; \ setflags ## 16 flagops; \ CLOCK_CYCLES(timing_mr); \ @@ -74,12 +80,14 @@ } \ static int op ## name ## _w_rmw_a32(uint32_t fetchdat) \ { \ + uint16_t dst; \ + uint16_t src; \ if (gettempc) tempc = CF_SET() ? 1 : 0; \ fetch_ea_32(fetchdat); \ if (cpu_mod == 3) \ { \ - uint16_t dst = cpu_state.regs[cpu_rm].w; \ - uint16_t src = cpu_state.regs[cpu_reg].w; \ + dst = cpu_state.regs[cpu_rm].w; \ + src = cpu_state.regs[cpu_reg].w; \ setflags ## 16 flagops; \ cpu_state.regs[cpu_rm].w = operation; \ CLOCK_CYCLES(timing_rr); \ @@ -87,8 +95,8 @@ } \ else \ { \ - uint16_t dst = geteaw(); if (cpu_state.abrt) return 1; \ - uint16_t src = cpu_state.regs[cpu_reg].w; \ + dst = geteaw(); if (cpu_state.abrt) return 1; \ + src = cpu_state.regs[cpu_reg].w; \ seteaw(operation); if (cpu_state.abrt) return 1; \ setflags ## 16 flagops; \ CLOCK_CYCLES(timing_mr); \ @@ -99,12 +107,14 @@ \ static int op ## name ## _l_rmw_a16(uint32_t fetchdat) \ { \ + uint32_t dst; \ + uint32_t src; \ if (gettempc) tempc = CF_SET() ? 1 : 0; \ fetch_ea_16(fetchdat); \ if (cpu_mod == 3) \ { \ - uint32_t dst = cpu_state.regs[cpu_rm].l; \ - uint32_t src = cpu_state.regs[cpu_reg].l; \ + dst = cpu_state.regs[cpu_rm].l; \ + src = cpu_state.regs[cpu_reg].l; \ setflags ## 32 flagops; \ cpu_state.regs[cpu_rm].l = operation; \ CLOCK_CYCLES(timing_rr); \ @@ -112,8 +122,8 @@ } \ else \ { \ - uint32_t dst = geteal(); if (cpu_state.abrt) return 1; \ - uint32_t src = cpu_state.regs[cpu_reg].l; \ + dst = geteal(); if (cpu_state.abrt) return 1; \ + src = cpu_state.regs[cpu_reg].l; \ seteal(operation); if (cpu_state.abrt) return 1; \ setflags ## 32 flagops; \ CLOCK_CYCLES(timing_mr); \ @@ -123,12 +133,14 @@ } \ static int op ## name ## _l_rmw_a32(uint32_t fetchdat) \ { \ + uint32_t dst; \ + uint32_t src; \ if (gettempc) tempc = CF_SET() ? 1 : 0; \ fetch_ea_32(fetchdat); \ if (cpu_mod == 3) \ { \ - uint32_t dst = cpu_state.regs[cpu_rm].l; \ - uint32_t src = cpu_state.regs[cpu_reg].l; \ + dst = cpu_state.regs[cpu_rm].l; \ + src = cpu_state.regs[cpu_reg].l; \ setflags ## 32 flagops; \ cpu_state.regs[cpu_rm].l = operation; \ CLOCK_CYCLES(timing_rr); \ @@ -136,8 +148,8 @@ } \ else \ { \ - uint32_t dst = geteal(); if (cpu_state.abrt) return 1; \ - uint32_t src = cpu_state.regs[cpu_reg].l; \ + dst = geteal(); if (cpu_state.abrt) return 1; \ + src = cpu_state.regs[cpu_reg].l; \ seteal(operation); if (cpu_state.abrt) return 1; \ setflags ## 32 flagops; \ CLOCK_CYCLES(timing_mr); \ diff --git a/src/x86_ops_bitscan.h b/src/x86_ops_bitscan.h index 834211128..9252b4b87 100644 --- a/src/x86_ops_bitscan.h +++ b/src/x86_ops_bitscan.h @@ -1,5 +1,6 @@ #define BS_common(start, end, dir, dest, time) \ flags_rebuild(); \ + instr_cycles = 0; \ if (temp) \ { \ int c; \ @@ -21,7 +22,7 @@ static int opBSF_w_a16(uint32_t fetchdat) { uint16_t temp; - int instr_cycles; + int instr_cycles = 0; fetch_ea_16(fetchdat); temp = geteaw(); if (cpu_state.abrt) return 1; @@ -36,7 +37,7 @@ static int opBSF_w_a16(uint32_t fetchdat) static int opBSF_w_a32(uint32_t fetchdat) { uint16_t temp; - int instr_cycles; + int instr_cycles = 0; fetch_ea_32(fetchdat); temp = geteaw(); if (cpu_state.abrt) return 1; @@ -51,7 +52,7 @@ static int opBSF_w_a32(uint32_t fetchdat) static int opBSF_l_a16(uint32_t fetchdat) { uint32_t temp; - int instr_cycles; + int instr_cycles = 0; fetch_ea_16(fetchdat); temp = geteal(); if (cpu_state.abrt) return 1; @@ -66,7 +67,7 @@ static int opBSF_l_a16(uint32_t fetchdat) static int opBSF_l_a32(uint32_t fetchdat) { uint32_t temp; - int instr_cycles; + int instr_cycles = 0; fetch_ea_32(fetchdat); temp = geteal(); if (cpu_state.abrt) return 1; @@ -82,7 +83,7 @@ static int opBSF_l_a32(uint32_t fetchdat) static int opBSR_w_a16(uint32_t fetchdat) { uint16_t temp; - int instr_cycles; + int instr_cycles = 0; fetch_ea_16(fetchdat); temp = geteaw(); if (cpu_state.abrt) return 1; @@ -97,7 +98,7 @@ static int opBSR_w_a16(uint32_t fetchdat) static int opBSR_w_a32(uint32_t fetchdat) { uint16_t temp; - int instr_cycles; + int instr_cycles = 0; fetch_ea_32(fetchdat); temp = geteaw(); if (cpu_state.abrt) return 1; @@ -112,7 +113,7 @@ static int opBSR_w_a32(uint32_t fetchdat) static int opBSR_l_a16(uint32_t fetchdat) { uint32_t temp; - int instr_cycles; + int instr_cycles = 0; fetch_ea_16(fetchdat); temp = geteal(); if (cpu_state.abrt) return 1; @@ -127,7 +128,7 @@ static int opBSR_l_a16(uint32_t fetchdat) static int opBSR_l_a32(uint32_t fetchdat) { uint32_t temp; - int instr_cycles; + int instr_cycles = 0; fetch_ea_32(fetchdat); temp = geteal(); if (cpu_state.abrt) return 1; diff --git a/src/x86_ops_call.h b/src/x86_ops_call.h index 40d90a09e..6d27373f4 100644 --- a/src/x86_ops_call.h +++ b/src/x86_ops_call.h @@ -163,7 +163,6 @@ static int opFF_w_a16(uint32_t fetchdat) break; default: -// fatal("Bad FF opcode %02X\n",rmdat&0x38); x86illegal(); } return cpu_state.abrt; @@ -240,7 +239,6 @@ static int opFF_w_a32(uint32_t fetchdat) break; default: -// fatal("Bad FF opcode %02X\n",rmdat&0x38); x86illegal(); } return cpu_state.abrt; @@ -318,7 +316,6 @@ static int opFF_l_a16(uint32_t fetchdat) break; default: -// fatal("Bad FF opcode %02X\n",rmdat&0x38); x86illegal(); } return cpu_state.abrt; @@ -394,7 +391,6 @@ static int opFF_l_a32(uint32_t fetchdat) break; default: -// fatal("Bad FF opcode %02X\n",rmdat&0x38); x86illegal(); } return cpu_state.abrt; diff --git a/src/x86_ops_i686.h b/src/x86_ops_i686.h index 0b6bec4de..b684e1195 100644 --- a/src/x86_ops_i686.h +++ b/src/x86_ops_i686.h @@ -150,7 +150,6 @@ static int opFXSAVESTOR_a16(uint32_t fetchdat) uint8_t fxinst = 0; uint16_t twd = x87_gettag(); uint16_t old_eaaddr = 0; - int old_ismmx = cpu_state.ismmx; uint8_t ftwb = 0; uint16_t rec_ftw = 0; uint16_t fpus = 0; @@ -172,9 +171,6 @@ static int opFXSAVESTOR_a16(uint32_t fetchdat) if ((fxinst > 1) || (cpu_mod == 3)) { - // if (fxinst > 1) pclog("FX instruction is: %02X\n", fxinst); - // if (cpu_mod == 3) pclog("MOD is 3\n"); - x86illegal(); return cpu_state.abrt; } @@ -186,8 +182,6 @@ static int opFXSAVESTOR_a16(uint32_t fetchdat) if (fxinst == 1) { /* FXRSTOR */ - // pclog("FXRSTOR issued\n"); - cpu_state.npxc = readmemw(easeg, cpu_state.eaaddr); fpus = readmemw(easeg, cpu_state.eaaddr + 2); cpu_state.npxc = (cpu_state.npxc & ~FPU_CW_Reserved_Bits) | 0x0040; @@ -251,10 +245,10 @@ static int opFXSAVESTOR_a16(uint32_t fetchdat) cpu_state.ismmx = 0; /*Horrible hack, but as PCem doesn't keep the FPU stack in 80-bit precision at all times something like this is needed*/ - if (cpu_state.MM[0].w[4] == 0xffff && cpu_state.MM[1].w[4] == 0xffff && cpu_state.MM[2].w[4] == 0xffff && cpu_state.MM[3].w[4] == 0xffff && - cpu_state.MM[4].w[4] == 0xffff && cpu_state.MM[5].w[4] == 0xffff && cpu_state.MM[6].w[4] == 0xffff && cpu_state.MM[7].w[4] == 0xffff && - !cpu_state.TOP && !(*(uint64_t *)cpu_state.tag)) - cpu_state.ismmx = old_ismmx; + if (cpu_state.MM_w4[0] == 0xffff && cpu_state.MM_w4[1] == 0xffff && cpu_state.MM_w4[2] == 0xffff && cpu_state.MM_w4[3] == 0xffff && + cpu_state.MM_w4[4] == 0xffff && cpu_state.MM_w4[5] == 0xffff && cpu_state.MM_w4[6] == 0xffff && cpu_state.MM_w4[7] == 0xffff && + !cpu_state.TOP && !(*(uint64_t *)cpu_state.tag)) + cpu_state.ismmx = 1; x87_settag(rec_ftw); @@ -265,8 +259,6 @@ static int opFXSAVESTOR_a16(uint32_t fetchdat) else { /* FXSAVE */ - // pclog("FXSAVE issued\n"); - if ((twd & 0x0003) == 0x0003) ftwb |= 0x01; if ((twd & 0x000C) == 0x000C) ftwb |= 0x02; if ((twd & 0x0030) == 0x0030) ftwb |= 0x04; @@ -333,7 +325,6 @@ static int opFXSAVESTOR_a32(uint32_t fetchdat) uint8_t fxinst = 0; uint16_t twd = x87_gettag(); uint32_t old_eaaddr = 0; - int old_ismmx = cpu_state.ismmx; uint8_t ftwb = 0; uint16_t rec_ftw = 0; uint16_t fpus = 0; @@ -355,9 +346,6 @@ static int opFXSAVESTOR_a32(uint32_t fetchdat) if ((fxinst > 1) || (cpu_mod == 3)) { - // if (fxinst > 1) pclog("FX instruction is: %02X\n", fxinst); - // if (cpu_mod == 3) pclog("MOD is 3\n"); - x86illegal(); return cpu_state.abrt; } @@ -369,8 +357,6 @@ static int opFXSAVESTOR_a32(uint32_t fetchdat) if (fxinst == 1) { /* FXRSTOR */ - // pclog("FXRSTOR issued\n"); - cpu_state.npxc = readmemw(easeg, cpu_state.eaaddr); fpus = readmemw(easeg, cpu_state.eaaddr + 2); cpu_state.npxc = (cpu_state.npxc & ~FPU_CW_Reserved_Bits) | 0x0040; @@ -434,10 +420,10 @@ static int opFXSAVESTOR_a32(uint32_t fetchdat) cpu_state.ismmx = 0; /*Horrible hack, but as PCem doesn't keep the FPU stack in 80-bit precision at all times something like this is needed*/ - if (cpu_state.MM[0].w[4] == 0xffff && cpu_state.MM[1].w[4] == 0xffff && cpu_state.MM[2].w[4] == 0xffff && cpu_state.MM[3].w[4] == 0xffff && - cpu_state.MM[4].w[4] == 0xffff && cpu_state.MM[5].w[4] == 0xffff && cpu_state.MM[6].w[4] == 0xffff && cpu_state.MM[7].w[4] == 0xffff && - !cpu_state.TOP && !(*(uint64_t *)cpu_state.tag)) - cpu_state.ismmx = old_ismmx; + if (cpu_state.MM_w4[0] == 0xffff && cpu_state.MM_w4[1] == 0xffff && cpu_state.MM_w4[2] == 0xffff && cpu_state.MM_w4[3] == 0xffff && + cpu_state.MM_w4[4] == 0xffff && cpu_state.MM_w4[5] == 0xffff && cpu_state.MM_w4[6] == 0xffff && cpu_state.MM_w4[7] == 0xffff && + !cpu_state.TOP && !(*(uint64_t *)cpu_state.tag)) + cpu_state.ismmx = 1; x87_settag(rec_ftw); @@ -448,8 +434,6 @@ static int opFXSAVESTOR_a32(uint32_t fetchdat) else { /* FXSAVE */ - // pclog("FXSAVE issued\n"); - if ((twd & 0x0003) == 0x0003) ftwb |= 0x01; if ((twd & 0x000C) == 0x000C) ftwb |= 0x02; if ((twd & 0x0030) == 0x0030) ftwb |= 0x04; diff --git a/src/x86_ops_int.h b/src/x86_ops_int.h index 139389160..dafb1dde5 100644 --- a/src/x86_ops_int.h +++ b/src/x86_ops_int.h @@ -12,6 +12,20 @@ static int opINT3(uint32_t fetchdat) return 1; } +static int opINT1(uint32_t fetchdat) +{ + int cycles_old = cycles; + if ((cr0 & 1) && (eflags & VM_FLAG) && (IOPL != 3)) + { + x86gpf(NULL,0); + return 1; + } + x86_int_sw(1); + CLOCK_CYCLES((is486) ? 44 : 59); + PREFETCH_RUN(cycles_old-cycles, 1, -1, 0,0,0,0, 0); + return 1; +} + static int opINT(uint32_t fetchdat) { int cycles_old = cycles; @@ -24,38 +38,6 @@ static int opINT(uint32_t fetchdat) return 1; } temp = getbytef(); -// /*if (temp == 0x10 && AH == 0xe) */pclog("INT %02X : %04X %04X %04X %04X %c %04X:%04X\n", temp, AX, BX, CX, DX, (AL < 32) ? ' ' : AL, CS, pc); -// if (CS == 0x0028 && pc == 0xC03813C0) -// output = 3; -/* if (pc == 0x8028009A) - output = 3; - if (pc == 0x80282B6F) - { - __times++; - if (__times == 2) - fatal("WRONG\n"); - } - if (pc == 0x802809CE) - fatal("RIGHT\n");*/ -// if (CS == 0x0028 && pc == 0x80037FE9) -// output = 3; -//if (CS == 0x9087 && pc == 0x3763) -// fatal("Here\n"); -//if (CS==0x9087 && pc == 0x0850) -// output = 1; - -/* if (output && pc == 0x80033008) - { - __times++; - if (__times == 2) - fatal("WRONG\n"); - }*/ -/* if (output && pc == 0x80D8) - { - __times++; - if (__times == 2) - fatal("RIGHT\n"); - }*/ x86_int_sw(temp); PREFETCH_RUN(cycles_old-cycles, 2, -1, 0,0,0,0, 0); diff --git a/src/x86_ops_io.h b/src/x86_ops_io.h index 8f190cea0..7d42299cc 100644 --- a/src/x86_ops_io.h +++ b/src/x86_ops_io.h @@ -103,7 +103,6 @@ static int opOUT_AL_DX(uint32_t fetchdat) } static int opOUT_AX_DX(uint32_t fetchdat) { - //pclog("OUT_AX_DX %04X %04X\n", DX, AX); check_io_perm(DX); check_io_perm(DX + 1); outw(DX, AX); diff --git a/src/x86_ops_jump.h b/src/x86_ops_jump.h index 93987633e..63ca65ea0 100644 --- a/src/x86_ops_jump.h +++ b/src/x86_ops_jump.h @@ -246,9 +246,11 @@ static int opJMP_r32(uint32_t fetchdat) static int opJMP_far_a16(uint32_t fetchdat) { - uint16_t addr = getwordf(); - uint16_t seg = getword(); if (cpu_state.abrt) return 1; - uint32_t oxpc = cpu_state.pc; + uint16_t addr, seg; + uint32_t oxpc; + addr = getwordf(); + seg = getword(); if (cpu_state.abrt) return 1; + oxpc = cpu_state.pc; cpu_state.pc = addr; loadcsjmp(seg, oxpc); CPU_BLOCK_END(); @@ -258,9 +260,11 @@ static int opJMP_far_a16(uint32_t fetchdat) } static int opJMP_far_a32(uint32_t fetchdat) { - uint32_t addr = getlong(); - uint16_t seg = getword(); if (cpu_state.abrt) return 1; - uint32_t oxpc = cpu_state.pc; + uint16_t seg; + uint32_t addr, oxpc; + addr = getlong(); + seg = getword(); if (cpu_state.abrt) return 1; + oxpc = cpu_state.pc; cpu_state.pc = addr; loadcsjmp(seg, oxpc); CPU_BLOCK_END(); @@ -321,8 +325,8 @@ static int opRET_l(uint32_t fetchdat) static int opRET_w_imm(uint32_t fetchdat) { - uint16_t offset = getwordf(); uint16_t ret; + uint16_t offset = getwordf(); ret = POP_W(); if (cpu_state.abrt) return 1; if (stack32) ESP += offset; @@ -337,8 +341,8 @@ static int opRET_w_imm(uint32_t fetchdat) } static int opRET_l_imm(uint32_t fetchdat) { - uint16_t offset = getwordf(); uint32_t ret; + uint16_t offset = getwordf(); ret = POP_L(); if (cpu_state.abrt) return 1; if (stack32) ESP += offset; diff --git a/src/x86_ops_misc.h b/src/x86_ops_misc.h index ddf727f32..a2b4f6f31 100644 --- a/src/x86_ops_misc.h +++ b/src/x86_ops_misc.h @@ -56,6 +56,7 @@ static int opF6_a16(uint32_t fetchdat) switch (rmdat & 0x38) { case 0x00: /*TEST b,#8*/ + case 0x08: src = readmemb(cs, cpu_state.pc); cpu_state.pc++; if (cpu_state.abrt) return 1; setznp8(src & dst); if (is486) CLOCK_CYCLES((cpu_mod == 3) ? 1 : 2); @@ -127,7 +128,6 @@ static int opF6_a16(uint32_t fetchdat) } else { -// pclog("IDIVb exception - %X / %08X = %X\n", tempws, dst, tempws2); x86_int(0); return 1; } @@ -153,6 +153,7 @@ static int opF6_a32(uint32_t fetchdat) switch (rmdat & 0x38) { case 0x00: /*TEST b,#8*/ + case 0x08: src = readmemb(cs, cpu_state.pc); cpu_state.pc++; if (cpu_state.abrt) return 1; setznp8(src & dst); if (is486) CLOCK_CYCLES((cpu_mod == 3) ? 1 : 2); @@ -224,7 +225,6 @@ static int opF6_a32(uint32_t fetchdat) } else { -// pclog("IDIVb exception - %X / %08X = %X\n", tempws, dst, tempws2); x86_int(0); return 1; } @@ -253,6 +253,7 @@ static int opF7_w_a16(uint32_t fetchdat) switch (rmdat & 0x38) { case 0x00: /*TEST w*/ + case 0x08: src = getword(); if (cpu_state.abrt) return 1; setznp16(src & dst); if (is486) CLOCK_CYCLES((cpu_mod == 3) ? 1 : 2); @@ -301,7 +302,6 @@ static int opF7_w_a16(uint32_t fetchdat) } else { -// fatal("DIVw BY 0 %04X:%04X %i\n",cs>>4,pc,ins); x86_int(0); return 1; } @@ -320,7 +320,6 @@ static int opF7_w_a16(uint32_t fetchdat) } else { -// pclog("IDIVw exception - %X / %08X = %X\n",tempws, dst, tempws2); x86_int(0); return 1; } @@ -346,6 +345,7 @@ static int opF7_w_a32(uint32_t fetchdat) switch (rmdat & 0x38) { case 0x00: /*TEST w*/ + case 0x08: src = getword(); if (cpu_state.abrt) return 1; setznp16(src & dst); if (is486) CLOCK_CYCLES((cpu_mod == 3) ? 1 : 2); @@ -394,7 +394,6 @@ static int opF7_w_a32(uint32_t fetchdat) } else { -// fatal("DIVw BY 0 %04X:%04X %i\n",cs>>4,pc,ins); x86_int(0); return 1; } @@ -413,7 +412,6 @@ static int opF7_w_a32(uint32_t fetchdat) } else { -// pclog("IDIVw exception - %X / %08X = %X\n", tempws, dst, tempws2); x86_int(0); return 1; } @@ -439,6 +437,7 @@ static int opF7_l_a16(uint32_t fetchdat) switch (rmdat & 0x38) { case 0x00: /*TEST l*/ + case 0x08: src = getlong(); if (cpu_state.abrt) return 1; setznp32(src & dst); if (is486) CLOCK_CYCLES((cpu_mod == 3) ? 1 : 2); @@ -508,6 +507,7 @@ static int opF7_l_a32(uint32_t fetchdat) switch (rmdat & 0x38) { case 0x00: /*TEST l*/ + case 0x08: src = getlong(); if (cpu_state.abrt) return 1; setznp32(src & dst); if (is486) CLOCK_CYCLES((cpu_mod == 3) ? 1 : 2); @@ -721,13 +721,19 @@ static int opWBINVD(uint32_t fetchdat) return 0; } - - static int opLOADALL(uint32_t fetchdat) { + if (CPL && (cr0&1)) + { + x86gpf(NULL,0); + return 1; + } + msw = (msw & 1) | readmemw(0, 0x806); flags = (readmemw(0, 0x818) & 0xffd5) | 2; flags_extract(); + tr.seg = readmemw(0, 0x816); cpu_state.pc = readmemw(0, 0x81A); + ldt.seg = readmemw(0, 0x81C); DS = readmemw(0, 0x81E); SS = readmemw(0, 0x820); CS = readmemw(0, 0x822); @@ -741,14 +747,33 @@ static int opLOADALL(uint32_t fetchdat) CX = readmemw(0, 0x832); AX = readmemw(0, 0x834); es = readmemw(0, 0x836) | (readmemb(0, 0x838) << 16); + _es.access = readmemb(0, 0x839); + _es.limit = readmemw(0, 0x83A); cs = readmemw(0, 0x83C) | (readmemb(0, 0x83E) << 16); + _cs.access = readmemb(0, 0x83F); + _cs.limit = readmemw(0, 0x840); ss = readmemw(0, 0x842) | (readmemb(0, 0x844) << 16); + _ss.access = readmemb(0, 0x845); + _ss.limit = readmemw(0, 0x846); ds = readmemw(0, 0x848) | (readmemb(0, 0x84A) << 16); + _ds.access = readmemb(0, 0x84B); + _ds.limit = readmemw(0, 0x84C); + gdt.base = readmemw(0, 0x84E) | (readmemb(0, 0x850) << 16); + gdt.limit = readmemw(0, 0x852); + ldt.base = readmemw(0, 0x854) | (readmemb(0, 0x856) << 16); + ldt.access = readmemb(0, 0x857); + ldt.limit = readmemw(0, 0x858); + idt.base = readmemw(0, 0x85A) | (readmemb(0, 0x85C) << 16); + idt.limit = readmemw(0, 0x85E); + tr.base = readmemw(0, 0x860) | (readmemb(0, 0x862) << 16); + tr.access = readmemb(0, 0x863); + tr.limit = readmemw(0, 0x864); CLOCK_CYCLES(195); + PREFETCH_RUN(195, 1, -1, 51,0,0,0, 0); return 0; } -static int set_segment_limit(x86seg *s, uint8_t segdat3) +static void set_segment_limit(x86seg *s, uint8_t segdat3) { if ((s->access & 0x18) != 0x10 || !(s->access & (1 << 2))) /*expand-down*/ { @@ -762,7 +787,7 @@ static int set_segment_limit(x86seg *s, uint8_t segdat3) } } -static int loadall_load_segment(uint32_t addr, x86seg *s) +static void loadall_load_segment(uint32_t addr, x86seg *s) { uint32_t attrib = readmeml(0, addr); uint32_t segdat3 = (attrib >> 16) & 0xff; diff --git a/src/x86_ops_mov.h b/src/x86_ops_mov.h index a9ba431c2..bf82c3d66 100644 --- a/src/x86_ops_mov.h +++ b/src/x86_ops_mov.h @@ -181,6 +181,7 @@ static int opMOV_b_imm_a16(uint32_t fetchdat) { uint8_t temp; fetch_ea_16(fetchdat); + ILLEGAL_ON((rmdat & 0x38) != 0); temp = readmemb(cs,cpu_state.pc); cpu_state.pc++; if (cpu_state.abrt) return 1; CHECK_WRITE(cpu_state.ea_seg, cpu_state.eaaddr, cpu_state.eaaddr); seteab(temp); @@ -192,6 +193,7 @@ static int opMOV_b_imm_a32(uint32_t fetchdat) { uint8_t temp; fetch_ea_32(fetchdat); + ILLEGAL_ON((rmdat & 0x38) != 0); temp = getbyte(); if (cpu_state.abrt) return 1; seteab(temp); CLOCK_CYCLES(timing_rr); @@ -203,6 +205,7 @@ static int opMOV_w_imm_a16(uint32_t fetchdat) { uint16_t temp; fetch_ea_16(fetchdat); + ILLEGAL_ON((rmdat & 0x38) != 0); temp = getword(); if (cpu_state.abrt) return 1; seteaw(temp); CLOCK_CYCLES(timing_rr); @@ -213,6 +216,7 @@ static int opMOV_w_imm_a32(uint32_t fetchdat) { uint16_t temp; fetch_ea_32(fetchdat); + ILLEGAL_ON((rmdat & 0x38) != 0); temp = getword(); if (cpu_state.abrt) return 1; seteaw(temp); CLOCK_CYCLES(timing_rr); @@ -223,6 +227,7 @@ static int opMOV_l_imm_a16(uint32_t fetchdat) { uint32_t temp; fetch_ea_16(fetchdat); + ILLEGAL_ON((rmdat & 0x38) != 0); temp = getlong(); if (cpu_state.abrt) return 1; seteal(temp); CLOCK_CYCLES(timing_rr); @@ -233,6 +238,7 @@ static int opMOV_l_imm_a32(uint32_t fetchdat) { uint32_t temp; fetch_ea_32(fetchdat); + ILLEGAL_ON((rmdat & 0x38) != 0); temp = getlong(); if (cpu_state.abrt) return 1; seteal(temp); CLOCK_CYCLES(timing_rr); @@ -243,8 +249,9 @@ static int opMOV_l_imm_a32(uint32_t fetchdat) static int opMOV_AL_a16(uint32_t fetchdat) { + uint8_t temp; uint16_t addr = getwordf(); - uint8_t temp = readmemb(cpu_state.ea_seg->base, addr); if (cpu_state.abrt) return 1; + temp = readmemb(cpu_state.ea_seg->base, addr); if (cpu_state.abrt) return 1; AL = temp; CLOCK_CYCLES((is486) ? 1 : 4); PREFETCH_RUN(4, 3, -1, 1,0,0,0, 0); @@ -252,8 +259,9 @@ static int opMOV_AL_a16(uint32_t fetchdat) } static int opMOV_AL_a32(uint32_t fetchdat) { + uint8_t temp; uint32_t addr = getlong(); - uint8_t temp = readmemb(cpu_state.ea_seg->base, addr); if (cpu_state.abrt) return 1; + temp = readmemb(cpu_state.ea_seg->base, addr); if (cpu_state.abrt) return 1; AL = temp; CLOCK_CYCLES((is486) ? 1 : 4); PREFETCH_RUN(4, 5, -1, 1,0,0,0, 1); @@ -261,8 +269,9 @@ static int opMOV_AL_a32(uint32_t fetchdat) } static int opMOV_AX_a16(uint32_t fetchdat) { + uint16_t temp; uint16_t addr = getwordf(); - uint16_t temp = readmemw(cpu_state.ea_seg->base, addr); if (cpu_state.abrt) return 1; + temp = readmemw(cpu_state.ea_seg->base, addr); if (cpu_state.abrt) return 1; AX = temp; CLOCK_CYCLES((is486) ? 1 : 4); PREFETCH_RUN(4, 3, -1, 1,0,0,0, 0); @@ -270,8 +279,9 @@ static int opMOV_AX_a16(uint32_t fetchdat) } static int opMOV_AX_a32(uint32_t fetchdat) { + uint16_t temp; uint32_t addr = getlong(); - uint16_t temp = readmemw(cpu_state.ea_seg->base, addr); if (cpu_state.abrt) return 1; + temp = readmemw(cpu_state.ea_seg->base, addr); if (cpu_state.abrt) return 1; AX = temp; CLOCK_CYCLES((is486) ? 1 : 4); PREFETCH_RUN(4, 5, -1, 1,0,0,0, 1); @@ -279,8 +289,9 @@ static int opMOV_AX_a32(uint32_t fetchdat) } static int opMOV_EAX_a16(uint32_t fetchdat) { + uint32_t temp; uint16_t addr = getwordf(); - uint32_t temp = readmeml(cpu_state.ea_seg->base, addr); if (cpu_state.abrt) return 1; + temp = readmeml(cpu_state.ea_seg->base, addr); if (cpu_state.abrt) return 1; EAX = temp; CLOCK_CYCLES((is486) ? 1 : 4); PREFETCH_RUN(4, 3, -1, 0,1,0,0, 0); @@ -288,8 +299,9 @@ static int opMOV_EAX_a16(uint32_t fetchdat) } static int opMOV_EAX_a32(uint32_t fetchdat) { + uint32_t temp; uint32_t addr = getlong(); - uint32_t temp = readmeml(cpu_state.ea_seg->base, addr); if (cpu_state.abrt) return 1; + temp = readmeml(cpu_state.ea_seg->base, addr); if (cpu_state.abrt) return 1; EAX = temp; CLOCK_CYCLES((is486) ? 1 : 4); PREFETCH_RUN(4, 5, -1, 0,1,0,0, 1); @@ -349,7 +361,7 @@ static int opMOV_a32_EAX(uint32_t fetchdat) static int opLEA_w_a16(uint32_t fetchdat) { fetch_ea_16(fetchdat); - // ILLEGAL_ON(cpu_mod == 3); + /* ILLEGAL_ON(cpu_mod == 3); */ cpu_state.regs[cpu_reg].w = (cpu_mod == 3) ? (cpu_state.last_ea & 0xffff) : cpu_state.eaaddr; CLOCK_CYCLES(timing_rr); PREFETCH_RUN(timing_rr, 2, rmdat, 0,0,0,0, 0); @@ -358,7 +370,7 @@ static int opLEA_w_a16(uint32_t fetchdat) static int opLEA_w_a32(uint32_t fetchdat) { fetch_ea_32(fetchdat); - // ILLEGAL_ON(cpu_mod == 3); + /* ILLEGAL_ON(cpu_mod == 3); */ cpu_state.regs[cpu_reg].w = (cpu_mod == 3) ? (cpu_state.last_ea & 0xffff) : cpu_state.eaaddr; CLOCK_CYCLES(timing_rr); PREFETCH_RUN(timing_rr, 2, rmdat, 0,0,0,0, 1); @@ -368,7 +380,7 @@ static int opLEA_w_a32(uint32_t fetchdat) static int opLEA_l_a16(uint32_t fetchdat) { fetch_ea_16(fetchdat); - // ILLEGAL_ON(cpu_mod == 3); + /* ILLEGAL_ON(cpu_mod == 3); */ cpu_state.regs[cpu_reg].l = ((cpu_mod == 3) ? cpu_state.last_ea : cpu_state.eaaddr) & 0xffff; CLOCK_CYCLES(timing_rr); PREFETCH_RUN(timing_rr, 2, rmdat, 0,0,0,0, 0); @@ -377,7 +389,7 @@ static int opLEA_l_a16(uint32_t fetchdat) static int opLEA_l_a32(uint32_t fetchdat) { fetch_ea_32(fetchdat); - // ILLEGAL_ON(cpu_mod == 3); + /* ILLEGAL_ON(cpu_mod == 3); */ cpu_state.regs[cpu_reg].l = (cpu_mod == 3) ? cpu_state.last_ea : cpu_state.eaaddr; CLOCK_CYCLES(timing_rr); PREFETCH_RUN(timing_rr, 2, rmdat, 0,0,0,0, 1); diff --git a/src/x86_ops_pmode.h b/src/x86_ops_pmode.h index 1f30fbfa7..85f028dbd 100644 --- a/src/x86_ops_pmode.h +++ b/src/x86_ops_pmode.h @@ -4,7 +4,7 @@ static int opARPL_a16(uint32_t fetchdat) NOTRM fetch_ea_16(fetchdat); - pclog("ARPL_a16\n"); + /* pclog("ARPL_a16\n"); */ temp_seg = geteaw(); if (cpu_state.abrt) return 1; flags_rebuild(); @@ -27,7 +27,7 @@ static int opARPL_a32(uint32_t fetchdat) NOTRM fetch_ea_32(fetchdat); - pclog("ARPL_a32\n"); + /* pclog("ARPL_a32\n"); */ temp_seg = geteaw(); if (cpu_state.abrt) return 1; flags_rebuild(); @@ -49,7 +49,7 @@ static int opARPL_a32(uint32_t fetchdat) static int opLAR_ ## name(uint32_t fetchdat) \ { \ int valid; \ - uint16_t sel, desc; \ + uint16_t sel, desc = 0; \ \ NOTRM \ fetch_ea(fetchdat); \ @@ -99,7 +99,7 @@ opLAR(l_a32, fetch_ea_32, 1, 1) static int opLSL_ ## name(uint32_t fetchdat) \ { \ int valid; \ - uint16_t sel, desc; \ + uint16_t sel, desc = 0; \ \ NOTRM \ fetch_ea(fetchdat); \ @@ -159,7 +159,7 @@ static int op0F00_common(uint32_t fetchdat, int ea32) uint16_t desc, sel; uint8_t access; -// pclog("op0F00 %02X %04X:%04X\n", rmdat & 0x38, CS, pc); + /* pclog("op0F00 %02X %04X:%04X\n", rmdat & 0x38, CS, pc); */ switch (rmdat & 0x38) { case 0x00: /*SLDT*/ @@ -293,12 +293,12 @@ static int op0F01_common(uint32_t fetchdat, int is32, int is286, int ea32) { uint32_t base; uint16_t limit, tempw; -// pclog("op0F01 %02X %04X:%04X\n", rmdat & 0x38, CS, pc); + /* pclog("op0F01 %02X %04X:%04X\n", rmdat & 0x38, CS, pc); */ switch (rmdat & 0x38) { case 0x00: /*SGDT*/ seteaw(gdt.limit); - base = gdt.base; //is32 ? gdt.base : (gdt.base & 0xffffff); + base = gdt.base; /* is32 ? gdt.base : (gdt.base & 0xffffff); */ if (is286) base |= 0xff000000; writememl(easeg, cpu_state.eaaddr + 2, base); @@ -321,10 +321,10 @@ static int op0F01_common(uint32_t fetchdat, int is32, int is286, int ea32) x86gpf(NULL,0); break; } -// pclog("LGDT %08X:%08X\n", easeg, eaaddr); + /* pclog("LGDT %08X:%08X\n", easeg, eaaddr); */ limit = geteaw(); base = readmeml(0, easeg + cpu_state.eaaddr + 2); if (cpu_state.abrt) return 1; -// pclog(" %08X %04X\n", base, limit); + /* pclog(" %08X %04X\n", base, limit); */ gdt.limit = limit; gdt.base = base; if (!is32) gdt.base &= 0xffffff; @@ -338,10 +338,10 @@ static int op0F01_common(uint32_t fetchdat, int is32, int is286, int ea32) x86gpf(NULL,0); break; } -// pclog("LIDT %08X:%08X\n", easeg, eaaddr); + /* pclog("LIDT %08X:%08X\n", easeg, eaaddr); */ limit = geteaw(); base = readmeml(0, easeg + cpu_state.eaaddr + 2); if (cpu_state.abrt) return 1; -// pclog(" %08X %04X\n", base, limit); + /* pclog(" %08X %04X\n", base, limit); */ idt.limit = limit; idt.base = base; if (!is32) idt.base &= 0xffffff; @@ -350,8 +350,9 @@ static int op0F01_common(uint32_t fetchdat, int is32, int is286, int ea32) break; case 0x20: /*SMSW*/ - if (is486) seteaw(msw); - else seteaw(msw | 0xFF00); + if (is486) seteaw(msw); + else if (is386) seteaw(msw | 0xFF00); + else seteaw(msw | 0xFFF0); CLOCK_CYCLES(2); PREFETCH_RUN(2, 2, rmdat, 0,0,(cpu_mod == 3) ? 0:1,0, ea32); break; @@ -364,6 +365,7 @@ static int op0F01_common(uint32_t fetchdat, int is32, int is286, int ea32) } tempw = geteaw(); if (cpu_state.abrt) return 1; if (msw & 1) tempw |= 1; + if (!is386) tempw &= 0xF; msw = tempw; PREFETCH_RUN(2, 2, rmdat, 0,0,(cpu_mod == 3) ? 0:1,0, ea32); break; diff --git a/src/x86_ops_shift.h b/src/x86_ops_shift.h index 495a1bf47..0c5a31f06 100644 --- a/src/x86_ops_shift.h +++ b/src/x86_ops_shift.h @@ -497,9 +497,11 @@ static int opD3_l_a32(uint32_t fetchdat) #define SHLD_w() \ if (count) \ { \ + int tempc; \ + uint32_t templ; \ uint16_t tempw = geteaw(); if (cpu_state.abrt) return 1; \ - int tempc = ((tempw << (count - 1)) & (1 << 15)) ? 1 : 0; \ - uint32_t templ = (tempw << 16) | cpu_state.regs[cpu_reg].w; \ + tempc = ((tempw << (count - 1)) & (1 << 15)) ? 1 : 0; \ + templ = (tempw << 16) | cpu_state.regs[cpu_reg].w; \ if (count <= 16) tempw = templ >> (16 - count); \ else tempw = (templ << count) >> 16; \ seteaw(tempw); if (cpu_state.abrt) return 1; \ @@ -511,8 +513,9 @@ static int opD3_l_a32(uint32_t fetchdat) #define SHLD_l() \ if (count) \ { \ + int tempc; \ uint32_t templ = geteal(); if (cpu_state.abrt) return 1; \ - int tempc = ((templ << (count - 1)) & (1 << 31)) ? 1 : 0; \ + tempc = ((templ << (count - 1)) & (1 << 31)) ? 1 : 0; \ templ = (templ << count) | (cpu_state.regs[cpu_reg].l >> (32 - count)); \ seteal(templ); if (cpu_state.abrt) return 1; \ setznp32(templ); \ @@ -523,10 +526,12 @@ static int opD3_l_a32(uint32_t fetchdat) #define SHRD_w() \ if (count) \ - { \ + { \ + int tempc; \ + uint32_t templ; \ uint16_t tempw = geteaw(); if (cpu_state.abrt) return 1; \ - int tempc = (tempw >> (count - 1)) & 1; \ - uint32_t templ = tempw | (cpu_state.regs[cpu_reg].w << 16); \ + tempc = (tempw >> (count - 1)) & 1; \ + templ = tempw | (cpu_state.regs[cpu_reg].w << 16); \ tempw = templ >> count; \ seteaw(tempw); if (cpu_state.abrt) return 1; \ setznp16(tempw); \ @@ -537,8 +542,9 @@ static int opD3_l_a32(uint32_t fetchdat) #define SHRD_l() \ if (count) \ { \ + int tempc; \ uint32_t templ = geteal(); if (cpu_state.abrt) return 1; \ - int tempc = (templ >> (count - 1)) & 1; \ + tempc = (templ >> (count - 1)) & 1; \ templ = (templ >> count) | (cpu_state.regs[cpu_reg].l << (32 - count)); \ seteal(templ); if (cpu_state.abrt) return 1; \ setznp32(templ); \ @@ -553,7 +559,7 @@ static int opD3_l_a32(uint32_t fetchdat) \ fetch_ea_16(fetchdat); \ count = getbyte() & 31; \ - operation(); \ + operation() \ \ CLOCK_CYCLES(3); \ PREFETCH_RUN(3, 3, rmdat, 0,(cpu_mod == 3) ? 0:1,0,(cpu_mod == 3) ? 0:1, 0); \ @@ -565,7 +571,7 @@ static int opD3_l_a32(uint32_t fetchdat) \ fetch_ea_16(fetchdat); \ count = CL & 31; \ - operation(); \ + operation() \ \ CLOCK_CYCLES(3); \ PREFETCH_RUN(3, 3, rmdat, 0,(cpu_mod == 3) ? 0:1,0,(cpu_mod == 3) ? 0:1, 0); \ @@ -577,7 +583,7 @@ static int opD3_l_a32(uint32_t fetchdat) \ fetch_ea_32(fetchdat); \ count = getbyte() & 31; \ - operation(); \ + operation() \ \ CLOCK_CYCLES(3); \ PREFETCH_RUN(3, 3, rmdat, 0,(cpu_mod == 3) ? 0:1,0,(cpu_mod == 3) ? 0:1, 1); \ @@ -589,7 +595,7 @@ static int opD3_l_a32(uint32_t fetchdat) \ fetch_ea_32(fetchdat); \ count = CL & 31; \ - operation(); \ + operation() \ \ CLOCK_CYCLES(3); \ PREFETCH_RUN(3, 3, rmdat, 0,(cpu_mod == 3) ? 0:1,0,(cpu_mod == 3) ? 0:1, 1); \ diff --git a/src/x86_ops_stack.h b/src/x86_ops_stack.h index 86daf52aa..621f602b3 100644 --- a/src/x86_ops_stack.h +++ b/src/x86_ops_stack.h @@ -310,10 +310,16 @@ static int opPOPL_a32(uint32_t fetchdat) static int opENTER_w(uint32_t fetchdat) { - uint16_t offset = getwordf(); - int count = (fetchdat >> 16) & 0xff; cpu_state.pc++; - uint32_t tempEBP = EBP, tempESP = ESP, frame_ptr; + uint16_t offset; + int count; + uint32_t tempEBP, tempESP, frame_ptr; int reads = 0, writes = 1, instr_cycles = 0; + uint16_t tempw; + + offset = getwordf(); + count = (fetchdat >> 16) & 0xff; cpu_state.pc++; + tempEBP = EBP; + tempESP = ESP; PUSH_W(BP); if (cpu_state.abrt) return 1; frame_ptr = ESP; @@ -322,8 +328,6 @@ static int opENTER_w(uint32_t fetchdat) { while (--count) { - uint16_t tempw; - BP -= 2; tempw = readmemw(ss, BP); if (cpu_state.abrt) { ESP = tempESP; EBP = tempEBP; return 1; } @@ -348,10 +352,15 @@ static int opENTER_w(uint32_t fetchdat) } static int opENTER_l(uint32_t fetchdat) { - uint16_t offset = getwordf(); - int count = (fetchdat >> 16) & 0xff; cpu_state.pc++; - uint32_t tempEBP = EBP, tempESP = ESP, frame_ptr; + uint16_t offset; + int count; + uint32_t tempEBP, tempESP, frame_ptr; int reads = 0, writes = 1, instr_cycles = 0; + uint32_t templ; + + offset = getwordf(); + count = (fetchdat >> 16) & 0xff; cpu_state.pc++; + tempEBP = EBP; tempESP = ESP; PUSH_L(EBP); if (cpu_state.abrt) return 1; frame_ptr = ESP; @@ -360,8 +369,6 @@ static int opENTER_l(uint32_t fetchdat) { while (--count) { - uint32_t templ; - EBP -= 4; templ = readmeml(ss, EBP); if (cpu_state.abrt) { ESP = tempESP; EBP = tempEBP; return 1; } @@ -455,17 +462,17 @@ static int opLEAVE_l(uint32_t fetchdat) } -PUSH_SEG_OPS(CS); -PUSH_SEG_OPS(DS); -PUSH_SEG_OPS(ES); -PUSH_SEG_OPS(FS); -PUSH_SEG_OPS(GS); -PUSH_SEG_OPS(SS); +PUSH_SEG_OPS(CS) +PUSH_SEG_OPS(DS) +PUSH_SEG_OPS(ES) +PUSH_SEG_OPS(FS) +PUSH_SEG_OPS(GS) +PUSH_SEG_OPS(SS) -POP_SEG_OPS(DS, &_ds); -POP_SEG_OPS(ES, &_es); -POP_SEG_OPS(FS, &_fs); -POP_SEG_OPS(GS, &_gs); +POP_SEG_OPS(DS, &_ds) +POP_SEG_OPS(ES, &_es) +POP_SEG_OPS(FS, &_fs) +POP_SEG_OPS(GS, &_gs) static int opPOP_SS_w(uint32_t fetchdat) diff --git a/src/x86seg.c b/src/x86seg.c index e19775b24..1042712ae 100644 --- a/src/x86seg.c +++ b/src/x86seg.c @@ -1,14 +1,17 @@ /* Copyright holders: Sarah Walker, SA1988 see COPYING for more details */ -//#if 0 #include #include #include #include "ibm.h" #include "mem.h" +#include "nvr.h" #include "x86.h" #include "386.h" +#include "386_common.h" +#undef readmemb +#define readmemb(a) ((readlookup2[(a)>>12]==-1)?readmembl(a):*(uint8_t *)(readlookup2[(a) >> 12] + (a))) #include "cpu.h" /*Controls whether the accessed bit in a descriptor is set when CS is loaded.*/ @@ -73,19 +76,9 @@ void x86seg_reset() void x86_doabrt(int x86_abrt) { -// ingpf = 1; CS = oldcs; cpu_state.pc = cpu_state.oldpc; _cs.access = (oldcpl << 5) | 0x80; -// pclog("x86_doabrt - %02X %08X %04X:%08X %i\n", x86_abrt, abrt_error, CS, pc, ins); - -/* if (CS == 0x3433 && cpu_state.pc == 0x000006B0) - { - // pclog("Quit it\n"); - dumpregs(); - exit(-1); - }*/ -// pclog("GPF! - error %04X %04X(%08X):%08X %02X %02X %i %04X %i %i\n",error,CS,cs,cpu_state.pc,opcode,opcode2,ins,flags&I_FLAG,IOPL, dtimes); if (msw & 1) pmodeint(x86_abrt, 0); @@ -143,30 +136,24 @@ void x86_doabrt(int x86_abrt) SP-=4; } } -// ingpf = 0; -// cpu_state.abrt = gpf = 1; } void x86gpf(char *s, uint16_t error) { - // pclog("GPF %04X : %s\n", error, s); cpu_state.abrt = ABRT_GPF; abrt_error = error; } void x86ss(char *s, uint16_t error) { - // pclog("SS %04X\n", error); cpu_state.abrt = ABRT_SS; abrt_error = error; } void x86ts(char *s, uint16_t error) { - // pclog("TS %04X\n", error); cpu_state.abrt = ABRT_TS; abrt_error = error; } void x86np(char *s, uint16_t error) { - // pclog("NP %04X : %s\n", error, s); cpu_state.abrt = ABRT_NP; abrt_error = error; } @@ -192,7 +179,6 @@ void do_seg_load(x86seg *s, uint16_t *segdat) s->limit_high = (segdat[3] & 0x40) ? 0xffffffff : 0xffff; s->limit_low = s->limit + 1; } -// if (output) pclog("SEG : base=%08x limit=%08x low=%08x high=%08x\n", s->base, s->limit, s->limit_low, s->limit_high); } static void do_seg_v86_init(x86seg *s) @@ -212,7 +198,6 @@ static void check_seg_valid(x86seg *s) { if ((s->seg & ~7) >= ldt.limit) { -// pclog("Bigger than LDT limit %04X %04X %02X %02X %02X\n", s->seg, ldt.limit, opcode, opcode2, rmdat); valid = 0; } } @@ -220,7 +205,6 @@ static void check_seg_valid(x86seg *s) { if ((s->seg & ~7) >= gdt.limit) { -// pclog("Bigger than GDT limit %04X %04X\n", s->seg, gdt.limit); valid = 0; } } @@ -232,7 +216,6 @@ static void check_seg_valid(x86seg *s) case 0x1A: case 0x1B: /*Readable non-conforming code*/ if ((s->seg & 3) > dpl || (CPL) > dpl) { -// pclog("Data seg fail - %04X:%08X %04X %i\n", CS, cpu_state.pc, s->seg, dpl); valid = 0; break; } @@ -258,36 +241,23 @@ void loadseg(uint16_t seg, x86seg *s) if (msw&1 && !(eflags&VM_FLAG)) { -// intcount++; if (!(seg&~3)) { if (s==&_ss) { - // pclog("SS selector = NULL!\n"); x86ss(NULL,0); return; -// dumpregs(); -// exit(-1); } -// if (s->base!=-1) pclog("NEW! "); s->seg=0; - // s->access = 0; s->access = 0x80; s->base=-1; -// pclog("NULL selector %s%s%s%s %04X(%06X):%06X\n",(s==&_ds)?"DS":"",(s==&_es)?"ES":"",(s==&_fs)?"FS":"",(s==&_gs)?"GS":"",CS,cs,cpu_state.pc); return; } -// if (s==&_ss) pclog("Load SS %04X\n",seg); -// pclog("Protected mode seg load!\n"); addr=seg&~7; if (seg&4) { if (addr>=ldt.limit) { - // pclog("Bigger than LDT limit %04X %04X %02X %02X %02X\n",seg,ldt.limit, opcode, opcode2, rmdat); -// dumppic(); -// dumpregs(); -// exit(-1); x86gpf("loadseg(): Bigger than LDT limit",seg&~3); return; } @@ -297,9 +267,6 @@ void loadseg(uint16_t seg, x86seg *s) { if (addr>=gdt.limit) { - // pclog("Bigger than GDT limit %04X %04X 1\n",seg,gdt.limit); -// dumpregs(); -// exit(-1); x86gpf("loadseg(): Bigger than GDT limit",seg&~3); return; } @@ -315,15 +282,12 @@ void loadseg(uint16_t seg, x86seg *s) { if (!(seg&~3)) { - // pclog("Load SS null selector\n"); x86gpf(NULL,seg&~3); return; } if ((seg&3)!=CPL || dpl!=CPL) { - // pclog("Invalid SS permiss\n"); x86gpf(NULL,seg&~3); -// x86abort("Invalid SS permiss for %04X!\n",seg&0xFFFC); return; } switch ((segdat[2]>>8)&0x1F) @@ -331,19 +295,15 @@ void loadseg(uint16_t seg, x86seg *s) case 0x12: case 0x13: case 0x16: case 0x17: /*r/w*/ break; default: - // pclog("Invalid SS type\n"); x86gpf(NULL,seg&~3); -// x86abort("Invalid SS segment type for %04X!\n",seg&0xFFFC); return; } if (!(segdat[2]&0x8000)) { - // pclog("Load SS not present!\n"); x86ss(NULL,seg&~3); return; } stack32 = (segdat[3] & 0x40) ? 1 : 0; -// pclog("Load SS %04x %04x %04x %04x\n", segdat[0], segdat[1], segdat[2], segdat[3]); } else if (s!=&_cs) { @@ -354,19 +314,15 @@ void loadseg(uint16_t seg, x86seg *s) case 0x10: case 0x11: case 0x12: case 0x13: /*Data segments*/ case 0x14: case 0x15: case 0x16: case 0x17: case 0x1A: case 0x1B: /*Readable non-conforming code*/ -// pclog("Load seg %04X %i %i %04X:%08X\n",seg,dpl,CS&3,CS,cpu_state.pc); if ((seg&3)>dpl || (CPL)>dpl) { - // pclog("Data seg fail - %04X:%08X %04X %i %04X\n",CS,cpu_state.pc,seg,dpl,segdat[2]); x86gpf(NULL,seg&~3); -// x86abort("Data segment load - level too low!\n",seg&0xFFFC); return; } break; case 0x1E: case 0x1F: /*Readable conforming code*/ break; default: - // pclog("Invalid segment type for %04X! %04X\n",seg&0xFFFC,segdat[2]); x86gpf(NULL,seg&~3); return; } @@ -416,24 +372,16 @@ void loadcs(uint16_t seg) if (output) pclog("Load CS %04X\n",seg); if (msw&1 && !(eflags&VM_FLAG)) { -// intcount++; -// flushmmucache(); -// pclog("Load CS %04X\n",seg); if (!(seg&~3)) { - // pclog("Trying to load CS with NULL selector! lcs\n"); -// dumpregs(); -// exit(-1); x86gpf(NULL,0); return; } -// pclog("Protected mode CS load! %04X\n",seg); addr=seg&~7; if (seg&4) { if (addr>=ldt.limit) { - // pclog("Bigger than LDT limit %04X %04X CS\n",seg,ldt.limit); x86gpf(NULL,seg&~3); return; } @@ -443,7 +391,6 @@ void loadcs(uint16_t seg) { if (addr>=gdt.limit) { - // pclog("Bigger than GDT limit %04X %04X CS\n",seg,gdt.limit); x86gpf(NULL,seg&~3); return; } @@ -454,9 +401,6 @@ void loadcs(uint16_t seg) segdat[1]=readmemw(0,addr+2); segdat[2]=readmemw(0,addr+4); segdat[3]=readmemw(0,addr+6); cpl_override=0; if (cpu_state.abrt) return; - // if (optype==JMP) pclog("Code seg - %04X - %04X %04X %04X %04X\n",seg,segdat[0],segdat[1],segdat[2],segdat[3]); -// if (!(segdat[2]&0x8000)) x86abort("Code segment not present!\n"); -// if (output) pclog("Segdat2 %04X\n",segdat[2]); if (segdat[2]&0x1000) /*Normal code segment*/ { if (!(segdat[2]&0x400)) /*Not conforming*/ @@ -464,7 +408,6 @@ void loadcs(uint16_t seg) if ((seg&3)>CPL) { x86gpf(NULL,seg&~3); - // pclog("loadcs RPL > CPL %04X %04X %i %02X\n",segdat[2],seg,CPL,opcode); return; } if (CPL != DPL) @@ -495,8 +438,6 @@ void loadcs(uint16_t seg) writememw(0, addr+4, segdat[2] | 0x100); /*Set accessed bit*/ cpl_override = 0; #endif -// if (output) pclog("Load CS %08X\n",_cs.base); -// CS=(CS&0xFFFC)|((_cs.access>>5)&3); } else /*System segment*/ { @@ -508,14 +449,10 @@ void loadcs(uint16_t seg) switch (segdat[2]&0xF00) { default: - // pclog("Bad CS %02X %02X %i special descriptor %03X %04X\n",opcode,rmdat,optype,segdat[2]&0xF00,seg); x86gpf(NULL,seg&~3); return; } } -// pclog("CS = %04X base=%06X limit=%04X access=%02X %04X\n",CS,cs,_cs.limit,_cs.access,addr); -// dumpregs(); -// exit(-1); } else { @@ -534,26 +471,20 @@ void loadcsjmp(uint16_t seg, uint32_t oxpc) { uint16_t segdat[4]; uint32_t addr; - int count; uint16_t type,seg2; uint32_t newpc; -// pclog("Load CS JMP %04X\n",seg); if (msw&1 && !(eflags&VM_FLAG)) { if (!(seg&~3)) { - // pclog("Trying to load CS with NULL selector! lcsjmp\n"); x86gpf(NULL,0); return; -// dumpregs(); -// exit(-1); } addr=seg&~7; if (seg&4) { if (addr>=ldt.limit) { - // pclog("Bigger than LDT limit %04X %04X CS\n",seg,ldt.limit); x86gpf(NULL,seg&~3); return; } @@ -563,7 +494,6 @@ void loadcsjmp(uint16_t seg, uint32_t oxpc) { if (addr>=gdt.limit) { - // pclog("Bigger than GDT limit %04X %04X CS\n",seg,gdt.limit); x86gpf(NULL,seg&~3); return; } @@ -577,7 +507,6 @@ void loadcsjmp(uint16_t seg, uint32_t oxpc) if (output) pclog("%04X %04X %04X %04X\n",segdat[0],segdat[1],segdat[2],segdat[3]); if (segdat[2]&0x1000) /*Normal code segment*/ { -// pclog("Normal CS\n"); if (!(segdat[2]&0x400)) /*Not conforming*/ { if ((seg&3)>CPL) @@ -620,10 +549,8 @@ void loadcsjmp(uint16_t seg, uint32_t oxpc) } else /*System segment*/ { -// pclog("System CS\n"); if (!(segdat[2]&0x8000)) { - // x86np("Load CS JMP system selector not present\n", seg & 0xfffc); return; } type=segdat[2]&0xF00; @@ -633,12 +560,10 @@ void loadcsjmp(uint16_t seg, uint32_t oxpc) { case 0x400: /*Call gate*/ case 0xC00: -// pclog("Call gate\n"); cgate32=(type&0x800); cgate16=!cgate32; oldcs=CS; cpu_state.oldpc=cpu_state.pc; - count=segdat[2]&31; #if 0 if ((DPL < CPL) || (DPL < (seg&3))) { @@ -665,18 +590,14 @@ void loadcsjmp(uint16_t seg, uint32_t oxpc) if (!(seg2&~3)) { - // pclog("Trying to load CS with NULL selector! lcsjmpcg\n"); x86gpf(NULL,0); return; -// dumpregs(); -// exit(-1); } addr=seg2&~7; if (seg2&4) { if (addr>=ldt.limit) { - // pclog("Bigger than LDT limit %04X %04X CSJ\n",seg2,gdt.limit); x86gpf(NULL,seg2&~3); return; } @@ -686,7 +607,6 @@ void loadcsjmp(uint16_t seg, uint32_t oxpc) { if (addr>=gdt.limit) { - // pclog("Bigger than GDT limit %04X %04X CSJ\n",seg2,gdt.limit); x86gpf(NULL,seg2&~3); return; } @@ -715,7 +635,6 @@ void loadcsjmp(uint16_t seg, uint32_t oxpc) case 0x1800: case 0x1900: case 0x1A00: case 0x1B00: /*Non-conforming code*/ if (DPL > CPL) { - // pclog("Call gate DPL > CPL"); x86gpf(NULL,seg2&~3); return; } @@ -734,7 +653,6 @@ void loadcsjmp(uint16_t seg, uint32_t oxpc) break; default: - // pclog("JMP Call gate bad segment type\n"); x86gpf(NULL,seg2&~3); return; } @@ -743,28 +661,18 @@ void loadcsjmp(uint16_t seg, uint32_t oxpc) case 0x900: /*386 Task gate*/ -// pclog("Task gate\n"); cpu_state.pc=oxpc; cpl_override=1; taskswitch286(seg,segdat,segdat[2]&0x800); flags &= ~NT_FLAG; cpl_override=0; -// case 0xB00: /*386 Busy task gate*/ -// if (optype==JMP) pclog("Task switch!\n"); -// taskswitch386(seg,segdat); return; default: - // pclog("Bad JMP CS %02X %02X %i special descriptor %03X %04X\n",opcode,rmdat,optype,segdat[2]&0xF00,seg); x86gpf(NULL,0); return; -// dumpregs(); -// exit(-1); } } -// pclog("CS = %04X base=%06X limit=%04X access=%02X %04X\n",CS,cs,_cs.limit,_cs.access,addr); -// dumpregs(); -// exit(-1); } else { @@ -782,7 +690,6 @@ void loadcsjmp(uint16_t seg, uint32_t oxpc) void PUSHW(uint16_t v) { -// if (output==3) pclog("PUSHW %04X to %08X\n",v,ESP-4); if (stack32) { writememw(ss,ESP-2,v); @@ -791,7 +698,6 @@ void PUSHW(uint16_t v) } else { -// pclog("Write %04X to %08X\n", v, ss+((SP-2)&0xFFFF)); writememw(ss,((SP-2)&0xFFFF),v); if (cpu_state.abrt) return; SP-=2; @@ -799,7 +705,6 @@ void PUSHW(uint16_t v) } void PUSHL(uint32_t v) { -// if (output==3) pclog("PUSHL %08X to %08X\n",v,ESP-4); if (stack32) { writememl(ss,ESP-4,v); @@ -855,8 +760,7 @@ void loadcscall(uint16_t seg) uint32_t addr,oldssbase=ss, oaddr; uint32_t newpc; int count; - uint16_t oldcs=CPL; - uint32_t oldss,oldsp,newsp,oldpc, oldsp2; + uint32_t oldss,oldsp,newsp, oldsp2; int type; uint16_t tempw; @@ -864,22 +768,17 @@ void loadcscall(uint16_t seg) if (msw&1 && !(eflags&VM_FLAG)) { - //flushmmucache(); if (csout) pclog("Protected mode CS load! %04X\n",seg); if (!(seg&~3)) { - // pclog("Trying to load CS with NULL selector! lcscall\n"); x86gpf(NULL,0); return; -// dumpregs(); -// exit(-1); } addr=seg&~7; if (seg&4) { if (addr>=ldt.limit) { - // pclog("Bigger than LDT limit %04X %04X CSC\n",seg,gdt.limit); x86gpf(NULL,seg&~3); return; } @@ -889,7 +788,6 @@ void loadcscall(uint16_t seg) { if (addr>=gdt.limit) { - // pclog("Bigger than GDT limit %04X %04X CSC\n",seg,gdt.limit); x86gpf(NULL,seg&~3); return; } @@ -911,26 +809,22 @@ void loadcscall(uint16_t seg) { if ((seg&3)>CPL) { - /* if (csout) */ // pclog("Not conforming, RPL > CPL\n"); x86gpf("loadcscall(): segment > CPL",seg&~3); return; } if (CPL != DPL) { - /* if (csout) */ // pclog("Not conforming, CPL != DPL (%i %i)\n",CPL,DPL); x86gpf(NULL,seg&~3); return; } } if (CPL < DPL) { - /* if (csout) */ // pclog("CPL < DPL\n"); x86gpf(NULL,seg&~3); return; } if (!(segdat[2]&0x8000)) { - /* if (csout) */ // pclog("Not present\n"); x86np("Load CS call not present", seg & 0xfffc); return; } @@ -970,15 +864,7 @@ void loadcscall(uint16_t seg) cgate32=(type&0x800); cgate16=!cgate32; oldcs=CS; - oldpc=cpu_state.pc; count=segdat[2]&31; -#if 0 - if ((DPL < CPL) || (DPL < (seg&3))) - { - x86gpf("",seg&~3); - return; - } -#endif if ((DPL < CPL)) { x86gpf("loadcscall(): ex DPL < CPL",seg&~3); @@ -1001,18 +887,14 @@ void loadcscall(uint16_t seg) if (!(seg2&~3)) { - // pclog("Trying to load CS with NULL selector! lcscallcg\n"); x86gpf(NULL,0); return; -// dumpregs(); -// exit(-1); } addr=seg2&~7; if (seg2&4) { if (addr>=ldt.limit) { - // pclog("Bigger than LDT limit %04X %04X CSC\n",seg2,gdt.limit); x86gpf(NULL,seg2&~3); return; } @@ -1022,7 +904,6 @@ void loadcscall(uint16_t seg) { if (addr>=gdt.limit) { - // pclog("Bigger than GDT limit %04X %04X CSC\n",seg2,gdt.limit); x86gpf(NULL,seg2&~3); return; } @@ -1076,7 +957,6 @@ void loadcscall(uint16_t seg) if (output) pclog("New stack %04X:%08X\n",newss,newsp); if (!(newss&~3)) { - // pclog("Call gate loading null SS\n"); x86ts(NULL,newss&~3); return; } @@ -1110,21 +990,16 @@ void loadcscall(uint16_t seg) if (output) pclog("Read stack seg done!\n"); if (((newss & 3) != DPL) || (DPL2 != DPL)) { - // pclog("Call gate loading SS with wrong permissions %04X %04X %i %i %04X %04X\n", newss, seg2, DPL, DPL2, segdat[2], segdat2[2]); -// dumpregs(); -// exit(-1); x86ts(NULL,newss&~3); return; } if ((segdat2[2]&0x1A00)!=0x1200) { - // pclog("Call gate loading SS wrong type\n"); x86ts(NULL,newss&~3); return; } if (!(segdat2[2]&0x8000)) { - // pclog("Call gate loading SS not present\n"); x86np("Call gate loading SS not present\n", newss & 0xfffc); return; } @@ -1165,12 +1040,10 @@ void loadcscall(uint16_t seg) PUSHL(oldsp2); if (cpu_state.abrt) { - // pclog("ABRT PUSHL\n"); SS = oldss; ESP = oldsp2; return; } -// if (output) pclog("Stack now %04X:%08X\n",SS,ESP); if (count) { while (count) @@ -1179,16 +1052,12 @@ void loadcscall(uint16_t seg) PUSHL(readmeml(oldssbase,oldsp+(count*4))); if (cpu_state.abrt) { - // pclog("ABRT COPYL\n"); SS = oldss; ESP = oldsp2; return; } } } -// x86abort("Call gate with count %i\n",count); -// PUSHL(oldcs); -// PUSHL(oldpc); if (cpu_state.abrt) return; } else { @@ -1198,14 +1067,11 @@ void loadcscall(uint16_t seg) PUSHW(oldsp2); if (cpu_state.abrt) { - // pclog("ABRT PUSHW\n"); SS = oldss; ESP = oldsp2; return; } if (output) pclog("Write SP to %04X:%04X\n",SS,SP); -// if (output) pclog("Stack %04X %i %04X:%04X\n",SP,count,oldssbase,oldsp); -// if (output) pclog("PUSH %04X %04X %i %i now %04X:%08X\n",oldss,oldsp,count,stack32,SS,ESP); if (count) { while (count) @@ -1216,38 +1082,22 @@ void loadcscall(uint16_t seg) PUSHW(tempw); if (cpu_state.abrt) { - // pclog("ABRT COPYW\n"); SS = oldss; ESP = oldsp2; return; } } } -// if (output) pclog("Stack %04X\n",SP); -// if (count) x86abort("Call gate with count\n"); -// PUSHW(oldcs); -// PUSHW(oldpc); if (cpu_state.abrt) return; } cycles -= timing_call_pm_gate_inner; break; } else if (DPL > CPL) { - // pclog("Call gate DPL > CPL"); x86gpf(NULL,seg2&~3); return; } case 0x1C00: case 0x1D00: case 0x1E00: case 0x1F00: /*Conforming*/ -/* if (type==0xC00) - { - PUSHL(oldcs); - PUSHL(oldpc); if (cpu_state.abrt) return; - } - else - { - PUSHW(oldcs); - PUSHW(oldpc); if (cpu_state.abrt) return; - }*/ CS=seg2; do_seg_load(&_cs, segdat); if (CPL==3 && oldcpl!=3) flushmmucache_cr3(); @@ -1263,30 +1113,16 @@ void loadcscall(uint16_t seg) break; default: - // pclog("Call gate bad segment type\n"); x86gpf(NULL,seg2&~3); return; } break; -// case 0x900: /*386 Task gate*/ -// case 0xB00: /*386 Busy task gate*/ -// if (optype==JMP) pclog("Task switch!\n"); -// taskswitch386(seg,segdat); -// return; - - default: - // pclog("Bad CALL special descriptor %03X\n",segdat[2]&0xF00); x86gpf(NULL,seg&~3); return; -// dumpregs(); -// exit(-1); } } -// pclog("CS = %04X base=%06X limit=%04X access=%02X %04X\n",CS,cs,_cs.limit,_cs.access,addr); -// dumpregs(); -// exit(-1); } else { @@ -1324,20 +1160,12 @@ void pmoderetf(int is32, uint16_t off) if (output) pclog("Return to %04X:%08X\n",seg,newpc); if ((seg&3)=ldt.limit) { - // pclog("Bigger than LDT limit %04X %04X RETF\n",seg,ldt.limit); x86gpf(NULL,seg&~3); return; } @@ -1356,10 +1183,7 @@ void pmoderetf(int is32, uint16_t off) { if (addr>=gdt.limit) { - // pclog("Bigger than GDT limit %04X %04X RETF\n",seg,gdt.limit); x86gpf(NULL,seg&~3); -// dumpregs(); -// exit(-1); return; } addr+=gdt.base; @@ -1384,7 +1208,6 @@ void pmoderetf(int is32, uint16_t off) case 0x1800: case 0x1900: case 0x1A00: case 0x1B00: /*Non-conforming*/ if (CPL != DPL) { - // pclog("RETF non-conforming CPL != DPL\n"); ESP=oldsp; x86gpf(NULL,seg&~3); return; @@ -1393,20 +1216,17 @@ void pmoderetf(int is32, uint16_t off) case 0x1C00: case 0x1D00: case 0x1E00: case 0x1F00: /*Conforming*/ if (CPL < DPL) { - // pclog("RETF non-conforming CPL < DPL\n"); ESP=oldsp; x86gpf(NULL,seg&~3); return; } break; default: - // pclog("RETF CS not code segment\n"); x86gpf(NULL,seg&~3); return; } if (!(segdat[2]&0x8000)) { - // pclog("RETF CS not present %i %04X %04X %04X\n",ins, segdat[0], segdat[1], segdat[2]); ESP=oldsp; x86np("RETF CS not present\n", seg & 0xfffc); return; @@ -1427,7 +1247,6 @@ void pmoderetf(int is32, uint16_t off) if (CPL==3 && oldcpl!=3) flushmmucache_cr3(); use32=(segdat[3]&0x40)?0x300:0; -// pclog("CPL=RPL return to %04X:%08X\n",CS,cpu_state.pc); cycles -= timing_retf_pm; } else @@ -1437,7 +1256,6 @@ void pmoderetf(int is32, uint16_t off) case 0x1800: case 0x1900: case 0x1A00: case 0x1B00: /*Non-conforming*/ if ((seg&3) != DPL) { - // pclog("RETF non-conforming RPL != DPL\n"); ESP=oldsp; x86gpf(NULL,seg&~3); return; @@ -1447,7 +1265,6 @@ void pmoderetf(int is32, uint16_t off) case 0x1C00: case 0x1D00: case 0x1E00: case 0x1F00: /*Conforming*/ if ((seg&3) < DPL) { - // pclog("RETF non-conforming RPL < DPL\n"); ESP=oldsp; x86gpf(NULL,seg&~3); return; @@ -1455,15 +1272,12 @@ void pmoderetf(int is32, uint16_t off) if (output) pclog("RETF conforming, %i %i\n",seg&3, DPL); break; default: - // pclog("RETF CS not code segment\n"); ESP=oldsp; x86gpf(NULL,seg&~3); return; } if (!(segdat[2]&0x8000)) { - // pclog("RETF CS not present! %i %04X %04X %04X\n",ins, segdat[0], segdat[1], segdat[2]); - ESP=oldsp; x86np("RETF CS not present\n", seg & 0xfffc); return; @@ -1472,7 +1286,6 @@ void pmoderetf(int is32, uint16_t off) { newsp=POPL(); newss=POPL(); if (cpu_state.abrt) return; -// pclog("is32 new stack %04X:%04X\n",newss,newsp); } else { @@ -1480,12 +1293,10 @@ void pmoderetf(int is32, uint16_t off) newsp=POPW(); if (output) pclog("SS read from %04X:%04X\n",SS,SP); newss=POPW(); if (cpu_state.abrt) return; -// pclog("!is32 new stack %04X:%04X\n",newss,newsp); } if (output) pclog("Read new stack : %04X:%04X (%08X)\n", newss, newsp, ldt.base); if (!(newss&~3)) { - // pclog("RETF loading null SS\n"); ESP=oldsp; x86gpf(NULL,newss&~3); return; @@ -1495,7 +1306,6 @@ void pmoderetf(int is32, uint16_t off) { if (addr>=ldt.limit) { - // pclog("Bigger than LDT limit %04X %04X RETF SS\n",newss,gdt.limit); ESP=oldsp; x86gpf(NULL,newss&~3); return; @@ -1506,7 +1316,6 @@ void pmoderetf(int is32, uint16_t off) { if (addr>=gdt.limit) { - // pclog("Bigger than GDT limit %04X %04X RETF SS\n",newss,gdt.limit); ESP=oldsp; x86gpf(NULL,newss&~3); return; @@ -1519,36 +1328,26 @@ void pmoderetf(int is32, uint16_t off) segdat2[2]=readmemw(0,addr+4); segdat2[3]=readmemw(0,addr+6); cpl_override=0; if (cpu_state.abrt) { ESP=oldsp; return; } if (output) pclog("Segment data %04X %04X %04X %04X\n", segdat2[0], segdat2[1], segdat2[2], segdat2[3]); -// if (((newss & 3) != DPL) || (DPL2 != DPL)) if ((newss & 3) != (seg & 3)) { - // pclog("RETF loading SS with wrong permissions %i %i %04X %04X\n", newss & 3, seg & 3, newss, seg); ESP=oldsp; -// output = 3; -// dumpregs(); -// exit(-1); x86gpf(NULL,newss&~3); return; } if ((segdat2[2]&0x1A00)!=0x1200) { - // pclog("RETF loading SS wrong type\n"); ESP=oldsp; -// dumpregs(); -// exit(-1); x86gpf(NULL,newss&~3); return; } if (!(segdat2[2]&0x8000)) { - // pclog("RETF loading SS not present\n"); ESP=oldsp; x86np("RETF loading SS not present\n", newss & 0xfffc); return; } if (DPL2 != (seg & 3)) { - // pclog("RETF loading SS with wrong permissions2 %i %i %04X %04X\n", DPL2, seg & 3, newss, seg); ESP=oldsp; x86gpf(NULL,newss&~3); return; @@ -1585,7 +1384,6 @@ void pmoderetf(int is32, uint16_t off) check_seg_valid(&_es); check_seg_valid(&_fs); check_seg_valid(&_gs); -// pclog("CPL=idt.limit) @@ -1624,19 +1416,15 @@ void pmodeint(int num, int soft) if (num==8) { /*Triple fault - reset!*/ - // pclog("Triple fault!\n"); -// output=1; softresetx86(); cpu_set_edx(); } else if (num==0xD) { - // pclog("Double fault!\n"); pmodeint(8,0); } else { - // pclog("INT out of range\n"); x86gpf(NULL,(num*8)+2+((soft)?0:1)); } if (output) pclog("addr >= IDT.limit\n"); @@ -1653,39 +1441,32 @@ void pmodeint(int num, int soft) if (output) pclog("Addr %08X seg %04X %04X %04X %04X\n",addr,segdat[0],segdat[1],segdat[2],segdat[3]); if (!(segdat[2]&0x1F00)) { - // pclog("No seg\n"); x86gpf(NULL,(num*8)+2); return; } if (DPL=0x800)?32:16; -// if (output) pclog("Int gate %04X %i oldpc %04X pc %04X\n",type,intgatesize,oldpc,cpu_state.pc); if (!(segdat[2]&0x8000)) { - // pclog("Int gate not present\n"); x86np("Int gate not present\n", (num << 3) | 2); return; } seg=segdat[1]; new_cpl = seg & 3; -// pclog("Interrupt gate : %04X:%04X%04X\n",seg,segdat[3],segdat[0]); addr=seg&~7; if (seg&4) { if (addr>=ldt.limit) { - // pclog("Bigger than LDT limit %04X %04X INT\n",seg,gdt.limit); x86gpf(NULL,seg&~3); return; } @@ -1695,18 +1476,11 @@ void pmodeint(int num, int soft) { if (addr>=gdt.limit) { - // pclog("Bigger than GDT limit %04X %04X INT %i\n",seg,gdt.limit,ins); x86gpf(NULL,seg&~3); return; } addr+=gdt.base; } -/* if ((seg&3) < CPL) - { - // pclog("INT to higher level\n"); - x86gpf(NULL,seg&~3); - return; - }*/ cpl_override=1; segdat2[0]=readmemw(0,addr); segdat2[1]=readmemw(0,addr+2); @@ -1716,26 +1490,21 @@ void pmodeint(int num, int soft) if (DPL2 > CPL) { - // pclog("INT to higher level 2\n"); x86gpf(NULL,seg&~3); return; } - //pclog("Type %04X\n",segdat2[2]); switch (segdat2[2]&0x1F00) { case 0x1800: case 0x1900: case 0x1A00: case 0x1B00: /*Non-conforming*/ if (DPL2=ldt.limit) { - // pclog("Bigger than LDT limit %04X %04X PMODEINT SS\n",newss,gdt.limit); x86ss(NULL,newss&~3); return; } @@ -1777,7 +1544,6 @@ void pmodeint(int num, int soft) { if (addr>=gdt.limit) { - // pclog("Bigger than GDT limit %04X %04X CSC\n",newss,gdt.limit); x86ss(NULL,newss&~3); return; } @@ -1790,19 +1556,16 @@ void pmodeint(int num, int soft) segdat3[3]=readmemw(0,addr+6); cpl_override=0; if (cpu_state.abrt) return; if (((newss & 3) != DPL2) || (DPL3 != DPL2)) { - // pclog("Int gate loading SS with wrong permissions\n"); x86ss(NULL,newss&~3); return; } if ((segdat3[2]&0x1A00)!=0x1200) { - // pclog("Int gate loading SS wrong type\n"); x86ss(NULL,newss&~3); return; } if (!(segdat3[2]&0x8000)) { - // pclog("Int gate loading SS not present\n"); x86np("Int gate loading SS not present\n", newss & 0xfffc); return; } @@ -1822,7 +1585,6 @@ void pmodeint(int num, int soft) cpl_override=1; if (type>=0x800) { -// if (output) pclog("Push 32 %i\n",eflags&VM_FLAG); if (eflags & VM_FLAG) { PUSHL(GS); @@ -1837,82 +1599,63 @@ void pmodeint(int num, int soft) PUSHL(oldss); PUSHL(oldsp); PUSHL(flags|(eflags<<16)); -// if (soft) pclog("Pushl CS %08X\n", CS); PUSHL(CS); -// if (soft) pclog("Pushl PC %08X\n", cpu_state.pc); PUSHL(cpu_state.pc); if (cpu_state.abrt) return; -// if (output) pclog("32Stack %04X:%08X\n",SS,ESP); } else { -// if (output) pclog("Push 16\n"); PUSHW(oldss); PUSHW(oldsp); PUSHW(flags); -// if (soft) pclog("Pushw CS %04X\n", CS); PUSHW(CS); -// if (soft) pclog("Pushw pc %04X\n", cpu_state.pc); PUSHW(cpu_state.pc); if (cpu_state.abrt) return; -// if (output) pclog("16Stack %04X:%08X\n",SS,ESP); } cpl_override=0; _cs.access=0 | 0x80; cycles -= timing_int_pm_outer - timing_int_pm; -// pclog("Non-confirming int gate, CS = %04X\n"); break; } else if (DPL2!=CPL) { - // pclog("Non-conforming int gate DPL != CPL\n"); x86gpf(NULL,seg&~3); return; } case 0x1C00: case 0x1D00: case 0x1E00: case 0x1F00: /*Conforming*/ if (!(segdat2[2]&0x8000)) { - // pclog("Int gate CS not present\n"); x86np("Int gate CS not present\n", segdat[1] & 0xfffc); return; } if ((eflags & VM_FLAG) && DPL20x800) { PUSHL(flags|(eflags<<16)); -// if (soft) pclog("Pushlc CS %08X\n", CS); PUSHL(CS); -// if (soft) pclog("Pushlc PC %08X\n", cpu_state.pc); PUSHL(cpu_state.pc); if (cpu_state.abrt) return; } else { PUSHW(flags); -// if (soft) pclog("Pushwc CS %04X\n", CS); PUSHW(CS); -// if (soft) pclog("Pushwc PC %04X\n", cpu_state.pc); PUSHW(cpu_state.pc); if (cpu_state.abrt) return; } new_cpl = CS & 3; break; default: - // pclog("Int gate CS not code segment - %04X %04X %04X %04X\n",segdat2[0],segdat2[1],segdat2[2],segdat2[3]); x86gpf(NULL,seg&~3); return; } do_seg_load(&_cs, segdat2); CS = (seg & ~3) | new_cpl; _cs.access = (_cs.access & ~(3 << 5)) | (new_cpl << 5); -// pclog("New CS = %04X\n",CS); if (CPL==3 && oldcpl!=3) flushmmucache_cr3(); if (type>0x800) cpu_state.pc=segdat[0]|(segdat[3]<<16); else cpu_state.pc=segdat[0]; use32=(segdat2[3]&0x40)?0x300:0; -// pclog("Int gate done!\n"); #ifdef CS_ACCESSED cpl_override = 1; @@ -1924,22 +1667,18 @@ void pmodeint(int num, int soft) if (!(type&0x100)) { flags&=~I_FLAG; -// pclog("INT %02X disabling interrupts %i\n",num,soft); } flags&=~(T_FLAG|NT_FLAG); -// if (output) pclog("Final Stack %04X:%08X\n",SS,ESP); cycles -= timing_int_pm; break; case 0x500: /*Task gate*/ -// pclog("Task gate\n"); seg=segdat[1]; addr=seg&~7; if (seg&4) { if (addr>=ldt.limit) { - // pclog("Bigger than LDT limit %04X %04X INT\n",seg,gdt.limit); x86gpf(NULL,seg&~3); return; } @@ -1949,7 +1688,6 @@ void pmodeint(int num, int soft) { if (addr>=gdt.limit) { - // pclog("Bigger than GDT limit %04X %04X INT %i\n",seg,gdt.limit,ins); x86gpf(NULL,seg&~3); return; } @@ -1963,7 +1701,6 @@ void pmodeint(int num, int soft) cpl_override=0; if (cpu_state.abrt) return; if (!(segdat2[2]&0x8000)) { - // pclog("Int task gate not present\n"); x86np("Int task gate not present\n", segdat[1] & 0xfffc); return; } @@ -1974,7 +1711,6 @@ void pmodeint(int num, int soft) break; default: - // pclog("Bad int gate type %04X %04X %04X %04X %04X\n",segdat[2]&0x1F00,segdat[0],segdat[1],segdat[2],segdat[3]); x86gpf(NULL,seg&~3); return; } @@ -1993,10 +1729,8 @@ void pmodeiret(int is32) uint32_t oldsp=ESP; if (is386 && (eflags&VM_FLAG)) { -// if (output) pclog("V86 IRET\n"); if (IOPL!=3) { - // pclog("V86 IRET! IOPL!=3\n"); x86gpf(NULL,0); return; } @@ -2025,13 +1759,8 @@ void pmodeiret(int is32) return; } -// pclog("IRET %i\n",is32); - //flushmmucache(); -// if (output) pclog("Pmode IRET %04X:%04X ",CS,cpu_state.pc); - if (flags&NT_FLAG) { -// pclog("NT IRET\n"); seg=readmemw(tr.base,0); addr=seg&~7; if (seg&4) @@ -2044,7 +1773,6 @@ void pmodeiret(int is32) { if (addr>=gdt.limit) { - // pclog("TS Bigger than GDT limit %04X %04X IRET\n",seg,gdt.limit); x86ts(NULL,seg&~3); return; } @@ -2063,25 +1791,19 @@ void pmodeiret(int is32) flagmask=0xFFFF; if (CPL) flagmask&=~0x3000; if (IOPL>16)&VM_FLAG)) { -// pclog("IRETD to V86\n"); - newsp=POPL(); newss=POPL(); segs[0]=POPL(); segs[1]=POPL(); segs[2]=POPL(); segs[3]=POPL(); if (cpu_state.abrt) { ESP = oldsp; return; } -// pclog("Pop stack %04X:%04X\n",newss,newsp); eflags=tempflags>>16; loadseg(segs[0],&_es); do_seg_v86_init(&_es); @@ -2092,9 +1814,6 @@ void pmodeiret(int is32) loadseg(segs[3],&_gs); do_seg_v86_init(&_gs); -// pclog("V86 IRET %04X:%08X\n",SS,ESP); -// output=3; - cpu_state.pc=newpc; _cs.base=seg<<4; _cs.limit=0xFFFF; @@ -2110,12 +1829,6 @@ void pmodeiret(int is32) use32=0; flags=(tempflags&0xFFD5)|2; cycles -= timing_iret_v86; -// pclog("V86 IRET to %04X:%04X %04X:%04X %04X %04X %04X %04X %i\n",CS,cpu_state.pc,SS,SP,DS,ES,FS,GS,cpu_state.abrt); - // if (CS==0xFFFF && pc==0xFFFFFFFF) timetolive=12; -/* { - dumpregs(); - exit(-1); - }*/ return; } } @@ -2125,25 +1838,18 @@ void pmodeiret(int is32) seg=POPW(); tempflags=POPW(); if (cpu_state.abrt) { ESP = oldsp; return; } } -// if (!is386) tempflags&=0xFFF; -// pclog("Returned to %04X:%08X %04X %04X %i\n",seg,newpc,flags,tempflags, ins); if (!(seg&~3)) { - // pclog("IRET CS=0\n"); ESP = oldsp; -// dumpregs(); -// exit(-1); x86gpf(NULL,0); return; } -// if (output) pclog("IRET %04X:%08X\n",seg,newpc); addr=seg&~7; if (seg&4) { if (addr>=ldt.limit) { - // pclog("Bigger than LDT limit %04X %04X IRET\n",seg,gdt.limit); ESP = oldsp; x86gpf(NULL,seg&~3); return; @@ -2154,7 +1860,6 @@ void pmodeiret(int is32) { if (addr>=gdt.limit) { - // pclog("Bigger than GDT limit %04X %04X IRET\n",seg,gdt.limit); ESP = oldsp; x86gpf(NULL,seg&~3); return; @@ -2163,7 +1868,6 @@ void pmodeiret(int is32) } if ((seg&3) < CPL) { - // pclog("IRET to lower level\n"); ESP = oldsp; x86gpf(NULL,seg&~3); return; @@ -2173,17 +1877,13 @@ void pmodeiret(int is32) segdat[1]=readmemw(0,addr+2); segdat[2]=readmemw(0,addr+4); segdat[3]=readmemw(0,addr+6); cpl_override=0; if (cpu_state.abrt) { ESP = oldsp; return; } -// pclog("Seg type %04X %04X\n",segdat[2]&0x1F00,segdat[2]); switch (segdat[2]&0x1F00) { case 0x1800: case 0x1900: case 0x1A00: case 0x1B00: /*Non-conforming code*/ if ((seg&3) != DPL) { - // pclog("IRET NC DPL %04X %04X %04X %04X %04X\n", seg, segdat[0], segdat[1], segdat[2], segdat[3]); ESP = oldsp; -// dumpregs(); -// exit(-1); x86gpf(NULL,seg&~3); return; } @@ -2191,31 +1891,24 @@ void pmodeiret(int is32) case 0x1C00: case 0x1D00: case 0x1E00: case 0x1F00: /*Conforming code*/ if ((seg&3) < DPL) { - // pclog("IRET C DPL\n"); ESP = oldsp; x86gpf(NULL,seg&~3); return; } break; default: - // pclog("IRET CS != code seg\n"); ESP = oldsp; x86gpf(NULL,seg&~3); -// dumpregs(); -// exit(-1); return; } if (!(segdat[2]&0x8000)) { - // pclog("IRET CS not present %i %04X %04X %04X\n",ins, segdat[0], segdat[1], segdat[2]); ESP = oldsp; x86np("IRET CS not present\n", seg & 0xfffc); return; } -// pclog("Seg %04X CPL %04X\n",seg,CPL); if ((seg&3) == CPL) { -// pclog("Same level\n"); CS=seg; do_seg_load(&_cs, segdat); _cs.access = (_cs.access & ~(3 << 5)) | ((CS & 3) << 5); @@ -2248,7 +1941,6 @@ void pmodeiret(int is32) if (!(newss&~3)) { - // pclog("IRET loading null SS\n"); ESP = oldsp; x86gpf(NULL,newss&~3); return; @@ -2258,7 +1950,6 @@ void pmodeiret(int is32) { if (addr>=ldt.limit) { - // pclog("Bigger than LDT limit %04X %04X PMODEIRET SS\n",newss,gdt.limit); ESP = oldsp; x86gpf(NULL,newss&~3); return; @@ -2269,7 +1960,6 @@ void pmodeiret(int is32) { if (addr>=gdt.limit) { - // pclog("Bigger than GDT limit %04X %04X PMODEIRET\n",newss,gdt.limit); ESP = oldsp; x86gpf(NULL,newss&~3); return; @@ -2281,34 +1971,26 @@ void pmodeiret(int is32) segdat2[1]=readmemw(0,addr+2); segdat2[2]=readmemw(0,addr+4); segdat2[3]=readmemw(0,addr+6); cpl_override=0; if (cpu_state.abrt) { ESP = oldsp; return; } -// pclog("IRET SS sd2 %04X\n",segdat2[2]); -// if (((newss & 3) != DPL) || (DPL2 != DPL)) if ((newss & 3) != (seg & 3)) { - // pclog("IRET loading SS with wrong permissions %04X %04X\n", newss, seg); ESP = oldsp; -// dumpregs(); -// exit(-1); x86gpf(NULL,newss&~3); return; } if ((segdat2[2]&0x1A00)!=0x1200) { - // pclog("IRET loading SS wrong type\n"); ESP = oldsp; x86gpf(NULL,newss&~3); return; } if (DPL2 != (seg & 3)) { - // pclog("IRET loading SS with wrong permissions2 %i %i %04X %04X\n", DPL2, seg & 3, newss, seg); ESP = oldsp; x86gpf(NULL,newss&~3); return; } if (!(segdat2[2]&0x8000)) { - // pclog("IRET loading SS not present\n"); ESP = oldsp; x86np("IRET loading SS not present\n", newss & 0xfffc); return; @@ -2347,7 +2029,6 @@ void pmodeiret(int is32) cpu_state.pc=newpc; flags=(flags&~flagmask)|(tempflags&flagmask&0xFFD5)|2; if (is32) eflags=tempflags>>16; -// pclog("done\n"); } void taskswitch286(uint16_t seg, uint16_t *segdat, int is32) @@ -2367,17 +2048,11 @@ void taskswitch286(uint16_t seg, uint16_t *segdat, int is32) uint16_t segdat2[4]; -//output=3; base=segdat[1]|((segdat[2]&0xFF)<<16)|((segdat[3]>>8)<<24); limit=segdat[0]|((segdat[3]&0xF)<<16); -// pclog("286 Task switch! %04X:%04X\n",CS,cpu_state.pc); -/// pclog("TSS %04X base %08X limit %04X old TSS %04X %08X %i\n",seg,base,limit,tr.seg,tr.base,ins); -// / pclog("%04X %04X %04X %04X\n",segdat[0],segdat[1],segdat[2],segdat[3]); if (is386) { -// if (output) pclog("32-bit TSS\n"); - new_cr3=readmeml(base,0x1C); new_pc=readmeml(base,0x20); new_flags=readmeml(base,0x24); @@ -2392,7 +2067,6 @@ void taskswitch286(uint16_t seg, uint16_t *segdat, int is32) new_edi=readmeml(base,0x44); new_es=readmemw(base,0x48); -// if (output) pclog("Read CS from %08X\n",base+0x4C); new_cs=readmemw(base,0x4C); new_ss=readmemw(base,0x50); new_ds=readmemw(base,0x54); @@ -2413,7 +2087,6 @@ void taskswitch286(uint16_t seg, uint16_t *segdat, int is32) if (optype==IRET) flags&=~NT_FLAG; -// if (output) pclog("Write PC %08X %08X\n",tr.base,cpu_state.pc); cpu_386_flags_rebuild(); writememl(tr.base,0x1C,cr3); writememl(tr.base,0x20,cpu_state.pc); @@ -2429,7 +2102,6 @@ void taskswitch286(uint16_t seg, uint16_t *segdat, int is32) writememl(tr.base,0x44,EDI); writememl(tr.base,0x48,ES); -// if (output) pclog("Write CS %04X to %08X\n",CS,tr.base+0x4C); writememl(tr.base,0x4C,CS); writememl(tr.base,0x50,SS); writememl(tr.base,0x54,DS); @@ -2456,21 +2128,15 @@ void taskswitch286(uint16_t seg, uint16_t *segdat, int is32) cr3=new_cr3; -// pclog("TS New CR3 %08X\n",cr3); flushmmucache(); - - - + cpu_state.pc=new_pc; -// if (output) pclog("New pc %08X\n",new_pc); flags=new_flags; eflags=new_flags>>16; cpu_386_flags_extract(); -// if (output) pclog("Load LDT %04X\n",new_ldt); ldt.seg=new_ldt; templ=(ldt.seg&~7)+gdt.base; -// if (output) pclog("Load from %08X %08X\n",templ,gdt.base); ldt.limit=readmemw(0,templ); if (readmemb(templ+6)&0x80) { @@ -2478,19 +2144,15 @@ void taskswitch286(uint16_t seg, uint16_t *segdat, int is32) ldt.limit|=0xFFF; } ldt.base=(readmemw(0,templ+2))|(readmemb(templ+4)<<16)|(readmemb(templ+7)<<24); -// if (output) pclog("Limit %04X Base %08X\n",ldt.limit,ldt.base); - if (eflags&VM_FLAG) { - // pclog("Task switch V86!\n"); x86gpf(NULL,0); return; } if (!(new_cs&~3)) { - // pclog("TS loading null CS\n"); x86gpf(NULL,0); return; } @@ -2499,7 +2161,6 @@ void taskswitch286(uint16_t seg, uint16_t *segdat, int is32) { if (addr>=ldt.limit) { - // pclog("Bigger than LDT limit %04X %04X %04X TS\n",new_cs,ldt.limit,addr); x86gpf(NULL,0); return; } @@ -2509,7 +2170,6 @@ void taskswitch286(uint16_t seg, uint16_t *segdat, int is32) { if (addr>=gdt.limit) { - // pclog("Bigger than GDT limit %04X %04X TS\n",new_cs,gdt.limit); x86gpf(NULL,0); return; } @@ -2521,7 +2181,6 @@ void taskswitch286(uint16_t seg, uint16_t *segdat, int is32) segdat2[3]=readmemw(0,addr+6); if (!(segdat2[2]&0x8000)) { - // pclog("TS loading CS not present\n"); x86np("TS loading CS not present\n", new_cs & 0xfffc); return; } @@ -2530,7 +2189,6 @@ void taskswitch286(uint16_t seg, uint16_t *segdat, int is32) case 0x1800: case 0x1900: case 0x1A00: case 0x1B00: /*Non-conforming*/ if ((new_cs&3) != DPL2) { - // pclog("TS load CS non-conforming RPL != DPL"); x86gpf(NULL,new_cs&~3); return; } @@ -2538,18 +2196,15 @@ void taskswitch286(uint16_t seg, uint16_t *segdat, int is32) case 0x1C00: case 0x1D00: case 0x1E00: case 0x1F00: /*Conforming*/ if ((new_cs&3) < DPL2) { - // pclog("TS load CS non-conforming RPL < DPL"); x86gpf(NULL,new_cs&~3); return; } break; default: - // pclog("TS load CS not code segment\n"); x86gpf(NULL,new_cs&~3); return; } -// if (output) pclog("new_cs %04X\n",new_cs); CS=new_cs; do_seg_load(&_cs, segdat2); if (CPL==3 && oldcpl!=3) flushmmucache_cr3(); @@ -2579,9 +2234,7 @@ void taskswitch286(uint16_t seg, uint16_t *segdat, int is32) } else { - // pclog("16-bit TSS\n"); resetx86(); - //exit(-1); } diff --git a/src/x87.c b/src/x87.c index 547e56091..a729a14c4 100644 --- a/src/x87.c +++ b/src/x87.c @@ -1,13 +1,3 @@ -//Quake timedemo demo1 - 8.1FPS - -//11A00 - D_SCAlloc -//11C1C - D_CacheSurface - -//36174 - SCR_CalcRefdef - -//SCR_CalcRefdef -//Calls R_SetVrect and R_ViewChanged - #define fplog 0 #include diff --git a/src/x87.h b/src/x87.h index 6a0c532b1..5e3db1960 100644 --- a/src/x87.h +++ b/src/x87.h @@ -1,9 +1,6 @@ uint32_t x87_pc_off,x87_op_off; uint16_t x87_pc_seg,x87_op_seg; -static inline void x87_set_mmx(); -static inline void x87_emms(); - uint16_t x87_gettag(); void x87_settag(uint16_t new_tag); diff --git a/src/x87_ops.h b/src/x87_ops.h index 2121e0b0b..e212c6ccb 100644 --- a/src/x87_ops.h +++ b/src/x87_ops.h @@ -32,31 +32,31 @@ static int rounding_modes[4] = {FE_TONEAREST, FE_DOWNWARD, FE_UPWARD, FE_TOWARDZ dst = src1 / (double)src2; \ } while (0) -static inline void x87_set_mmx() +static __inline void x87_set_mmx() { cpu_state.TOP = 0; *(uint64_t *)cpu_state.tag = 0; cpu_state.ismmx = 1; } -static inline void x87_emms() +static __inline void x87_emms() { *(uint64_t *)cpu_state.tag = 0x0303030303030303ll; cpu_state.ismmx = 0; } -static inline void x87_checkexceptions() +static __inline void x87_checkexceptions() { } -static inline void x87_push(double i) +static __inline void x87_push(double i) { cpu_state.TOP=(cpu_state.TOP-1)&7; cpu_state.ST[cpu_state.TOP] = i; cpu_state.tag[cpu_state.TOP&7] = (i == 0.0) ? 1 : 0; } -static inline double x87_pop() +static __inline double x87_pop() { double t = cpu_state.ST[cpu_state.TOP]; cpu_state.tag[cpu_state.TOP&7] = 3; @@ -64,7 +64,7 @@ static inline double x87_pop() return t; } -static inline int64_t x87_fround(double b) +static __inline int64_t x87_fround(double b) { int64_t a, c; @@ -85,13 +85,20 @@ static inline int64_t x87_fround(double b) return (int64_t)ceil(b); case 3: /*Chop*/ return (int64_t)b; + default: + return (int64_t)0; } } #define BIAS80 16383 #define BIAS64 1023 -static inline double x87_ld80() +static __inline double x87_ld80() { + int64_t exp64; + int64_t blah; + int64_t exp64final; + int64_t mant64; + int64_t sign; struct { int16_t begin; union @@ -104,12 +111,12 @@ static inline double x87_ld80() test.eind.ll |= (uint64_t)readmeml(easeg,cpu_state.eaaddr+4)<<32; test.begin = readmemw(easeg,cpu_state.eaaddr+8); - int64_t exp64 = (((test.begin&0x7fff) - BIAS80)); - int64_t blah = ((exp64 >0)?exp64:-exp64)&0x3ff; - int64_t exp64final = ((exp64 >0)?blah:-blah) +BIAS64; + exp64 = (((test.begin&0x7fff) - BIAS80)); + blah = ((exp64 >0)?exp64:-exp64)&0x3ff; + exp64final = ((exp64 >0)?blah:-blah) +BIAS64; - int64_t mant64 = (test.eind.ll >> 11) & (0xfffffffffffff); - int64_t sign = (test.begin&0x8000)?1:0; + mant64 = (test.eind.ll >> 11) & (0xfffffffffffffll); + sign = (test.begin&0x8000)?1:0; if ((test.begin & 0x7fff) == 0x7fff) exp64final = 0x7ff; @@ -123,8 +130,14 @@ static inline double x87_ld80() return test.eind.d; } -static inline void x87_st80(double d) +static __inline void x87_st80(double d) { + int64_t sign80; + int64_t exp80; + int64_t exp80final; + int64_t mant80; + int64_t mant80final; + struct { int16_t begin; union @@ -136,21 +149,21 @@ static inline void x87_st80(double d) test.eind.d=d; - int64_t sign80 = (test.eind.ll&(0x8000000000000000))?1:0; - int64_t exp80 = test.eind.ll&(0x7ff0000000000000); - int64_t exp80final = (exp80>>52); - int64_t mant80 = test.eind.ll&(0x000fffffffffffff); - int64_t mant80final = (mant80 << 11); + sign80 = (test.eind.ll&(0x8000000000000000ll))?1:0; + exp80 = test.eind.ll&(0x7ff0000000000000ll); + exp80final = (exp80>>52); + mant80 = test.eind.ll&(0x000fffffffffffffll); + mant80final = (mant80 << 11); if (exp80final == 0x7ff) /*Infinity / Nan*/ { exp80final = 0x7fff; - mant80final |= (0x8000000000000000); + mant80final |= (0x8000000000000000ll); } - else if (d != 0){ //Zero is a special case - // Elvira wants the 8 and tcalc doesn't - mant80final |= (0x8000000000000000); - //Ca-cyber doesn't like this when result is zero. + else if (d != 0){ /* Zero is a special case */ + /* Elvira wants the 8 and tcalc doesn't */ + mant80final |= (0x8000000000000000ll); + /* Ca-cyber doesn't like this when result is zero. */ exp80final += (BIAS80 - BIAS64); } test.begin = (((int16_t)sign80)<<15)| (int16_t)exp80final; @@ -161,7 +174,7 @@ static inline void x87_st80(double d) writememw(easeg,cpu_state.eaaddr+8,test.begin); } -static inline void x87_st_fsave(int reg) +static __inline void x87_st_fsave(int reg) { reg = (cpu_state.TOP + reg) & 7; @@ -175,7 +188,7 @@ static inline void x87_st_fsave(int reg) x87_st80(cpu_state.ST[reg]); } -static inline void x87_ld_frstor(int reg) +static __inline void x87_ld_frstor(int reg) { reg = (cpu_state.TOP + reg) & 7; @@ -191,21 +204,21 @@ static inline void x87_ld_frstor(int reg) cpu_state.ST[reg] = x87_ld80(); } -static inline void x87_ldmmx(MMX_REG *r, uint16_t *w4) +static __inline void x87_ldmmx(MMX_REG *r, uint16_t *w4) { r->l[0] = readmeml(easeg, cpu_state.eaaddr); r->l[1] = readmeml(easeg, cpu_state.eaaddr + 4); *w4 = readmemw(easeg, cpu_state.eaaddr + 8); } -static inline void x87_stmmx(MMX_REG r) +static __inline void x87_stmmx(MMX_REG r) { writememl(easeg, cpu_state.eaaddr, r.l[0]); writememl(easeg, cpu_state.eaaddr + 4, r.l[1]); writememw(easeg, cpu_state.eaaddr + 8, 0xffff); } -static inline uint16_t x87_compare(double a, double b) +static __inline uint16_t x87_compare(double a, double b) { #if defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined WIN32 || defined _WIN32 || defined _WIN32 uint32_t out; @@ -214,11 +227,11 @@ static inline uint16_t x87_compare(double a, double b) { if (((a == INFINITY) || (a == -INFINITY)) && ((b == INFINITY) || (b == -INFINITY))) { - // pclog("Comparing infinity\n"); + /* pclog("Comparing infinity\n"); */ - asm volatile ("" : : : "memory"); + __asm volatile ("" : : : "memory"); - asm( + __asm( "fldl %2\n" "fldl %1\n" "fclex\n" @@ -234,9 +247,9 @@ static inline uint16_t x87_compare(double a, double b) /* Memory barrier, to force GCC to write to the input parameters * before the compare rather than after */ - asm volatile ("" : : : "memory"); + __asm volatile ("" : : : "memory"); - asm( + __asm( "fldl %2\n" "fldl %1\n" "fclex\n" @@ -254,7 +267,7 @@ static inline uint16_t x87_compare(double a, double b) if (is386) { - if ((a == INFINITY) || (a == -INFINITY)) && ((b == INFINITY) || (b == -INFINITY)) + if (((a == INFINITY) || (a == -INFINITY)) && ((b == INFINITY) || (b == -INFINITY))) { out |= C3; return out; @@ -277,16 +290,16 @@ static inline uint16_t x87_compare(double a, double b) #endif } -static inline uint16_t x87_ucompare(double a, double b) +static __inline uint16_t x87_ucompare(double a, double b) { #if defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined WIN32 || defined _WIN32 || defined _WIN32 uint32_t out; /* Memory barrier, to force GCC to write to the input parameters * before the compare rather than after */ - asm volatile ("" : : : "memory"); + __asm volatile ("" : : : "memory"); - asm( + __asm( "fldl %2\n" "fldl %1\n" "fclex\n" @@ -345,7 +358,10 @@ static int op_nofpu_a16(uint32_t fetchdat) return 1; } else + { fetch_ea_16(fetchdat); + return 0; + } } static int op_nofpu_a32(uint32_t fetchdat) { @@ -355,9 +371,31 @@ static int op_nofpu_a32(uint32_t fetchdat) return 1; } else + { fetch_ea_32(fetchdat); + return 0; + } } +static int FPU_ILLEGAL_a16(uint32_t fetchdat) +{ + fetch_ea_16(fetchdat); + CLOCK_CYCLES(timing_rr); + PREFETCH_RUN(timing_rr, 2, rmdat, 0,0,0,0, 0); + return 0; +} + +static int FPU_ILLEGAL_a32(uint32_t fetchdat) +{ + fetch_ea_32(fetchdat); + CLOCK_CYCLES(timing_rr); + PREFETCH_RUN(timing_rr, 2, rmdat, 0,0,0,0, 0); + return 0; +} + +#define ILLEGAL_a16 FPU_ILLEGAL_a16 +#define ILLEGAL_a32 FPU_ILLEGAL_a32 + OpFn OP_TABLE(fpu_d8_a16)[32] = { opFADDs_a16, opFMULs_a16, opFCOMs_a16, opFCOMPs_a16, opFSUBs_a16, opFSUBRs_a16, opFDIVs_a16, opFDIVRs_a16, @@ -376,7 +414,7 @@ OpFn OP_TABLE(fpu_d8_a32)[32] = OpFn OP_TABLE(fpu_287_d9_a16)[256] = { opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, @@ -385,7 +423,7 @@ OpFn OP_TABLE(fpu_287_d9_a16)[256] = opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, @@ -394,7 +432,7 @@ OpFn OP_TABLE(fpu_287_d9_a16)[256] = opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, @@ -402,20 +440,20 @@ OpFn OP_TABLE(fpu_287_d9_a16)[256] = opFSTENV_a16, opFSTENV_a16, opFSTENV_a16, opFSTENV_a16, opFSTENV_a16, opFSTENV_a16, opFSTENV_a16, opFSTENV_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, - opFLD, opFLD, opFLD, opFLD, opFLD, opFLD, opFLD, opFLD, - opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, - opFNOP, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /*Invalid*/ - opFCHS, opFABS, ILLEGAL, ILLEGAL, opFTST, opFXAM, ILLEGAL, ILLEGAL, - opFLD1, opFLDL2T, opFLDL2E, opFLDPI, opFLDEG2, opFLDLN2, opFLDZ, ILLEGAL, - opF2XM1, opFYL2X, opFPTAN, opFPATAN, ILLEGAL, opFPREM1, opFDECSTP, opFINCSTP, - opFPREM, opFYL2XP1,opFSQRT, opFSINCOS, opFRNDINT, opFSCALE, opFSIN, opFCOS + opFLD, opFLD, opFLD, opFLD, opFLD, opFLD, opFLD, opFLD, + opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, + opFNOP, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, /*Invalid*/ + opFCHS, opFABS, ILLEGAL_a16, ILLEGAL_a16, opFTST, opFXAM, ILLEGAL_a16, ILLEGAL_a16, + opFLD1, opFLDL2T, opFLDL2E, opFLDPI, opFLDEG2, opFLDLN2, opFLDZ, ILLEGAL_a16, + opF2XM1, opFYL2X, opFPTAN, opFPATAN, ILLEGAL_a16, opFPREM1, opFDECSTP, opFINCSTP, + opFPREM, opFYL2XP1, opFSQRT, opFSINCOS, opFRNDINT, opFSCALE, opFSIN, opFCOS }; OpFn OP_TABLE(fpu_287_d9_a32)[256] = { opFLDs_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, @@ -424,7 +462,7 @@ OpFn OP_TABLE(fpu_287_d9_a32)[256] = opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, @@ -433,7 +471,7 @@ OpFn OP_TABLE(fpu_287_d9_a32)[256] = opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, @@ -441,20 +479,20 @@ OpFn OP_TABLE(fpu_287_d9_a32)[256] = opFSTENV_a32, opFSTENV_a32, opFSTENV_a32, opFSTENV_a32, opFSTENV_a32, opFSTENV_a32, opFSTENV_a32, opFSTENV_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, - opFLD, opFLD, opFLD, opFLD, opFLD, opFLD, opFLD, opFLD, - opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, - opFNOP, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /*Invalid*/ - opFCHS, opFABS, ILLEGAL, ILLEGAL, opFTST, opFXAM, ILLEGAL, ILLEGAL, - opFLD1, opFLDL2T, opFLDL2E, opFLDPI, opFLDEG2, opFLDLN2, opFLDZ, ILLEGAL, - opF2XM1, opFYL2X, opFPTAN, opFPATAN, ILLEGAL, opFPREM1, opFDECSTP, opFINCSTP, - opFPREM, opFYL2XP1,opFSQRT, opFSINCOS, opFRNDINT, opFSCALE, opFSIN, opFCOS + opFLD, opFLD, opFLD, opFLD, opFLD, opFLD, opFLD, opFLD, + opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, + opFNOP, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, /*Invalid*/ + opFCHS, opFABS, ILLEGAL_a32, ILLEGAL_a32, opFTST, opFXAM, ILLEGAL_a32, ILLEGAL_a32, + opFLD1, opFLDL2T, opFLDL2E, opFLDPI, opFLDEG2, opFLDLN2, opFLDZ, ILLEGAL_a32, + opF2XM1, opFYL2X, opFPTAN, opFPATAN, ILLEGAL_a32, opFPREM1, opFDECSTP, opFINCSTP, + opFPREM, opFYL2XP1, opFSQRT, opFSINCOS, opFRNDINT, opFSCALE, opFSIN, opFCOS }; OpFn OP_TABLE(fpu_d9_a16)[256] = { opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, @@ -463,7 +501,7 @@ OpFn OP_TABLE(fpu_d9_a16)[256] = opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, @@ -472,7 +510,7 @@ OpFn OP_TABLE(fpu_d9_a16)[256] = opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFSTPs_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, opFLDENV_a16, @@ -480,20 +518,20 @@ OpFn OP_TABLE(fpu_d9_a16)[256] = opFSTENV_a16, opFSTENV_a16, opFSTENV_a16, opFSTENV_a16, opFSTENV_a16, opFSTENV_a16, opFSTENV_a16, opFSTENV_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, opFSTCW_a16, - opFLD, opFLD, opFLD, opFLD, opFLD, opFLD, opFLD, opFLD, - opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, - opFNOP, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, /*Invalid*/ - opFCHS, opFABS, ILLEGAL, ILLEGAL, opFTST, opFXAM, ILLEGAL, ILLEGAL, - opFLD1, opFLDL2T, opFLDL2E, opFLDPI, opFLDEG2, opFLDLN2, opFLDZ, ILLEGAL, - opF2XM1, opFYL2X, opFPTAN, opFPATAN, ILLEGAL, opFPREM1, opFDECSTP, opFINCSTP, - opFPREM, opFYL2XP1,opFSQRT, opFSINCOS, opFRNDINT, opFSCALE, opFSIN, opFCOS + opFLD, opFLD, opFLD, opFLD, opFLD, opFLD, opFLD, opFLD, + opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, + opFNOP, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, /*Invalid*/ + opFCHS, opFABS, ILLEGAL_a16, ILLEGAL_a16, opFTST, opFXAM, ILLEGAL_a16, ILLEGAL_a16, + opFLD1, opFLDL2T, opFLDL2E, opFLDPI, opFLDEG2, opFLDLN2, opFLDZ, ILLEGAL_a16, + opF2XM1, opFYL2X, opFPTAN, opFPATAN, ILLEGAL_a16, opFPREM1, opFDECSTP, opFINCSTP, + opFPREM, opFYL2XP1, opFSQRT, opFSINCOS, opFRNDINT, opFSCALE, opFSIN, opFCOS }; OpFn OP_TABLE(fpu_d9_a32)[256] = { opFLDs_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, @@ -502,7 +540,7 @@ OpFn OP_TABLE(fpu_d9_a32)[256] = opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, @@ -511,7 +549,7 @@ OpFn OP_TABLE(fpu_d9_a32)[256] = opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, opFLDs_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFSTPs_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, opFLDENV_a32, @@ -519,14 +557,14 @@ OpFn OP_TABLE(fpu_d9_a32)[256] = opFSTENV_a32, opFSTENV_a32, opFSTENV_a32, opFSTENV_a32, opFSTENV_a32, opFSTENV_a32, opFSTENV_a32, opFSTENV_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, opFSTCW_a32, - opFLD, opFLD, opFLD, opFLD, opFLD, opFLD, opFLD, opFLD, - opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, - opFNOP, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, /*Invalid*/ - opFCHS, opFABS, ILLEGAL, ILLEGAL, opFTST, opFXAM, ILLEGAL, ILLEGAL, - opFLD1, opFLDL2T, opFLDL2E, opFLDPI, opFLDEG2, opFLDLN2, opFLDZ, ILLEGAL, - opF2XM1, opFYL2X, opFPTAN, opFPATAN, ILLEGAL, opFPREM1, opFDECSTP, opFINCSTP, - opFPREM, opFYL2XP1,opFSQRT, opFSINCOS, opFRNDINT, opFSCALE, opFSIN, opFCOS + opFLD, opFLD, opFLD, opFLD, opFLD, opFLD, opFLD, opFLD, + opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, + opFNOP, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, /*Invalid*/ + opFCHS, opFABS, ILLEGAL_a32, ILLEGAL_a32, opFTST, opFXAM, ILLEGAL_a32, ILLEGAL_a32, + opFLD1, opFLDL2T, opFLDL2E, opFLDPI, opFLDEG2, opFLDLN2, opFLDZ, ILLEGAL_a32, + opF2XM1, opFYL2X, opFPTAN, opFPATAN, ILLEGAL_a32, opFPREM1, opFDECSTP, opFINCSTP, + opFPREM, opFYL2XP1, opFSQRT, opFSINCOS, opFRNDINT, opFSCALE, opFSIN, opFCOS }; OpFn OP_TABLE(fpu_287_da_a16)[256] = @@ -558,14 +596,14 @@ OpFn OP_TABLE(fpu_287_da_a16)[256] = opFDIVil_a16, opFDIVil_a16, opFDIVil_a16, opFDIVil_a16, opFDIVil_a16, opFDIVil_a16, opFDIVil_a16, opFDIVil_a16, opFDIVRil_a16, opFDIVRil_a16, opFDIVRil_a16, opFDIVRil_a16, opFDIVRil_a16, opFDIVRil_a16, opFDIVRil_a16, opFDIVRil_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, }; OpFn OP_TABLE(fpu_287_da_a32)[256] = { @@ -596,14 +634,14 @@ OpFn OP_TABLE(fpu_287_da_a32)[256] = opFDIVil_a32, opFDIVil_a32, opFDIVil_a32, opFDIVil_a32, opFDIVil_a32, opFDIVil_a32, opFDIVil_a32, opFDIVil_a32, opFDIVRil_a32, opFDIVRil_a32, opFDIVRil_a32, opFDIVRil_a32, opFDIVRil_a32, opFDIVRil_a32, opFDIVRil_a32, opFDIVRil_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, }; OpFn OP_TABLE(fpu_da_a16)[256] = @@ -635,14 +673,14 @@ OpFn OP_TABLE(fpu_da_a16)[256] = opFDIVil_a16, opFDIVil_a16, opFDIVil_a16, opFDIVil_a16, opFDIVil_a16, opFDIVil_a16, opFDIVil_a16, opFDIVil_a16, opFDIVRil_a16, opFDIVRil_a16, opFDIVRil_a16, opFDIVRil_a16, opFDIVRil_a16, opFDIVRil_a16, opFDIVRil_a16, opFDIVRil_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, opFUCOMPP, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, opFUCOMPP, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, }; OpFn OP_TABLE(fpu_da_a32)[256] = { @@ -673,14 +711,14 @@ OpFn OP_TABLE(fpu_da_a32)[256] = opFDIVil_a32, opFDIVil_a32, opFDIVil_a32, opFDIVil_a32, opFDIVil_a32, opFDIVil_a32, opFDIVil_a32, opFDIVil_a32, opFDIVRil_a32, opFDIVRil_a32, opFDIVRil_a32, opFDIVRil_a32, opFDIVRil_a32, opFDIVRil_a32, opFDIVRil_a32, opFDIVRil_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, opFUCOMPP, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, opFUCOMPP, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, }; OpFn OP_TABLE(fpu_686_da_a16)[256] = @@ -716,10 +754,10 @@ OpFn OP_TABLE(fpu_686_da_a16)[256] = opFCMOVE, opFCMOVE, opFCMOVE, opFCMOVE, opFCMOVE, opFCMOVE, opFCMOVE, opFCMOVE, opFCMOVBE, opFCMOVBE, opFCMOVBE, opFCMOVBE, opFCMOVBE, opFCMOVBE, opFCMOVBE, opFCMOVBE, opFCMOVU, opFCMOVU, opFCMOVU, opFCMOVU, opFCMOVU, opFCMOVU, opFCMOVU, opFCMOVU, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, opFUCOMPP, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, opFUCOMPP, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, }; OpFn OP_TABLE(fpu_686_da_a32)[256] = { @@ -754,241 +792,241 @@ OpFn OP_TABLE(fpu_686_da_a32)[256] = opFCMOVE, opFCMOVE, opFCMOVE, opFCMOVE, opFCMOVE, opFCMOVE, opFCMOVE, opFCMOVE, opFCMOVBE, opFCMOVBE, opFCMOVBE, opFCMOVBE, opFCMOVBE, opFCMOVBE, opFCMOVBE, opFCMOVBE, opFCMOVU, opFCMOVU, opFCMOVU, opFCMOVU, opFCMOVU, opFCMOVU, opFCMOVU, opFCMOVU, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, opFUCOMPP, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, opFUCOMPP, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, }; OpFn OP_TABLE(fpu_287_db_a16)[256] = { opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - opFNOP, opFNOP, opFCLEX, opFINIT, opFNOP, opFNOP, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + opFNOP, opFNOP, opFCLEX, opFINIT, opFNOP, opFNOP, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, }; OpFn OP_TABLE(fpu_287_db_a32)[256] = { opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - opFNOP, opFNOP, opFCLEX, opFINIT, opFNOP, opFNOP, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + opFNOP, opFNOP, opFCLEX, opFINIT, opFNOP, opFNOP, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, }; OpFn OP_TABLE(fpu_db_a16)[256] = { opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - opFNOP, opFNOP, opFCLEX, opFINIT, opFNOP, opFNOP, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + opFNOP, opFNOP, opFCLEX, opFINIT, opFNOP, opFNOP, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, }; OpFn OP_TABLE(fpu_db_a32)[256] = { opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - opFNOP, opFNOP, opFCLEX, opFINIT, opFNOP, opFNOP, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + opFNOP, opFNOP, opFCLEX, opFINIT, opFNOP, opFNOP, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, }; OpFn OP_TABLE(fpu_686_db_a16)[256] = { opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, opFISTPil_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, opFLDe_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFSTPe_a16, opFCMOVNB, opFCMOVNB, opFCMOVNB, opFCMOVNB, opFCMOVNB, opFCMOVNB, opFCMOVNB, opFCMOVNB, opFCMOVNE, opFCMOVNE, opFCMOVNE, opFCMOVNE, opFCMOVNE, opFCMOVNE, opFCMOVNE, opFCMOVNE, opFCMOVNBE, opFCMOVNBE, opFCMOVNBE, opFCMOVNBE, opFCMOVNBE, opFCMOVNBE, opFCMOVNBE, opFCMOVNBE, opFCMOVNU, opFCMOVNU, opFCMOVNU, opFCMOVNU, opFCMOVNU, opFCMOVNU, opFCMOVNU, opFCMOVNU, - opFNOP, opFNOP, opFCLEX, opFINIT, opFNOP, opFNOP, ILLEGAL, ILLEGAL, + opFNOP, opFNOP, opFCLEX, opFINIT, opFNOP, opFNOP, ILLEGAL_a16, ILLEGAL_a16, opFUCOMI, opFUCOMI, opFUCOMI, opFUCOMI, opFUCOMI, opFUCOMI, opFUCOMI, opFUCOMI, opFCOMI, opFCOMI, opFCOMI, opFCOMI, opFCOMI, opFCOMI, opFCOMI, opFCOMI, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, }; OpFn OP_TABLE(fpu_686_db_a32)[256] = { opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, opFILDil_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, opFISTPil_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, opFLDe_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFSTPe_a32, opFCMOVNB, opFCMOVNB, opFCMOVNB, opFCMOVNB, opFCMOVNB, opFCMOVNB, opFCMOVNB, opFCMOVNB, opFCMOVNE, opFCMOVNE, opFCMOVNE, opFCMOVNE, opFCMOVNE, opFCMOVNE, opFCMOVNE, opFCMOVNE, opFCMOVNBE, opFCMOVNBE, opFCMOVNBE, opFCMOVNBE, opFCMOVNBE, opFCMOVNBE, opFCMOVNBE, opFCMOVNBE, opFCMOVNU, opFCMOVNU, opFCMOVNU, opFCMOVNU, opFCMOVNU, opFCMOVNU, opFCMOVNU, opFCMOVNU, - opFNOP, opFNOP, opFCLEX, opFINIT, opFNOP, opFNOP, ILLEGAL, ILLEGAL, + opFNOP, opFNOP, opFCLEX, opFINIT, opFNOP, opFNOP, ILLEGAL_a32, ILLEGAL_a32, opFUCOMI, opFUCOMI, opFUCOMI, opFUCOMI, opFUCOMI, opFUCOMI, opFUCOMI, opFUCOMI, opFCOMI, opFCOMI, opFCOMI, opFCOMI, opFCOMI, opFCOMI, opFCOMI, opFCOMI, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, }; OpFn OP_TABLE(fpu_287_dc_a16)[32] = @@ -996,14 +1034,14 @@ OpFn OP_TABLE(fpu_287_dc_a16)[32] = opFADDd_a16, opFMULd_a16, opFCOMd_a16, opFCOMPd_a16, opFSUBd_a16, opFSUBRd_a16, opFDIVd_a16, opFDIVRd_a16, opFADDd_a16, opFMULd_a16, opFCOMd_a16, opFCOMPd_a16, opFSUBd_a16, opFSUBRd_a16, opFDIVd_a16, opFDIVRd_a16, opFADDd_a16, opFMULd_a16, opFCOMd_a16, opFCOMPd_a16, opFSUBd_a16, opFSUBRd_a16, opFDIVd_a16, opFDIVRd_a16, - opFADDr, opFMULr, ILLEGAL, ILLEGAL, opFSUBRr, opFSUBr, opFDIVRr, opFDIVr + opFADDr, opFMULr, ILLEGAL_a16, ILLEGAL_a16, opFSUBRr, opFSUBr, opFDIVRr, opFDIVr }; OpFn OP_TABLE(fpu_287_dc_a32)[32] = { opFADDd_a32, opFMULd_a32, opFCOMd_a32, opFCOMPd_a32, opFSUBd_a32, opFSUBRd_a32, opFDIVd_a32, opFDIVRd_a32, opFADDd_a32, opFMULd_a32, opFCOMd_a32, opFCOMPd_a32, opFSUBd_a32, opFSUBRd_a32, opFDIVd_a32, opFDIVRd_a32, opFADDd_a32, opFMULd_a32, opFCOMd_a32, opFCOMPd_a32, opFSUBd_a32, opFSUBRd_a32, opFDIVd_a32, opFDIVRd_a32, - opFADDr, opFMULr, ILLEGAL, ILLEGAL, opFSUBRr, opFSUBr, opFDIVRr, opFDIVr + opFADDr, opFMULr, ILLEGAL_a32, ILLEGAL_a32, opFSUBRr, opFSUBr, opFDIVRr, opFDIVr }; OpFn OP_TABLE(fpu_dc_a16)[32] = @@ -1024,106 +1062,106 @@ OpFn OP_TABLE(fpu_dc_a32)[32] = OpFn OP_TABLE(fpu_287_dd_a16)[256] = { opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFFREE, opFFREE, opFFREE, opFFREE, opFFREE, opFFREE, opFFREE, opFFREE, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFST, opFST, opFST, opFST, opFST, opFST, opFST, opFST, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, }; OpFn OP_TABLE(fpu_287_dd_a32)[256] = { opFLDd_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFFREE, opFFREE, opFFREE, opFFREE, opFFREE, opFFREE, opFFREE, opFFREE, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFST, opFST, opFST, opFST, opFST, opFST, opFST, opFST, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, }; OpFn OP_TABLE(fpu_dd_a16)[256] = { opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTPd_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, opFSTOR_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSAVE_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, opFSTSW_a16, @@ -1133,35 +1171,35 @@ OpFn OP_TABLE(fpu_dd_a16)[256] = opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFUCOM, opFUCOM, opFUCOM, opFUCOM, opFUCOM, opFUCOM, opFUCOM, opFUCOM, opFUCOMP, opFUCOMP, opFUCOMP, opFUCOMP, opFUCOMP, opFUCOMP, opFUCOMP, opFUCOMP, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, }; OpFn OP_TABLE(fpu_dd_a32)[256] = { opFLDd_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, opFLDd_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTPd_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, opFSTOR_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSAVE_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, opFSTSW_a32, @@ -1171,8 +1209,8 @@ OpFn OP_TABLE(fpu_dd_a32)[256] = opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFUCOM, opFUCOM, opFUCOM, opFUCOM, opFUCOM, opFUCOM, opFUCOM, opFUCOM, opFUCOMP, opFUCOMP, opFUCOMP, opFUCOMP, opFUCOMP, opFUCOMP, opFUCOMP, opFUCOMP, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, }; OpFn OP_TABLE(fpu_287_de_a16)[256] = @@ -1206,8 +1244,8 @@ OpFn OP_TABLE(fpu_287_de_a16)[256] = opFADDP, opFADDP, opFADDP, opFADDP, opFADDP, opFADDP, opFADDP, opFADDP, opFMULP, opFMULP, opFMULP, opFMULP, opFMULP, opFMULP, opFMULP, opFMULP, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, opFCOMPP, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, opFCOMPP, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFSUBRP, opFSUBRP, opFSUBRP, opFSUBRP, opFSUBRP, opFSUBRP, opFSUBRP, opFSUBRP, opFSUBP, opFSUBP, opFSUBP, opFSUBP, opFSUBP, opFSUBP, opFSUBP, opFSUBP, opFDIVRP, opFDIVRP, opFDIVRP, opFDIVRP, opFDIVRP, opFDIVRP, opFDIVRP, opFDIVRP, @@ -1245,8 +1283,8 @@ OpFn OP_TABLE(fpu_287_de_a32)[256] = opFADDP, opFADDP, opFADDP, opFADDP, opFADDP, opFADDP, opFADDP, opFADDP, opFMULP, opFMULP, opFMULP, opFMULP, opFMULP, opFMULP, opFMULP, opFMULP, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, opFCOMPP, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, opFCOMPP, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFSUBRP, opFSUBRP, opFSUBRP, opFSUBRP, opFSUBRP, opFSUBRP, opFSUBRP, opFSUBRP, opFSUBP, opFSUBP, opFSUBP, opFSUBP, opFSUBP, opFSUBP, opFSUBP, opFSUBP, opFDIVRP, opFDIVRP, opFDIVRP, opFDIVRP, opFDIVRP, opFDIVRP, opFDIVRP, opFDIVRP, @@ -1285,7 +1323,7 @@ OpFn OP_TABLE(fpu_de_a16)[256] = opFADDP, opFADDP, opFADDP, opFADDP, opFADDP, opFADDP, opFADDP, opFADDP, opFMULP, opFMULP, opFMULP, opFMULP, opFMULP, opFMULP, opFMULP, opFMULP, opFCOMP, opFCOMP, opFCOMP, opFCOMP, opFCOMP, opFCOMP, opFCOMP, opFCOMP, - ILLEGAL, opFCOMPP, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, opFCOMPP, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFSUBRP, opFSUBRP, opFSUBRP, opFSUBRP, opFSUBRP, opFSUBRP, opFSUBRP, opFSUBRP, opFSUBP, opFSUBP, opFSUBP, opFSUBP, opFSUBP, opFSUBP, opFSUBP, opFSUBP, opFDIVRP, opFDIVRP, opFDIVRP, opFDIVRP, opFDIVRP, opFDIVRP, opFDIVRP, opFDIVRP, @@ -1324,7 +1362,7 @@ OpFn OP_TABLE(fpu_de_a32)[256] = opFADDP, opFADDP, opFADDP, opFADDP, opFADDP, opFADDP, opFADDP, opFADDP, opFMULP, opFMULP, opFMULP, opFMULP, opFMULP, opFMULP, opFMULP, opFMULP, opFCOMP, opFCOMP, opFCOMP, opFCOMP, opFCOMP, opFCOMP, opFCOMP, opFCOMP, - ILLEGAL, opFCOMPP, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, opFCOMPP, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFSUBRP, opFSUBRP, opFSUBRP, opFSUBRP, opFSUBRP, opFSUBRP, opFSUBRP, opFSUBRP, opFSUBP, opFSUBP, opFSUBP, opFSUBP, opFSUBP, opFSUBP, opFSUBP, opFSUBP, opFDIVRP, opFDIVRP, opFDIVRP, opFDIVRP, opFDIVRP, opFDIVRP, opFDIVRP, opFDIVRP, @@ -1334,105 +1372,105 @@ OpFn OP_TABLE(fpu_de_a32)[256] = OpFn OP_TABLE(fpu_287_df_a16)[256] = { opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, opFFREEP, opFFREEP, opFFREEP, opFFREEP, opFFREEP, opFFREEP, opFFREEP, opFFREEP, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - opFSTSW_AX, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + opFSTSW_AX, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, }; OpFn OP_TABLE(fpu_287_df_a32)[256] = { opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, opFFREEP, opFFREEP, opFFREEP, opFFREEP, opFFREEP, opFFREEP, opFFREEP, opFFREEP, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - opFSTSW_AX, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + opFSTSW_AX, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, }; OpFn OP_TABLE(fpu_df_a16)[256] = { opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, @@ -1441,36 +1479,36 @@ OpFn OP_TABLE(fpu_df_a16)[256] = opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, - opFSTSW_AX, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + opFSTSW_AX, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, }; OpFn OP_TABLE(fpu_df_a32)[256] = { opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, @@ -1479,37 +1517,37 @@ OpFn OP_TABLE(fpu_df_a32)[256] = opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, - opFSTSW_AX, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + opFSTSW_AX, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, }; OpFn OP_TABLE(fpu_686_df_a16)[256] = { opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, opFISTPiw_a16, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, opFILDiq_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FBSTP_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, FISTPiq_a16, @@ -1518,36 +1556,36 @@ OpFn OP_TABLE(fpu_686_df_a16)[256] = opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, - opFSTSW_AX, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + opFSTSW_AX, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, opFUCOMIP, opFUCOMIP, opFUCOMIP, opFUCOMIP, opFUCOMIP, opFUCOMIP, opFUCOMIP, opFUCOMIP, opFCOMIP, opFCOMIP, opFCOMIP, opFCOMIP, opFCOMIP, opFCOMIP, opFCOMIP, opFCOMIP, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, }; OpFn OP_TABLE(fpu_686_df_a32)[256] = { opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, opFILDiw_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, opFISTPiw_a32, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, opFILDiq_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FBSTP_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, FISTPiq_a32, @@ -1556,10 +1594,10 @@ OpFn OP_TABLE(fpu_686_df_a32)[256] = opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFXCH, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, opFSTP, - opFSTSW_AX, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + opFSTSW_AX, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, opFUCOMIP, opFUCOMIP, opFUCOMIP, opFUCOMIP, opFUCOMIP, opFUCOMIP, opFUCOMIP, opFUCOMIP, opFCOMIP, opFCOMIP, opFCOMIP, opFCOMIP, opFCOMIP, opFCOMIP, opFCOMIP, opFCOMIP, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, + ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, ILLEGAL_a32, }; OpFn OP_TABLE(nofpu_a16)[256] = diff --git a/src/xtide.c b/src/xtide.c index fc3b70f75..587f1de02 100644 --- a/src/xtide.c +++ b/src/xtide.c @@ -1,3 +1,5 @@ +#include + #include "ibm.h" #include "device.h" @@ -59,6 +61,9 @@ static uint8_t xtide_read(uint16_t port, void *p) case 0xe: return readide(0, 0x3f6); + + default: + return 0xff; } } @@ -92,6 +97,20 @@ static void *xtide_ps2_init() xtide_t *xtide = malloc(sizeof(xtide_t)); memset(xtide, 0, sizeof(xtide_t)); + rom_init(&xtide->bios_rom, "roms/SIDE1V12.BIN", 0xc8000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL); + ide_init(); + ide_pri_disable(); + ide_sec_disable(); + io_sethandler(0x0360, 0x0010, xtide_read, NULL, NULL, xtide_write, NULL, NULL, xtide); + + return xtide; +} + +static void *xtide_at_ps2_init() +{ + xtide_t *xtide = malloc(sizeof(xtide_t)); + memset(xtide, 0, sizeof(xtide_t)); + rom_init(&xtide->bios_rom, "roms/ide_at_1_1_5.bin", 0xc8000, 0x4000, 0x3fff, 0, MEM_MAPPING_EXTERNAL); ide_init(); @@ -116,6 +135,11 @@ static int xtide_at_available() } static int xtide_ps2_available() +{ + return rom_present("roms/SIDE1V12.BIN"); +} + +static int xtide_at_ps2_available() { return rom_present("roms/ide_at_1_1_5.bin"); } @@ -148,7 +172,7 @@ device_t xtide_at_device = device_t xtide_ps2_device = { "XTIDE (PS/2)", - DEVICE_AT, + DEVICE_PS2, xtide_ps2_init, xtide_close, xtide_ps2_available, @@ -157,3 +181,16 @@ device_t xtide_ps2_device = NULL, NULL }; + +device_t xtide_at_ps2_device = +{ + "XTIDE (AT) (PS/2)", + DEVICE_PS2, + xtide_at_ps2_init, + xtide_close, + xtide_at_ps2_available, + NULL, + NULL, + NULL, + NULL +}; diff --git a/src/xtide.h b/src/xtide.h index d74dc76c2..666783629 100644 --- a/src/xtide.h +++ b/src/xtide.h @@ -1,3 +1,4 @@ extern device_t xtide_device; extern device_t xtide_at_device; extern device_t xtide_ps2_device; +extern device_t xtide_at_ps2_device;