src/mame/audio/gyruss.c
| r2462 | r2463 | |
| 1 | | #include "driver.h" |
| 2 | | #include "deprecat.h" |
| 3 | | #include "cpu/i8039/i8039.h" |
| 4 | | #include "sound/flt_rc.h" |
| 5 | | |
| 6 | | |
| 7 | | |
| 8 | | /* The timer clock which feeds the upper 4 bits of */ |
| 9 | | /* AY-3-8910 port A is based on the same clock */ |
| 10 | | /* feeding the sound CPU Z80. It is a divide by */ |
| 11 | | /* 10240, formed by a standard divide by 1024, */ |
| 12 | | /* followed by a divide by 10 using a 4 bit */ |
| 13 | | /* bi-quinary count sequence. (See LS90 data sheet */ |
| 14 | | /* for an example). */ |
| 15 | | /* */ |
| 16 | | /* Bit 0 comes from the output of the divide by 1024 */ |
| 17 | | /* 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 */ |
| 18 | | /* Bit 1 comes from the QC output of the LS90 producing a sequence of */ |
| 19 | | /* 0, 0, 1, 1, 0, 0, 1, 1, 1, 0 */ |
| 20 | | /* Bit 2 comes from the QD output of the LS90 producing a sequence of */ |
| 21 | | /* 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 */ |
| 22 | | /* Bit 3 comes from the QA output of the LS90 producing a sequence of */ |
| 23 | | /* 0, 0, 0, 0, 0, 1, 1, 1, 1, 1 */ |
| 24 | | |
| 25 | | static const int gyruss_timer[10] = |
| 26 | | { |
| 27 | | 0x00, 0x01, 0x02, 0x03, 0x04, 0x09, 0x0a, 0x0b, 0x0a, 0x0d |
| 28 | | }; |
| 29 | | |
| 30 | | READ8_HANDLER( gyruss_portA_r ) |
| 31 | | { |
| 32 | | return gyruss_timer[(activecpu_gettotalcycles()/1024) % 10]; |
| 33 | | } |
| 34 | | |
| 35 | | |
| 36 | | |
| 37 | | static void filter_w(int chip,int data) |
| 38 | | { |
| 39 | | int i; |
| 40 | | |
| 41 | | |
| 42 | | for (i = 0;i < 3;i++) |
| 43 | | { |
| 44 | | int C; |
| 45 | | |
| 46 | | |
| 47 | | C = 0; |
| 48 | | if (data & 1) C += 47000; /* 47000pF = 0.047uF */ |
| 49 | | if (data & 2) C += 220000; /* 220000pF = 0.22uF */ |
| 50 | | data >>= 2; |
| 51 | | filter_rc_set_RC(3*chip + i,FLT_RC_LOWPASS, 1000,2200,200,CAP_P(C)); |
| 52 | | } |
| 53 | | } |
| 54 | | |
| 55 | | WRITE8_HANDLER( gyruss_filter0_w ) |
| 56 | | { |
| 57 | | filter_w(0,data); |
| 58 | | } |
| 59 | | |
| 60 | | WRITE8_HANDLER( gyruss_filter1_w ) |
| 61 | | { |
| 62 | | filter_w(1,data); |
| 63 | | } |
| 64 | | |
| 65 | | |
| 66 | | WRITE8_HANDLER( gyruss_sh_irqtrigger_w ) |
| 67 | | { |
| 68 | | /* writing to this register triggers IRQ on the sound CPU */ |
| 69 | | cpunum_set_input_line_and_vector(Machine, 2,0,HOLD_LINE,0xff); |
| 70 | | } |
| 71 | | |
| 72 | | WRITE8_HANDLER( gyruss_i8039_irq_w ) |
| 73 | | { |
| 74 | | cpunum_set_input_line(Machine, 3, 0, PULSE_LINE); |
| 75 | | } |