~ubuntu-branches/debian/sid/mame/sid

« back to all changes in this revision

Viewing changes to mess/src/mame/drivers/macs.c

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach, Jordi Mallach, Emmanuel Kasper
  • Date: 2011-12-19 22:56:27 UTC
  • mfrom: (0.1.2)
  • Revision ID: package-import@ubuntu.com-20111219225627-ub5oga1oys4ogqzm
Tags: 0.144-1
[ Jordi Mallach ]
* Fix syntax errors in DEP5 copyright file (lintian).
* Use a versioned copyright Format specification field.
* Update Vcs-* URLs.
* Move transitional packages to the new metapackages section, and make
  them priority extra.
* Remove references to GNU/Linux and MESS sources from copyright.
* Add build variables for s390x.
* Use .xz tarballs as it cuts 4MB for the upstream sources.
* Add nplayers.ini as a patch. Update copyright file to add CC-BY-SA-3.0.

[ Emmanuel Kasper ]
* New upstream release. Closes: #651538.
* Add Free Desktop compliant png icons of various sizes taken from
  the hydroxygen iconset
* Mess is now built from a new source package, to avoid possible source
  incompatibilities between mame and the mess overlay.
* Mame-tools are not built from the mame source package anymore, but
  from the mess source package

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 
3
 
macs.c - Multi Amenity Cassette System
4
 
 
5
 
processor seems to be ST0016 (z80 based) from SETA
6
 
 
7
 
around 0x3700 of the bios (when interleaved) contains the ram test text
8
 
 
9
 
TODO:
10
 
(general)
11
 
-Hook-Up bios.
12
 
(yujan)
13
 
-Girls disappears when you win.
14
 
-Some gfx are offset.
15
 
 
16
 
 
17
 
----- Game Notes -----
18
 
 
19
 
Kisekae Mahjong  (c)1995 I'MAX
20
 
Kisekae Hanafuda (c)1995 I'MAX
21
 
Seimei-Kantei-Meimei-Ki Cult Name (c)1996 I'MAX
22
 
 
23
 
KISEKAE -- info
24
 
 
25
 
* DIP SWITCH *
26
 
 
27
 
                      | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
28
 
-------------------------------------------------------
29
 
 P2 Level |  Normal   |off|off|                       |
30
 
          |   Weak    |on |off|                       |
31
 
          |  Strong   |off|on |                       |
32
 
          |Very strong|on |on |                       |
33
 
-------------------------------------------------------
34
 
 P2 Points|  Normal   |       |off|off|               |
35
 
          |  Easy     |       |on |off|               |
36
 
          |  Hard     |       |off|on |               |
37
 
          | Very hard |       |on |on |               |
38
 
-------------------------------------------------------
39
 
 P1       |  1000pts  |               |off|           |
40
 
 points   |  2000pts  |               |on |           |
41
 
-------------------------------------------------------
42
 
  Auto    |   Yes     |                   |off|       |
43
 
  tumo    |   No      |                   |on |       |
44
 
-------------------------------------------------------
45
 
  Not     |           |                       |off|   |
46
 
  Used    |           |                       |on |   |
47
 
-------------------------------------------------------
48
 
  Tumo    |   Long    |                           |off|
49
 
  time    |   Short   |                           |on |
50
 
-------------------------------------------------------
51
 
 
52
 
* at slotA -> DIP SW3
53
 
     slotB -> DIP SW4
54
 
 
55
 
 
56
 
*/
57
 
 
58
 
#include "emu.h"
59
 
#include "cpu/z80/z80.h"
60
 
#include "sound/st0016.h"
61
 
#include "includes/st0016.h"
62
 
 
63
 
 
64
 
class macs_state : public driver_device
65
 
{
66
 
public:
67
 
        macs_state(const machine_config &mconfig, device_type type, const char *tag)
68
 
                : driver_device(mconfig, type, tag) { }
69
 
 
70
 
        UINT8 m_mux_data;
71
 
        UINT8 m_rev;
72
 
        UINT8 *m_ram1;
73
 
        UINT8 *m_ram2;
74
 
};
75
 
 
76
 
 
77
 
static MACHINE_RESET(macs);
78
 
 
79
 
 
80
 
static ADDRESS_MAP_START( macs_mem, AS_PROGRAM, 8 )
81
 
        AM_RANGE(0x0000, 0x7fff) AM_ROMBANK("bank4")
82
 
        AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
83
 
        AM_RANGE(0xc000, 0xcfff) AM_READ(st0016_sprite_ram_r) AM_WRITE(st0016_sprite_ram_w)
84
 
        AM_RANGE(0xd000, 0xdfff) AM_READ(st0016_sprite2_ram_r) AM_WRITE(st0016_sprite2_ram_w)
85
 
        AM_RANGE(0xe000, 0xe7ff) AM_RAM /* work ram ? */
86
 
        AM_RANGE(0xe800, 0xe87f) AM_RAM AM_BASE_MEMBER(macs_state, m_ram2)
87
 
        AM_RANGE(0xe900, 0xe9ff) AM_DEVREADWRITE("stsnd", st0016_snd_r, st0016_snd_w)
88
 
        AM_RANGE(0xea00, 0xebff) AM_READ(st0016_palette_ram_r) AM_WRITE(st0016_palette_ram_w)
89
 
        AM_RANGE(0xec00, 0xec1f) AM_READ(st0016_character_ram_r) AM_WRITE(st0016_character_ram_w)
