Previous 15994 Revisions Next

r6652 Wednesday 16th December, 2009 at 04:12:51 UTC by R. Belmont
[ESQ1] Use existing DUART device.
[src/mess/drivers]esq1.c

src/mess/drivers/esq1.c
r6651r6652
55    Ensoniq ESQ-1 and SQ-80 Digital Wave Synthesizers
66    Preliminary driver by R. Belmont
77
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)
1717
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)
2929
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)
3838
3939If SEQRAM is mapped at 4000, DUART port 2 determines the 32KB "master bank" and ports 0 and 1
4040determine which of the 4 8KB "sub banks" is visible.
r6651r6652
4545NMI is from the IRQ line on the FDC (again, SQ-80 only).
4646
4747TODO:
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)
5352
5453***************************************************************************/
5554
5655#include "driver.h"
5756#include "cpu/m6809/m6809.h"
5857#include "sound/es5503.h"
58#include "machine/68681.h"
5959
60static UINT8 uart_regs[0x10];
61static UINT8 uart_outputport;
62
6360static void esq1_doc_irq(const device_config *device, int state)
6461{
6562}
r6651r6652
9087   es5503_set_base(devtag_get_device(machine, "es5503"), memory_region(machine, "ensoniq"));
9188
9289   // set default OSROM banking
93   memory_set_bankptr(machine, "bank1", memory_region(machine, "osrom") );
90   memory_set_bankptr(machine, "osbank", memory_region(machine, "osrom") );
9491}
9592
96static void recalc_osrom_bank(running_machine *machine)
97{
98   int bank = ((uart_outputport >> 1) & 0x7) ^ 7;
93static 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
100ADDRESS_MAP_END
99101
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
103116
104static READ8_HANDLER( uart_r )
117static void duart_irq_handler(const device_config *device, UINT8 vector)
105118{
106//  printf("Read UART @ %x\n", offset);
119   cputag_set_input_line(device->machine, "maincpu", 0, HOLD_LINE);
120};
107121
108   switch (offset)
109   {
110      case 5:   // interrupt status
111         return 0x08;   // timer/counter expire
112         break;
113   }
114
122static UINT8 duart_input(const device_config *device)
123{
115124   return 0;
116125}
117126
118static WRITE8_HANDLER( uart_w )
127static void duart_output(const device_config *device, UINT8 data)
119128{
120   uart_regs[offset] = data;
129   int bank = ((data >> 1) & 0x7);
121130
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) );
140134}
141135
142static 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
149ADDRESS_MAP_END
150
151static INTERRUPT_GEN( esq1_interrupt )
136static void duart_tx(const device_config *device, int channel, UINT8 data)
152137{
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);
154139}
155140
141static 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
156152static MACHINE_DRIVER_START( esq1 )
157153   MDRV_CPU_ADD("maincpu", M6809E, 4000000)   // how fast is it?
158154   MDRV_CPU_PROGRAM_MAP(esq1_map)
159   MDRV_CPU_VBLANK_INT("screen", esq1_interrupt)
160155
161156   MDRV_MACHINE_RESET( esq1 )
162157
158   MDRV_DUART68681_ADD("duart", 40000000, duart_config)
159
163160   MDRV_SCREEN_ADD("screen", RASTER)
164161   MDRV_SCREEN_REFRESH_RATE(60)
165162   MDRV_VIDEO_START(esq1)
r6651r6652
189186ROM_END
190187
191188CONS( 1987, esq1, 0, 0, esq1, esq1, 0, 0, "Ensoniq", "ESQ-1", GAME_NOT_WORKING )
192
193/*
194
1957 to UART 6                counter/timer upper
196d0 to UART 7               counter/timer lower
19760 to UART 4               aux control (C/T timer mode using external clock)
19820 to UART a               command register B
19930 to UART a               command register B
20010 to UART a               command register B
20113 to UART 8               mode register B => 8 bits no parity
202f to UART 8                mode register B => force odd parity, 8 bits (?)
203ee to UART 9               clock select register B
2045 to UART a                command register B (Enable Tx/Enable Rx)
205e7 to UART b               Tx holding register B (send E7 to display)
2060 to UART d                output port config (all bits are output ports)
207ab to UART 5               interrupt mask register (input port change, RxRdyB, counter ready, RxReadyA, TxReadyA)
208
209*/
210

Previous 15994 Revisions Next


© 1998-2018 The MESS Team