trunk/src/emu/machine/pit8253.c
| r31650 | r31651 | |
| 41 | 41 | #define LOG1(msg) do { if (VERBOSE >= 1) logerror msg; } while (0) |
| 42 | 42 | #define LOG2(msg) do { if (VERBOSE >= 2) logerror msg; } while (0) |
| 43 | 43 | |
| 44 | | #define CYCLES_NEVER ((UINT32) -1) |
| 44 | #define CYCLES_NEVER (0xffffffff) |
| 45 | 45 | |
| 46 | 46 | |
| 47 | 47 | const device_type PIT8253 = &device_creator<pit8253_device>; |
| r31650 | r31651 | |
| 56 | 56 | m_out1_handler(*this), |
| 57 | 57 | m_out2_handler(*this) |
| 58 | 58 | { |
| 59 | | for(int i = 0; i < ARRAY_LENGTH(m_timers); ++i) |
| 59 | for (int i = 0; i < PIT8253_MAX_TIMER; i++) |
| 60 | 60 | { |
| 61 | 61 | m_timers[i].gate = 1; |
| 62 | 62 | m_timers[i].phase = 0; |
| r31650 | r31651 | |
| 73 | 73 | m_out1_handler(*this), |
| 74 | 74 | m_out2_handler(*this) |
| 75 | 75 | { |
| 76 | | for(int i = 0; i < ARRAY_LENGTH(m_timers); ++i) |
| 76 | for (int i = 0; i < PIT8253_MAX_TIMER; i++) |
| 77 | 77 | { |
| 78 | 78 | m_timers[i].gate = 1; |
| 79 | 79 | m_timers[i].phase = 0; |
| r31650 | r31651 | |
| 129 | 129 | save_item(NAME(timer->latched_status), timerno); |
| 130 | 130 | save_item(NAME(timer->null_count), timerno); |
| 131 | 131 | save_item(NAME(timer->phase), timerno); |
| 132 | | save_item(NAME(timer->cycles_to_output), timerno); |
| 133 | 132 | save_item(NAME(timer->last_updated), timerno); |
| 134 | 133 | save_item(NAME(timer->clock), timerno); |
| 135 | 134 | } |
| r31650 | r31651 | |
| 158 | 157 | timer->latched_count = 0; |
| 159 | 158 | timer->latched_status = 0; |
| 160 | 159 | timer->null_count = 1; |
| 161 | | timer->cycles_to_output = CYCLES_NEVER; |
| 162 | 160 | |
| 163 | 161 | timer->last_updated = machine().time(); |
| 164 | 162 | |
| r31650 | r31651 | |
| 215 | 213 | |
| 216 | 214 | static UINT32 adjusted_count(int bcd, UINT16 val) |
| 217 | 215 | { |
| 218 | | if (bcd == 0) |
| 219 | | return val == 0 ? 0x10000 : val; |
| 220 | | return val == 0 ? 10000 : decimal_from_bcd(val); |
| 216 | if (!bcd) |
| 217 | return (val == 0) ? 0x10000 : val; |
| 218 | return (val == 0) ? 10000 : decimal_from_bcd(val); |
| 221 | 219 | } |
| 222 | 220 | |
| 223 | 221 | |
| 224 | 222 | /* This function subtracts 1 from timer->value "cycles" times, taking into |
| 225 | 223 | account binary or BCD operation, and wrapping around from 0 to 0xFFFF or |
| 226 | 224 | 0x9999 as necessary. */ |
| 227 | | void pit8253_device::decrease_counter_value(pit8253_timer *timer, UINT64 cycles) |
| 225 | void pit8253_device::decrease_counter_value(pit8253_timer *timer, INT64 cycles) |
| 228 | 226 | { |
| 229 | 227 | UINT16 value; |
| 230 | 228 | UINT8 units, tens, hundreds, thousands; |
| r31650 | r31651 | |
| 250 | 248 | cycles -= units; |
| 251 | 249 | units = (10 - cycles % 10) % 10; |
| 252 | 250 | |
| 253 | | cycles =(cycles + 9) / 10; /* the +9 is so we get a carry if cycles%10 wasn't 0 */ |
| 251 | cycles = (cycles + 9) / 10; /* the +9 is so we get a carry if cycles%10 wasn't 0 */ |
| 254 | 252 | if (cycles <= tens) |
| 255 | 253 | { |
| 256 | 254 | tens -= cycles; |
| r31650 | r31651 | |
| 269 | 267 | { |
| 270 | 268 | cycles -= hundreds; |
| 271 | 269 | hundreds = (10 - cycles % 10) % 10; |
| 272 | | cycles=(cycles + 9) / 10; |
| 270 | cycles = (cycles + 9) / 10; |
| 273 | 271 | thousands = (10 + thousands - cycles % 10) % 10; |
| 274 | 272 | } |
| 275 | 273 | } |
| r31650 | r31651 | |
| 321 | 319 | UINT32 adjusted_value; |
| 322 | 320 | int bcd = CTRL_BCD(timer->control); |
| 323 | 321 | int mode = CTRL_MODE(timer->control); |
| 324 | | int cycles_to_output = 0; |
| 322 | UINT32 cycles_to_output = CYCLES_NEVER; |
| 325 | 323 | |
| 326 | 324 | LOG2(("pit8253: simulate2(): simulating %d cycles for %d in mode %d, bcd = %d, phase = %d, gate = %d, output %d, value = 0x%04x\n", |
| 327 | 325 | (int)elapsed_cycles, timer->index, mode, bcd, timer->phase, pit8253_gate(timer), timer->output, timer->value)); |
| r31650 | r31651 | |
| 503 | 501 | { |
| 504 | 502 | if (elapsed_cycles + 1 >= adjusted_value) |
| 505 | 503 | { |
| 506 | | /* Coounter hits 1, output goes low */ |
| 504 | /* Counter hits 1, output goes low */ |
| 507 | 505 | timer->phase = 3; |
| 508 | 506 | set_output(timer, 0); |
| 509 | 507 | } |
| r31650 | r31651 | |
| 527 | 525 | switch (timer->phase) |
| 528 | 526 | { |
| 529 | 527 | case 1: cycles_to_output = 1; break; |
| 530 | | default: cycles_to_output = (timer->value == 1 ? 1 : (adjusted_count(bcd, timer->value) - 1)); |
| 528 | default: cycles_to_output = (timer->value == 1) ? 1 : (adjusted_count(bcd, timer->value) - 1); break; |
| 531 | 529 | } |
| 532 | 530 | } |
| 533 | 531 | break; |
| r31650 | r31651 | |
| 604 | 602 | while ((timer->phase == 2 && elapsed_cycles >= ((adjusted_value + 1) >> 1)) || |
| 605 | 603 | (timer->phase == 3 && elapsed_cycles >= (adjusted_value >> 1))); |
| 606 | 604 | |
| 607 | | decrease_counter_value(timer, elapsed_cycles << 1); |
| 605 | decrease_counter_value(timer, elapsed_cycles * 2); |
| 606 | |
| 608 | 607 | switch (timer->phase) |
| 609 | 608 | { |
| 610 | 609 | case 1: cycles_to_output = 1; break; |
| r31650 | r31651 | |
| 692 | 691 | break; |
| 693 | 692 | } |
| 694 | 693 | |
| 695 | | timer->cycles_to_output = cycles_to_output; |
| 696 | 694 | if (cycles_to_output == CYCLES_NEVER || timer->clockin == 0) |
| 697 | 695 | { |
| 698 | 696 | timer->updatetimer->adjust(attotime::never, timer->index); |
| r31650 | r31651 | |
| 730 | 728 | { |
| 731 | 729 | if (elapsed_cycles > 0) |
| 732 | 730 | simulate2(timer, elapsed_cycles); |
| 733 | | else |
| 734 | | if (timer->clockin) |
| 735 | | timer->updatetimer->adjust(attotime::from_hz(timer->clockin), timer->index); |
| 731 | else if (timer->clockin) |
| 732 | timer->updatetimer->adjust(attotime::from_hz(timer->clockin), timer->index); |
| 736 | 733 | } |
| 737 | 734 | |
| 738 | 735 | |
| r31650 | r31651 | |
| 741 | 738 | { |
| 742 | 739 | /* With the 82C54's maximum clockin of 10MHz, 64 bits is nearly 60,000 |
| 743 | 740 | years of time. Should be enough for now. */ |
| 744 | | attotime now = machine().time(); |
| 741 | attotime now = machine().time(); |
| 745 | 742 | attotime elapsed_time = now - timer->last_updated; |
| 746 | | INT64 elapsed_cycles = elapsed_time.as_double() * timer->clockin; |
| 743 | INT64 elapsed_cycles = elapsed_time.as_double() * timer->clockin; |
| 747 | 744 | |
| 748 | 745 | LOG1(("pit8253: update(): timer %d, %" I64FMT "d elapsed_cycles\n", timer->index, elapsed_cycles)); |
| 749 | 746 | |
| r31650 | r31651 | |
| 811 | 808 | if (timer->latched_count != 0) |
| 812 | 809 | { |
| 813 | 810 | /* Read back latched count */ |
| 814 | | data = (timer->latch >> (timer->rmsb != 0 ? 8 : 0)) & 0xff; |
| 811 | data = (timer->latch >> (timer->rmsb ? 8 : 0)) & 0xff; |
| 815 | 812 | timer->rmsb = 1 - timer->rmsb; |
| 816 | 813 | --timer->latched_count; |
| 817 | 814 | } |
| r31650 | r31651 | |
| 840 | 837 | |
| 841 | 838 | case 3: |
| 842 | 839 | /* read bits 0-7 first, then 8-15 */ |
| 843 | | data = (value >> (timer->rmsb != 0 ? 8 : 0)) & 0xff; |
| 840 | data = (value >> (timer->rmsb ? 8 : 0)) & 0xff; |
| 844 | 841 | timer->rmsb = 1 - timer->rmsb; |
| 845 | 842 | break; |
| 846 | 843 | } |
| r31650 | r31651 | |
| 892 | 889 | if ((command & 1) == 0) |
| 893 | 890 | { |
| 894 | 891 | /* readback status command */ |
| 895 | | if (timer->latched_status == 0) |
| 892 | if (!timer->latched_status) |
| 896 | 893 | { |
| 897 | | timer->status = (timer->control & 0x3f) | (timer->output != 0 ? 0x80 : 0) | (timer->null_count != 0 ? 0x40 : 0); |
| 894 | timer->status = (timer->control & 0x3f) | ((timer->output != 0) ? 0x80 : 0) | (timer->null_count ? 0x40 : 0); |
| 895 | timer->latched_status = 1; |
| 898 | 896 | } |
| 899 | | |
| 900 | | timer->latched_status = 1; |
| 901 | 897 | } |
| 902 | 898 | /* Experimentally determined: the read latch command seems to have no |
| 903 | 899 | effect if we're halfway through a 16-bit read */ |
| 904 | | if ((command & 2) == 0 && timer->rmsb == 0) |
| 900 | if ((command & 2) == 0 && !timer->rmsb) |
| 905 | 901 | { |
| 906 | 902 | /* readback count command */ |
| 907 | 903 | |
| r31650 | r31651 | |
| 984 | 980 | /* Experimentally verified: this command does not affect the mode control register */ |
| 985 | 981 | readback(timer, 1); |
| 986 | 982 | } |
| 987 | | else { |
| 983 | else |
| 984 | { |
| 988 | 985 | LOG1(("pit8253: write(): timer=%d bytes=%d mode=%d bcd=%d\n", (data >> 6) & 3, (data >> 4) & 3, (data >> 1) & 7, data & 1)); |
| 989 | 986 | |
| 990 | 987 | timer->control = (data & 0x3f); |
| r31650 | r31651 | |
| 1039 | 1036 | |
| 1040 | 1037 | case 3: |
| 1041 | 1038 | /* read/write bits 0-7 first, then 8-15 */ |
| 1042 | | if (timer->wmsb != 0) |
| 1039 | if (timer->wmsb) |
| 1043 | 1040 | { |
| 1044 | 1041 | /* check if we should compensate for not being on a cycle boundary */ |
| 1045 | 1042 | if (middle_of_a_cycle) |
trunk/src/emu/machine/pit8253.h
| r31650 | r31651 | |
| 62 | 62 | UINT8 control; /* 6-bit control byte */ |
| 63 | 63 | UINT8 status; /* status byte - 8254 only */ |
| 64 | 64 | UINT8 lowcount; /* LSB of new counter value for 16-bit writes */ |
| 65 | | INT32 rmsb; /* 1 = Next read is MSB of 16-bit value */ |
| 66 | | INT32 wmsb; /* 1 = Next write is MSB of 16-bit value */ |
| 67 | | INT32 output; /* 0 = low, 1 = high */ |
| 65 | int rmsb; /* 1 = Next read is MSB of 16-bit value */ |
| 66 | int wmsb; /* 1 = Next write is MSB of 16-bit value */ |
| 67 | int output; /* 0 = low, 1 = high */ |
| 68 | 68 | |
| 69 | | INT32 gate; /* gate input (0 = low, 1 = high) */ |
| 70 | | INT32 latched_count; /* number of bytes of count latched */ |
| 71 | | INT32 latched_status; /* 1 = status latched (8254 only) */ |
| 72 | | INT32 null_count; /* 1 = mode control or count written, 0 = count loaded */ |
| 73 | | INT32 phase; /* see phase definition tables in simulate2(), below */ |
| 74 | | |
| 75 | | UINT32 cycles_to_output; /* cycles until output callback called */ |
| 69 | int gate; /* gate input (0 = low, 1 = high) */ |
| 70 | int latched_count; /* number of bytes of count latched */ |
| 71 | int latched_status; /* 1 = status latched (8254 only) */ |
| 72 | int null_count; /* 1 = mode control or count written, 0 = count loaded */ |
| 73 | int phase; /* see phase definition tables in simulate2(), below */ |
| 76 | 74 | }; |
| 77 | 75 | |
| 78 | 76 | class pit8253_device : public device_t |
| r31650 | r31651 | |
| 125 | 123 | |
| 126 | 124 | private: |
| 127 | 125 | int pit8253_gate(pit8253_timer *timer); |
| 128 | | void decrease_counter_value(pit8253_timer *timer, UINT64 cycles); |
| 126 | void decrease_counter_value(pit8253_timer *timer, INT64 cycles); |
| 129 | 127 | void load_counter_value(pit8253_timer *timer); |
| 130 | 128 | void set_output(pit8253_timer *timer, int output); |
| 131 | 129 | void simulate2(pit8253_timer *timer, INT64 elapsed_cycles); |
trunk/src/emu/cpu/i86/i186.c
| r31650 | r31651 | |
| 1032 | 1032 | t->int_timer->adjust(attotime::never, which); |
| 1033 | 1033 | break; |
| 1034 | 1034 | } |
| 1035 | |
| 1035 | 1036 | default: |
| 1036 | 1037 | break; |
| 1037 | 1038 | } |
| r31650 | r31651 | |
| 1052 | 1053 | struct timer_state *t = &m_timer[which]; |
| 1053 | 1054 | |
| 1054 | 1055 | t->count++; |
| 1055 | | if(t->control & 2) |
| 1056 | if (t->control & 2) |
| 1056 | 1057 | { |
| 1057 | | if(t->count == (t->active_count ? t->maxB : t->maxA)) |
| 1058 | if (t->count == (t->active_count ? t->maxB : t->maxA)) |
| 1058 | 1059 | device_timer(*t->int_timer, which, which, NULL); |
| 1059 | 1060 | } |
| 1060 | | else if(t->count == t->maxA) |
| 1061 | else if (t->count == t->maxA) |
| 1061 | 1062 | device_timer(*t->int_timer, which, which, NULL); |
| 1062 | 1063 | } |
| 1063 | 1064 | |
| r31650 | r31651 | |
| 1088 | 1089 | internal_timer_sync(which); |
| 1089 | 1090 | update_int_timer = 1; |
| 1090 | 1091 | } |
| 1092 | |
| 1091 | 1093 | t->maxA = new_maxA; |
| 1094 | |
| 1092 | 1095 | if (new_maxA == 0) |
| 1093 | 1096 | { |
| 1094 | | new_maxA = 0x10000; |
| 1097 | new_maxA = 0x10000; |
| 1095 | 1098 | } |
| 1096 | 1099 | } |
| 1097 | 1100 | |
| r31650 | r31651 | |
| 1108 | 1111 | |
| 1109 | 1112 | if (new_maxB == 0) |
| 1110 | 1113 | { |
| 1111 | | new_maxB = 0x10000; |
| 1114 | new_maxB = 0x10000; |
| 1112 | 1115 | } |
| 1113 | 1116 | } |
| 1114 | 1117 | |
| 1115 | | |
| 1116 | 1118 | /* handle control changes */ |
| 1117 | 1119 | if (new_control != -1) |
| 1118 | 1120 | { |
| r31650 | r31651 | |
| 1367 | 1369 | case 0x30: |
| 1368 | 1370 | if (LOG_PORTS) logerror("%05X:read 80186 Timer %d count\n", pc(), (offset - 0x28) / 4); |
| 1369 | 1371 | which = (offset - 0x28) / 4; |
| 1370 | | if (!(offset & 1)) |
| 1372 | if (ACCESSING_BITS_0_7) |
| 1371 | 1373 | internal_timer_sync(which); |
| 1372 | 1374 | return m_timer[which].count; |
| 1373 | 1375 | |
| r31650 | r31651 | |
| 1466 | 1468 | WRITE16_MEMBER(i80186_cpu_device::internal_port_w) |
| 1467 | 1469 | { |
| 1468 | 1470 | int which; |
| 1469 | | |
| 1471 | |
| 1470 | 1472 | switch (offset) |
| 1471 | 1473 | { |
| 1472 | 1474 | case 0x11: |
| r31650 | r31651 | |
| 1670 | 1672 | { |
| 1671 | 1673 | UINT32 newmap = (data & 0xfff) << 8; |
| 1672 | 1674 | UINT32 oldmap = (m_reloc & 0xfff) << 8; |
| 1673 | | if(!(data & 0x1000) || ((data & 0x1000) && (m_reloc & 0x1000))) |
| 1675 | if (!(data & 0x1000) || ((data & 0x1000) && (m_reloc & 0x1000))) |
| 1674 | 1676 | m_program->unmap_readwrite(oldmap, oldmap + 0xff); |
| 1675 | | if(data & 0x1000) // TODO: make work with 80188 if needed |
| 1677 | if (data & 0x1000) // TODO: make work with 80188 if needed |
| 1676 | 1678 | m_program->install_readwrite_handler(newmap, newmap + 0xff, read16_delegate(FUNC(i80186_cpu_device::internal_port_r), this), write16_delegate(FUNC(i80186_cpu_device::internal_port_w), this)); |
| 1677 | 1679 | } |
| 1678 | 1680 | m_reloc = data; |
trunk/src/mame/audio/leland.c
| r31650 | r31651 | |
| 124 | 124 | |
| 125 | 125 | WRITE_LINE_MEMBER(leland_80186_sound_device::i80186_tmr1_w) |
| 126 | 126 | { |
| 127 | | if(state) |
| 127 | if (state) |
| 128 | 128 | { |
| 129 | | if(m_ext_active && (m_ext_start < m_ext_stop)) |
| 129 | if (m_ext_active && (m_ext_start < m_ext_stop)) |
| 130 | 130 | { |
| 131 | 131 | m_dac_sample[7] = (m_ext_base[m_ext_start] << 8) - 0x8000; |
| 132 | 132 | m_ext_start++; |
| r31650 | r31651 | |
| 248 | 248 | m_audiocpu = downcast<i80186_cpu_device *>(machine().device("audiocpu")); |
| 249 | 249 | |
| 250 | 250 | /* determine which sound hardware is installed */ |
| 251 | | if(m_type == TYPE_WSF) |
| 251 | if (m_type == TYPE_WSF) |
| 252 | 252 | m_ext_base = machine().root_device().memregion("dac")->base(); |
| 253 | 253 | |
| 254 | 254 | m_dac_timer = timer_alloc(); |
| r31650 | r31651 | |
| 257 | 257 | void leland_80186_sound_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
| 258 | 258 | { |
| 259 | 259 | INT32 out = 0; |
| 260 | | for(int i = 0; i < 8; i++) |
| 260 | for (int i = 0; i < 8; i++) |
| 261 | 261 | out += m_dac_sample[i] * m_dac_volume[i]; |
| 262 | | m_dac->write(out>>10); |
| 262 | |
| 263 | m_dac->write(out >> 10); |
| 263 | 264 | } |
| 264 | 265 | |
| 265 | 266 | void leland_80186_sound_device::device_reset() |
| r31650 | r31651 | |
| 324 | 325 | |
| 325 | 326 | WRITE16_MEMBER(leland_80186_sound_device::peripheral_ctrl) |
| 326 | 327 | { |
| 327 | | switch(offset) |
| 328 | switch (offset) |
| 328 | 329 | { |
| 329 | 330 | case 2: |
| 330 | 331 | m_peripheral = data; |
| 331 | 332 | break; |
| 333 | |
| 332 | 334 | case 4: |
| 333 | 335 | { |
| 334 | 336 | UINT32 temp = (m_peripheral & 0xffc0) << 4; |
| r31650 | r31651 | |
| 343 | 345 | } |
| 344 | 346 | break; |
| 345 | 347 | } |
| 348 | |
| 346 | 349 | default: |
| 347 | 350 | break; |
| 348 | 351 | } |
| r31650 | r31651 | |
| 494 | 497 | /* handle value changes */ |
| 495 | 498 | if (ACCESSING_BITS_0_7) |
| 496 | 499 | { |
| 497 | | m_dac_sample[which] = (data << 8) - 0x8000; |
| 500 | m_dac_sample[which] = (data << 8 & 0xff00) - 0x8000; |
| 498 | 501 | m_clock_active &= ~(1<<which); |
| 499 | 502 | } |
| 500 | 503 | |
| r31650 | r31651 | |
| 535 | 538 | if (ACCESSING_BITS_0_7) |
| 536 | 539 | dac_w(space, 1, data, mem_mask); |
| 537 | 540 | return; |
| 541 | |
| 542 | default: |
| 543 | break; |
| 538 | 544 | } |
| 539 | 545 | |
| 540 | 546 | /* if we have a YM2151 (and an external DAC), handle those offsets */ |
| r31650 | r31651 | |
| 565 | 571 | m_ext_stop <<= 4; |
| 566 | 572 | if (LOG_EXTERN) logerror("External DAC stop = %05X\n", m_ext_stop); |
| 567 | 573 | return; |
| 574 | |
| 575 | default: |
| 576 | break; |
| 568 | 577 | } |
| 569 | 578 | } |
| 570 | 579 | logerror("%05X:Unexpected peripheral write %d/%02X = %02X\n", m_audiocpu->device_t::safe_pc(), 5, offset, data); |
| r31650 | r31651 | |
| 601 | 610 | return main_to_sound_comm_r(space, offset, mem_mask); |
| 602 | 611 | |
| 603 | 612 | case 2: |
| 604 | | if(mem_mask == 0xff00) |
| 605 | | return 0xffff; |
| 606 | | return m_pit0->read(space, offset & 3); |
| 613 | if (mem_mask != 0xff00) |
| 614 | return m_pit0->read(space, offset & 3); |
| 615 | break; |
| 607 | 616 | |
| 608 | 617 | case 3: |
| 609 | 618 | if (m_type <= TYPE_REDLINE) |
| 610 | 619 | { |
| 611 | | if(mem_mask == 0xff00) |
| 612 | | return 0xffff; |
| 613 | | return m_pit1->read(space, offset & 3); |
| 620 | if (mem_mask != 0xff00) |
| 621 | return m_pit1->read(space, offset & 3); |
| 614 | 622 | } |
| 615 | | else if(m_type == TYPE_WSF) |
| 623 | else if (m_type == TYPE_WSF) |
| 616 | 624 | return m_ymsnd->read(space, offset); |
| 617 | 625 | break; |
| 618 | 626 | |
| 619 | 627 | case 4: |
| 620 | 628 | if (m_type == TYPE_REDLINE) |
| 621 | 629 | { |
| 622 | | if(mem_mask == 0xff00) |
| 623 | | return 0xffff; |
| 624 | | return m_pit2->read(space, offset & 3); |
| 630 | if (mem_mask != 0xff00) |
| 631 | return m_pit2->read(space, offset & 3); |
| 625 | 632 | } |
| 626 | 633 | else |
| 627 | 634 | logerror("%05X:Unexpected peripheral read %d/%02X\n", m_audiocpu->device_t::safe_pc(), select, offset*2); |
| r31650 | r31651 | |
| 647 | 654 | break; |
| 648 | 655 | |
| 649 | 656 | case 2: |
| 650 | | if(mem_mask == 0xff00) |
| 651 | | return; |
| 652 | | m_pit0->write(space, offset & 3, data); |
| 657 | if (mem_mask != 0xff00) |
| 658 | m_pit0->write(space, offset & 3, data); |
| 653 | 659 | break; |
| 654 | 660 | |
| 655 | 661 | case 3: |
| 656 | 662 | if (m_type <= TYPE_REDLINE) |
| 657 | 663 | { |
| 658 | | if(mem_mask == 0xff00) |
| 659 | | return; |
| 660 | | m_pit1->write(space, offset & 3, data); |
| 664 | if (mem_mask != 0xff00) |
| 665 | m_pit1->write(space, offset & 3, data); |
| 661 | 666 | } |
| 662 | 667 | else if(m_type == TYPE_WSF) |
| 663 | 668 | m_ymsnd->write(space, offset, data); |
| r31650 | r31651 | |
| 666 | 671 | case 4: |
| 667 | 672 | if (m_type == TYPE_REDLINE) |
| 668 | 673 | { |
| 669 | | if(mem_mask == 0xff00) |
| 670 | | return; |
| 671 | | m_pit2->write(space, offset & 3, data); |
| 674 | if (mem_mask != 0xff00) |
| 675 | m_pit2->write(space, offset & 3, data); |
| 672 | 676 | } |
| 673 | | else if(mem_mask == 0xffff) |
| 677 | else if (mem_mask == 0xffff) |
| 674 | 678 | { |
| 675 | 679 | m_dac_sample[6] = (data << 6) - 0x8000; |
| 676 | 680 | m_clock_active &= ~(1<<6); |
| r31650 | r31651 | |
| 678 | 682 | break; |
| 679 | 683 | |
| 680 | 684 | case 5: /* Ataxx/WSF/Indy Heat only */ |
| 681 | | if(m_type > TYPE_REDLINE) |
| 685 | if (m_type > TYPE_REDLINE) |
| 682 | 686 | ataxx_dac_control(space, offset, data, mem_mask); |
| 683 | 687 | break; |
| 684 | 688 | |