90
 
        AM_RANGE(0xf000, 0xf7ff) AM_RAMBANK("bank3") /* common /backup ram ?*/
91
 
        AM_RANGE(0xf800, 0xffff) AM_RAMBANK("bank2") /* common /backup ram ?*/
92
 
ADDRESS_MAP_END
93
 
 
94
 
static WRITE8_HANDLER(rambank_w)
95
 
{
96
 
        macs_state *state = space->machine().driver_data<macs_state>();
97
 
        memory_set_bankptr(space->machine(),  "bank3", &state->m_ram1[0x10000+(data&1)*0x800] );
98
 
}
99
 
 
100
 
static READ8_HANDLER( macs_input_r )
101
 
{
102
 
        macs_state *state = space->machine().driver_data<macs_state>();
103
 
        switch(offset)
104
 
        {
105
 
                case 0:
106
 
                {
107
 
                        /*It's bit-wise*/
108
 
                        switch(state->m_mux_data&0x0f)
109
 
                        {
110
 
                                case 0x00: return input_port_read(space->machine(), "IN0");
111
 
                                case 0x01: return input_port_read(space->machine(), "IN1");
112
 
                                case 0x02: return input_port_read(space->machine(), "IN2");
113
 
                                case 0x04: return input_port_read(space->machine(), "IN3");
114
 
                                case 0x08: return input_port_read(space->machine(), "IN4");
115
 
                                default:
116
 
                                logerror("Unmapped mahjong panel mux data %02x\n",state->m_mux_data);
117
 
                                return 0xff;
118
 
                        }
119
 
                }
120
 
                case 1: return input_port_read(space->machine(), "SYS0");
121
 
                case 2: return input_port_read(space->machine(), "DSW0");
122
 
                case 3: return input_port_read(space->machine(), "DSW1");
123
 
                case 4: return input_port_read(space->machine(), "DSW2");
124
 
                case 5: return input_port_read(space->machine(), "DSW3");
125
 
                case 6: return input_port_read(space->machine(), "DSW4");
126
 
                case 7: return input_port_read(space->machine(), "SYS1");
127
 
                default:        popmessage("Unmapped I/O read at PC = %06x offset = %02x",cpu_get_pc(&space->device()),offset+0xc0);
128
 
        }
129
 
 
130
 
        return 0xff;
131
 
}
132
 
 
133
 
 
134
 
static WRITE8_HANDLER( macs_rom_bank_w )
135
 
{
136
 
        memory_set_bankptr(space->machine(),  "bank1", space->machine().region("maincpu")->base() + (data* 0x4000) + 0x10000 + macs_cart_slot*0x400000 );
137
 
 
138
 
        st0016_rom_bank=data;
139
 
}
140
 
 
141
 
static WRITE8_HANDLER( macs_output_w )
142
 
{
143
 
        macs_state *state = space->machine().driver_data<macs_state>();
144
 
        UINT8 *ROM = space->machine().region("maincpu")->base();
145
 
 
146
 
        switch(offset)
147
 
        {
148
 
                case 0:
149
 
                /*
150
 
        --x- ---- sets RAM bank?
151
 
        ---- -x-- Cassette B slot
152
 
        ---- --x- Cassette A slot
153
 
        */
154
 
 
155
 
                if(state->m_rev == 1)
156
 
                {
157
 
                        /* FIXME: dunno if this RAM bank is right, DASM tracking made on the POST screens indicates that there's just one RAM bank,
158
 
                      but then MACS2 games locks up. */
159
 
                        memory_set_bankptr(space->machine(),  "bank3", &state->m_ram1[((data&0x20)>>5)*0x1000+0x000] );
160
 
 
161
 
                        macs_cart_slot = (data & 0xc) >> 2;
162
 
 
163
 
                        memory_set_bankptr(space->machine(),  "bank4", &ROM[macs_cart_slot*0x400000+0x10000] );
164
 
                }
165
 
 
166
 
                memory_set_bankptr(space->machine(),  "bank2", &state->m_ram1[((data&0x20)>>5)*0x1000+0x800] );
167
 
                break;
168
 
                case 2: state->m_mux_data = data; break;
169
 
 
170
 
        }
171
 
}
172
 
 
173
 
static ADDRESS_MAP_START( macs_io, AS_IO, 8 )
174
 
        ADDRESS_MAP_GLOBAL_MASK(0xff)
175
 
        AM_RANGE(0x00, 0xbf) AM_READ(st0016_vregs_r) AM_WRITE(st0016_vregs_w) /* video/crt regs ? */
176
 
        AM_RANGE(0xc0, 0xc7) AM_READWRITE(macs_input_r,macs_output_w)
177
 
        AM_RANGE(0xe0, 0xe0) AM_WRITENOP /* renju = $40, neratte = 0 */
178
 
        AM_RANGE(0xe1, 0xe1) AM_WRITE(macs_rom_bank_w)
179
 
        AM_RANGE(0xe2, 0xe2) AM_WRITE(st0016_sprite_bank_w)
180
 
        AM_RANGE(0xe3, 0xe4) AM_WRITE(st0016_character_bank_w)
181
 
        AM_RANGE(0xe5, 0xe5) AM_WRITE(st0016_palette_bank_w)
182
 
        AM_RANGE(0xe6, 0xe6) AM_WRITE(rambank_w) /* banking ? ram bank ? shared rambank ? */
