PCem
changeset 81:c63d59bbff1e
PIC fixes. OAKCDROM.SYS works again.
| author | TomW |
|---|---|
| date | Sat Mar 08 15:10:55 2014 +0000 |
| parents | bc749e3a164e |
| children | 56d6d9b214ff |
| files | src/pic.c |
| diffstat | 1 files changed, 16 insertions(+), 7 deletions(-) [+] |
line diff
1.1 --- a/src/pic.c Thu Mar 06 18:01:11 2014 +0000 1.2 +++ b/src/pic.c Sat Mar 08 15:10:55 2014 +0000 1.3 @@ -9,11 +9,15 @@ 1.4 1.5 void pic_updatepending() 1.6 { 1.7 + if ((pic2.pend&~pic2.mask)&~pic2.mask2) 1.8 + pic.pend |= (1 << 2); 1.9 + else 1.10 + pic.pend &= ~(1 << 2); 1.11 pic_intpending = (pic.pend & ~pic.mask) & ~pic.mask2; 1.12 if (!((pic.mask | pic.mask2) & (1 << 2))) 1.13 pic_intpending |= ((pic2.pend&~pic2.mask)&~pic2.mask2); 1.14 /* pclog("pic_intpending = %i %02X %02X %02X %02X\n", pic_intpending, pic.ins, pic.pend, pic.mask, pic.mask2); 1.15 - pclog(" %02X %02X %02X %02X\n", pic_intpending, pic2.ins, pic2.pend, pic2.mask, pic2.mask2);*/ 1.16 + pclog(" %02X %02X %02X %02X %i %i\n", pic2.ins, pic2.pend, pic2.mask, pic2.mask2, ((pic.mask | pic.mask2) & (1 << 2)), ((pic2.pend&~pic2.mask)&~pic2.mask2));*/ 1.17 } 1.18 1.19 1.20 @@ -217,8 +221,8 @@ 1.21 1.22 uint8_t pic2_read(uint16_t addr, void *priv) 1.23 { 1.24 - if (addr&1) { /*pclog("Read PIC2 mask %02X %04X:%08X\n",pic2.mask,CS,pc); */return pic2.mask; } 1.25 - if (pic2.read) { /*pclog("Read PIC2 ins %02X %04X:%08X\n",pic2.ins,CS,pc); */return pic2.ins; } 1.26 + if (addr&1) { /*pclog("Read PIC2 mask %02X %04X:%08X\n",pic2.mask,CS,pc);*/ return pic2.mask; } 1.27 + if (pic2.read) { /*pclog("Read PIC2 ins %02X %04X:%08X\n",pic2.ins,CS,pc);*/ return pic2.ins; } 1.28 /*pclog("Read PIC2 pend %02X %04X:%08X\n",pic2.pend,CS,pc);*/ 1.29 return pic2.pend; 1.30 } 1.31 @@ -279,15 +283,20 @@ 1.32 { 1.33 int c = 0; 1.34 while (!(num & (1 << c))) c++; 1.35 - //pclog("INTC %04X %i\n", num, c); 1.36 +// pclog("INTC %04X %i\n", num, c); 1.37 pic_current[c]=0; 1.38 -#if 0 1.39 - if (num>0xFF) pic2.pend&=~(num>>8); 1.40 + 1.41 + if (num > 0xff) 1.42 + { 1.43 + pic2.pend &= ~(num >> 8); 1.44 + if (!((pic2.pend&~pic2.mask)&~pic2.mask2)) 1.45 + pic.pend &= ~(1 << 2); 1.46 + } 1.47 else 1.48 { 1.49 pic.pend&=~num; 1.50 } 1.51 -#endif 1.52 + pic_updatepending(); 1.53 } 1.54 1.55 uint8_t picinterrupt()
