|
|
| version 1.14, 2004/08/15 15:18:00 | version 1.15, 2004/08/15 17:51:53 |
|---|---|
| Line 162 BRESULT ieitem_ctc(UINT id) { | Line 162 BRESULT ieitem_ctc(UINT id) { |
| if (!(ch->cmd[i] & 0x80)) { | if (!(ch->cmd[i] & 0x80)) { |
| intr ^= bit; | intr ^= bit; |
| } | } |
| #if 0 // アークスのタイミング→あとで修正 | #if 1 // アークスのタイミング→あとで修正 |
| else if (0) | else if (0) |
| #elif 1 | #elif 1 |
| else if ((ch->countmax[i] - ch->count[i]) >= ch->range[i]) | else if ((ch->countmax[i] - ch->count[i]) >= ch->range[i]) |
| Line 178 BRESULT ieitem_ctc(UINT id) { | Line 178 BRESULT ieitem_ctc(UINT id) { |
| else if (!r) { | else if (!r) { |
| r = TRUE; | r = TRUE; |
| intr ^= bit; | intr ^= bit; |
| TRACEOUT(("ctc int %d %d [%.2x]", ch->num, i, ch->cmd[i])); | ch->irq = (UINT8)i; |
| // TRACEOUT(("ctc int %d %d [%.2x]", ch->num, i, ch->cmd[i])); | |
| Z80_INTERRUPT((REG8)(ch->vector + (i << 1))); | Z80_INTERRUPT((REG8)(ch->vector + (i << 1))); |
| } | } |
| } | } |
| Line 194 BRESULT ieitem_ctc(UINT id) { | Line 195 BRESULT ieitem_ctc(UINT id) { |
| return(r); | return(r); |
| } | } |
| void ieeoi_ctc(UINT id) { | |
| CTCCH *ch; | |
| REG8 intr; | |
| UINT curirq; | |
| ch = ctc.ch + (id - IEVENT_CTC0); | |
| intr = ctcwork(ch) | ch->intr; | |
| curirq = ch->irq; | |
| if (intr & (1 << curirq)) { // 割り込み中に割り込んだ… | |
| // カウンタが0でなければ割り込みを消す | |
| if ((ch->countmax[curirq] - ch->count[curirq]) >= ch->range[curirq]) { | |
| intr ^= (1 << curirq); | |
| } | |
| } | |
| ch->intr = intr; | |
| if (intr) { | |
| ievent_set(id); | |
| } | |
| else { | |
| ctcnextevent(ch); | |
| } | |
| } | |
| // ---- | // ---- |
| Line 219 static void ctcch_o(CTCCH *ch, UINT port | Line 244 static void ctcch_o(CTCCH *ch, UINT port |
| ch->scale[port] = scale; | ch->scale[port] = scale; |
| ch->countmax[port] = count << scale; | ch->countmax[port] = count << scale; |
| ch->count[port] = count << scale; | ch->count[port] = count << scale; |
| // ch->range[port] = ((count + 3) >> 2) << scale; | ch->range[port] = 1 << scale; |
| ch->range[port] = 4 << scale; | |
| ch->cmd[port] &= ~6; | ch->cmd[port] &= ~6; |
| ctcnextevent(ch); | ctcnextevent(ch); |
| } | } |