183
 
        AM_RANGE(0xe7, 0xe7) AM_WRITENOP /* watchdog */
184
 
        AM_RANGE(0xf0, 0xf0) AM_READ(st0016_dma_r)
185
 
ADDRESS_MAP_END
186
 
 
187
 
static GFXDECODE_START( macs )
188
 
//  GFXDECODE_ENTRY( NULL, 0, charlayout,      0, 16*4  )
189
 
GFXDECODE_END
190
 
 
191
 
static INPUT_PORTS_START( macs_base )
192
 
        /*0*/
193
 
        PORT_START("DSW0")
194
 
        PORT_DIPNAME( 0x01, 0x01, "DSW0 - BIT 1" )
195
 
        PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
196
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
197
 
        PORT_DIPNAME( 0x02, 0x02, "DSW0 - BIT 2" )
198
 
        PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
199
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
200
 
        PORT_DIPNAME( 0x04, 0x04, "DSW0 - BIT 4" )
201
 
        PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
202
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
203
 
        PORT_DIPNAME( 0x08, 0x08, "DSW0 - BIT 8" )
204
 
        PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
205
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
206
 
        PORT_DIPNAME( 0x10, 0x10, "DSW0 - BIT 10" )
207
 
        PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
208
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
209
 
        PORT_DIPNAME( 0x20, 0x20, "DSW0 - BIT 20" )
210
 
        PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
211
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
212
 
        PORT_DIPNAME( 0x40, 0x40, "DSW0 - BIT 40" )
213
 
        PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
214
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
215
 
        PORT_DIPNAME( 0x80, 0x80, "DSW0 - BIT 80" )
216
 
        PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
217
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
218
 
 
219
 
        /*1*/
220
 
        PORT_START("DSW1")
221
 
        PORT_DIPNAME( 0x01, 0x01, "DSW1 - BIT 1" )
222
 
        PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
223
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
224
 
        PORT_DIPNAME( 0x02, 0x02, "DSW1 - BIT 2" )
225
 
        PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
226
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
227
 
        PORT_DIPNAME( 0x04, 0x04, "DSW1 - BIT 4" )
228
 
        PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
229
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
230
 
        PORT_DIPNAME( 0x08, 0x08, "DSW1 - BIT 8" )
231
 
        PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
232
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
233
 
        PORT_DIPNAME( 0x10, 0x10, "DSW1 - BIT 10" )
234
 
        PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
235
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
236
 
        PORT_DIPNAME( 0x20, 0x20, "DSW1 - BIT 20" )
237
 
        PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
238
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
239
 
        PORT_DIPNAME( 0x40, 0x40, "DSW1 - BIT 40" )
240
 
        PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
241
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
242
 
        PORT_DIPNAME( 0x80, 0x80, "DSW1 - BIT 80" )
243
 
        PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
244
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
245
 
 
246
 
        /*2*/
247
 
        PORT_START("DSW2")
248
 
        PORT_DIPNAME( 0x01, 0x01, "DSW2 - BIT 1" )
249
 
        PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
250
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
251
 
        PORT_DIPNAME( 0x02, 0x02, "DSW2 - BIT 2" )
252
 
        PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
253
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
254
 
        PORT_DIPNAME( 0x04, 0x04, "DSW2 - BIT 4" )
255
 
        PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
256
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
257
 
        PORT_DIPNAME( 0x08, 0x08, "DSW2 - BIT 8" )
258
 
        PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
259
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
260
 
        PORT_DIPNAME( 0x10, 0x10, "DSW2 - BIT 10" )
261
 
        PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
262
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
263
 
        PORT_DIPNAME( 0x20, 0x20, "DSW2 - BIT 20" )
264
 
        PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
265
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
266
 
        PORT_DIPNAME( 0x40, 0x40, "DSW2 - BIT 40" )
267
 
        PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
268
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
269
 
        PORT_DIPNAME( 0x80, 0x80, "DSW2 - BIT 80" )
270
 
        PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
271
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
272
 
 
273
 
        /*3*/
274
 
        PORT_START("DSW3")
275
 
        PORT_DIPNAME( 0x01, 0x01, "DSW3 - BIT 1" )
276
 
        PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
277
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
278
 
        PORT_DIPNAME( 0x02, 0x02, "DSW3 - BIT 2" )
279
 
        PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
280
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
281
 
        PORT_DIPNAME( 0x04, 0x04, DEF_STR( Demo_Sounds ) )
282
 
        PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
283
 
        PORT_DIPSETTING(    0x04, DEF_STR( On ) )
284
 
        PORT_DIPNAME( 0x08, 0x00, "Game" )
285
 
        PORT_DIPSETTING(    0x08, "Bet Type" )
286
 
        PORT_DIPSETTING(    0x00, "Normal Type" )
287
 
        PORT_DIPNAME( 0x10, 0x10, DEF_STR( Level_Select ) )
288
 
        PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
289
 
        PORT_DIPSETTING(    0x10, DEF_STR( On ) )
290
 
        PORT_DIPNAME( 0x20, 0x20, "Memory Reset" )
291
 
        PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
292
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
293
 
        PORT_DIPNAME( 0x40, 0x40, "Analyzer" )
294
 
        PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
295
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
296
 
        PORT_DIPNAME( 0x80, 0x80, "Test Mode" )
297
 
        PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
298
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
299
 
 
300
 
        /*4 - external (printer  in cultname)*/
