src/mess/audio/vic6560.c
| r3167 | r3168 | |
| 14 | 14 | #include "video/vic6560.h" |
| 15 | 15 | |
| 16 | 16 | |
| 17 | #define VERBOSE_LEVEL 0 |
| 18 | #define DBG_LOG(N,M,A) \ |
| 19 | { \ |
| 20 | if(VERBOSE_LEVEL >= N) \ |
| 21 | { \ |
| 22 | if( M ) \ |
| 23 | logerror("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) M ); \ |
| 24 | logerror A; \ |
| 25 | } \ |
| 26 | } |
| 27 | |
| 28 | |
| 17 | 29 | /* |
| 18 | 30 | * assumed model: |
| 19 | 31 | * each write to a ton/noise generated starts it new |
| r3167 | r3168 | |
| 82 | 94 | if (tone1samples == 0) |
| 83 | 95 | tone1samples = 1; |
| 84 | 96 | } |
| 85 | | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vic6560"); |
| 86 | | mame_printf_debug("tone1 %.2x %d\n", data, TONE1_FREQUENCY); |
| 97 | DBG_LOG (1, "vic6560", ("tone1 %.2x %d\n", data, TONE1_FREQUENCY)); |
| 87 | 98 | break; |
| 88 | 99 | case 0xb: |
| 89 | 100 | vic6560[offset] = data; |
| r3167 | r3168 | |
| 94 | 105 | if (tone2samples == 0) |
| 95 | 106 | tone2samples = 1; |
| 96 | 107 | } |
| 97 | | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vic6560"); |
| 98 | | mame_printf_debug("tone2 %.2x %d\n", data, TONE2_FREQUENCY); |
| 108 | DBG_LOG (1, "vic6560", ("tone2 %.2x %d\n", data, TONE2_FREQUENCY)); |
| 99 | 109 | break; |
| 100 | 110 | case 0xc: |
| 101 | 111 | vic6560[offset] = data; |
| r3167 | r3168 | |
| 106 | 116 | if (tone2samples == 0) |
| 107 | 117 | tone2samples = 1; |
| 108 | 118 | } |
| 109 | | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vic6560"); |
| 110 | | mame_printf_debug("tone3 %.2x %d\n", data, TONE3_FREQUENCY); |
| 119 | DBG_LOG (1, "vic6560", ("tone3 %.2x %d\n", data, TONE3_FREQUENCY)); |
| 111 | 120 | break; |
| 112 | 121 | case 0xd: |
| 113 | 122 | vic6560[offset] = data; |
| r3167 | r3168 | |
| 115 | 124 | { |
| 116 | 125 | noisesamples = (int) ((double) NOISE_FREQUENCY_MAX * machine->sample_rate |
| 117 | 126 | * NOISE_BUFFER_SIZE_SEC / NOISE_FREQUENCY); |
| 118 | | |
| 119 | | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vic6560"); |
| 120 | | mame_printf_debug("noise %.2x %d sample:%d\n", data, NOISE_FREQUENCY, noisesamples); |
| 121 | | |
| 127 | DBG_LOG (1, "vic6560", ("noise %.2x %d sample:%d\n", |
| 128 | data, NOISE_FREQUENCY, noisesamples)); |
| 122 | 129 | if ((double) noisepos / noisesamples >= 1.0) |
| 123 | 130 | { |
| 124 | 131 | noisepos = 0; |
| r3167 | r3168 | |
| 131 | 138 | break; |
| 132 | 139 | case 0xe: |
| 133 | 140 | vic6560[offset] = (old & ~0xf) | (data & 0xf); |
| 134 | | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "vic6560"); |
| 135 | | mame_printf_debug("volume %d\n", data & 0xf); |
| 141 | DBG_LOG (3, "vic6560", ("volume %d\n", data & 0xf)); |
| 136 | 142 | break; |
| 137 | 143 | } |
| 138 | 144 | } |
src/mess/audio/t6721.c
| r3167 | r3168 | |
| 19 | 19 | |
| 20 | 20 | #include "machine/tpi6525.h" |
| 21 | 21 | |
| 22 | |
| 23 | #define VERBOSE_LEVEL 0 |
| 24 | #define DBG_LOG(N,M,A) \ |
| 25 | { \ |
| 26 | if(VERBOSE_LEVEL >= N) \ |
| 27 | { \ |
| 28 | if( M ) \ |
| 29 | logerror("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) M ); \ |
| 30 | logerror A; \ |
| 31 | } \ |
| 32 | } |
| 33 | |
| 34 | |
| 35 | |
| 22 | 36 | /* |
| 23 | 37 | c364 speech |
| 24 | 38 | say 0 .. 10 |
| r3167 | r3168 | |
| 102 | 116 | |
| 103 | 117 | WRITE8_HANDLER(c364_speech_w) |
| 104 | 118 | { |
| 105 | | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "364"); |
| 106 | | mame_printf_debug("port write %.2x %.2x\n", offset, data); |
| 107 | | |
| 119 | DBG_LOG (2, "364", ("port write %.2x %.2x\n", offset, data)); |
| 108 | 120 | switch (offset) { |
| 109 | 121 | case 0: |
| 110 | 122 | if (data&0x80) { |
| r3167 | r3168 | |
| 151 | 163 | break; |
| 152 | 164 | case 2: |
| 153 | 165 | speech.sample.data[speech.sample.index++]=data; |
| 154 | | if (speech.sample.index==sizeof(speech.sample.data)) |
| 155 | | { |
| 156 | | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "t6721"); |
| 157 | | mame_printf_debug("%.2x%.2x%.2x%.2x%.2x%.2x\n", speech.sample.data[0], speech.sample.data[1], |
| 158 | | speech.sample.data[2], speech.sample.data[3], speech.sample.data[4], speech.sample.data[5]); |
| 166 | if (speech.sample.index==sizeof(speech.sample.data)) { |
| 167 | DBG_LOG(1,"t6721",("%.2x%.2x%.2x%.2x%.2x%.2x\n", |
| 168 | speech.sample.data[0], |
| 169 | speech.sample.data[1], |
| 170 | speech.sample.data[2], |
| 171 | speech.sample.data[3], |
| 172 | speech.sample.data[4], |
| 173 | speech.sample.data[5])); |
| 159 | 174 | speech.sample.index=0; |
| 160 | 175 | /*speech.endOfSample=false; */ |
| 161 | 176 | speech.busy=TRUE; |
| r3167 | r3168 | |
| 178 | 193 | } |
| 179 | 194 | break; |
| 180 | 195 | } |
| 181 | | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "364"); |
| 182 | | mame_printf_debug("port read %.2x %.2x\n", offset, data); |
| 196 | DBG_LOG (2, "364", ("port read %.2x %.2x\n", offset, data)); |
| 183 | 197 | return data; |
| 184 | 198 | } |
| 199 | |
| 200 | |
src/mess/audio/ted7360.c
| r3167 | r3168 | |
| 14 | 14 | #include "video/ted7360.h" |
| 15 | 15 | |
| 16 | 16 | |
| 17 | #define VERBOSE_LEVEL 0 |
| 18 | #define DBG_LOG(N,M,A) \ |
| 19 | { \ |
| 20 | if(VERBOSE_LEVEL >= N) \ |
| 21 | { \ |
| 22 | if( M ) \ |
| 23 | logerror("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) M ); \ |
| 24 | logerror A; \ |
| 25 | } \ |
| 26 | } |
| 27 | |
| 28 | |
| 17 | 29 | /* noise channel: look into vic6560.c */ |
| 18 | 30 | #define NOISE_BUFFER_SIZE_SEC 5 |
| 19 | 31 | |
| r3167 | r3168 | |
| 55 | 67 | else |
| 56 | 68 | ted7360[offset] = data; |
| 57 | 69 | tone1samples = machine->sample_rate / TONE_FREQUENCY (TONE1_VALUE); |
| 58 | | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "ted7360"); |
| 59 | | mame_printf_debug("tone1 %d %d sample:%d\n", TONE1_VALUE, TONE_FREQUENCY(TONE1_VALUE), tone1samples); |
| 70 | DBG_LOG (1, "ted7360", ("tone1 %d %d sample:%d\n", |
| 71 | TONE1_VALUE, TONE_FREQUENCY(TONE1_VALUE), tone1samples)); |
| 60 | 72 | |
| 61 | 73 | break; |
| 62 | 74 | case 0xf: |
| 63 | 75 | case 0x10: |
| 64 | 76 | ted7360[offset] = data; |
| 65 | 77 | tone2samples = machine->sample_rate / TONE_FREQUENCY (TONE2_VALUE); |
| 66 | | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "ted7360"); |
| 67 | | mame_printf_debug("tone2 %d %d sample:%d\n", TONE2_VALUE, TONE_FREQUENCY(TONE2_VALUE), tone2samples); |
| 78 | DBG_LOG (1, "ted7360", ("tone2 %d %d sample:%d\n", |
| 79 | TONE2_VALUE, TONE_FREQUENCY(TONE2_VALUE), tone2samples)); |
| 68 | 80 | |
| 69 | 81 | noisesamples = (int) ((double) NOISE_FREQUENCY_MAX * machine->sample_rate |
| 70 | 82 | * NOISE_BUFFER_SIZE_SEC / NOISE_FREQUENCY); |
| 71 | | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "ted7360"); |
| 72 | | mame_printf_debug("noise %d sample:%d\n", NOISE_FREQUENCY, noisesamples); |
| 83 | DBG_LOG (1, "ted7360", ("noise %d sample:%d\n", |
| 84 | NOISE_FREQUENCY, noisesamples)); |
| 73 | 85 | if (!NOISE_ON || ((double) noisepos / noisesamples >= 1.0)) |
| 74 | 86 | { |
| 75 | 87 | noisepos = 0; |
| r3167 | r3168 | |
| 77 | 89 | break; |
| 78 | 90 | case 0x11: |
| 79 | 91 | ted7360[offset] = data; |
| 80 | | |
| 81 | | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "ted7360"); |
| 82 | | mame_printf_debug("%s volume %d, %s %s %s\n", TONE_ON?"on":"off", VOLUME, |
| 83 | | TONE1_ON?"tone1":"", TONE2_ON?"tone2":"", NOISE_ON?"noise":""); |
| 84 | | |
| 92 | DBG_LOG(1, "ted7360", ("%s volume %d, %s %s %s\n", |
| 93 | TONE_ON?"on":"off", |
| 94 | VOLUME, TONE1_ON?"tone1":"", TONE2_ON?"tone2":"", |
| 95 | NOISE_ON?"noise":"")); |
| 85 | 96 | if (!TONE_ON||!TONE1_ON) tone1pos=0; |
| 86 | 97 | if (!TONE_ON||!TONE2_ON) tone2pos=0; |
| 87 | 98 | if (!TONE_ON||!NOISE_ON) noisepos=0; |
| r3167 | r3168 | |
| 185 | 196 | } |
| 186 | 197 | return (void *) ~0; |
| 187 | 198 | } |
| 199 | |
src/mess/machine/tpi6525.c
| r3167 | r3168 | |
| 76 | 76 | |
| 77 | 77 | #include "tpi6525.h" |
| 78 | 78 | |
| 79 | |
| 80 | #define VERBOSE_LEVEL 0 |
| 81 | #define DBG_LOG(N,M,A) \ |
| 82 | { \ |
| 83 | if(VERBOSE_LEVEL >= N) \ |
| 84 | { \ |
| 85 | if( M ) \ |
| 86 | logerror("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) M ); \ |
| 87 | logerror A; \ |
| 88 | } \ |
| 89 | } |
| 90 | |
| 91 | |
| 79 | 92 | TPI6525 tpi6525[4]={ |
| 80 | 93 | { 0 }, |
| 81 | 94 | { 1 }, |
| r3167 | r3168 | |
| 113 | 126 | { |
| 114 | 127 | if (!This->interrupt.level && (This->air!=0)) { |
| 115 | 128 | This->interrupt.level=1; |
| 116 | | |
| 117 | | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "tpi6525"); |
| 118 | | mame_printf_debug("%d set interrupt\n",This->number); |
| 119 | | |
| 129 | DBG_LOG (3, "tpi6525",("%d set interrupt\n",This->number)); |
| 120 | 130 | if (This->interrupt.output!=NULL) |
| 121 | 131 | This->interrupt.output(machine, This->interrupt.level); |
| 122 | 132 | } |
| r3167 | r3168 | |
| 126 | 136 | { |
| 127 | 137 | if (This->interrupt.level && (This->air==0)) { |
| 128 | 138 | This->interrupt.level=0; |
| 129 | | |
| 130 | | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "tpi6525"); |
| 131 | | mame_printf_debug("%d clear interrupt\n",This->number); |
| 132 | | |
| 139 | DBG_LOG (3, "tpi6525",("%d clear interrupt\n",This->number)); |
| 133 | 140 | if (This->interrupt.output!=NULL) |
| 134 | 141 | This->interrupt.output(machine, This->interrupt.level); |
| 135 | 142 | } |
| r3167 | r3168 | |
| 269 | 276 | if (This->c.read) data&=This->c.read(); |
| 270 | 277 | data=(data&~This->c.ddr)|(This->c.ddr&This->c.port); |
| 271 | 278 | } |
| 272 | | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "tpi6525"); |
| 273 | | mame_printf_debug("%d read %.2x %.2x\n",This->number, offset,data); |
| 279 | DBG_LOG (2, "tpi6525", |
| 280 | ("%d read %.2x %.2x\n",This->number, offset,data)); |
| 274 | 281 | break; |
| 275 | 282 | case 3: |
| 276 | 283 | data=This->a.ddr; |
| r3167 | r3168 | |
| 309 | 316 | tpi6525_clear_interrupt(machine, This); |
| 310 | 317 | break; |
| 311 | 318 | } |
| 312 | | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "tpi6525"); |
| 313 | | mame_printf_debug("%d read %.2x %.2x\n",This->number, offset,data); |
| 319 | DBG_LOG (3, "tpi6525", |
| 320 | ("%d read %.2x %.2x\n",This->number, offset,data)); |
| 314 | 321 | return data; |
| 315 | 322 | } |
| 316 | 323 | |
| 317 | 324 | static void tpi6525_port_w(running_machine *machine, TPI6525 *This, int offset, int data) |
| 318 | 325 | { |
| 319 | | mame_printf_debug("%11.6f: %-24s", attotime_to_double(timer_get_time()), (char*) "tpi6525"); |
| 320 | | mame_printf_debug("%d write %.2x %.2x\n",This->number, offset,data); |
| 326 | DBG_LOG (2, "tpi6525", |
| 327 | ("%d write %.2x %.2x\n",This->number, offset,data)); |
| 321 | 328 | |
| 322 | 329 | switch (offset&7) { |
| 323 | 330 | case 0: |