src/mess/drivers/esq1.c
| r6651 | r6652 | |
| 5 | 5 | Ensoniq ESQ-1 and SQ-80 Digital Wave Synthesizers |
| 6 | 6 | Preliminary driver by R. Belmont |
| 7 | 7 | |
| 8 | | Map for ESQ-1: |
| 9 | | 0000-1fff: OS RAM |
| 10 | | 2000-3fff: Cartridge |
| 11 | | 4000-5fff: SEQRAM |
| 12 | | 6000-63ff: ES5503 DOC |
| 13 | | 6400-67ff: MC2681 DUART |
| 14 | | 6800-6fff: AD7524 (CV_MUX) |
| 15 | | 7000-7fff: OS ROM low (banked) |
| 16 | | 8000-ffff: OS ROM high (fixed) |
| 8 | Map for ESQ-1: |
| 9 | 0000-1fff: OS RAM |
| 10 | 2000-3fff: Cartridge |
| 11 | 4000-5fff: SEQRAM |
| 12 | 6000-63ff: ES5503 DOC |
| 13 | 6400-67ff: MC2681 DUART |
| 14 | 6800-6fff: AD7524 (CV_MUX) |
| 15 | 7000-7fff: OS ROM low (banked) |
| 16 | 8000-ffff: OS ROM high (fixed) |
| 17 | 17 | |
| 18 | | Map for SQ-80: |
| 19 | | 0000-1fff: OS RAM |
| 20 | | 2000-3fff: Cartridge |
| 21 | | 4000-5fff: DOSRAM or SEQRAM (banked) |
| 22 | | 6000-63ff: ES5503 DOC |
| 23 | | 6400-67ff: MC2681 DUART |
| 24 | | 6800-6bff: AD7524 (CV_MUX) |
| 25 | | 6c00-6dff: Mapper (bit 0 only - determines DOSRAM or SEQRAM at 4000) |
| 26 | | 6e00-6fff: WD1772 FDC (not present on ESQ1) |
| 27 | | 7000-7fff: OS ROM low (banked) |
| 28 | | 8000-ffff: OS ROM high (fixed) |
| 18 | Map for SQ-80: |
| 19 | 0000-1fff: OS RAM |
| 20 | 2000-3fff: Cartridge |
| 21 | 4000-5fff: DOSRAM or SEQRAM (banked) |
| 22 | 6000-63ff: ES5503 DOC |
| 23 | 6400-67ff: MC2681 DUART |
| 24 | 6800-6bff: AD7524 (CV_MUX) |
| 25 | 6c00-6dff: Mapper (bit 0 only - determines DOSRAM or SEQRAM at 4000) |
| 26 | 6e00-6fff: WD1772 FDC (not present on ESQ1) |
| 27 | 7000-7fff: OS ROM low (banked) |
| 28 | 8000-ffff: OS ROM high (fixed) |
| 29 | 29 | |
| 30 | | CV_MUX area: |
| 31 | | write to output goes to |
| 32 | | $68f8 $00 D/A converter |
| 33 | | $68f0 -$08 Filter Frequency (FF) |
| 34 | | $68e8 -$10 Filter Resonance (Q) |
| 35 | | $68d8 -$20 Final DCA (ENV4) |
| 36 | | $68b8 -$40 Panning (PAN) |
| 37 | | $6878 -$80 Floppy (Motor/LED on) |
| 30 | CV_MUX area: |
| 31 | write to output goes to |
| 32 | $68f8 $00 D/A converter |
| 33 | $68f0 -$08 Filter Frequency (FF) |
| 34 | $68e8 -$10 Filter Resonance (Q) |
| 35 | $68d8 -$20 Final DCA (ENV4) |
| 36 | $68b8 -$40 Panning (PAN) |
| 37 | $6878 -$80 Floppy (Motor/LED on) |
| 38 | 38 | |
| 39 | 39 | If SEQRAM is mapped at 4000, DUART port 2 determines the 32KB "master bank" and ports 0 and 1 |
| 40 | 40 | determine which of the 4 8KB "sub banks" is visible. |
| r6651 | r6652 | |
| 45 | 45 | NMI is from the IRQ line on the FDC (again, SQ-80 only). |
| 46 | 46 | |
| 47 | 47 | TODO: |
| 48 | | - Actual 2681 DUART emulation |
| 49 | | - VFD display |
| 50 | | - Keyboard |
| 51 | | - Analog filters and VCA on the back end of the 5503 |
| 52 | | - SQ-80 support (additional banking, FDC) |
| 48 | - VFD display |
| 49 | - Keyboard |
| 50 | - Analog filters and VCA on the back end of the 5503 |
| 51 | - SQ-80 support (additional banking, FDC) |
| 53 | 52 | |
| 54 | 53 | ***************************************************************************/ |
| 55 | 54 | |
| 56 | 55 | #include "driver.h" |
| 57 | 56 | #include "cpu/m6809/m6809.h" |
| 58 | 57 | #include "sound/es5503.h" |
| 58 | #include "machine/68681.h" |
| 59 | 59 | |
| 60 | | static UINT8 uart_regs[0x10]; |
| 61 | | static UINT8 uart_outputport; |
| 62 | | |
| 63 | 60 | static void esq1_doc_irq(const device_config *device, int state) |
| 64 | 61 | { |
| 65 | 62 | } |
| r6651 | r6652 | |
| 90 | 87 | es5503_set_base(devtag_get_device(machine, "es5503"), memory_region(machine, "ensoniq")); |
| 91 | 88 | |
| 92 | 89 | // set default OSROM banking |
| 93 | | memory_set_bankptr(machine, "bank1", memory_region(machine, "osrom") ); |
| 90 | memory_set_bankptr(machine, "osbank", memory_region(machine, "osrom") ); |
| 94 | 91 | } |
| 95 | 92 | |
| 96 | | static void recalc_osrom_bank(running_machine *machine) |
| 97 | | { |
| 98 | | int bank = ((uart_outputport >> 1) & 0x7) ^ 7; |
| 93 | static ADDRESS_MAP_START( esq1_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 94 | AM_RANGE(0x0000, 0x1fff) AM_RAM // OSRAM |
| 95 | AM_RANGE(0x4000, 0x5fff) AM_RAM // SEQRAM |
| 96 | AM_RANGE(0x6000, 0x63ff) AM_DEVREADWRITE("es5503", es5503_r, es5503_w) |
| 97 | AM_RANGE(0x6400, 0x640f) AM_DEVREADWRITE("duart", duart68681_r, duart68681_w) |
| 98 | AM_RANGE(0x7000, 0x7fff) AM_ROMBANK("osbank") |
| 99 | AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION("osrom", 0x8000) // OS "high" ROM is always mapped here |
| 100 | ADDRESS_MAP_END |
| 99 | 101 | |
| 100 | | // printf("bank %d => offset %x (PC=%x)\n", bank, bank * 0x1000, cpu_get_pc(machine->cpu[0])); |
| 101 | | memory_set_bankptr(machine, "bank1", memory_region(machine, "osrom") + (bank * 0x1000) ); |
| 102 | | } |
| 102 | // from the schematics: |
| 103 | // |
| 104 | // DUART channel A is MIDI |
| 105 | // channel B is to the keyboard/display |
| 106 | // IP0 = tape in |
| 107 | // IP1 = sequencer expansion cartridge inserted |
| 108 | // IP2 = patch cartridge inserted |
| 109 | // IP3 & 4 are 0.5 MHz, IP 5 & 6 are 1 MHz (note 0.5 MHz / 16 = MIDI baud rate) |
| 110 | // |
| 111 | // OP0 = to display processor |
| 112 | // OP1/2/3 = bank select 0, 1, and 2 |
| 113 | // OP4 = metronome low |
| 114 | // OP5 = metronome hi |
| 115 | // OP6/7 = tape out |
| 103 | 116 | |
| 104 | | static READ8_HANDLER( uart_r ) |
| 117 | static void duart_irq_handler(const device_config *device, UINT8 vector) |
| 105 | 118 | { |
| 106 | | // printf("Read UART @ %x\n", offset); |
| 119 | cputag_set_input_line(device->machine, "maincpu", 0, HOLD_LINE); |
| 120 | }; |
| 107 | 121 | |
| 108 | | switch (offset) |
| 109 | | { |
| 110 | | case 5: // interrupt status |
| 111 | | return 0x08; // timer/counter expire |
| 112 | | break; |
| 113 | | } |
| 114 | | |
| 122 | static UINT8 duart_input(const device_config *device) |
| 123 | { |
| 115 | 124 | return 0; |
| 116 | 125 | } |
| 117 | 126 | |
| 118 | | static WRITE8_HANDLER( uart_w ) |
| 127 | static void duart_output(const device_config *device, UINT8 data) |
| 119 | 128 | { |
| 120 | | uart_regs[offset] = data; |
| 129 | int bank = ((data >> 1) & 0x7); |
| 121 | 130 | |
| 122 | | // printf("%x to UART %x\n", data, offset); |
| 123 | | |
| 124 | | switch (offset) |
| 125 | | { |
| 126 | | case 0xb: |
| 127 | | // printf("%02x to 6500\n", data); |
| 128 | | break; |
| 129 | | |
| 130 | | case 0xe: // set output port bits |
| 131 | | uart_outputport |= data; |
| 132 | | recalc_osrom_bank(space->machine); |
| 133 | | break; |
| 134 | | |
| 135 | | case 0xf: // reset output port bits |
| 136 | | uart_outputport &= ~data; |
| 137 | | recalc_osrom_bank(space->machine); |
| 138 | | break; |
| 139 | | } |
| 131 | // printf("DP [%02x]: %d mlo %d mhi %d tape %d\n", data, data&1, (data>>4)&1, (data>>5)&1, (data>>6)&3); |
| 132 | // printf("[%02x] bank %d => offset %x (PC=%x)\n", data, bank, bank * 0x1000, cpu_get_pc(device->machine->firstcpu)); |
| 133 | memory_set_bankptr(device->machine, "osbank", memory_region(device->machine, "osrom") + (bank * 0x1000) ); |
| 140 | 134 | } |
| 141 | 135 | |
| 142 | | static ADDRESS_MAP_START( esq1_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 143 | | AM_RANGE(0x0000, 0x1fff) AM_RAM // OSRAM |
| 144 | | AM_RANGE(0x4000, 0x5fff) AM_RAM // SEQRAM |
| 145 | | AM_RANGE(0x6000, 0x63ff) AM_DEVREADWRITE("es5503", es5503_r, es5503_w) |
| 146 | | AM_RANGE(0x6400, 0x640f) AM_READWRITE( uart_r, uart_w ) |
| 147 | | AM_RANGE(0x7000, 0x7fff) AM_ROMBANK("bank1") |
| 148 | | AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION("osrom", 0x8000) // OS "high" ROM is always mapped here |
| 149 | | ADDRESS_MAP_END |
| 150 | | |
| 151 | | static INTERRUPT_GEN( esq1_interrupt ) |
| 136 | static void duart_tx(const device_config *device, int channel, UINT8 data) |
| 152 | 137 | { |
| 153 | | cputag_set_input_line(device->machine, "maincpu", 0, HOLD_LINE); |
| 138 | if ((data != 0) && (channel == 1)) printf("[%d]: %02x %c\n", channel, data, data); |
| 154 | 139 | } |
| 155 | 140 | |
| 141 | static const duart68681_config duart_config = |
| 142 | { |
| 143 | duart_irq_handler, |
| 144 | duart_tx, |
| 145 | duart_input, |
| 146 | duart_output, |
| 147 | |
| 148 | 500000, 500000, // IP3, IP4 |
| 149 | 1000000, 1000000, // IP5, IP6 |
| 150 | }; |
| 151 | |
| 156 | 152 | static MACHINE_DRIVER_START( esq1 ) |
| 157 | 153 | MDRV_CPU_ADD("maincpu", M6809E, 4000000) // how fast is it? |
| 158 | 154 | MDRV_CPU_PROGRAM_MAP(esq1_map) |
| 159 | | MDRV_CPU_VBLANK_INT("screen", esq1_interrupt) |
| 160 | 155 | |
| 161 | 156 | MDRV_MACHINE_RESET( esq1 ) |
| 162 | 157 | |
| 158 | MDRV_DUART68681_ADD("duart", 40000000, duart_config) |
| 159 | |
| 163 | 160 | MDRV_SCREEN_ADD("screen", RASTER) |
| 164 | 161 | MDRV_SCREEN_REFRESH_RATE(60) |
| 165 | 162 | MDRV_VIDEO_START(esq1) |
| r6651 | r6652 | |
| 189 | 186 | ROM_END |
| 190 | 187 | |
| 191 | 188 | CONS( 1987, esq1, 0, 0, esq1, esq1, 0, 0, "Ensoniq", "ESQ-1", GAME_NOT_WORKING ) |
| 192 | | |
| 193 | | /* |
| 194 | | |
| 195 | | 7 to UART 6 counter/timer upper |
| 196 | | d0 to UART 7 counter/timer lower |
| 197 | | 60 to UART 4 aux control (C/T timer mode using external clock) |
| 198 | | 20 to UART a command register B |
| 199 | | 30 to UART a command register B |
| 200 | | 10 to UART a command register B |
| 201 | | 13 to UART 8 mode register B => 8 bits no parity |
| 202 | | f to UART 8 mode register B => force odd parity, 8 bits (?) |
| 203 | | ee to UART 9 clock select register B |
| 204 | | 5 to UART a command register B (Enable Tx/Enable Rx) |
| 205 | | e7 to UART b Tx holding register B (send E7 to display) |
| 206 | | 0 to UART d output port config (all bits are output ports) |
| 207 | | ab to UART 5 interrupt mask register (input port change, RxRdyB, counter ready, RxReadyA, TxReadyA) |
| 208 | | |
| 209 | | */ |
| 210 | | |