301
 
        PORT_START("DSW4")
302
 
        PORT_DIPNAME( 0x01, 0x01, "DSW4 - BIT 1" )
303
 
        PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
304
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
305
 
        PORT_DIPNAME( 0x02, 0x02, "DSW4 - BIT 2" )
306
 
        PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
307
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
308
 
        PORT_DIPNAME( 0x04, 0x04, "DSW4 - BIT 4" )
309
 
        PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
310
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
311
 
        PORT_DIPNAME( 0x08, 0x08, "DSW4 - BIT 8" )
312
 
        PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
313
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
314
 
        PORT_DIPNAME( 0x10, 0x10, "DSW4 - BIT 10" )
315
 
        PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
316
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
317
 
        PORT_DIPNAME( 0x20, 0x20, "DSW4 - BIT 20" )
318
 
        PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
319
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
320
 
        PORT_DIPNAME( 0x40, 0x40, "DSW4 - BIT 40" )
321
 
        PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
322
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
323
 
        PORT_DIPNAME( 0x80, 0x00, "DSW4 - BIT 80" )
324
 
        PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
325
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
326
 
 
327
 
        /*
328
 
    Note: These could likely to be switches that are on the game board and not Dip Switches
329
 
    */
330
 
        PORT_START("SYS0")
331
 
        PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED )
332
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Note In") PORT_CODE(KEYCODE_4_PAD)
333
 
 
334
 
        PORT_START("SYS1")
335
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
336
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Clear Coin Counter") PORT_CODE(KEYCODE_1_PAD)
337
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Memory Reset Key") PORT_CODE(KEYCODE_2_PAD)
338
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Analyzer Key") PORT_CODE(KEYCODE_3_PAD)
339
 
        PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
340
 
INPUT_PORTS_END
341
 
 
342
 
static INPUT_PORTS_START( macs_m )
343
 
        PORT_INCLUDE( macs_base )
344
 
 
345
 
        /*MAHJONG PANEL*/
346
 
        PORT_START("IN0")
347
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE )
348
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE )
349
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP )
350
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP )
351
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG )
352
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL )
353
 
        PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
354
 
 
355
 
        PORT_START("IN1")
356
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )
357
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E )
358
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I )
359
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M )
360
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
361
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
362
 
        PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
363
 
 
364
 
        PORT_START("IN2")
365
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B )
366
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F )
367
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J )
368
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N )
369
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
370
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
371
 
        PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
372
 
 
373
 
        PORT_START("IN3")
374
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C )
375
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G )
376
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K )
377
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
378
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
379
 
        PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
380
 
 
381
 
        PORT_START("IN4")
382
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D )
383
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H )
384
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L )
385
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
386
 
        PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
387
 
INPUT_PORTS_END
388
 
 
389
 
static INPUT_PORTS_START( kisekaem )
390
 
        PORT_INCLUDE( macs_m )
391
 
 
392
 
        PORT_MODIFY("SYS1")
393
 
        PORT_DIPNAME( 0x01, 0x01, "SYS1 - BIT 1" )
394
 
        PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
395
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
396
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 )
397
 
        PORT_DIPNAME( 0x04, 0x04, "SYS1 - BIT 4" )
398
 
        PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
399
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
400
 
        PORT_DIPNAME( 0x08, 0x08, "SYS1 - BIT 8" )
401
 
        PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
402
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
403
 
        PORT_DIPNAME( 0x10, 0x10, "SYS1 - BIT 10" )
404
 
        PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
405
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
406
 
        PORT_DIPNAME( 0x20, 0x20, "SYS1 - BIT 20" )
407
 
        PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
408
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
409
 
        PORT_DIPNAME( 0x40, 0x40, "SYS1 - BIT 40" )
410
 
        PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
411
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
412
 
        PORT_DIPNAME( 0x80, 0x00, "SYS1 - BIT 80" )
413
 
        PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
414
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
415
 
INPUT_PORTS_END
416
 
 
417
 
static INPUT_PORTS_START( macs_h )
418
 
        PORT_INCLUDE( macs_base )
419
 
 
420
 
        /*HANAFUDA PANEL*/
421
 
        // Also other inputs from the Mahjong panel are detected in Service Mode
422
 
        PORT_START("IN0")
423
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE )
424
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE )
425
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP )
426
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP )
427
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG )
428
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL )
429
 
        PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
430
 
 
431
 
        PORT_START("IN1")
432
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_HANAFUDA_A )
433
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_HANAFUDA_E )
434
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
435
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_HANAFUDA_YES )
436
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
437
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
438
 
        PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
439
 
 
440
 
        PORT_START("IN2")
441
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_HANAFUDA_B )
442
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_HANAFUDA_F )
443
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
444
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_HANAFUDA_NO )
445
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
446
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
447
 
        PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
448
 
 
449
 
        PORT_START("IN3")
450
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_HANAFUDA_C )
451
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_HANAFUDA_G )
452
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
453
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
454
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
455
 
        PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
456
 
 
457
 
        PORT_START("IN4")
458
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_HANAFUDA_D )
459
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_HANAFUDA_H )
460
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
461
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
462
 
        PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
463
 
INPUT_PORTS_END
464
 
 
465
 
 
466
 
static const st0016_interface st0016_config =
467
 
{
468
 
        &st0016_charram
469
 
};
470
 
 
471
 
