src/mame/machine/archimds.c
| r8890 | r8891 | |
| 135 | 135 | static TIMER_CALLBACK( vidc_audio_tick ) |
| 136 | 136 | { |
| 137 | 137 | address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 138 | INT16 res; |
| 138 | 139 | |
| 139 | | dac_signed_data_w(space->machine->device("dac"), (space->read_byte(vidc_sndstart+vidc_sndcur))); |
| 140 | res = (space->read_word(vidc_sndstart+vidc_sndcur)); |
| 140 | 141 | |
| 142 | dac_signed_data_w(space->machine->device("dac"), res); |
| 143 | |
| 141 | 144 | vidc_sndcur++; |
| 142 | 145 | |
| 143 | | if (vidc_sndcur >= (vidc_sndend-vidc_sndstart)+0x10) |
| 146 | if (vidc_sndcur >= (vidc_sndend-vidc_sndstart)+0x40) |
| 144 | 147 | { |
| 145 | 148 | vidc_sndcur = 0; |
| 146 | 149 | archimedes_request_irq_b(machine, ARCHIMEDES_IRQB_SOUND_EMPTY); |
| r8890 | r8891 | |
| 148 | 151 | if(!audio_dma_on) |
| 149 | 152 | { |
| 150 | 153 | timer_adjust_oneshot(snd_timer, attotime_never, 0); |
| 151 | | dac_signed_data_w(space->machine->device("dac"), 0x80); |
| 154 | dac_signed_data_16_w(space->machine->device("dac"), 0x8000); |
| 152 | 155 | } |
| 153 | 156 | } |
| 154 | 157 | } |
| r8890 | r8891 | |
| 860 | 863 | case 5: /* sound end */ |
| 861 | 864 | //logerror("MEMC: SNDEND %08x\n",data); |
| 862 | 865 | vidc_sndend = 0x2000000 | ((data>>2)&0x7fff)*16; |
| 866 | break; |
| 867 | |
| 868 | case 6: |
| 869 | vidc_sndcur = 0; |
| 863 | 870 | archimedes_request_irq_b(space->machine, ARCHIMEDES_IRQB_SOUND_EMPTY); |
| 864 | 871 | break; |
| 865 | 872 | |
| r8890 | r8891 | |
| 882 | 889 | double sndhz; |
| 883 | 890 | |
| 884 | 891 | /* FIXME: is the frequency correct? */ |
| 885 | | sndhz = (250000.0) / (double)((vidc_regs[0xc0]&0xff)+2); |
| 892 | sndhz = (250000.0 * 4) / (double)((vidc_regs[0xc0]&0xff)+2); |
| 886 | 893 | |
| 887 | 894 | printf("MEMC: Starting audio DMA at %f Hz, buffer from %x to %x\n", sndhz, vidc_sndstart, vidc_sndend); |
| 888 | 895 | |
| 889 | | vidc_sndcur = 0; |
| 890 | | |
| 891 | | timer_adjust_periodic(snd_timer, ATTOTIME_IN_HZ(sndhz), 0, ATTOTIME_IN_HZ(sndhz)); |
| 896 | timer_adjust_periodic(snd_timer, attotime_zero, 0, ATTOTIME_IN_HZ(sndhz)); |
| 892 | 897 | } |
| 893 | 898 | |
| 894 | 899 | break; |