Previous 15994 Revisions Next

r2883 Monday 23rd June, 2008 at 17:26:53 UTC by Curt Coder
[AQUARIUS] Added support for cartridge and .wav tape images. Fixed tilemap rendering. Added AY-3-8910(4) sound. Fixed bug #158.
[src/mess]mess.mak
[src/mess/drivers]aquarius.c
[src/mess/includes]aquarius.h
[src/mess/machine]aquarius.c
[src/mess/video]aquarius.c

src/mess/video/aquarius.c
r2882r2883
1111
1212static tilemap *aquarius_tilemap;
1313
14/**************************************************************************/
14static const rgb_t aquarius_colors[] =
15{
16   RGB_BLACK,               /* Black */
17   MAKE_RGB(0xff, 0x00, 0x00),   /* Red */
18   MAKE_RGB(0x00, 0xff, 0x00),   /* Green */
19   MAKE_RGB(0xff, 0xff, 0x00),   /* Yellow */
20   MAKE_RGB(0x00, 0x00, 0xff),   /* Blue */
21   MAKE_RGB(0x7f, 0x00, 0x7f),   /* Violet */
22   MAKE_RGB(0x7f, 0xff, 0xff),   /* Light Blue-Green */
23   RGB_WHITE,               /* White */
24   MAKE_RGB(0xc0, 0xc0, 0xc0),   /* Light Gray */
25   MAKE_RGB(0x00, 0xff, 0xff),   /* Blue-Green */
26   MAKE_RGB(0xff, 0x00, 0xff),   /* Magenta */
27   MAKE_RGB(0x00, 0x00, 0x7f),   /* Dark Blue */
28   MAKE_RGB(0xff, 0xff, 0x7f),   /* Light Yellow */
29   MAKE_RGB(0x7f, 0xff, 0x7f),   /* Light Green */
30   MAKE_RGB(0xff, 0x7f, 0x00),   /* Orange */
31   MAKE_RGB(0x7f, 0x7f, 0x7f)   /* Dark Gray */
32};
1533
34static const unsigned short aquarius_palette[] =
35{
36    0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0,10, 0,11, 0,12, 0,13, 0,14, 0,15, 0,
37    0, 1, 1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 1, 8, 1, 9, 1,10, 1,11, 1,12, 1,13, 1,14, 1,15, 1,
38    0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5, 2, 6, 2, 7, 2, 8, 2, 9, 2,10, 2,11, 2,12, 2,13, 2,14, 2,15, 2,
39    0, 3, 1, 3, 2, 3, 3, 3, 4, 3, 5, 3, 6, 3, 7, 3, 8, 3, 9, 3,10, 3,11, 3,12, 3,13, 3,14, 3,15, 3,
40    0, 4, 1, 4, 2, 4, 3, 4, 4, 4, 5, 4, 6, 4, 7, 4, 8, 4, 9, 4,10, 4,11, 4,12, 4,13, 4,14, 4,15, 4,
41    0, 5, 1, 5, 2, 5, 3, 5, 4, 5, 5, 5, 6, 5, 7, 5, 8, 5, 9, 5,10, 5,11, 5,12, 5,13, 5,14, 5,15, 5,
42    0, 6, 1, 6, 2, 6, 3, 6, 4, 6, 5, 6, 6, 6, 7, 6, 8, 6, 9, 6,10, 6,11, 6,12, 6,13, 6,14, 6,15, 6,
43    0, 7, 1, 7, 2, 7, 3, 7, 4, 7, 5, 7, 6, 7, 7, 7, 8, 7, 9, 7,10, 7,11, 7,12, 7,13, 7,14, 7,15, 7,
44    0, 8, 1, 8, 2, 8, 3, 8, 4, 8, 5, 8, 6, 8, 7, 8, 8, 8, 9, 8,10, 8,11, 8,12, 8,13, 8,14, 8,15, 8,
45    0, 9, 1, 9, 2, 9, 3, 9, 4, 9, 5, 9, 6, 9, 7, 9, 8, 9, 9, 9,10, 9,11, 9,12, 9,13, 9,14, 9,15, 9,
46    0,10, 1,10, 2,10, 3,10, 4,10, 5,10, 6,10, 7,10, 8,10, 9,10,10,10,11,10,12,10,13,10,14,10,15,10,
47    0,11, 1,11, 2,11, 3,11, 4,11, 5,11, 6,11, 7,11, 8,11, 9,11,10,11,11,11,12,11,13,11,14,11,15,11,
48    0,12, 1,12, 2,12, 3,12, 4,12, 5,12, 6,12, 7,12, 8,12, 9,12,10,12,11,12,12,12,13,12,14,12,15,12,
49    0,13, 1,13, 2,13, 3,13, 4,13, 5,13, 6,13, 7,13, 8,13, 9,13,10,13,11,13,12,13,13,13,14,13,15,13,
50    0,14, 1,14, 2,14, 3,14, 4,14, 5,14, 6,14, 7,14, 8,14, 9,14,10,14,11,14,12,14,13,14,14,14,15,14,
51    0,15, 1,15, 2,15, 3,15, 4,15, 5,15, 6,15, 7,15, 8,15, 9,15,10,15,11,15,12,15,13,15,14,15,15,15,
52};
53
54PALETTE_INIT( aquarius )
55{
56   int i;
57
58   machine->colortable = colortable_alloc(machine, 16);
59
60   for (i = 0; i < 16; i++)
61      colortable_palette_set_color(machine->colortable, i, aquarius_colors[i]);
62
63   for (i = 0; i < 512; i++)
64      colortable_entry_set_value(machine->colortable, i, aquarius_palette[i]);
65}
66
67WRITE8_HANDLER( aquarius_videoram_w )
68{
69   videoram[offset] = data;
70   tilemap_mark_tile_dirty(aquarius_tilemap, offset);
71}
72
73WRITE8_HANDLER( aquarius_colorram_w )
74{
75   colorram[offset] = data;
76   tilemap_mark_tile_dirty(aquarius_tilemap, offset);
77}
78
1679static TILE_GET_INFO(aquarius_gettileinfo)
1780{
18   SET_TILE_INFO(
19      0,                        /* gfx */
20      videoram[tile_index +    40],   /* character */
21      videoram[tile_index + 0x400],   /* color */
22      0);                        /* flags */
81   int bank = 0;
82   int code = videoram[tile_index];
83   int color = colorram[tile_index];
84   int flags = 0;
85
86   SET_TILE_INFO(bank, code, color, flags);
2387}
2488
2589VIDEO_START( aquarius )
2690{
27   aquarius_tilemap = tilemap_create(
28      aquarius_gettileinfo,
29      tilemap_scan_rows,
30      8, 8,
31      40, 24);
91   aquarius_tilemap = tilemap_create(aquarius_gettileinfo, tilemap_scan_rows, 8, 8, 40, 24);
3292}
3393
3494VIDEO_UPDATE( aquarius )
3595{
3696   tilemap_draw(bitmap, NULL, aquarius_tilemap, 0, 0);
97
3798   return 0;
3899}
39
40WRITE8_HANDLER( aquarius_videoram_w )
41{
42   if (videoram[offset] != data)
43   {
44      if ((offset >= 40) && (offset < 40+960))
45         tilemap_mark_tile_dirty(aquarius_tilemap, offset - 40);
46      else if ((offset >= 0x400) && (offset < 0x400+960))
47         tilemap_mark_tile_dirty(aquarius_tilemap, offset - 0x400);
48      videoram[offset] = data;
49   }
50}
src/mess/includes/aquarius.h
r2882r2883
44 *
55 ****************************************************************************/
66
7#ifndef AQUARIUS_H_
8#define AQUARIUS_H_
7#ifndef __AQUARIUS__
8#define __AQUARIUS__
99
10
11/*----------- defined in machine/aquarius.c -----------*/
12
13extern MACHINE_RESET( aquarius );
14extern  READ8_HANDLER( aquarius_port_ff_r );
15extern  READ8_HANDLER( aquarius_port_fe_r );
16extern WRITE8_HANDLER( aquarius_port_fc_w );
17extern WRITE8_HANDLER( aquarius_port_fe_w );
18extern WRITE8_HANDLER( aquarius_port_ff_w );
19
20
2110/*----------- defined in video/aquarius.c -----------*/
2211
23extern VIDEO_START( aquarius );
24extern VIDEO_UPDATE( aquarius );
25extern WRITE8_HANDLER( aquarius_videoram_w );
12WRITE8_HANDLER( aquarius_videoram_w );
13WRITE8_HANDLER( aquarius_colorram_w );
2614
15PALETTE_INIT( aquarius );
16VIDEO_START( aquarius );
17VIDEO_UPDATE( aquarius );
2718
2819#endif /* AQUARIUS_H_ */
src/mess/machine/aquarius.c
r2882r2883
1/**********************************************************************
2
3  machine.c
4
5  Functions to emulate general aspects of the machine (RAM, ROM, interrups,
6  I/O ports)
7
8**********************************************************************/
9
10#include <stdio.h>
11#include "driver.h"
12#include "cpu/z80/z80.h"
13#include "includes/aquarius.h"
14#include "sound/speaker.h"
15
16static   int   aquarius_ramsize = 0;
17
18MACHINE_RESET( aquarius )
19{
20   logerror("aquarius_init\r\n");
21   if (input_port_read(machine, "RAM") != aquarius_ramsize)
22   {
23      aquarius_ramsize = input_port_read(machine, "RAM");
24      switch (aquarius_ramsize)
25      {
26         case 02:
27            memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, SMH_RAM);
28            memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, SMH_RAM);
29            memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x7fff, 0, 0, SMH_RAM);
30            memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x7fff, 0, 0, SMH_RAM);
31            break;
32         case 01:
33            memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, SMH_NOP);
34            memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, SMH_NOP);
35            memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x7fff, 0, 0, SMH_RAM);
36            memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x7fff, 0, 0, SMH_RAM);
37            break;
38         case 00:
39            memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, SMH_NOP);
40            memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, SMH_NOP);
41            memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x7fff, 0, 0, SMH_NOP);
42            memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x7fff, 0, 0, SMH_NOP);
43            break;
44      }
45   }
46}
47
48 READ8_HANDLER ( aquarius_port_ff_r )
49{
50   int loop, loop2, bc, rpl;
51   char port[6];
52
53   bc = activecpu_get_reg(Z80_BC) >> 8;
54   rpl = 0xff;
55
56   for (loop = 0x80, loop2 = 7; loop; loop >>= 1, loop2--)
57   {
58      if (!(bc & loop))
59      {
60         sprintf(port, "KEY%d", loop2);
61         rpl &= input_port_read(machine, port);
62      }
63   }
64
65   return (rpl);
66}
67
68 READ8_HANDLER ( aquarius_port_fe_r )
69{
70   return (0xff);
71}
72
73WRITE8_HANDLER ( aquarius_port_fc_w )
74{
75   speaker_level_w(0, data & 0x01);
76}
77
78WRITE8_HANDLER ( aquarius_port_fe_w )
79{
80}
81
82WRITE8_HANDLER ( aquarius_port_ff_w )
83{
84}
85
src/mess/mess.mak
r2882r2883
10051005$(MESSOBJ)/aquarius.a: \
10061006   $(MESS_DRIVERS)/aquarius.o   \
10071007   $(MESS_VIDEO)/aquarius.o \
1008   $(MESS_MACHINE)/aquarius.o \
10091008
10101009$(MESSOBJ)/exidy.a:    \
10111010   $(MESS_MACHINE)/ay31015.o   \
src/mess/drivers/aquarius.c
r2882r2883
1/************************************************************************
2Aquarius Memory map
1/*
32
4    CPU: z80
3   TODO:
54
6    Memory map
7        0000 1fff   BASIC
8        2000 2fff   expansion?
9        3000 33ff   screen ram
10        3400 37ff   colour ram
11        3800 3fff   RAM (standard)
12        4000 7fff   RAM (expansion)
13        8000 ffff   RAM (emulator only)
5   - vsync
6   - hand controllers
7   - scramble RAM also
8   - CAQ tape support
9   - memory mapper
10   - proper video timings
11   - PAL mode
1412
15    Ports: Out
16        fc          Buzzer, bit 0.
17        fe          Printer.
13   - floppy support
14   - modem
15   - "old" version of BASIC ROM
16   - Aquarius II
1817
19    Ports: In
20        fc          Tape in, bit 1.
21        fe          Printer.
22        ff          Keyboard, Bit set in .B selects keyboard matrix
23                    line. Return bit 0 - 5 low for pressed key.
18*/
2419
25************************************************************************/
26
2720#include "driver.h"
2821#include "includes/aquarius.h"
2922#include "cpu/z80/z80.h"
23#include "devices/basicdsk.h"
24#include "devices/cartslot.h"
25#include "devices/cassette.h"
26#include "devices/printer.h"
27#include "sound/ay8910.h"
28#include "sound/speaker.h"
3029
30static const device_config *cassette_device_image(void)
31{
32   return image_from_devtype_and_index(IO_CASSETTE, 0);
33}
3134
32/* Memory w/r functions */
35/* Read/Write Handlers */
3336
37static UINT8 *decrypt_rom;
38static UINT8 scrambler;
39
40static READ8_HANDLER( cassette_r )
41{
42   /*
43
44      To read stored data from cassette the program should look at bit zero of
45      the cassette input port and measure the time difference between leading
46      edges or trailing edges. This is to prevent DC level shifting from altering
47      pulse width of data. The program should then look for sync bytes for data
48      synchronisation before data block transfer. If there is any task that must
49      be performed during cassette loading, the maximum allowable time to do the
50      job after one byte from cassette, must be less than 80% of the period of a
51      mark cycle. Control must be returned at that time to the cassette routine
52      in order to maintain data integrity.
53   
54   */
55
56   return (cassette_input(cassette_device_image()) < +0.0) ? 0 : 1;
57}
58
59static WRITE8_HANDLER( cassette_w )
60{
61   /*
62
63      Sound and cassette port use a common pin. Therefore the signal to cassette
64      will appear on audio output. Sound port is a simple one bit I/O and therefore
65      it must be toggled at a specific rate under software control.
66
67   */
68
69   speaker_level_w(0, data & 0x01);
70
71   cassette_output(cassette_device_image(), (data & 0x01) ? +1.0 : -1.0);
72}
73
74static READ8_HANDLER( vsync_r )
75{
76   /*
77
78      The current state of the vertical sync will appear on bit 0 during a read of
79      this port. The waveform and timing spec is shown as follows:
80
81         |<-    Active scan period   ->|V.sync |<-
82         |      12.8 ms                |3.6 ms (PAL)
83         |                             |2.8 ms (NTSC)
84         +++++++++++++++++++++++++++++++       ++++++++++++
85         +                             +       +
86         +                             +       +
87      +++++                             +++++++++
88
89   */
90
91   return 0;
92}
93
94static WRITE8_HANDLER( mapper_w )
95{
96   /*
97
98      Bit D0 of this port controls the swapping of the lower 16K block in the memory
99      map with the upper 16K. A 1 in this bit indicates swapping. This bit is reset
100      after power up initialization.
101
102   */
103}
104
105static READ8_HANDLER( printer_r )
106{
107   /*
108
109      Printer handshaking port (read) Port 0xFE when read, presents the clear
110      to send status from PRNHASK pin at bit D0. A 1 indicates printer is ready,
111      0 means not ready.
112
113   */
114
115   return 1; // ready
116}
117
118static WRITE8_HANDLER( printer_w )
119{
120   /*
121
122      This is a single bit I/O at D0, it will perform as a serial output
123      port under software control. Since timing is done by software the
124      baudrate is variable. In BASIC this is a 1200 baud printer port for
125      the 40 column thermal printer.
126
127   */
128}
129
130static READ8_HANDLER( keyboard_r )
131{
132   /*
133
134      This port is 6 bits wide, when read, it returns the row data from the
135      keyboard matrix. The keyboard is usually scanned in the following manner:
136
137      The keyboard is a 6 row by 8 column matrix. The column is connected to
138      the higher order address bus A15-A8. When Z80 executes its input
139      instruction sets, either the current content of the accumulator (A) or
140      the content of register (B) will go to the higher order address bus.
141      Therefore the keyboard can be scanned by placing a specific scanning
142      pattern in (A) or (B) and reading the result returned on rows.
143
144   */
145
146   UINT8 keylatch = offset >> 8;
147   int row;
148
149   if (keylatch == 0) return 0;
150
151   for (row = 0; row < 8; row++)
152   {
153      if (!BIT(keylatch, row))
154      {
155         char port[5];
156         sprintf(port, "ROW%d", row);
157     
158         return input_port_read(machine, port);
159      }
160   }
161
162   return 0xff;
163}
164
165static WRITE8_HANDLER( scrambler_w )
166{
167   /*
168
169      Software lock: Writing this port with an 8 bit value will set the software
170      scrambler pattern. The data that appears on the output side will be the
171      result of the input bus EX-ORed with this pattern, bit by bit. The software
172      lock is a scrambler built between the CPU and external interface. The
173      scrambling pattern is contained in port 0xFF and is not readable. CPU data
174      output to external bus will be XORed with this pattern in a bit by bit
175      fashion to generate the real data on external bus. By the same mechanism,
176      data from external bus is also XORed with this pattern and read by CPU.
177
178      Therefore it the external device is RAM, the software lock simply has no
179      effect as long as the scrambling pattern remains unchanged. For I/O
180      operation the pattern is gated to 0 and thus scrambling action is nullified.
181
182      In BASIC operation the scrambling pattern is generated by a random number
183      routine. For game cartridge the lock pattern is generated from data in the
184      game cartridge itself.
185
186   */
187
188   UINT8 *ROM = memory_region(REGION_CPU1) + 0xc000;
189   UINT16 addr;
190
191   scrambler = data;
192
193   for (addr = 0; addr < 16*1024; addr++)
194   {
195      decrypt_rom[addr] = ROM[addr] ^ scrambler;
196   }
197}
198
199/* Memory Maps */
200
34201static ADDRESS_MAP_START( aquarius_mem, ADDRESS_SPACE_PROGRAM, 8)
35202   AM_RANGE(0x0000, 0x1fff) AM_ROM
36   AM_RANGE(0x2000, 0x2fff) AM_NOP
37   AM_RANGE(0x3000, 0x37ff) AM_READWRITE(SMH_RAM, aquarius_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size)
203   AM_RANGE(0x3000, 0x33ff) AM_RAM AM_WRITE(aquarius_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size)
204   AM_RANGE(0x3400, 0x37ff) AM_RAM AM_WRITE(aquarius_colorram_w) AM_BASE(&colorram)
38205   AM_RANGE(0x3800, 0x3fff) AM_RAM
39   AM_RANGE(0x4000, 0x7fff) AM_NOP
40   AM_RANGE(0x8000, 0xffff) AM_NOP
206   AM_RANGE(0x4000, 0xbfff) AM_RAMBANK(1)
207   AM_RANGE(0xc000, 0xffff) AM_ROMBANK(2)
41208ADDRESS_MAP_END
42209
43
44/* port i/o functions */
45
46210static ADDRESS_MAP_START( aquarius_io, ADDRESS_SPACE_IO, 8)
47   ADDRESS_MAP_GLOBAL_MASK(0xff)
48   AM_RANGE(0xfc, 0xfc) AM_WRITE(aquarius_port_fc_w)
49   AM_RANGE(0xfe, 0xfe) AM_READWRITE(aquarius_port_fe_r, aquarius_port_fe_w)
50   AM_RANGE(0xff, 0xff) AM_READWRITE(aquarius_port_ff_r, aquarius_port_ff_w)
211//   AM_RANGE(0x7e, 0x7f) AM_MIRROR(0xff00) AM_READWRITE(modem_r, modem_w)
212//   AM_RANGE(0xe0, 0xef) AM_MIRROR(0xff00) AM_READWRITE(floppy_r, floppy_w)
213   AM_RANGE(0xf6, 0xf6) AM_MIRROR(0xff00) AM_READWRITE(AY8910_read_port_0_r, AY8910_write_port_0_w)
214   AM_RANGE(0xf7, 0xf7) AM_MIRROR(0xff00) AM_WRITE(AY8910_control_port_0_w)
215   AM_RANGE(0xfc, 0xfc) AM_MIRROR(0xff00) AM_READWRITE(cassette_r, cassette_w)
216   AM_RANGE(0xfd, 0xfd) AM_MIRROR(0xff00) AM_READWRITE(vsync_r, mapper_w)
217   AM_RANGE(0xfe, 0xfe) AM_MIRROR(0xff00) AM_READWRITE(printer_r, printer_w)
218   AM_RANGE(0xff, 0xff) AM_MIRROR(0xff00) AM_MASK(0xff00) AM_READWRITE(keyboard_r, scrambler_w)
51219ADDRESS_MAP_END
52220
221/* Input Ports */
53222
54/* graphics output */
223static INPUT_CHANGED( aquarius_reset )
224{
225   cpunum_set_input_line(field->port->machine, 0, INPUT_LINE_RESET, (input_port_read(field->port->machine, "RESET") ? CLEAR_LINE : ASSERT_LINE));
226}
55227
228static INPUT_PORTS_START(aquarius)
229   PORT_START_TAG("ROW0")
230   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("= +\tNEXT") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+')
231   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90 \\") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR('\\')
232   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(": *\tPEEK") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*')
233   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RTN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
234   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("; @\tPOKE") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('@')
235   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(". >\tVAL") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
236   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
237
238   PORT_START_TAG("ROW1")
239   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("- _\tFOR") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_')
240   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("/ ^") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('/') PORT_CHAR('^')
241   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0 ?") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('?')
242   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR(16)
243   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("L\tPOINT") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR(12)
244   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(", <\tSTR$") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
245   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
246
247   PORT_START_TAG("ROW2")
248   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("9 )\tCOPY") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')')
249   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(15)
250   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K\tPRESET") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHAR(11)
251   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR(13)
252   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("N\tRIGHT$") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(14)
253   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("J\tPSET") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR(10)
254   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
255
256   PORT_START_TAG("ROW3")
257   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("8 (\tRETURN") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(')
258   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(9)
259   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7 '\tGOSUB") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'')
260   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(21)
261   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_CHAR(8)
262   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("B\tMID$") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR(2)
263   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
264
265   PORT_START_TAG("ROW4")
266   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6 &\tON") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&')
267   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR(25)
268   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("G\tBELL") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR(7)
269   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("V\tLEFT$") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR(22)
270   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C\tSTOP") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR(3)
271   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F\tDATA") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR(6)
272   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
273
274   PORT_START_TAG("ROW5")
275   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5 %\tGOTO") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
276   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("T\tINPUT") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(20)
277   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4 $\tTHEN") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
278   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("R\tRETYP") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR(18)
279   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D\tREAD") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(4)
280   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("X\tDELINE") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(24)
281   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
282
283   PORT_START_TAG("ROW6")
284   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3 #\tIF") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#')
285   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E\tDIM") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(5)
286   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("S\tSTPLST") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(19)
287   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Z\tCLOAD") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(26)
288   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE\tCHR$") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(32)
289   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A\tCSAVE") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR(1)
290   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
291
292   PORT_START_TAG("ROW7")
293   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2 \"\tLIST") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"')
294   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("W\tREM") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR(23)
295   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("1 !\tRUN") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
296   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHAR(17)
297   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
298   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2)
299   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
300
301   PORT_START_TAG("RESET")
302   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RST") PORT_CODE(KEYCODE_F10) PORT_CHANGED(aquarius_reset, 0)
303
304   PORT_START_TAG("LEFT")
305   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
306
307   PORT_START_TAG("RIGHT")
308   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
309INPUT_PORTS_END
310
311/* Character Layout */
312
56313static const gfx_layout aquarius_charlayout =
57314{
58315   8, 8,
r2882r2883
65322   8 * 8
66323};
67324
325/* Graphics Decode Information */
326
68327static GFXDECODE_START( aquarius )
69328   GFXDECODE_ENTRY( REGION_GFX1, 0x0000, aquarius_charlayout, 0, 256 )
70329GFXDECODE_END
71330
72static const rgb_t aquarius_colors[] =
331/* Interrupt Generator */
332
333static INTERRUPT_GEN( aquarius_interrupt )
73334{
74   RGB_BLACK,               /* Black */
75   MAKE_RGB(0xff, 0x00, 0x00),   /* Red */
76   MAKE_RGB(0x00, 0xff, 0x00),   /* Green */
77   MAKE_RGB(0xff, 0xff, 0x00),   /* Yellow */
78   MAKE_RGB(0x00, 0x00, 0xff),   /* Blue */
79   MAKE_RGB(0x7f, 0x00, 0x7f),   /* Violet */
80   MAKE_RGB(0x7f, 0xff, 0xff),   /* Light Blue-Green */
81   RGB_WHITE,               /* White */
82   MAKE_RGB(0xc0, 0xc0, 0xc0),   /* Light Gray */
83   MAKE_RGB(0x00, 0xff, 0xff),   /* Blue-Green */
84   MAKE_RGB(0xff, 0x00, 0xff),   /* Magenta */
85   MAKE_RGB(0x00, 0x00, 0x7f),   /* Dark Blue */
86   MAKE_RGB(0xff, 0xff, 0x7f),   /* Light Yellow */
87   MAKE_RGB(0x7f, 0xff, 0x7f),   /* Light Green */
88   MAKE_RGB(0xff, 0x7f, 0x00),   /* Orange */
89   MAKE_RGB(0x7f, 0x7f, 0x7f)   /* Dark Gray */
90};
335   cpunum_set_input_line(machine, 0, INPUT_LINE_IRQ0, HOLD_LINE);
336}
91337
92static const unsigned short aquarius_palette[] =
338/* Sound Interface */
339
340static READ8_HANDLER( aquarius_ay8910_port_a_r )
93341{
94    0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0,10, 0,11, 0,12, 0,13, 0,14, 0,15, 0,
95    0, 1, 1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 1, 8, 1, 9, 1,10, 1,11, 1,12, 1,13, 1,14, 1,15, 1,
96    0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5, 2, 6, 2, 7, 2, 8, 2, 9, 2,10, 2,11, 2,12, 2,13, 2,14, 2,15, 2,
97    0, 3, 1, 3, 2, 3, 3, 3, 4, 3, 5, 3, 6, 3, 7, 3, 8, 3, 9, 3,10, 3,11, 3,12, 3,13, 3,14, 3,15, 3,
98    0, 4, 1, 4, 2, 4, 3, 4, 4, 4, 5, 4, 6, 4, 7, 4, 8, 4, 9, 4,10, 4,11, 4,12, 4,13, 4,14, 4,15, 4,
99    0, 5, 1, 5, 2, 5, 3, 5, 4, 5, 5, 5, 6, 5, 7, 5, 8, 5, 9, 5,10, 5,11, 5,12, 5,13, 5,14, 5,15, 5,
100    0, 6, 1, 6, 2, 6, 3, 6, 4, 6, 5, 6, 6, 6, 7, 6, 8, 6, 9, 6,10, 6,11, 6,12, 6,13, 6,14, 6,15, 6,
101    0, 7, 1, 7, 2, 7, 3, 7, 4, 7, 5, 7, 6, 7, 7, 7, 8, 7, 9, 7,10, 7,11, 7,12, 7,13, 7,14, 7,15, 7,
102    0, 8, 1, 8, 2, 8, 3, 8, 4, 8, 5, 8, 6, 8, 7, 8, 8, 8, 9, 8,10, 8,11, 8,12, 8,13, 8,14, 8,15, 8,
103    0, 9, 1, 9, 2, 9, 3, 9, 4, 9, 5, 9, 6, 9, 7, 9, 8, 9, 9, 9,10, 9,11, 9,12, 9,13, 9,14, 9,15, 9,
104    0,10, 1,10, 2,10, 3,10, 4,10, 5,10, 6,10, 7,10, 8,10, 9,10,10,10,11,10,12,10,13,10,14,10,15,10,
105    0,11, 1,11, 2,11, 3,11, 4,11, 5,11, 6,11, 7,11, 8,11, 9,11,10,11,11,11,12,11,13,11,14,11,15,11,
106    0,12, 1,12, 2,12, 3,12, 4,12, 5,12, 6,12, 7,12, 8,12, 9,12,10,12,11,12,12,12,13,12,14,12,15,12,
107    0,13, 1,13, 2,13, 3,13, 4,13, 5,13, 6,13, 7,13, 8,13, 9,13,10,13,11,13,12,13,13,13,14,13,15,13,
108    0,14, 1,14, 2,14, 3,14, 4,14, 5,14, 6,14, 7,14, 8,14, 9,14,10,14,11,14,12,14,13,14,14,14,15,14,
109    0,15, 1,15, 2,15, 3,15, 4,15, 5,15, 6,15, 7,15, 8,15, 9,15,10,15,11,15,12,15,13,15,14,15,15,15,
110};
342   return input_port_read(machine, "RIGHT");
343}
111344
112static PALETTE_INIT( aquarius )
345static READ8_HANDLER( aquarius_ay8910_port_b_r )
113346{
114   int i;
347   return input_port_read(machine, "LEFT");
348}
115349
116   machine->colortable = colortable_alloc(machine, 16);
350static const struct AY8910interface ay8910_interface =
351{
352   AY8910_LEGACY_OUTPUT,
353   AY8910_DEFAULT_LOADS,
354   aquarius_ay8910_port_a_r,
355   aquarius_ay8910_port_b_r,
356   NULL,
357   NULL
358};
117359
118   for ( i = 0; i < 16; i++ )
119      colortable_palette_set_color(machine->colortable, i, aquarius_colors[i]);
360/* Machine Initialization */
120361
121   for (i=0; i < 512; i++)
122      colortable_entry_set_value(machine->colortable, i, aquarius_palette[i]);
362static MACHINE_START( aquarius )
363{
364   decrypt_rom = auto_malloc(16*1024);
123365}
124366
125/* Keyboard input */
367static MACHINE_RESET( aquarius )
368{
369   /* RAM expansion */
126370
127static INPUT_PORTS_START(aquarius)
128   PORT_START_TAG("KEY0")   /* count = 0 */
129   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=       +   NEXT")   PORT_CODE(KEYCODE_EQUALS)     PORT_CHAR('=') PORT_CHAR('+')
130   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del     \\")         PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(8)   PORT_CHAR('\\')
131   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":       *   PEEK")   PORT_CODE(KEYCODE_QUOTE)      PORT_CHAR(':') PORT_CHAR('*')
132   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rtn")                PORT_CODE(KEYCODE_SLASH)      PORT_CHAR(13)
133   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";       @   POKE")   PORT_CODE(KEYCODE_COLON)      PORT_CHAR(';') PORT_CHAR('@')
134   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".       >   VAL")    PORT_CODE(KEYCODE_STOP)       PORT_CHAR('.') PORT_CHAR('>')
135   PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
371   switch (mess_ram_size)
372   {
373   case 4 * 1024:
374      memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0xbfff, 0, 0, SMH_UNMAP, SMH_UNMAP);
375      break;
136376
137   PORT_START_TAG("KEY1")   /* count = 1 */
138   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-       _   FOR")    PORT_CODE(KEYCODE_MINUS)      PORT_CHAR('-') PORT_CHAR('_')
139   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/       ^")          PORT_CODE(KEYCODE_OPENBRACE)  PORT_CHAR('/') PORT_CHAR('^')
140   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0       ?")          PORT_CODE(KEYCODE_0)          PORT_CHAR('0') PORT_CHAR('?')
141   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("p       P")          PORT_CODE(KEYCODE_P)          PORT_CHAR('p') PORT_CHAR('P')  PORT_CHAR(16)
142   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("l       L   POINT")  PORT_CODE(KEYCODE_L)          PORT_CHAR('l') PORT_CHAR('L')  PORT_CHAR(12)
143   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",       <   STR$")   PORT_CODE(KEYCODE_COMMA)      PORT_CHAR(',') PORT_CHAR('<')
144   PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
377   case 8 * 1024: // 4K expansion
378      memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x4fff, 0, 0, SMH_BANK1, SMH_BANK1);
379      memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5000, 0xbfff, 0, 0, SMH_UNMAP, SMH_UNMAP);
380      break;
145381
146   PORT_START_TAG("KEY2")   /* count = 2 */
147   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9       )   COPY")   PORT_CODE(KEYCODE_9)          PORT_CHAR('9') PORT_CHAR(')')
148   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("o       O")          PORT_CODE(KEYCODE_O)          PORT_CHAR('o') PORT_CHAR('O')  PORT_CHAR(15)
149   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("k       K   PRESET") PORT_CODE(KEYCODE_K)          PORT_CHAR('k') PORT_CHAR('K')  PORT_CHAR(11)
150   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("m       M   Rtn")    PORT_CODE(KEYCODE_M)          PORT_CHAR('m') PORT_CHAR('M')  PORT_CHAR(13)
151   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("n       N   RIGHT$") PORT_CODE(KEYCODE_N)          PORT_CHAR('n') PORT_CHAR('N')  PORT_CHAR(14)
152   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("j       J   PSET")   PORT_CODE(KEYCODE_J)          PORT_CHAR('j') PORT_CHAR('J')  PORT_CHAR(10)
153   PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
382   case 20 * 1024: // 16K expansion
383      memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x8fff, 0, 0, SMH_BANK1, SMH_BANK1);
384      memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9000, 0xbfff, 0, 0, SMH_UNMAP, SMH_UNMAP);
385      break;
154386
155   PORT_START_TAG("KEY3")   /* count = 3 */
156   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8       (   RETURN") PORT_CODE(KEYCODE_8)          PORT_CHAR('8') PORT_CHAR('(')
157   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("i       I")          PORT_CODE(KEYCODE_I)          PORT_CHAR('i') PORT_CHAR('I')  PORT_CHAR(9)
158   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7       '   GOSUB")  PORT_CODE(KEYCODE_7)          PORT_CHAR('7') PORT_CHAR('\'')
159   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("u       U")          PORT_CODE(KEYCODE_U)          PORT_CHAR('u') PORT_CHAR('U')  PORT_CHAR(21)
160   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("h       H")          PORT_CODE(KEYCODE_H)          PORT_CHAR('h') PORT_CHAR('H')  PORT_CHAR(8)
161   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("b       B   MID$")   PORT_CODE(KEYCODE_B)          PORT_CHAR('b') PORT_CHAR('B')  PORT_CHAR(2)
162   PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
387   case 36 * 1024: // 32K expansion (prototype)
388      memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0xbfff, 0, 0, SMH_BANK1, SMH_BANK1);
389      break;
390   }
163391
164   PORT_START_TAG("KEY4")   /* count = 4 */
165   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6       &   ON")     PORT_CODE(KEYCODE_6)          PORT_CHAR('6') PORT_CHAR('&')
166   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("y       Y")          PORT_CODE(KEYCODE_Y)          PORT_CHAR('y') PORT_CHAR('Y')  PORT_CHAR(25)
167   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("g       G   Bell")   PORT_CODE(KEYCODE_G)          PORT_CHAR('g') PORT_CHAR('G')  PORT_CHAR(7)
168   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("v       V   LEFT$")  PORT_CODE(KEYCODE_V)          PORT_CHAR('v') PORT_CHAR('V')  PORT_CHAR(22)
169   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("c       C   Stop")   PORT_CODE(KEYCODE_C)          PORT_CHAR('c') PORT_CHAR('C')  PORT_CHAR(3)
170   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f       F   DATA")   PORT_CODE(KEYCODE_F)          PORT_CHAR('f') PORT_CHAR('F')  PORT_CHAR(6)
171   PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
392   memory_configure_bank(1, 0, 1, mess_ram, 0);
393   memory_set_bank(1, 0);
172394
173   PORT_START_TAG("KEY5")   /* count = 5 */
174   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5       %   GOTO")   PORT_CODE(KEYCODE_5)          PORT_CHAR('5') PORT_CHAR('%')
175   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("t       T   INPUT")  PORT_CODE(KEYCODE_T)          PORT_CHAR('t') PORT_CHAR('T')  PORT_CHAR(20)
176   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4       $   THEN")   PORT_CODE(KEYCODE_4)          PORT_CHAR('4') PORT_CHAR('$')
177   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("r       R   Retyp")  PORT_CODE(KEYCODE_R)          PORT_CHAR('r') PORT_CHAR('R')  PORT_CHAR(18)
178   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("d       D   READ")   PORT_CODE(KEYCODE_D)          PORT_CHAR('d') PORT_CHAR('D')  PORT_CHAR(4)
179   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("x       X   Deline") PORT_CODE(KEYCODE_X)          PORT_CHAR('x') PORT_CHAR('X')  PORT_CHAR(24)
180   PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
395   /* cartridge */
181396
182   PORT_START_TAG("KEY6")   /* count = 6 */
183   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3       #   IF")     PORT_CODE(KEYCODE_3)          PORT_CHAR('3') PORT_CHAR('#')
184   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("e       E   DIM")    PORT_CODE(KEYCODE_E)          PORT_CHAR('e') PORT_CHAR('E')  PORT_CHAR(5)
185   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("s       S   Stplst") PORT_CODE(KEYCODE_S)          PORT_CHAR('s') PORT_CHAR('S')  PORT_CHAR(19)
186   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("z       Z   CLOAD")  PORT_CODE(KEYCODE_Z)          PORT_CHAR('z') PORT_CHAR('Z')  PORT_CHAR(26)
187   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space       CHR$")   PORT_CODE(KEYCODE_LSHIFT)     PORT_CHAR(32)
188   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("a       A   CSAVE")  PORT_CODE(KEYCODE_A)          PORT_CHAR('a') PORT_CHAR('A')  PORT_CHAR(1)
189   PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
397   memory_configure_bank(2, 0, 1, decrypt_rom, 0);
398   memory_set_bank(2, 0);
399}
190400
191   PORT_START_TAG("KEY7")   /* count = 7 */
192   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2       \"   LIST")  PORT_CODE(KEYCODE_2)          PORT_CHAR('2') PORT_CHAR('\"')
193   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("w       W   REM")    PORT_CODE(KEYCODE_W)          PORT_CHAR('w') PORT_CHAR('W')  PORT_CHAR(23)
194   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1       !   RUN")    PORT_CODE(KEYCODE_1)          PORT_CHAR('1') PORT_CHAR('!')
195   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("q       Q")          PORT_CODE(KEYCODE_Q)          PORT_CHAR('q') PORT_CHAR('Q')  PORT_CHAR(17)
196   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift")              PORT_CODE(KEYCODE_CAPSLOCK)   PORT_CHAR(UCHAR_SHIFT_1)
197   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctl")                PORT_CODE(KEYCODE_TAB)        PORT_CHAR(UCHAR_SHIFT_2)
198   PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
401/* Machine Driver */
199402
200//  The reset key labelled "Rst" is not currently emulated
201
202// This is a hack: it should be managed via -ramsize switch!!!
203   PORT_START_TAG("RAM")   /* Machine config */
204   PORT_CONFNAME(0x03, 3, "RAM Size")
205   PORT_CONFSETTING(0, "4 Kb")
206   PORT_CONFSETTING(1, "20 Kb")
207   PORT_CONFSETTING(2, "56 Kb")
208
209// Aquarius supports a pair of controllers: each one has a 16-position disc pad and six buttons
210
211INPUT_PORTS_END
212
213/* Sound output */
214
215static INTERRUPT_GEN( aquarius_interrupt )
216{
217   cpunum_set_input_line(machine, 0, 0, HOLD_LINE);
218}
219
220/* Machine definition */
221403static MACHINE_DRIVER_START( aquarius )
222404   /* basic machine hardware */
223   MDRV_CPU_ADD_TAG("main", Z80, 3500000)
405   MDRV_CPU_ADD_TAG("main", Z80, XTAL_3_579545MHz) // ???
224406   MDRV_CPU_PROGRAM_MAP(aquarius_mem, 0)
225407   MDRV_CPU_IO_MAP(aquarius_io, 0)
226408   MDRV_CPU_VBLANK_INT("main", aquarius_interrupt)
227   MDRV_INTERLEAVE(1)
228409
410   MDRV_MACHINE_START( aquarius )
229411   MDRV_MACHINE_RESET( aquarius )
230412
231413    /* video hardware */
r2882r2883
236418   MDRV_SCREEN_SIZE(40 * 8, 24 * 8)
237419   MDRV_SCREEN_VISIBLE_AREA(0, 40 * 8 - 1, 0, 24 * 8 - 1)
238420   MDRV_GFXDECODE( aquarius )
239   MDRV_PALETTE_LENGTH(ARRAY_LENGTH(aquarius_palette))
421   MDRV_PALETTE_LENGTH(512)
240422   MDRV_PALETTE_INIT( aquarius )
241423
242424   MDRV_VIDEO_START( aquarius )
r2882r2883
246428   MDRV_SPEAKER_STANDARD_MONO("mono")
247429   MDRV_SOUND_ADD(SPEAKER, 0)
248430   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
431
432   MDRV_SOUND_ADD(AY8910, XTAL_3_579545MHz/2) // ??? AY-3-8914
433   MDRV_SOUND_CONFIG(ay8910_interface)
434   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
435
436   /* printer */
437   MDRV_DEVICE_ADD("printer", PRINTER)
249438MACHINE_DRIVER_END
250439
440/* ROMs */
251441
252ROM_START(aquarius)
253   ROM_REGION(0x10000, REGION_CPU1,0)
254   ROM_LOAD("aq2.rom", 0x0000, 0x2000, CRC(a2d15bcf) SHA1(ca6ef55e9ead41453efbf5062d6a60285e9661a6))
255   ROM_REGION(0x0800, REGION_GFX1,0)
256   ROM_LOAD("aq2.chr", 0x0000, 0x0800, BAD_DUMP CRC(0b3edeed) SHA1(d2509839386b852caddcaa89cd376be647ba1492))
442ROM_START( aquarius )
443   ROM_REGION( 0x10000, REGION_CPU1, 0 )
444//   ROM_LOAD( "aquarius.u2", 0x0000, 0x2000, CRC(5cfa5b42) SHA1(02c8ee11e911d1aa346812492d14284b6870cb3e) )
445   ROM_LOAD( "aq2.u2", 0x0000, 0x2000, CRC(a2d15bcf) SHA1(ca6ef55e9ead41453efbf5062d6a60285e9661a6) )
446   
447   ROM_REGION( 0x0800, REGION_GFX1, 0 )
448   ROM_LOAD( "aq2.u5", 0x0000, 0x0800, BAD_DUMP CRC(0b3edeed) SHA1(d2509839386b852caddcaa89cd376be647ba1492) )
257449ROM_END
258450
259/*      YEAR    NAME        PARENT  COMPAT  MACHINE     INPUT       INIT    CONFIG      COMPANY     FULLNAME */
260COMP(   1983,   aquarius,   0,      0,      aquarius,   aquarius,   0,      NULL,      "Mattel",   "Aquarius" , 0)
451/* System Configuration */
452
453static DEVICE_IMAGE_LOAD( aquarius_cart )
454{
455   int size = image_length(image);
456   UINT8 *ptr = memory_region(REGION_CPU1) + 0xc000;
457
458   if (image_fread(image, ptr, size) != size)
459   {
460      return INIT_FAIL;
461   }
462
463   switch (size)
464   {
465   case 8 * 1024:
466      memory_install_readwrite8_handler(image->machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xdfff, 0, 0x2000, SMH_BANK2, SMH_UNMAP);
467      break;
468
469   case 16 * 1024:
470      memory_install_readwrite8_handler(image->machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xffff, 0, 0, SMH_BANK2, SMH_UNMAP);
471      break;
472   }
473
474   return INIT_PASS;
475}
476
477static void aquarius_cartslot_getinfo( const mess_device_class *devclass, UINT32 state, union devinfo *info )
478{
479   switch( state )
480   {
481      /* --- the following bits of info are returned as 64-bit signed integers --- */
482      case MESS_DEVINFO_INT_COUNT:               info->i = 1; break;
483
484      /* --- the following bits of info are returned as pointers to data or functions --- */
485      case MESS_DEVINFO_PTR_LOAD:                  info->load = DEVICE_IMAGE_LOAD_NAME(aquarius_cart); break;
486
487      /* --- the following bits of info are returned as NULL-terminated strings --- */
488      case MESS_DEVINFO_STR_FILE_EXTENSIONS:         strcpy(info->s = device_temp_str(), "bin"); break;
489
490      default:                              cartslot_device_getinfo( devclass, state, info ); break;
491   }
492}
493
494static void aquarius_cassette_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
495{
496   // cassette
497   switch(state)
498   {
499      /* --- the following bits of info are returned as 64-bit signed integers --- */
500      case MESS_DEVINFO_INT_COUNT:               info->i = 1; break;
501      case MESS_DEVINFO_INT_CASSETTE_DEFAULT_STATE:   info->i = CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED; break;
502
503      default:                              cassette_device_getinfo(devclass, state, info); break;
504   }
505}
506
507static DEVICE_IMAGE_LOAD( aquarius_floppy )
508{
509   // 128K images, 64K/side
510   return INIT_FAIL;
511}
512
513static void aquarius_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
514{
515   /* floppy */
516   switch(state)
517   {
518      /* --- the following bits of info are returned as 64-bit signed integers --- */
519      case MESS_DEVINFO_INT_COUNT:               info->i = 1; break;
520
521      /* --- the following bits of info are returned as pointers to data or functions --- */
522      case MESS_DEVINFO_PTR_LOAD:                  info->load = DEVICE_IMAGE_LOAD_NAME(aquarius_floppy); break;
523
524      /* --- the following bits of info are returned as NULL-terminated strings --- */
525      case MESS_DEVINFO_STR_FILE_EXTENSIONS:         strcpy(info->s = device_temp_str(), "dsk"); break;
526
527      default:                              legacybasicdsk_device_getinfo(devclass, state, info); break;
528   }
529}
530
531static SYSTEM_CONFIG_START( aquarius )
532   CONFIG_RAM_DEFAULT( 4 * 1024)
533   CONFIG_RAM        ( 8 * 1024)
534   CONFIG_RAM        (20 * 1024)
535   CONFIG_RAM        (36 * 1024)
536   CONFIG_DEVICE(aquarius_cartslot_getinfo)
537   CONFIG_DEVICE(aquarius_cassette_getinfo)
538   CONFIG_DEVICE(aquarius_floppy_getinfo)
539SYSTEM_CONFIG_END
540
541/*      YEAR    NAME        PARENT      COMPAT  MACHINE     INPUT       INIT    CONFIG      COMPANY     FULLNAME         FLAGS */
542COMP(   1983,   aquarius,   0,         0,      aquarius,   aquarius,   0,      aquarius,   "Mattel",   "Aquarius (NTSC)",   0 )
543//COMP(   1984,   aquariu2,   aquarius,   0,      aquarius,   aquarius,   0,      aquarius,   "Mattel",   "Aquarius II",   GAME_NOT_WORKING )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team