static MACHINE_CONFIG_START( macs, macs_state )
472
 
        /* basic machine hardware */
473
 
        MCFG_CPU_ADD("maincpu",Z80,8000000) /* 8 MHz ? */
474
 
        MCFG_CPU_PROGRAM_MAP(macs_mem)
475
 
        MCFG_CPU_IO_MAP(macs_io)
476
 
 
477
 
        MCFG_CPU_VBLANK_INT("screen", irq0_line_hold)
478
 
 
479
 
        MCFG_MACHINE_RESET(macs)
480
 
 
481
 
        /* video hardware */
482
 
        MCFG_SCREEN_ADD("screen", RASTER)
483
 
        MCFG_SCREEN_REFRESH_RATE(60)
484
 
        MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
485
 
        MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
486
 
        MCFG_SCREEN_SIZE(128*8, 128*8)
487
 
        MCFG_SCREEN_VISIBLE_AREA(0*8, 128*8-1, 0*8, 128*8-1)
488
 
        MCFG_SCREEN_UPDATE(st0016)
489
 
 
490
 
        MCFG_GFXDECODE(macs)
491
 
        MCFG_PALETTE_LENGTH(16*16*4+1)
492
 
 
493
 
        MCFG_VIDEO_START(st0016)
494
 
 
495
 
        MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
496
 
 
497
 
        MCFG_SOUND_ADD("stsnd", ST0016, 0)
498
 
        MCFG_SOUND_CONFIG(st0016_config)
499
 
        MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
500
 
        MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
501
 
MACHINE_CONFIG_END
502
 
 
503
 
 
504
 
 
505
 
#define MACS_BIOS \
506
 
        ROM_REGION( 0x1000000, "user1", 0 ) \
507
 
        ROM_LOAD16_BYTE( "macsos_l.u43", 0x00000, 0x80000, CRC(0b5aed5e) SHA1(042e705017ee34656e2c6af45825bb2dd3447747) ) \
508
 
        ROM_LOAD16_BYTE( "macsos_h.u44", 0x00001, 0x80000, CRC(538b68e4) SHA1(a0534147791e94e726f49451d0e95671ae0a87d5) ) \
509
 
 
510
 
#define MACS2_BIOS \
511
 
        ROM_REGION( 0x1000000, "user1", 0 ) \
512
 
        ROM_LOAD16_BYTE( "macs2os_l.bin", 0x00000, 0x80000, NO_DUMP ) \
513
 
        ROM_LOAD16_BYTE( "macs2os_h.bin", 0x00001, 0x80000, NO_DUMP ) \
514
 
 
515
 
ROM_START( macsbios )
516
 
        MACS_BIOS
517
 
        ROM_REGION( 0x400000, "user2", ROMREGION_ERASEFF ) // Slot A
518
 
        ROM_REGION( 0x400000, "user3", ROMREGION_ERASEFF ) // Slot B
519
 
 
520
 
        ROM_REGION( 0x1000000, "maincpu", 0 )
521
 
        ROM_COPY( "user1",   0x00000, 0x010000, 0x400000 )
522
 
        ROM_COPY( "user1",   0x00000, 0x000000, 0x0008000 )
523
 
ROM_END
524
 
 
525
 
ROM_START( mac2bios )
526
 
        MACS2_BIOS
527
 
        ROM_REGION( 0x400000, "user2", ROMREGION_ERASEFF ) // Slot A
528
 
        ROM_REGION( 0x400000, "user3", ROMREGION_ERASEFF ) // Slot B
529
 
 
530
 
        ROM_REGION( 0x1000000, "maincpu", 0 )
531
 
        ROM_COPY( "user1",   0x00000, 0x010000, 0x400000 )
532
 
        ROM_COPY( "user1",   0x00000, 0x000000, 0x0008000 )
533
 
ROM_END
534
 
 
535
 
ROM_START( kisekaem )
536
 
        MACS_BIOS
537
 
 
538
 
        ROM_REGION( 0x400000, "user2", 0 ) // Slot A
539
 
        ROM_LOAD16_BYTE( "am-mj.u8", 0x000000, 0x100000, CRC(3cf85151) SHA1(e05400065c384730f04ef565db5ba27eb3973d15) )
540
 
        ROM_LOAD16_BYTE( "am-mj.u7", 0x000001, 0x100000, CRC(4b645354) SHA1(1dbf9141c3724e5dff2cd8066117fb1b94671a80) )
541
 
        ROM_LOAD16_BYTE( "am-mj.u6", 0x200000, 0x100000, CRC(23b3aa24) SHA1(bfabdb16f9b1b60230bb636a944ab46fdfda49d7) )
542
 
        ROM_LOAD16_BYTE( "am-mj.u5", 0x200001, 0x100000, CRC(b4d53e29) SHA1(d7683fdd5531bf1aa0ef1e4e6f517b31e2d5829e) )
543
 
 
544
 
 
545
 
        ROM_REGION( 0x400000, "user3", ROMREGION_ERASEFF ) // Slot B
546
 
 
547
 
        ROM_REGION( 0x1000000, "maincpu", 0 )
548
 
        ROM_COPY( "user1",   0x00000, 0x010000, 0x400000 )
549
 
        ROM_COPY( "user1",   0x00000, 0x000000, 0x008000 )
550
 
        ROM_COPY( "user2",   0x00000, 0x410000, 0x400000 )
551
 
ROM_END
552
 
 
553
 
