|
|
| version 1.5, 2003/11/28 08:01:33 | version 1.7, 2003/11/30 12:32:04 |
|---|---|
| Line 112 void pic_irq(void) { | Line 112 void pic_irq(void) { |
| int i; | int i; |
| BYTE bit; | BYTE bit; |
| char pry; | SINT8 pry; |
| BYTE irq; | BYTE irq; |
| BYTE sirq; | BYTE sirq; |
| BYTE targetbit; | BYTE targetbit; |
| Line 130 void pic_irq(void) { | Line 130 void pic_irq(void) { |
| pry = -1; | pry = -1; |
| } | } |
| else { | else { |
| pry = (char)p->pi[0].pry[p->pi[0].level[p->pi[0].levels - 1]]; | pry = (SINT8)p->pi[0].pry[p->pi[0].level[p->pi[0].levels - 1]]; |
| } | } |
| irq = 0xff; | irq = 0xff; |
| targetbit = 0; | targetbit = 0; |
| for (bit=1, i=0; bit; bit<<=1, i++) { | for (bit=1, i=0; bit; bit<<=1, i++) { |
| if ((p->pi[0].irr & bit) && | if ((p->pi[0].irr & bit) && |
| (!((p->pi[0].imr | p->pi[0].isr) & bit))) { | (!((p->pi[0].imr | p->pi[0].isr) & bit))) { |
| if ((char)p->pi[0].pry[i] > pry) { | if ((SINT8)p->pi[0].pry[i] > pry) { |
| pry = p->pi[0].pry[i]; | pry = p->pi[0].pry[i]; |
| irq = (BYTE)i; | irq = (BYTE)i; |
| targetbit = bit; | targetbit = bit; |
| Line 152 void pic_irq(void) { | Line 152 void pic_irq(void) { |
| sirq = p->pi[1].icw[2] & 7; | sirq = p->pi[1].icw[2] & 7; |
| bit = 1 << sirq; | bit = 1 << sirq; |
| if (!((p->pi[0].imr | p->pi[0].isr) & bit)) { | if (!((p->pi[0].imr | p->pi[0].isr) & bit)) { |
| if ((char)p->pi[0].pry[sirq] > pry) { | if ((SINT8)p->pi[0].pry[sirq] > pry) { |
| irq = sirq; | irq = sirq; |
| targetbit = bit; | targetbit = bit; |
| } | } |
| Line 184 void pic_irq(void) { | Line 184 void pic_irq(void) { |
| pry = -1; | pry = -1; |
| } | } |
| else { | else { |
| pry = (char)p->pi[1].pry[p->pi[1].level[p->pi[1].levels - 1]]; | pry = (SINT8)p->pi[1].pry[p->pi[1].level[p->pi[1].levels - 1]]; |
| } | } |
| targetbit = 0; | targetbit = 0; |
| for (bit=1, i=0; bit; bit<<=1, i++) { | for (bit=1, i=0; bit; bit<<=1, i++) { |
| if ((p->pi[1].irr & bit) && | if ((p->pi[1].irr & bit) && |
| (!((p->pi[1].imr | p->pi[1].isr) & bit))) { | (!((p->pi[1].imr | p->pi[1].isr) & bit))) { |
| if ((char)p->pi[1].pry[i] > pry) { | if ((SINT8)p->pi[1].pry[i] > pry) { |
| pry = p->pi[1].pry[i]; | pry = p->pi[1].pry[i]; |
| irq = (BYTE)i; | irq = (BYTE)i; |
| targetbit = bit; | targetbit = bit; |
| Line 338 static void IOOUTCALL pic_o00(UINT port, | Line 338 static void IOOUTCALL pic_o00(UINT port, |
| } | } |
| } | } |
| #if defined(TRACE) | |
| extern int piccnt; | |
| #endif | |
| static void IOOUTCALL pic_o02(UINT port, BYTE dat) { | static void IOOUTCALL pic_o02(UINT port, BYTE dat) { |
| PICITEM picp; | PICITEM picp; |
| Line 345 static void IOOUTCALL pic_o02(UINT port, | Line 349 static void IOOUTCALL pic_o02(UINT port, |
| // TRACEOUT(("pic %x %x", port, dat)); | // TRACEOUT(("pic %x %x", port, dat)); |
| picp = &pic.pi[(port >> 3) & 1]; | picp = &pic.pi[(port >> 3) & 1]; |
| if (!picp->writeicw) { | if (!picp->writeicw) { |
| #if 1 // マスクのセットだけなら nevent_forceexit()をコールしない | |
| if ((isI286DI) || (pic.ext_irq) || | |
| ((picp->imr & dat) == picp->imr)) { | |
| picp->imr = dat; | |
| return; | |
| } | |
| // リセットされたビットは割り込みある? | |
| if (!(picp->irr & (picp->imr & (~dat)))) { | |
| picp->imr = dat; | |
| return; | |
| } | |
| #endif | |
| picp->imr = dat; | picp->imr = dat; |
| #if defined(TRACE) | |
| piccnt++; | |
| #endif | |
| } | } |
| else { | else { |
| picp->icw[picp->writeicw] = dat; | picp->icw[picp->writeicw] = dat; |