|
|
| version 1.12, 2004/08/14 12:16:17 | version 1.13, 2004/08/15 07:52:16 |
|---|---|
| Line 74 static REG8 ctcwork(CTCCH *ch) { | Line 74 static REG8 ctcwork(CTCCH *ch) { |
| if (count <= 0) { | if (count <= 0) { |
| count = ch->countmax[3] - ((0 - count) % ch->countmax[3]); | count = ch->countmax[3] - ((0 - count) % ch->countmax[3]); |
| intr |= (ch->cmd[3] & 0x80) >> (7 - 3); | intr |= (ch->cmd[3] & 0x80) >> (7 - 3); |
| TRACEOUT(("ctc3 !")); | |
| } | } |
| ch->count[3] = count; | ch->count[3] = count; |
| } | } |
| Line 156 BRESULT ieitem_ctc(UINT id) { | Line 155 BRESULT ieitem_ctc(UINT id) { |
| intr |= ch->intr; | intr |= ch->intr; |
| r = FALSE; | r = FALSE; |
| if (intr) { | if (intr) { |
| for (i=0, bit=1; i<4; i++, bit<<=1) { | // for (i=0, bit=1; i<4; i++, bit<<=1) |
| for (i=4, bit=8; i--; bit>>=1) | |
| { | |
| if (intr & bit) { | if (intr & bit) { |
| if (!(ch->cmd[i] & 0x80)) { | if (!(ch->cmd[i] & 0x80)) { |
| intr ^= bit; | intr ^= bit; |
| Line 164 BRESULT ieitem_ctc(UINT id) { | Line 165 BRESULT ieitem_ctc(UINT id) { |
| #if 0 // アークスのタイミング→あとで修正 | #if 0 // アークスのタイミング→あとで修正 |
| else if (0) | else if (0) |
| #elif 1 | #elif 1 |
| if ((ch->countmax[i] - ch->count[i]) >= ch->range[i]) | |
| #elif 0 | |
| else if (((ch->cmd[i] & 0x10) == 0) && | else if (((ch->cmd[i] & 0x10) == 0) && |
| ((ch->countmax[i] - ch->count[i]) >= (256 >> 1))) | ((ch->countmax[i] - ch->count[i]) >= (256 >> 1))) |
| #else | #else |
| Line 175 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", ch->num, i)); | // TRACEOUT(("ctc int %d %d", ch->num, i)); |
| Z80_INTERRUPT((REG8)(ch->vector + (i << 1))); | Z80_INTERRUPT((REG8)(ch->vector + (i << 1))); |
| } | } |
| } | } |
| Line 213 static void ctcch_o(CTCCH *ch, UINT port | Line 216 static void ctcch_o(CTCCH *ch, UINT port |
| scale = 4 - 1; | scale = 4 - 1; |
| } | } |
| } | } |
| count <<= scale; | |
| ch->scale[port] = scale; | ch->scale[port] = scale; |
| ch->countmax[port] = count; | ch->countmax[port] = count << scale; |
| ch->count[port] = count; | ch->count[port] = count << scale; |
| // ch->range[port] = ((count + 3) >> 2) << scale; | |
| ch->range[port] = 4 << scale; | |
| ch->cmd[port] &= ~6; | ch->cmd[port] &= ~6; |
| ctcnextevent(ch); | ctcnextevent(ch); |
| } | } |