ROM_START( kisekaeh )
554
 
        MACS_BIOS
555
 
 
556
 
        ROM_REGION( 0x400000, "user2", 0 ) // Slot A
557
 
        ROM_LOAD16_BYTE( "kh-u8.bin", 0x000000, 0x100000, CRC(601b9e6a) SHA1(54508a6db3928f78897df64ce400791e4789d0f6) )
558
 
        ROM_LOAD16_BYTE( "kh-u7.bin", 0x000001, 0x100000, CRC(8f6e4bb3) SHA1(361545189feeda0887f930727d25655309b84629) )
559
 
        ROM_LOAD16_BYTE( "kh-u6.bin", 0x200000, 0x100000, CRC(8e700204) SHA1(876e5530d749828de077293cb109a71b67cef140) )
560
 
        ROM_LOAD16_BYTE( "kh-u5.bin", 0x200001, 0x100000, CRC(709bf7c8) SHA1(0a93e0c4f9be22a3302a1c5d2a6ec4739b202ea8) )
561
 
 
562
 
 
563
 
        ROM_REGION( 0x400000, "user3", ROMREGION_ERASEFF ) // Slot B
564
 
 
565
 
        ROM_REGION( 0x1000000, "maincpu", 0 )
566
 
        ROM_COPY( "user1",   0x00000, 0x010000, 0x400000 )
567
 
        ROM_COPY( "user1",   0x00000, 0x000000, 0x008000 )
568
 
        ROM_COPY( "user2",   0x00000, 0x410000, 0x400000 )
569
 
ROM_END
570
 
 
571
 
ROM_START( cultname ) // uses printer - two different games ? (slot a - checks for printer, slot b - not)
572
 
        MACS_BIOS
573
 
 
574
 
        ROM_REGION( 0x400000, "user2", 0 ) // Slot A
575
 
        ROM_LOAD16_BYTE( "cult-d0.u8", 0x000000, 0x100000, CRC(394bc1a6) SHA1(98df5406862234815b46c7b0ac0b19e4b597d1b6) )
576
 
        ROM_LOAD16_BYTE( "cult-d1.u7", 0x000001, 0x100000, CRC(f628133b) SHA1(f06e20212074e5d95cc7d419ac8ce98fb9be3b62) )
577
 
        ROM_LOAD16_BYTE( "cult-d2.u6", 0x200000, 0x100000, CRC(c5521bc6) SHA1(7554b56b0201b7d81754defa2244fb7ff7452bf6) )
578
 
        ROM_LOAD16_BYTE( "cult-d3.u5", 0x200001, 0x100000, CRC(4325b09b) SHA1(45699a0444a221f893724754c917d33041cabcb9) )
579
 
 
580
 
 
581
 
        ROM_REGION( 0x400000, "user3", 0 ) // Slot B
582
 
        ROM_LOAD16_BYTE( "cult-g0.u8", 0x000000, 0x100000, CRC(f5ab977b) SHA1(e7ee758cc2864500b339e236b944f98df9a1c10e) )
583
 
        ROM_LOAD16_BYTE( "cult-g1.u7", 0x000001, 0x100000, CRC(32ae15a4) SHA1(061992efec1ed5527f200bf4c111344b156e759d) )
584
 
        ROM_LOAD16_BYTE( "cult-g2.u6", 0x200000, 0x100000, CRC(30ed056d) SHA1(71735339bb501b94402ef403b5a2a60effa39c36) )
585
 
        ROM_LOAD16_BYTE( "cult-g3.u5", 0x200001, 0x100000, CRC(fe58b418) SHA1(512f5c544cfafaa98bd2b3791ff1cf67adecec8d) )
586
 
 
587
 
 
588
 
        ROM_REGION( 0x1000000, "maincpu", 0 )
589
 
        ROM_COPY( "user1",   0x00000, 0x010000, 0x400000 )
590
 
        ROM_COPY( "user1",   0x00000, 0x000000, 0x008000 )
591
 
        ROM_COPY( "user2",   0x00000, 0x410000, 0x400000 )
592
 
        ROM_COPY( "user3",   0x00000, 0x810000, 0x400000 )
593
 
ROM_END
594
 
 
595
 
/* these are listed as MACS2 sub-boards, is it the same?  - it's not ;) */
596
 
 
597
 
ROM_START( yuka )
598
 
        MACS2_BIOS
599
 
 
600
 
        ROM_REGION( 0x400000, "user2", 0 ) // Slot A
601
 
 
602
 
        ROM_LOAD16_BYTE( "yu-ka_2.u6", 0x000001, 0x100000, CRC(c3c5728b) SHA1(e53cdcae556f34bab45d9342fd78ec29b6543c46) )
603
 
        ROM_LOAD16_BYTE( "yu-ka_4.u5", 0x000000, 0x100000, CRC(7e391ee6) SHA1(3a0c122c9d0e2a91df6d8039fb958b6d00997747) )
604
 
        ROM_LOAD16_BYTE( "yu-ka_1.u8", 0x200001, 0x100000, CRC(bccd1b15) SHA1(02511f3be60c53b5f5d90f12f0648f6e184ca667) )
605
 
        ROM_LOAD16_BYTE( "yu-ka_3.u7", 0x200000, 0x100000, CRC(45b8263e) SHA1(59e1846c91dc39a086e8306260506673eb91de0b) )
606
 
 
607
 
        ROM_REGION( 0x400000, "user3", ROMREGION_ERASE00 ) // Slot B
608
 
 
609
 
        ROM_REGION( 0x1000000, "maincpu", 0 )
610
 
        ROM_COPY( "user2",   0x00000, 0x010000, 0x400000 )
611
 
        ROM_COPY( "user2",   0x00000, 0x000000, 0x0008000 )
612
 
ROM_END
613
 
 
614
 
ROM_START( yujan )
615
 
        MACS2_BIOS
616
 
 
617
 
        ROM_REGION( 0x400000, "user2", 0 ) // Slot A
618
 
        ROM_LOAD16_BYTE( "yu-jan_2.u6", 0x000001, 0x100000, CRC(2f4a8d4b) SHA1(4b328a253b1980a76f46a9a98a7f486813894a33) )
619
 
        ROM_LOAD16_BYTE( "yu-jan_4.u5", 0x000000, 0x100000, CRC(226df87b) SHA1(a887728f1ea2ef5f6b4dcd6b5b61586f5e8f267d) )
620
 
        ROM_LOAD16_BYTE( "yu-jan_1.u8", 0x200001, 0x100000, CRC(feeeee6a) SHA1(e9613f50d6d2e62fac6b529f81486250cfe83819) )
621
 
        ROM_LOAD16_BYTE( "yu-jan_3.u7", 0x200000, 0x100000, CRC(1c1d6997) SHA1(9b07ae6b9ef1c0b57fbaa5fd0bcf1d2d7f17351f) )
622
 
 
623
 
        ROM_REGION( 0x400000, "user3", ROMREGION_ERASEFF ) // Slot B
624
 
 
625
 
        ROM_REGION( 0x1000000, "maincpu", 0 )
626
 
        ROM_COPY( "user2",   0x00000, 0x010000, 0x400000 )
627
 
        ROM_COPY( "user2",   0x00000, 0x000000, 0x0008000 )
628
 
ROM_END
629
 
 
630
 
static const UINT8 ramdata[160]=
631
 
{
632
 
        0xAF, 0xED, 0x47, 0xD3, 0xC1, 0xD3, 0x0C, 0xD3, 0xAF, 0xED, 0x47, 0xD3, 0xC1, 0xD3, 0x0C, 0xD3,
633
 
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
634
 
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
635
 
        0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
636
 
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xAF, 0x32, 0x1F, 0xFE, 0xD3,
637
 
        0xE0, 0x3A, 0x0A, 0xE8, 0xF6, 0x04, 0x32, 0x0A, 0xE8, 0xD3, 0xC0, 0x01, 0x08, 0x00, 0x21, 0x00,
638
 
        0x01, 0x11, 0x00, 0xFE, 0xED, 0xB0, 0x01, 0x10, 0x00, 0x21, 0x10, 0x01, 0x11, 0x00, 0xF0, 0xED,
639
 
        0xB0, 0x3A, 0x0A, 0xE8, 0xE6, 0xF3, 0xF6, 0x08, 0x32, 0x0A, 0xE8, 0xD3, 0xC0, 0x01, 0x08, 0x00,
640
 
        0x21, 0x00, 0x01, 0x11, 0x08, 0xFE, 0xED, 0xB0, 0x01, 0x10, 0x00, 0x21, 0x10, 0x01, 0x11, 0x20,
641
 
        0xF0, 0xED, 0xB0, 0x3A, 0x0A, 0xE8, 0xE6, 0xF3, 0x32, 0x0A, 0xE8, 0xD3, 0xC0, 0xC9, 0x00, 0xF3
642
 
};
643
 
 
644
 
static MACHINE_RESET(macs)
645
 
{
646
 
        macs_state *state = machine.driver_data<macs_state>();
647
 
        UINT8 *macs_ram1 = state->m_ram1;
648
 
        #if 0
649
 
        UINT8 *macs_ram2 = state->m_ram2;
650
 
/*
651
 
        BIOS ram init:
652
 
 
653
 
        72CA: 01 C7 00      ld   bc,$00C7
654
 
        72CD: 11 9F FE      ld   de,$FE9F
655
 
        72D0: 21 27 73      ld   hl,$7327
656
 
        72D3: ED B0         ldir
657
 
        72D5: 3E C3         ld   a,$C3
658
 
        72D7: 32 16 E8      ld   ($E816),a
659
 
        72DA: 32 19 E8      ld   ($E819),a
660
 
        72DD: 21 9F FE      ld   hl,$FE9F
661
 
        72E0: 22 17 E8      ld   ($E817),hl
662
 
        72E3: 21 E0 FE      ld   hl,$FEE0
663
 
        72E6: 22 1A E8      ld   ($E81A),hl
664
 
        ...
665
 
        //bank change ? = set 5th bit in port $c0
666
 
        ...
667
 
        72F8: 01 C7 00      ld   bc,$00C7
668
 
        72FB: 11 9F FE      ld   de,$FE9F
669
 
        72FE: 21 27 73      ld   hl,$7327
670
 
        7301: ED B0         ldir
671
 
        ...
672
 
        7305: 01 07 05      ld   bc,$0507
673
 
        7308: 11 00 F8      ld   de,$F800
674
 
        730B: 21 FA 73      ld   hl,$73FA
675
 
        730E: ED B0         ldir
676
 
        ...
677
 
*/
678
 
                memcpy(macs_ram1 + 0x0e9f, machine.region("user1")->base()+0x7327, 0xc7);
679
 
                memcpy(macs_ram1 + 0x1e9f, machine.region("user1")->base()+0x7327, 0xc7);
680
 
 
681
 
                memcpy(macs_ram1 + 0x0800, machine.region("user1")->base()+0x73fa, 0x507);
682
 
                memcpy(macs_ram1 + 0x1800, machine.region("user1")->base()+0x73fa, 0x507);
683
 
 
684
 
#define MAKEJMP(n,m)    macs_ram2[(n) - 0xe800 + 0]=0xc3;\
685
 
                                                macs_ram2[(n) - 0xe800 + 1]=(m)&0xff;\
686
 
                                                macs_ram2[(n) - 0xe800 + 2]=((m)>>8)&0xff;
687
 
 
688
 
                MAKEJMP(0xe810, 0xfe4b);
689
 
                MAKEJMP(0xe816, 0xfe9f);
690
 
                MAKEJMP(0xe81a, 0xfee0);
691
 
 
692
 
#undef MAKEJMP
693
 
 
694
 
                {
695
 
                        int i;
696
 
                        for(i=0;i<160;i++)
697
 
                        {
698
 
                                macs_ram1[0xe00+i]=ramdata[i];
699
 
                                macs_ram1[0x1e00+i]=ramdata[i];
700
 
                        }
701
 
                }
702
 
                macs_ram1[0x0f67]=0xff;
703
 
                macs_ram1[0x1f67]=0xff;
704
 
 
705
 
                macs_ram1[0x0ff6]=0x02;
706
 
                macs_ram1[0x1ff6]=0x02;
707
 
 
708
 
                macs_ram1[0x0ff7]=0x08;
709
 
                macs_ram1[0x1ff7]=0x08;
710
 
 
711
 
                macs_ram1[0x0ff8]=0x6c;
712
 
                macs_ram1[0x1ff8]=0x6c;
713
 
 
714
 
                macs_ram1[0x0ff9]=0x07;
715
 
                macs_ram1[0x1ff9]=0x07;
716
 
                #endif
717
 
 
718
 
                memory_set_bankptr(machine,  "bank1", machine.region("maincpu")->base() + 0x10000 );
719
 
                memory_set_bankptr(machine,  "bank2", macs_ram1+0x800);
720
 
                memory_set_bankptr(machine,  "bank3", macs_ram1+0x10000);
721
 
                memory_set_bankptr(machine,  "bank4", machine.region("maincpu")->base() );
722
 
}
723
 
 
724
 
static DRIVER_INIT(macs)
725
 
{
726
 
        macs_state *state = machine.driver_data<macs_state>();
727
 
        state->m_ram1=auto_alloc_array(machine, UINT8, 0x20000);
728
 
        st0016_game=10|0x80;
729
 
        state->m_rev = 1;
730
 
}
731
 
 
732
 
static DRIVER_INIT(macs2)
733
 
{
734
 
        macs_state *state = machine.driver_data<macs_state>();
735
 
        state->m_ram1=auto_alloc_array(machine, UINT8, 0x20000);
736
 
        st0016_game=10|0x80;
737
 
        state->m_rev = 2;
738
 
}
739
 
 
740
 
static DRIVER_INIT(kisekaeh)
741
 
{
742
 
        macs_state *state = machine.driver_data<macs_state>();
743
 
        state->m_ram1=auto_alloc_array(machine, UINT8, 0x20000);
744
 
        st0016_game=11|0x180;
745
 
        state->m_rev = 1;
746
 
}
747
 
 
748
 
static DRIVER_INIT(kisekaem)
749
 
{
750
 
        macs_state *state = machine.driver_data<macs_state>();
751
 
        state->m_ram1=auto_alloc_array(machine, UINT8, 0x20000);
752
 
        st0016_game=10|0x180;
753
 
        state->m_rev = 1;
754
 
}
755
 
 
756
 
 
757
 
GAME( 1995, macsbios, 0,        macs, macs_m, macs,     ROT0, "I'Max", "Multi Amenity Cassette System BIOS", GAME_IS_BIOS_ROOT | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING )
758
 
GAME( 1995, mac2bios, 0,        macs, macs_m, macs2,     ROT0, "I'Max", "Multi Amenity Cassette System 2 BIOS", GAME_IS_BIOS_ROOT | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING )
759
 
 
760
 
GAME( 1995, kisekaem, macsbios, macs, kisekaem, kisekaem,   ROT0, "I'Max", "Kisekae Mahjong",  GAME_NOT_WORKING|GAME_IMPERFECT_SOUND )
761
 
GAME( 1995, kisekaeh, macsbios, macs, macs_h,   kisekaeh,   ROT0, "I'Max", "Kisekae Hanafuda",  GAME_NOT_WORKING |GAME_IMPERFECT_SOUND)
762
 
GAME( 1996, cultname, macsbios, macs, macs_m,   macs,       ROT0, "I'Max", "Seimei-Kantei-Meimei-Ki Cult Name",  GAME_NOT_WORKING |GAME_IMPERFECT_SOUND)
763
 
GAME( 1999, yuka,     macsbios, macs, macs_h,   macs2,      ROT0, "Yubis / T.System", "Yu-Ka",  0 )
764
 
GAME( 1999, yujan,    macsbios, macs, macs_m,   macs2,      ROT0, "Yubis / T.System", "Yu-Jan",  0 )