Previous 15994 Revisions Next

r3054 Sunday 17th August, 2008 at 12:58:38 UTC by Firewave
Removed obsolete files
[src/emu/cpu]drcumld.c drcumld.h
[src/mame/drivers]exctsccr.c kinstb.c m92.h wilytowr.c
[src/mame/includes]rescap.h
[src/mame/machine]drakton.c pckeybrd.h pcshare.h strtheat.c
[src/mame/video]exctsccr.c

src/mame/machine/pckeybrd.h
r3053r3054
1/**********************************************************************
2
3    pckeybrd.h
4
5    PC-style keyboard emulation
6
7    This emulation is decoupled from the AT 8042 emulation used in the
8    IBM ATs and above
9
10**********************************************************************/
11
12#ifndef PCKEYBRD_H
13#define PCKEYBRD_H
14
15typedef enum
16{
17   AT_KEYBOARD_TYPE_PC,
18   AT_KEYBOARD_TYPE_AT,
19   AT_KEYBOARD_TYPE_MF2
20} AT_KEYBOARD_TYPE;
21
22void at_keyboard_init(running_machine *machine, AT_KEYBOARD_TYPE type);
23
24void at_keyboard_polling(void);
25int at_keyboard_read(void);
26void at_keyboard_write(UINT8 data);
27void at_keyboard_reset(void);
28void at_keyboard_set_scan_code_set(int set);
29
30INPUT_PORTS_EXTERN( pc_keyboard );
31INPUT_PORTS_EXTERN( at_keyboard );
32
33#endif /* PCKEYBRD_H */
34
35
src/mame/machine/pcshare.h
r3053r3054
1#include "sound/custom.h"
2
3/* flags for init_pc_common */
4#define PCCOMMON_KEYBOARD_PC   0
5#define PCCOMMON_KEYBOARD_AT   1
6
7void init_pc_common(running_machine *machine, UINT32 flags, void (*set_keyb_int_func)(int));
8
9void pc_keyboard(void);
10UINT8 pc_keyb_read(void);
11void pc_keyb_set_clock(int on);
12void pc_keyb_clear(void);
13
src/mame/machine/strtheat.c
r3053r3054
1/***************************************************************************
2
3  machine.c
4
5  Street Heat runs on the same type board as theglobp. It features 4 decryption algorythms
6that can be implemented sequentially using the IN command. See machine\theglobp.c for more
7details.  The advantage of this is weak sections can be isolated.  The key that contains the
8text is obviously easily broken as is the boot section.  The remaining 2 keys are not used
9much which means there's not much data to look at.  Knowing the last command in a section
10will be IN is enough of a clue to break it though.
11
12  This system is fairly effective in preventing decrypted roms.  Certain key addresses are
13read in all 4 states. That is easily patched, but in at least some of the games encrypted
14program code is read in the wrong key as data and used as sound data.  A
15plaintext version of the roms produces things like 30 second long coinup sounds.
16
17  - David Widel (d_widel@hotmail.com)
18
19***************************************************************************/
20
21#include "driver.h"
22#include "includes/dkong.h"
23
24static void strtheat_decrypt_rom_8(void)
25{
26   int oldbyte,inverted_oldbyte,newbyte;
27   int mem;
28   UINT8 *RAM;
29
30   RAM = memory_region(REGION_CPU1);
31
32
33   for (mem=0;mem<0x4000;mem++)
34   {
35      oldbyte = RAM[mem];
36      inverted_oldbyte = ~oldbyte;
37
38      /*  Note: D2 is inverted and connected to D1, D5 is inverted and
39            connected to D0.  The other six data bits are converted by a
40            PAL10H8 driven by the counter. */
41      newbyte = 0;
42
43      /*  start  c  */
44      newbyte  = (inverted_oldbyte & 0x80) >> 3;
45      newbyte |= (inverted_oldbyte & 0x40) >> 0;
46      newbyte |= (inverted_oldbyte & 0x20) >> 5;
47      newbyte |= (inverted_oldbyte & 0x10) >> 2;
48      newbyte |= (inverted_oldbyte & 0x08) >> 0;
49      newbyte |= (inverted_oldbyte & 0x04) >> 1;
50      newbyte |= (oldbyte & 0x02) << 4;
51      newbyte |= (oldbyte & 0x01) << 7;
52
53      RAM[mem + 0x10000] = newbyte;
54   }
55}
56
57static void strtheat_decrypt_rom_9(void)
58{
59   int oldbyte,inverted_oldbyte,newbyte;
60   int mem;
61   UINT8 *RAM;
62
63   RAM = memory_region(REGION_CPU1);
64
65   for (mem=0;mem<0x4000;mem++)
66   {
67      oldbyte = RAM[mem];
68      inverted_oldbyte = ~oldbyte;
69
70      /*  Note: D2 is inverted and connected to D1, D5 is inverted and
71            connected to D0.  The other six data bits are converted by a
72            PAL10H8 driven by the counter. */
73      newbyte = 0;
74
75      /*   d  */
76      newbyte  = (oldbyte & 0x80) >> 5;
77      newbyte |= (inverted_oldbyte & 0x40) << 0;
78      newbyte |= (inverted_oldbyte & 0x20) >> 5;
79      newbyte |= (inverted_oldbyte & 0x10) << 1;
80      newbyte |= (inverted_oldbyte & 0x08) << 0;
81      newbyte |= (inverted_oldbyte & 0x04) >> 1;
82      newbyte |= (inverted_oldbyte & 0x02) << 3;
83      newbyte |= (oldbyte & 0x01) << 7;
84
85      RAM[mem + 0x14000] = newbyte;
86   }
87}
88
89static void strtheat_decrypt_rom_A(void)
90{
91   int oldbyte,inverted_oldbyte,newbyte;
92   int mem;
93   UINT8 *RAM;
94
95   RAM = memory_region(REGION_CPU1);
96
97   for (mem=0;mem<0x4000;mem++)
98   {
99      oldbyte = RAM[mem];
100      inverted_oldbyte = ~oldbyte;
101
102      /*  Note: D2 is inverted and connected to D1, D5 is inverted and
103            connected to D0.  The other six data bits are converted by a
104            PAL10H8 driven by the counter. */
105      newbyte = 0;
106
107      /* DAHF bGcE   dis B   */
108      newbyte  = (inverted_oldbyte & 0x80) >> 3;
109      newbyte |= (inverted_oldbyte & 0x40) << 1;
110      newbyte |= (inverted_oldbyte & 0x20) >> 5;
111      newbyte |= (inverted_oldbyte & 0x10) >> 2;
112      newbyte |= (oldbyte & 0x08) << 3;
113      newbyte |= (inverted_oldbyte & 0x04) >> 1;
114      newbyte |= (oldbyte & 0x02) << 4;
115      newbyte |= (inverted_oldbyte & 0x01) << 3;
116
117      RAM[mem + 0x18000] = newbyte;
118   }
119}
120
121static void strtheat_decrypt_rom_B(void)
122{
123   int oldbyte,inverted_oldbyte,newbyte;
124   int mem;
125   UINT8 *RAM;
126
127   RAM = memory_region(REGION_CPU1);
128
129   for (mem=0;mem<0x4000;mem++)
130   {
131      oldbyte = RAM[mem];
132      inverted_oldbyte = ~oldbyte;
133
134      /*  Note: D2 is inverted and connected to D1, D5 is inverted and
135            connected to D0.  The other six data bits are converted by a
136            PAL10H8 driven by the counter. */
137      newbyte = 0;
138
139      /*  a  ascii fAHCbGDE  */
140      newbyte  = (oldbyte & 0x80) >> 5;
141      newbyte |= (inverted_oldbyte & 0x40) << 1;
142      newbyte |= (inverted_oldbyte & 0x20) >> 5;
143      newbyte |= (inverted_oldbyte & 0x10) << 1;
144      newbyte |= (oldbyte & 0x08) << 3;
145      newbyte |= (inverted_oldbyte & 0x04) >> 1;
146      newbyte |= (inverted_oldbyte & 0x02) << 3;
147      newbyte |= (inverted_oldbyte & 0x01) << 3;
148
149      RAM[mem + 0x1C000] = newbyte;
150   }
151}
152
153static READ8_HANDLER( strtheat_inputport_0_r )
154{
155   if(input_port_read_indexed(machine, 3) & 0x40)
156   {
157      /* Joystick inputs */
158      return input_port_read_indexed(machine, 0);
159   }
160   else
161   {
162      /* Steering Wheel inputs */
163      return (input_port_read_indexed(machine, 0) & ~3) | (input_port_read_indexed(machine, 4) & 3);
164   }
165}
166
167static READ8_HANDLER( strtheat_inputport_1_r )
168{
169   if(input_port_read_indexed(machine, 3) & 0x40)
170   {
171      /* Joystick inputs */
172      return input_port_read_indexed(machine, 1);
173   }
174   else
175   {
176      /* Steering Wheel inputs */
177      return (input_port_read_indexed(machine, 1) & ~3) | (input_port_read_indexed(machine, 5) & 3);
178   }
179}
180
181DRIVER_INIT( strtheat )
182{
183
184   memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, SMH_BANK1 );
185
186   /* While the PAL supports up to 16 decryption methods, only four
187        are actually used in the PAL.  Therefore, we'll take a little
188        memory overhead and decrypt the ROMs using each method in advance. */
189   strtheat_decrypt_rom_8();
190   strtheat_decrypt_rom_9();
191   strtheat_decrypt_rom_A();
192   strtheat_decrypt_rom_B();
193
194   /* custom handlers supporting Joystick or Steering Wheel */
195   memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x7c00, 0x7c00, 0, 0, strtheat_inputport_0_r);
196   memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x7c80, 0x7c80, 0, 0, strtheat_inputport_1_r);
197}
src/mame/machine/drakton.c
r3053r3054
1/***************************************************************************************
2    Drakton (c) 1984 Epos
3    decryption by Pierpaolo Prazzoli
4    based on decryptions of the other Epos games
5
6    For general documentation on how the encryption works, see machine/theglobp.c
7****************************************************************************************/
8
9#include "driver.h"
10#include "includes/dkong.h"
11
12static void drakton_decrypt_rom_8(void)
13{
14   UINT8 oldbyte,newbyte;
15   UINT8 *ROM;
16   int mem;
17
18   ROM = memory_region(REGION_CPU1);
19
20   for (mem=0;mem<0x4000;mem++)
21   {
22      oldbyte = ROM[mem];
23
24      /*  Note: D2 is inverted and connected to D1, D5 is inverted and
25            connected to D0.  The other six data bits are converted by a
26            PAL10H8 driven by the counter. */
27
28      newbyte = (oldbyte & 0x02) | (~oldbyte & ~0x02);
29      newbyte = BITSWAP8(newbyte,7,6,1,3,0,4,2,5);
30
31      ROM[mem + 0x10000] = newbyte;
32   }
33}
34
35static void drakton_decrypt_rom_9(void)
36{
37   UINT8 oldbyte,newbyte;
38   UINT8 *ROM;
39   int mem;
40
41   ROM = memory_region(REGION_CPU1);
42
43   for (mem=0;mem<0x4000;mem++)
44   {
45      oldbyte = ROM[mem];
46
47      /*  Note: D2 is inverted and connected to D1, D5 is inverted and
48            connected to D0.  The other six data bits are converted by a
49            PAL10H8 driven by the counter. */
50
51      newbyte = (oldbyte & 0x40) | (~oldbyte & ~0x40);
52      newbyte = BITSWAP8(newbyte,7,1,4,3,0,6,2,5);
53
54      ROM[mem + 0x14000] = newbyte;
55   }
56}
57
58static void drakton_decrypt_rom_A(void)
59{
60   UINT8 oldbyte,newbyte;
61   UINT8 *ROM;
62   int mem;
63
64   ROM = memory_region(REGION_CPU1);
65
66   for (mem=0;mem<0x4000;mem++)
67   {
68      oldbyte = ROM[mem];
69
70      /*  Note: D2 is inverted and connected to D1, D5 is inverted and
71            connected to D0.  The other six data bits are converted by a
72            PAL10H8 driven by the counter. */
73
74      newbyte = (oldbyte & 0x8a) | (~oldbyte & ~0x8a);
75      newbyte = BITSWAP8(newbyte,7,6,1,0,3,4,2,5);
76
77      ROM[mem + 0x18000] = newbyte;
78   }
79}
80
81static void drakton_decrypt_rom_B(void)
82{
83   UINT8 oldbyte,newbyte;
84   UINT8 *ROM;
85   int mem;
86
87   ROM = memory_region(REGION_CPU1);
88
89   for (mem=0;mem<0x4000;mem++)
90   {
91      oldbyte = ROM[mem];
92
93      /*  Note: D2 is inverted and connected to D1, D5 is inverted and
94            connected to D0.  The other six data bits are converted by a
95            PAL10H8 driven by the counter. */
96
97      newbyte = (oldbyte & 0xc8) | (~oldbyte & ~0xc8);
98      newbyte = BITSWAP8(newbyte,7,1,4,0,3,6,2,5);
99
100      ROM[mem + 0x1C000] = newbyte;
101   }
102}
103
104DRIVER_INIT( drakton )
105{
106
107   memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, SMH_BANK1 );
108
109   /* While the PAL supports up to 16 decryption methods, only four
110        are actually used in the PAL.  Therefore, we'll take a little
111        memory overhead and decrypt the ROMs using each method in advance. */
112
113   drakton_decrypt_rom_8();
114   drakton_decrypt_rom_9();
115   drakton_decrypt_rom_A();
116   drakton_decrypt_rom_B();
117}
src/mame/includes/rescap.h
r3053r3054
1#ifndef RC_MACROS_H
2#define RC_MACROS_H
3
4/* Little helpers for magnitude conversions */
5#define RES_K(res) ((double)(res)*1e3)
6#define RES_M(res) ((double)(res)*1e6)
7#define CAP_U(cap) ((double)(cap)*1e-6)
8#define CAP_N(cap) ((double)(cap)*1e-9)
9#define CAP_P(cap) ((double)(cap)*1e-12)
10
11#endif
src/mame/video/exctsccr.c
r3053r3054
1#include "driver.h"
2
3static int gfx_bank;
4
5static tilemap *bg_tilemap;
6
7/***************************************************************************
8
9  Convert the color PROMs into a more useable format.
10
11***************************************************************************/
12PALETTE_INIT( exctsccr )
13{
14   int i;
15
16   /* allocate the colortable */
17   machine->colortable = colortable_alloc(machine, 0x20);
18
19   /* create a lookup table for the palette */
20   for (i = 0; i < 0x20; i++)
21   {
22      int bit0, bit1, bit2;
23      int r, g, b;
24
25      /* red component */
26      bit0 = (color_prom[i] >> 0) & 0x01;
27      bit1 = (color_prom[i] >> 1) & 0x01;
28      bit2 = (color_prom[i] >> 2) & 0x01;
29      r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
30
31      /* green component */
32      bit0 = (color_prom[i] >> 3) & 0x01;
33      bit1 = (color_prom[i] >> 4) & 0x01;
34      bit2 = (color_prom[i] >> 5) & 0x01;
35      g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
36
37      /* blue component */
38      bit0 = 0;
39      bit1 = (color_prom[i] >> 6) & 0x01;
40      bit2 = (color_prom[i] >> 7) & 0x01;
41      b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
42
43      colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
44   }
45
46   /* color_prom now points to the beginning of the lookup table */
47   color_prom += 0x20;
48
49   /* characters */
50   for (i = 0; i < 0x100; i++)
51   {
52      int swapped_i = BITSWAP8(i,2,7,6,5,4,3,1,0);
53      UINT8 ctabentry = color_prom[0x100 + swapped_i];
54      colortable_entry_set_value(machine->colortable, i, ctabentry);
55   }
56   /* sprites */
57   for (i = 0x80; i < 0x100; i++)
58   {
59      int swapped_i = BITSWAP8(i,2,7,6,5,4,3,1,0);
60      UINT8 ctabentry = color_prom[0x100 + swapped_i] | 0x10;
61      colortable_entry_set_value(machine->colortable, i, ctabentry);
62   }
63
64   /* sprites */
65   for (i = 0; i < 0x100; i++)
66   {
67      UINT8 ctabentry = color_prom[i] | 0x10;
68      colortable_entry_set_value(machine->colortable, i + 0x100, ctabentry);
69   }
70}
71
72WRITE8_HANDLER( exctsccr_videoram_w )
73{
74   videoram[offset] = data;
75   tilemap_mark_tile_dirty(bg_tilemap, offset);
76}
77
78WRITE8_HANDLER( exctsccr_colorram_w )
79{
80   colorram[offset] = data;
81   tilemap_mark_tile_dirty(bg_tilemap, offset);
82}
83
84WRITE8_HANDLER( exctsccr_gfx_bank_w )
85{
86   data &= 0x01;
87   if (gfx_bank != data)
88   {
89      gfx_bank = data;
90      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
91   }
92}
93
94WRITE8_HANDLER( exctsccr_flipscreen_w )
95{
96   flip_screen_set(data & 0x01);
97}
98
99static TILE_GET_INFO( get_bg_tile_info )
100{
101   int code = videoram[tile_index];
102   int color = colorram[tile_index] & 0x0f;
103
104   SET_TILE_INFO(0, code + (gfx_bank << 8), color, 0);
105}
106
107VIDEO_START( exctsccr )
108{
109   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows,
110       8, 8, 32, 32);
111}
112
113static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
114{
115   int offs;
116   UINT8 *OBJ1, *OBJ2;
117
118   OBJ1 = videoram;
119   OBJ2 = &(spriteram[0x20]);
120
121   for ( offs = 0x0e; offs >= 0; offs -= 2 )
122   {
123      int sx,sy,code,bank,flipx,flipy,color;
124
125      sx = 256 - OBJ2[offs+1];
126      sy = OBJ2[offs] - 16;
127
128      code = ( OBJ1[offs] >> 2 ) & 0x3f;
129      flipx = ( OBJ1[offs] ) & 0x01;
130      flipy = ( OBJ1[offs] ) & 0x02;
131      color = ( OBJ1[offs+1] ) & 0x0f;
132      bank = ( ( OBJ1[offs+1] >> 4 ) & 1 );
133
134      drawgfx(bitmap,machine->gfx[1],
135            code + (bank << 6),
136            color,
137            flipx, flipy,
138            sx,sy,
139            cliprect,
140            TRANSPARENCY_PEN,0);
141   }
142
143   OBJ1 = spriteram_2;
144   OBJ2 = spriteram;
145
146   for ( offs = 0x0e; offs >= 0; offs -= 2 )
147   {
148      int sx,sy,code,flipx,flipy,color;
149
150      sx = 256 - OBJ2[offs+1];
151      sy = OBJ2[offs] - 16;
152
153      code = ( OBJ1[offs] >> 2 ) & 0x3f;
154      flipx = ( OBJ1[offs] ) & 0x01;
155      flipy = ( OBJ1[offs] ) & 0x02;
156      color = ( OBJ1[offs+1] ) & 0x0f;
157
158      drawgfx(bitmap,machine->gfx[2],
159         code,
160         color,
161         flipx, flipy,
162         sx,sy,
163         cliprect,
164         TRANSPARENCY_PENS,
165         colortable_get_transpen_mask(machine->colortable, machine->gfx[2], color, 0x10));
166   }
167}
168
169
170
171VIDEO_UPDATE( exctsccr )
172{
173   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
174   draw_sprites(screen->machine, bitmap, cliprect);
175   return 0;
176}
src/mame/drivers/wilytowr.c
r3053r3054
1/***************************************************************************
2
3Wily Tower              (c) 1984 Irem
4Fighting Basketball     (c) 1984 Paradise Co. Ltd.
5
6driver by Nicola Salmoria
7
8
9Notes:
10- Unless there is some special logic related to NMI enable, the game doesn't
11  rely on vblank for timing. It all seems to be controlled by the CPU clock.
12  The NMI handler just handles the "Stop Mode" dip switch.
13
14Tomasz Slanina 2008.06.14:
15- Addedd sound emulation - atomboy and fghtbskt req different interrupt (T1)
16  timing than wilytowr, otherwise music/fx tempo is too fast. Maybe both
17  tmings are wrong - must be verified on real pcb.
18- Extra space in atomboy 2764 eproms is filled with garbage z80 code
19  (taken from one of code roms, but from different offset)
20- Fghtbskt has one AY, but every frame writes 0 to 2nd AY regs - probably
21  leftover from Wily Tower sound driver/code
22- I'm not sure about sound_status write - maybe it's something else or
23  different data (p1?) is used as status
24
25TODO:
26- Sprite positioning is wacky. The electric 'bands' that go along the pipes
27  are drawn 2 pixels off in x/y directions. If you fix that, then the player
28  sprite doesn't slide in the middle of the pipes when climbing...
29- Clocks
30
31Dip locations verified for:
32- atomboy (manual)
33
34
35***************************************************************************/
36
37#include "driver.h"
38#include "cpu/i8039/i8039.h"
39#include "sound/ay8910.h"
40#include "sound/samples.h"
41
42extern void fghtbskt_sh_start(void);
43extern WRITE8_HANDLER( fghtbskt_samples_w );
44
45static UINT8 *wilytowr_videoram2, *wilytowr_scrollram;
46static int pal_bank, fg_flag, sy_offset;
47static tilemap *bg_tilemap, *fg_tilemap;
48static UINT8 sound_irq;
49static int sound_status;
50static int p1,p2;
51
52
53static PALETTE_INIT( wilytowr )
54{
55   int i;
56
57   for (i = 0;i < 256;i++)
58   {
59      int bit0,bit1,bit2,bit3,r,g,b;
60
61      /* red component */
62      bit0 = (color_prom[i] >> 0) & 0x01;
63      bit1 = (color_prom[i] >> 1) & 0x01;
64      bit2 = (color_prom[i] >> 2) & 0x01;
65      bit3 = (color_prom[i] >> 3) & 0x01;
66      r =  0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
67      /* green component */
68      bit0 = (color_prom[i + 256] >> 0) & 0x01;
69      bit1 = (color_prom[i + 256] >> 1) & 0x01;
70      bit2 = (color_prom[i + 256] >> 2) & 0x01;
71      bit3 = (color_prom[i + 256] >> 3) & 0x01;
72      g =  0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
73      /* blue component */
74      bit0 = (color_prom[i + 2*256] >> 0) & 0x01;
75      bit1 = (color_prom[i + 2*256] >> 1) & 0x01;
76      bit2 = (color_prom[i + 2*256] >> 2) & 0x01;
77      bit3 = (color_prom[i + 2*256] >> 3) & 0x01;
78      b =  0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
79
80      palette_set_color(machine,i,MAKE_RGB(r,g,b));
81   }
82
83   color_prom += 3*256;
84
85   for (i = 0;i < 4;i++)
86   {
87      int bit0,bit1,bit2,r,g,b;
88
89      /* red component */
90      bit0 = (color_prom[i] >> 0) & 0x01;
91      bit1 = (color_prom[i] >> 1) & 0x01;
92      bit2 = (color_prom[i] >> 2) & 0x01;
93      r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
94      /* green component */
95      bit0 = (color_prom[i] >> 3) & 0x01;
96      bit1 = (color_prom[i] >> 4) & 0x01;
97      bit2 = (color_prom[i] >> 5) & 0x01;
98      g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
99      /* blue component */
100      bit0 = (color_prom[i] >> 6) & 0x01;
101      bit1 = (color_prom[i] >> 7) & 0x01;
102      b = 0x4f * bit0 + 0xa8 * bit1;
103
104      palette_set_color(machine,i+256,MAKE_RGB(r,g,b));
105   }
106}
107
108static WRITE8_HANDLER( wilytowr_videoram_w )
109{
110   videoram[offset] = data;
111   tilemap_mark_tile_dirty(bg_tilemap, offset);
112}
113
114static WRITE8_HANDLER( wilytowr_colorram_w )
115{
116   colorram[offset] = data;
117   tilemap_mark_tile_dirty(bg_tilemap, offset);
118}
119
120static WRITE8_HANDLER( wilytowr_videoram2_w )
121{
122   wilytowr_videoram2[offset] = data;
123   tilemap_mark_tile_dirty(fg_tilemap, offset);
124}
125
126static WRITE8_HANDLER( wilytwr_palbank_w )
127{
128   if (pal_bank != (data & 0x01))
129   {
130      pal_bank = data & 0x01;
131      tilemap_mark_all_tiles_dirty(bg_tilemap);
132   }
133}
134
135static WRITE8_HANDLER( wilytwr_flipscreen_w )
136{
137   if (flip_screen_get() != (~data & 0x01))
138   {
139      flip_screen_set(~data & 0x01);
140      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
141   }
142}
143
144static WRITE8_HANDLER( fghtbskt_flipscreen_w )
145{
146   flip_screen_set(data);
147   fg_flag = flip_screen_get() ? TILE_FLIPX : 0;
148}
149
150
151static TILE_GET_INFO( get_bg_tile_info )
152{
153   int attr = colorram[tile_index];
154   int code = videoram[tile_index] | ((attr & 0x30) << 4);
155   int color = (attr & 0x0f) + (pal_bank << 4);
156
157   SET_TILE_INFO(1, code, color, 0);
158}
159
160static TILE_GET_INFO( get_fg_tile_info )
161{
162   int code = wilytowr_videoram2[tile_index];
163
164   SET_TILE_INFO(0, code, 0, fg_flag);
165}
166
167static VIDEO_START( wilytowr )
168{
169   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows,
170      8, 8, 32, 32);
171
172   fg_tilemap = tilemap_create(get_fg_tile_info, tilemap_scan_rows,
173      8, 8, 32, 32);
174
175   tilemap_set_scroll_cols(bg_tilemap, 32);
176   tilemap_set_transparent_pen(fg_tilemap, 0);
177
178   fg_flag = 0;
179}
180
181static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
182{
183   int offs;
184
185   for (offs = 0;offs < spriteram_size;offs += 4)
186   {
187      int code = spriteram[offs + 1] | ((spriteram[offs + 2] & 0x10) << 4);
188      int color = (spriteram[offs + 2] & 0x0f) + (pal_bank << 4);
189      int flipx = spriteram[offs + 2] & 0x20;
190      int flipy = 0;
191      int sx = spriteram[offs + 3];
192      int sy = sy_offset - spriteram[offs];
193
194      if (flip_screen_get())
195      {
196         sx = 240 - sx;
197         sy = sy_offset - sy;
198         flipx = !flipx;
199         flipy = !flipy;
200      }
201
202      drawgfx(bitmap, machine->gfx[2],
203         code, color,
204         flipx, flipy,
205         sx, sy,
206         cliprect,
207         TRANSPARENCY_PEN, 0);
208   }
209}
210
211static VIDEO_UPDATE( wilytowr )
212{
213   int col;
214
215   for (col = 0; col < 32; col++)
216      tilemap_set_scrolly(bg_tilemap, col, wilytowr_scrollram[col * 8]);
217
218   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
219   draw_sprites(screen->machine, bitmap, cliprect);
220   tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 0);
221   return 0;
222}
223
224
225static WRITE8_HANDLER( coin_w )
226{
227   coin_counter_w(offset, data & 0x01);
228}
229
230static WRITE8_HANDLER( snd_irq_w )
231{
232   cpunum_set_input_line(machine, 1, 0, ASSERT_LINE);
233   timer_call_after_resynch(NULL, 0, NULL);
234}
235
236static WRITE8_HANDLER( snddata_w )
237{
238   int num_ays = (sndti_exists(SOUND_AY8910, 1)) ? 2 : 1;
239
240   if ((p2 & 0xf0) == 0xe0)
241      AY8910_control_port_0_w(machine,0,offset);
242   else if ((p2 & 0xf0) == 0xa0)
243      AY8910_write_port_0_w(machine,0,offset);
244   else if (num_ays == 2 && (p1 & 0xe0) == 0x60)
245      AY8910_control_port_1_w(machine,0,offset);
246   else if (num_ays == 2 && (p1 & 0xe0) == 0x40)
247       AY8910_write_port_1_w(machine,0,offset);
248   else if ((p2 & 0xf0) == 0x70 )
249      sound_status=offset;
250}
251
252static WRITE8_HANDLER( p1_w )
253{
254   p1 = data;
255}
256
257static WRITE8_HANDLER( p2_w )
258{
259   p2 = data;
260   if((p2&0xf0)==0x50)
261   {
262      cpunum_set_input_line(machine, 1, 0, CLEAR_LINE);
263   }
264}
265
266static READ8_HANDLER( snd_status_r )
267{
268   return sound_status;
269}
270
271static READ8_HANDLER( irq_r )
272{
273   if (sound_irq)
274   {
275      sound_irq = 0;
276      return 1;
277   }
278   return 0;
279}
280
281static READ8_HANDLER( snddata_r )
282{
283   switch(p2&0xf0)
284   {
285      case 0x60:   return soundlatch_r(machine,0); ;
286      case 0x70:   return memory_region(machine, REGION_USER1)[((p1&0x1f)<<8)|offset];
287   }
288   return 0xff;
289}
290
291static ADDRESS_MAP_START( wilytowr_map, ADDRESS_SPACE_PROGRAM, 8 )
292   AM_RANGE(0x0000, 0xbfff) AM_ROM
293   AM_RANGE(0xd000, 0xdfff) AM_RAM
294   AM_RANGE(0xe000, 0xe1ff) AM_RAM
295   AM_RANGE(0xe200, 0xe2ff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
296   AM_RANGE(0xe300, 0xe3ff) AM_RAM AM_BASE(&wilytowr_scrollram)
297   AM_RANGE(0xe400, 0xe7ff) AM_RAM_WRITE(wilytowr_videoram2_w) AM_BASE(&wilytowr_videoram2)
298   AM_RANGE(0xe800, 0xebff) AM_RAM_WRITE(wilytowr_videoram_w) AM_BASE(&videoram)
299   AM_RANGE(0xec00, 0xefff) AM_RAM_WRITE(wilytowr_colorram_w) AM_BASE(&colorram)
300   AM_RANGE(0xf000, 0xf000) AM_WRITE(interrupt_enable_w)   /* NMI enable */
301   AM_RANGE(0xf002, 0xf002) AM_WRITE(wilytwr_flipscreen_w)
302   AM_RANGE(0xf003, 0xf003) AM_WRITE(wilytwr_palbank_w)
303   AM_RANGE(0xf006, 0xf007) AM_WRITE(coin_w)
304   AM_RANGE(0xf800, 0xf800) AM_READWRITE(input_port_0_r, soundlatch_w)
305   AM_RANGE(0xf801, 0xf801) AM_READWRITE(input_port_1_r, SMH_NOP)   /* continues game when in stop mode (cleared by NMI handler) */
306   AM_RANGE(0xf802, 0xf802) AM_READ(input_port_2_r)
307   AM_RANGE(0xf803, 0xf803) AM_WRITE(snd_irq_w)
308   AM_RANGE(0xf806, 0xf806) AM_READ(input_port_3_r)
309ADDRESS_MAP_END
310
311static ADDRESS_MAP_START( fghtbskt_map, ADDRESS_SPACE_PROGRAM, 8 )
312   AM_RANGE(0x0000, 0x5fff) AM_ROM
313   AM_RANGE(0x8000, 0xbfff) AM_ROM
314   AM_RANGE(0xc000, 0xc7ff) AM_RAM
315   AM_RANGE(0xd000, 0xd1ff) AM_RAM
316   AM_RANGE(0xd200, 0xd2ff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
317   AM_RANGE(0xd300, 0xd3ff) AM_RAM AM_BASE(&wilytowr_scrollram)
318   AM_RANGE(0xd400, 0xd7ff) AM_RAM_WRITE(wilytowr_videoram2_w) AM_BASE(&wilytowr_videoram2)
319   AM_RANGE(0xd800, 0xdbff) AM_RAM_WRITE(wilytowr_videoram_w) AM_BASE(&videoram)
320   AM_RANGE(0xdc00, 0xdfff) AM_RAM_WRITE(wilytowr_colorram_w) AM_BASE(&colorram)
321   AM_RANGE(0xf000, 0xf000) AM_READ(snd_status_r)
322   AM_RANGE(0xf001, 0xf001) AM_READ(input_port_0_r)
323   AM_RANGE(0xf002, 0xf002) AM_READ(input_port_1_r)
324   AM_RANGE(0xf003, 0xf003) AM_READ(input_port_2_r)
325   AM_RANGE(0xf000, 0xf000) AM_WRITE(snd_irq_w)
326   AM_RANGE(0xf001, 0xf001) AM_WRITENOP
327   AM_RANGE(0xf002, 0xf002) AM_WRITE(soundlatch_w)
328   AM_RANGE(0xf800, 0xf800) AM_WRITENOP
329   AM_RANGE(0xf801, 0xf801) AM_WRITE(interrupt_enable_w)
330   AM_RANGE(0xf802, 0xf802) AM_WRITE(fghtbskt_flipscreen_w)
331   AM_RANGE(0xf803, 0xf803) AM_WRITENOP
332   AM_RANGE(0xf804, 0xf804) AM_WRITENOP
333   AM_RANGE(0xf805, 0xf805) AM_WRITENOP
334   AM_RANGE(0xf806, 0xf806) AM_WRITENOP
335   AM_RANGE(0xf807, 0xf807) AM_WRITE(fghtbskt_samples_w)
336ADDRESS_MAP_END
337
338static ADDRESS_MAP_START( i8039_map, ADDRESS_SPACE_PROGRAM, 8 )
339   AM_RANGE(0x0000, 0x0fff) AM_ROM
340ADDRESS_MAP_END
341
342
343static ADDRESS_MAP_START( i8039_port_map, ADDRESS_SPACE_IO, 8 )
344   AM_RANGE(0x00, 0xff) AM_READWRITE(snddata_r, snddata_w)
345   AM_RANGE(I8039_p1, I8039_p1) AM_WRITE(p1_w)
346   AM_RANGE(I8039_p2, I8039_p2) AM_WRITE(p2_w)
347   AM_RANGE(I8039_t1, I8039_t1) AM_READ(irq_r)
348ADDRESS_MAP_END
349
350
351
352static INPUT_PORTS_START( wilytowr )
353   PORT_START_TAG("IN0")
354   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 )
355   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY
356   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY
357   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY
358   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY
359   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START2 )
360   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START1 )
361   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 )
362
363   PORT_START_TAG("IN1")
364   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL
365   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
366   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
367   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
368   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
369   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 )
370   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SERVICE1 )
371   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
372
373   PORT_START_TAG("DSW0")
374   PORT_DIPNAME( 0x03, 0x01, DEF_STR( Lives ) )      PORT_DIPLOCATION("SW1:!1,!2")
375   PORT_DIPSETTING(    0x00, "2" )
376   PORT_DIPSETTING(    0x01, "3" )
377   PORT_DIPSETTING(    0x02, "4" )
378   PORT_DIPSETTING(    0x03, "5" )
379   PORT_DIPNAME( 0x0c, 0x00, "Bonus Points Rate" )      PORT_DIPLOCATION("SW1:!3,!4")
380   PORT_DIPSETTING(    0x00, DEF_STR( Normal ) )
381   PORT_DIPSETTING(    0x04, "x1.2" )
382   PORT_DIPSETTING(    0x08, "x1.4" )
383   PORT_DIPSETTING(    0x0c, "x1.6" )
384   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Coin_A ) )      PORT_DIPLOCATION("SW1:!5,!6") PORT_CONDITION("DSW1",0x04,PORTCOND_EQUALS,0x04) /* coin mode 2 */
385   PORT_DIPSETTING(    0x20, DEF_STR( 3C_1C ) )
386   PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
387   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
388   PORT_DIPSETTING(    0x30, DEF_STR( Free_Play ) )   /* Not documented */
389   PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Coin_B ) )      PORT_DIPLOCATION("SW1:!7,!8") PORT_CONDITION("DSW1",0x04,PORTCOND_EQUALS,0x04) /* coin mode 2 */
390   PORT_DIPSETTING(    0x00, DEF_STR( 1C_2C ) )
391   PORT_DIPSETTING(    0x40, DEF_STR( 1C_3C ) )
392   PORT_DIPSETTING(    0x80, DEF_STR( 1C_5C ) )
393   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_6C ) )
394   PORT_DIPNAME( 0xf0, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:!5,!6,!7,!8") PORT_CONDITION("DSW1",0x04,PORTCOND_EQUALS,0x00) /* coin mode 1 */
395   PORT_DIPSETTING(    0x60, DEF_STR( 7C_1C ) )
396   PORT_DIPSETTING(    0x50, DEF_STR( 6C_1C ) )
397   PORT_DIPSETTING(    0x40, DEF_STR( 5C_1C ) )
398   PORT_DIPSETTING(    0x30, DEF_STR( 4C_1C ) )
399   PORT_DIPSETTING(    0x20, DEF_STR( 3C_1C ) )
400   PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
401   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
402   PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) )
403   PORT_DIPSETTING(    0x90, DEF_STR( 1C_3C ) )
404   PORT_DIPSETTING(    0xa0, DEF_STR( 1C_4C ) )
405   PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
406   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_6C ) )
407   PORT_DIPSETTING(    0xd0, DEF_STR( 1C_7C ) )
408   PORT_DIPSETTING(    0xe0, DEF_STR( 1C_8C ) )
409   PORT_DIPSETTING(    0x70, DEF_STR( 1C_9C ) )
410   PORT_DIPSETTING(    0xf0, DEF_STR( Free_Play ) )
411
412   PORT_START_TAG("DSW1")
413   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Flip_Screen ) )   PORT_DIPLOCATION("SW2:!1")
414   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
415   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
416   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Cabinet ) )      PORT_DIPLOCATION("SW2:!2")
417   PORT_DIPSETTING(    0x02, DEF_STR( Upright ) )
418   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
419   /*  "For cabinets with a single coin selector or 2 coin selectors of the same value, set to Mode 1.
420        For cabinets with coin selectors of two different values, set to Mode 2." */
421   PORT_DIPNAME( 0x04, 0x00, "Coin Mode" )            PORT_DIPLOCATION("SW2:!3")
422   PORT_DIPSETTING(    0x00, "Mode 1" )
423   PORT_DIPSETTING(    0x04, "Mode 2" )
424   PORT_DIPUNUSED_DIPLOC( 0x08, 0x00, "SW2:!4" )      /* Listed as "Unused" */
425   /* In stop mode, press 1 to stop and 2 to restart */
426   PORT_DIPNAME( 0x10, 0x00, "Stop Mode (Cheat)")      PORT_DIPLOCATION("SW2:!5")
427   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
428   PORT_DIPSETTING(    0x10, DEF_STR( On ) )
429   PORT_DIPUNUSED_DIPLOC( 0x20, 0x00, "SW2:!6" )      /* Listed as "Unused" */
430   PORT_DIPNAME( 0x40, 0x00, "Invulnerability (Cheat)") PORT_DIPLOCATION("SW2:!7")
431   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
432   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
433   PORT_SERVICE_DIPLOC(0x80, IP_ACTIVE_HIGH, "SW2:!8" )
434INPUT_PORTS_END
435
436static INPUT_PORTS_START( fghtbskt )
437   PORT_START
438   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )  PORT_8WAY
439   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )    PORT_8WAY
440   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY
441   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )  PORT_8WAY
442   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )
443   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN1 )
444   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START2 )
445   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START1 )
446
447   PORT_START
448   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )  PORT_8WAY PORT_COCKTAIL
449   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )    PORT_8WAY PORT_COCKTAIL
450   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
451   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )  PORT_8WAY PORT_COCKTAIL
452   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL
453   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 )
454   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
455   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
456
457   PORT_START
458   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_A ) )
459   PORT_DIPSETTING(    0x03, DEF_STR( 3C_1C ) )
460   PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
461   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
462   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
463   PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Coin_B ) )
464   PORT_DIPSETTING(    0x04, DEF_STR( 1C_1C ) )
465   PORT_DIPSETTING(    0x00, DEF_STR( 1C_2C ) )
466   PORT_DIPSETTING(    0x08, DEF_STR( 1C_4C ) )
467   PORT_DIPSETTING(    0x0c, "99 Credits / Sound Test" )
468   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
469   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
470   PORT_DIPSETTING(    0x10, DEF_STR( On ) )
471   PORT_DIPNAME( 0x20, 0x00, "Time Count Down" )
472   PORT_DIPSETTING(    0x00, "Slow" )
473   PORT_DIPSETTING(    0x20, "Too Fast" )
474   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Cabinet ) )
475   PORT_DIPSETTING(    0x40, DEF_STR( Upright ) )
476   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
477   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )
478   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
479   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
480INPUT_PORTS_END
481
482
483static const gfx_layout charlayout =
484{
485   8,8,
486   RGN_FRAC(1,2),
487   2,
488   { RGN_FRAC(1,2), RGN_FRAC(0,2) },
489   { 0, 1, 2, 3, 4, 5, 6, 7 },
490   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
491   8*8
492};
493
494static const gfx_layout tilelayout =
495{
496   8,8,
497   RGN_FRAC(1,3),
498   3,
499   { RGN_FRAC(2,3), RGN_FRAC(1,3), RGN_FRAC(0,3) },
500   { 0, 1, 2, 3, 4, 5, 6, 7 },
501   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
502   8*8
503};
504
505static const gfx_layout spritelayout =
506{
507   16,16,
508   RGN_FRAC(1,6),
509   3,
510   { RGN_FRAC(2,3), RGN_FRAC(1,3), RGN_FRAC(0,3) },
511   { 0, 1, 2, 3, 4, 5, 6, 7,
512         RGN_FRAC(1,6)+0, RGN_FRAC(1,6)+1, RGN_FRAC(1,6)+2, RGN_FRAC(1,6)+3,
513         RGN_FRAC(1,6)+4, RGN_FRAC(1,6)+5, RGN_FRAC(1,6)+6, RGN_FRAC(1,6)+7 },
514   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
515         8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
516   16*8
517};
518
519static GFXDECODE_START( wilytowr )
520   GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout,   256, 1 )
521   GFXDECODE_ENTRY( REGION_GFX2, 0, tilelayout,     0, 32 )
522   GFXDECODE_ENTRY( REGION_GFX3, 0, spritelayout,   0, 32 )
523GFXDECODE_END
524
525static GFXDECODE_START( fghtbskt )
526   GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout,   16, 1 )
527   GFXDECODE_ENTRY( REGION_GFX2, 0, tilelayout,    0, 32 )
528   GFXDECODE_ENTRY( REGION_GFX3, 0, spritelayout,  0, 32 )
529GFXDECODE_END
530
531
532static const struct Samplesinterface fghtbskt_samples_interface =
533{
534   1,
535   NULL,
536   fghtbskt_sh_start
537};
538
539static void snd_irq(running_machine *machine, int num)
540{
541   sound_irq = 1;
542}
543
544static MACHINE_DRIVER_START( wilytowr )
545
546   /* basic machine hardware */
547   MDRV_CPU_ADD_TAG("maincpu",Z80,12000000/4)     /* 3 MHz */
548   MDRV_CPU_PROGRAM_MAP(wilytowr_map,0)
549   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
550
551   /* audio CPU */
552   MDRV_CPU_ADD_TAG("soundcpu",I8039,12000000/4)   /* ????? */
553   MDRV_CPU_PROGRAM_MAP(i8039_map,0)
554   MDRV_CPU_IO_MAP(i8039_port_map,0)
555   MDRV_CPU_PERIODIC_INT(snd_irq, 60)
556
557
558   /* video hardware */
559   MDRV_SCREEN_ADD("main", RASTER)
560   MDRV_SCREEN_REFRESH_RATE(60)
561   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
562   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
563   MDRV_SCREEN_SIZE(32*8, 32*8)
564   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
565
566   MDRV_GFXDECODE(wilytowr)
567   MDRV_PALETTE_LENGTH(256+4)
568
569   MDRV_PALETTE_INIT(wilytowr)
570   MDRV_VIDEO_START(wilytowr)
571   MDRV_VIDEO_UPDATE(wilytowr)
572
573   /* sound hardware */
574   MDRV_SPEAKER_STANDARD_MONO("mono")
575
576   MDRV_SOUND_ADD(AY8910, 3579545/4)
577   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
578
579   MDRV_SOUND_ADD(AY8910, 3579545/4)
580   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
581MACHINE_DRIVER_END
582
583static MACHINE_DRIVER_START( atomboy )
584   MDRV_IMPORT_FROM(wilytowr)
585   MDRV_CPU_MODIFY("soundcpu")
586   MDRV_CPU_PERIODIC_INT(snd_irq, 60/2)
587MACHINE_DRIVER_END
588
589static MACHINE_DRIVER_START( fghtbskt )
590
591   /* basic machine hardware */
592   MDRV_CPU_ADD(Z80, 12000000/4)     /* 3 MHz */
593   MDRV_CPU_PROGRAM_MAP(fghtbskt_map,0)
594   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
595
596   /* audio CPU */
597   MDRV_CPU_ADD(I8039,12000000/4)   /* ????? */
598   MDRV_CPU_PROGRAM_MAP(i8039_map,0)
599   MDRV_CPU_IO_MAP(i8039_port_map,0)
600   MDRV_CPU_PERIODIC_INT(snd_irq, 60/2)
601
602   /* video hardware */
603   MDRV_SCREEN_ADD("main", RASTER)
604   MDRV_SCREEN_REFRESH_RATE(60)
605   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
606   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
607   MDRV_SCREEN_SIZE(32*8, 32*8)
608   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
609
610   MDRV_GFXDECODE(fghtbskt)
611   MDRV_PALETTE_LENGTH(256)
612
613   MDRV_PALETTE_INIT(RRRR_GGGG_BBBB)
614   MDRV_VIDEO_START(wilytowr)
615   MDRV_VIDEO_UPDATE(wilytowr)
616
617   /* sound hardware */
618   MDRV_SPEAKER_STANDARD_MONO("mono")
619
620   MDRV_SOUND_ADD(AY8910, 12000000/4/2)
621   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
622
623   MDRV_SOUND_ADD(SAMPLES, 0)
624   MDRV_SOUND_CONFIG(fghtbskt_samples_interface)
625   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
626MACHINE_DRIVER_END
627
628
629/***************************************************************************
630
631  Game driver(s)
632
633***************************************************************************/
634
635ROM_START( wilytowr )
636   ROM_REGION( 0x10000, REGION_CPU1, 0 )
637   ROM_LOAD( "wt4e.bin",     0x0000, 0x2000, CRC(a38e4b8a) SHA1(e296ba1764d3e8e2a5cc43bdde7f30a522b437ff) )
638   ROM_LOAD( "wt4h.bin",     0x2000, 0x2000, CRC(c1405ceb) SHA1(c11dd4cd180bc9576e8042e1f56074620ea00f53) )
639   ROM_LOAD( "wt4j.bin",     0x4000, 0x2000, CRC(379fb1c3) SHA1(677e4077f6d2140e4fb5c3d86bc7081d3b6cc028) )
640   ROM_LOAD( "wt4k.bin",     0x6000, 0x2000, CRC(2dd6f9c7) SHA1(88ba58a1ddd25403211b7f920ba7006ed80c13eb) )
641   ROM_LOAD( "wt_a-4m.bin",  0x8000, 0x2000, CRC(c1f8a7d5) SHA1(4307e7604aec728a1f5b0e6a0d6c9f4d37084da3) )
642   ROM_LOAD( "wt_a-4n.bin",  0xa000, 0x2000, CRC(b212f7d2) SHA1(dd1c35559982e8bbcb0e778c733a3afb5b6611df) )
643
644   ROM_REGION( 0x1000, REGION_CPU2, 0 )   /* 8039 */
645   ROM_LOAD( "wt4d.bin",     0x0000, 0x1000, CRC(25a171bf) SHA1(7465dbfa8858d0f5822eb748b96d99753d58d243) )
646
647   ROM_REGION( 0x2000, REGION_GFX1, ROMREGION_DISPOSE )
648   /* '3' character is bad, but ROMs have been verified on four boards */
649   ROM_LOAD( "wt_b-5e.bin",  0x0000, 0x1000, CRC(fe45df43) SHA1(9586a5728069e0c293bd17d4663305ce5758ca01) )
650   ROM_LOAD( "wt_b-5f.bin",  0x1000, 0x1000, CRC(87a17eff) SHA1(cee2ba2889baf08dc6ee1c8e9150bd277f343be9) )
651
652   ROM_REGION( 0x6000, REGION_GFX2, ROMREGION_DISPOSE )
653   ROM_LOAD( "wtb5a.bin",    0x0000, 0x2000, CRC(efc1cbfa) SHA1(9a2ea29e64360ef7b143ac1b6a1ba3e672be4a42) )
654   ROM_LOAD( "wtb5b.bin",    0x2000, 0x2000, CRC(ab4bfd07) SHA1(1d5010413989895c09d8e5ee903d665506836f94) )
655   ROM_LOAD( "wtb5d.bin",    0x4000, 0x2000, CRC(40f23e1d) SHA1(abff583021e2cf2d2ec83adbbd4f2e96bfa3e04f) )
656
657   ROM_REGION( 0x6000, REGION_GFX3, ROMREGION_DISPOSE )
658   /* there are horizontal lines in some tiles, but ROMs have been verified on four boards */
659   ROM_LOAD( "wt2j.bin",     0x0000, 0x1000, CRC(d1bf0670) SHA1(8d07bce354bb4538948c358fd696304a8e0640b8) )
660   ROM_LOAD( "wt3k.bin",     0x1000, 0x1000, CRC(83c39a0e) SHA1(da98f887ac5c3d52281eece3d760c41fb9ecfd5c) )
661   ROM_LOAD( "wt_a-3m.bin",  0x2000, 0x1000, CRC(e7e468ae) SHA1(17448191b440b668714d83730075938aaaf34b5a) )
662   ROM_LOAD( "wt_a-3n.bin",  0x3000, 0x1000, CRC(0741d1a9) SHA1(51f5ee03db8a3f7afbf944b9e3e4ae12b2520269) )
663   ROM_LOAD( "wt_a-3p.bin",  0x4000, 0x1000, CRC(7299f362) SHA1(5ba309d789df8432c08d67e4f9e8bf6c447fc425) )
664   ROM_LOAD( "wt_a-3s.bin",  0x5000, 0x1000, CRC(9b37d50d) SHA1(a08d4a7654b815cb652be66dbaa097011327f5d5) )
665
666   ROM_REGION( 0x2000, REGION_USER1, 0 )
667   ROM_LOAD( "wt_a-6d.bin",  0x0000, 0x1000, CRC(a5dde29b) SHA1(8f7545d2022da7c98d47112179dce717f6c3c5e2) )
668
669
670   ROM_REGION( 0x0320, REGION_PROMS, 0 )
671   ROM_LOAD( "wt_a-5s-.bpr", 0x0000, 0x0100, CRC(041950e7) SHA1(8276068bec3f4c5013c773033fca3cd3ed9e82ef) )   /* red */
672   ROM_LOAD( "wt_a-5r-.bpr", 0x0100, 0x0100, CRC(bc04bf25) SHA1(37d0e89296760f51df5a0d434dca390fb60bb052) )   /* green */
673   ROM_LOAD( "wt_a-5p-.bpr", 0x0200, 0x0100, CRC(ed819a19) SHA1(76f13dcf1674f136375738756e175ceec469d545) )   /* blue */
674   ROM_LOAD( "wt_b-9l-.bpr", 0x0300, 0x0020, CRC(d2728744) SHA1(e6b1a570854ca90326414874432ab03ec85b9c8e) )   /* char palette */
675ROM_END
676
677ROM_START( atomboy )
678   ROM_REGION( 0x10000, REGION_CPU1, 0 )
679   ROM_LOAD( "wt_a-4e.bin",  0x0000, 0x2000, CRC(f7978185) SHA1(6a108d1e9b1a81cedf865aba3998748dcf1d55ef) )
680   ROM_LOAD( "wt_a-4h.bin",  0x2000, 0x2000, CRC(0ca9950b) SHA1(d6583fcdf17d16a8884932695caa9c5587a20795) )
681   ROM_LOAD( "wt_a-4j.bin",  0x4000, 0x2000, CRC(1badbc65) SHA1(e0768f2cd7bbe8908fd68ff6d54dbef84cc7de4c) )
682   ROM_LOAD( "wt_a-4k.bin",  0x6000, 0x2000, CRC(5a341f75) SHA1(9e1a180e37aaa0afbf8ff45219be40d3f75fe60a) )
683   ROM_LOAD( "wt_a-4m.bin",  0x8000, 0x2000, CRC(c1f8a7d5) SHA1(4307e7604aec728a1f5b0e6a0d6c9f4d37084da3) )
684   ROM_LOAD( "wt_a-4n.bin",  0xa000, 0x2000, CRC(b212f7d2) SHA1(dd1c35559982e8bbcb0e778c733a3afb5b6611df) )
685
686   ROM_REGION( 0x2000, REGION_CPU2, 0 )   /* 8039 */
687   ROM_LOAD( "wt_a-4d-b.bin",  0x0000, 0x2000, CRC(793ea53f) SHA1(9dbff5e011a1f1f48aad68f8e5b02bcdb86c182a) ) /* 2764 ROM, Also had a red dot on label */
688
689   ROM_REGION( 0x2000, REGION_GFX1, ROMREGION_DISPOSE )
690   /* '3' character is bad, but ROMs have been verified on four boards */
691   ROM_LOAD( "wt_b-5e.bin",  0x0000, 0x1000, CRC(fe45df43) SHA1(9586a5728069e0c293bd17d4663305ce5758ca01) )
692   ROM_LOAD( "wt_b-5f.bin",  0x1000, 0x1000, CRC(87a17eff) SHA1(cee2ba2889baf08dc6ee1c8e9150bd277f343be9) )
693
694   ROM_REGION( 0x6000, REGION_GFX2, ROMREGION_DISPOSE )
695   ROM_LOAD( "wt_b-5a.bin",  0x0000, 0x2000, CRC(da22c452) SHA1(bd921baa12087e996d07625e05eda00981608655) )
696   ROM_LOAD( "wt_b-5b.bin",  0x2000, 0x2000, CRC(4fb25a1f) SHA1(0f90fb3b373760c33ba9be3b56b917eca92c9700) )
697   ROM_LOAD( "wt_b-5d.bin",  0x4000, 0x2000, CRC(75be2604) SHA1(fe1f110e188aa34a04a9f43412a8308240391fcf) )
698
699   ROM_REGION( 0xc000, REGION_GFX3, ROMREGION_DISPOSE )
700   ROM_LOAD( "wt_a-3j-b.bin",  0x0000, 0x2000, CRC(996470f1) SHA1(c0c787a73535917d1314bb2e1e9056aea9859205) ) /* All these ROMs are 2764 type/size */
701   ROM_LOAD( "wt_a-3k-b.bin",  0x2000, 0x2000, CRC(8f4ec45c) SHA1(525393e0555e1aa24df74e8095da216f02fe3c65) )
702   ROM_LOAD( "wt_a-3m-b.bin",  0x4000, 0x2000, CRC(4ac40358) SHA1(c71bd62ef1e8d008abd468c193e67b278599a5f3) )
703   ROM_LOAD( "wt_a-3n-b.bin",  0x6000, 0x2000, CRC(709eef5b) SHA1(95beadcf876a2549836329521f1293634413e983) )
704   ROM_LOAD( "wt_a-3p-b.bin",  0x8000, 0x2000, CRC(3018b840) SHA1(77df9d4f1c8d76d30c435d03d51ef9e7509fab9c) )
705   ROM_LOAD( "wt_a-3s-b.bin",  0xa000, 0x2000, CRC(05a251d4) SHA1(1cd9102871507ab988d5fe799024d63b93807448) )
706
707   ROM_REGION( 0x2000, REGION_USER1, 0 )
708   ROM_LOAD( "wt_a-6d.bin",  0x0000, 0x1000, CRC(a5dde29b) SHA1(8f7545d2022da7c98d47112179dce717f6c3c5e2) )
709
710   ROM_REGION( 0x0320, REGION_PROMS, 0 )
711   ROM_LOAD( "wt_a-5s-b.bpr", 0x0000, 0x0100, CRC(991e2a04) SHA1(a70525948ad85ad898e0d8a25fb6d1639a4ec133) )   /* red    TBP24S10 (read as 82s129) */
712   ROM_LOAD( "wt_a-5r-b.bpr", 0x0100, 0x0100, CRC(fb3822b7) SHA1(bb1ecdd0156acc16bef3c9072e496e4f544b5d9d) )   /* green  TBP24S10 (read as 82s129) */
713   ROM_LOAD( "wt_a-5p-b.bpr", 0x0200, 0x0100, CRC(95849f7d) SHA1(ad031d6035045b19c1cd65ac6a78c5aa4b647cd6) )   /* blue   TBP24S10 (read as 82s129) */
714   ROM_LOAD( "wt_b-9l-.bpr",  0x0300, 0x0020, CRC(d2728744) SHA1(e6b1a570854ca90326414874432ab03ec85b9c8e) )   /* char palette */
715ROM_END
716
717ROM_START( atomboya )
718   ROM_REGION( 0x10000, REGION_CPU1, 0 )
719   ROM_LOAD( "wt_a-4e.bin",  0x0000, 0x2000, CRC(f7978185) SHA1(6a108d1e9b1a81cedf865aba3998748dcf1d55ef) )
720   ROM_LOAD( "wt_a-4h.bin",  0x2000, 0x2000, CRC(0ca9950b) SHA1(d6583fcdf17d16a8884932695caa9c5587a20795) )
721   ROM_LOAD( "wt_a-4j.bin",  0x4000, 0x2000, CRC(1badbc65) SHA1(e0768f2cd7bbe8908fd68ff6d54dbef84cc7de4c) )
722   ROM_LOAD( "wt_a-4k.bin",  0x6000, 0x2000, CRC(5a341f75) SHA1(9e1a180e37aaa0afbf8ff45219be40d3f75fe60a) )
723   ROM_LOAD( "wt_a-4m.bin",  0x8000, 0x2000, CRC(c1f8a7d5) SHA1(4307e7604aec728a1f5b0e6a0d6c9f4d37084da3) )
724   ROM_LOAD( "wt_a-4n.bin",  0xa000, 0x2000, CRC(b212f7d2) SHA1(dd1c35559982e8bbcb0e778c733a3afb5b6611df) )
725
726   ROM_REGION( 0x1000, REGION_CPU2, 0 )   /* 8039 */
727   ROM_LOAD( "wt_a-4d.bin",  0x0000, 0x1000, CRC(3d43361e) SHA1(2977df9f90d9d214909c56ab44c40ab45fd90675) )
728
729   ROM_REGION( 0x2000, REGION_GFX1, ROMREGION_DISPOSE )
730   /* '3' character is bad, but ROMs have been verified on four boards */
731   ROM_LOAD( "wt_b-5e.bin",  0x0000, 0x1000, CRC(fe45df43) SHA1(9586a5728069e0c293bd17d4663305ce5758ca01) )
732   ROM_LOAD( "wt_b-5f.bin",  0x1000, 0x1000, CRC(87a17eff) SHA1(cee2ba2889baf08dc6ee1c8e9150bd277f343be9) )
733
734   ROM_REGION( 0x6000, REGION_GFX2, ROMREGION_DISPOSE )
735   ROM_LOAD( "wt_b-5a.bin",  0x0000, 0x2000, CRC(da22c452) SHA1(bd921baa12087e996d07625e05eda00981608655) )
736   ROM_LOAD( "wt_b-5b.bin",  0x2000, 0x2000, CRC(4fb25a1f) SHA1(0f90fb3b373760c33ba9be3b56b917eca92c9700) )
737   ROM_LOAD( "wt_b-5d.bin",  0x4000, 0x2000, CRC(75be2604) SHA1(fe1f110e188aa34a04a9f43412a8308240391fcf) )
738
739   ROM_REGION( 0x6000, REGION_GFX3, ROMREGION_DISPOSE )
740   /* there are horizontal lines in some tiles, but ROMs have been verified on four boards */
741   ROM_LOAD( "wt_a-3j.bin",  0x0000, 0x1000, CRC(b30ca38f) SHA1(885743893461b8617180a9723f6fcef160a2f05d) )
742   ROM_LOAD( "wt_a-3k.bin",  0x1000, 0x1000, CRC(9a77eb73) SHA1(2564a3b3744b0be147b41c521fc7efde53bdfea7) )
743   ROM_LOAD( "wt_a-3m.bin",  0x2000, 0x1000, CRC(e7e468ae) SHA1(17448191b440b668714d83730075938aaaf34b5a) )
744   ROM_LOAD( "wt_a-3n.bin",  0x3000, 0x1000, CRC(0741d1a9) SHA1(51f5ee03db8a3f7afbf944b9e3e4ae12b2520269) )
745   ROM_LOAD( "wt_a-3p.bin",  0x4000, 0x1000, CRC(7299f362) SHA1(5ba309d789df8432c08d67e4f9e8bf6c447fc425) )
746   ROM_LOAD( "wt_a-3s.bin",  0x5000, 0x1000, CRC(9b37d50d) SHA1(a08d4a7654b815cb652be66dbaa097011327f5d5) )
747
748   ROM_REGION( 0x1000, REGION_USER1, 0 )
749   ROM_LOAD( "wt_a-6d.bin",  0x0000, 0x1000, CRC(a5dde29b) SHA1(8f7545d2022da7c98d47112179dce717f6c3c5e2) )
750
751   ROM_REGION( 0x0320, REGION_PROMS, 0 )
752   ROM_LOAD( "wt_a-5s-.bpr", 0x0000, 0x0100, CRC(041950e7) SHA1(8276068bec3f4c5013c773033fca3cd3ed9e82ef) )   /* red */
753   ROM_LOAD( "wt_a-5r-.bpr", 0x0100, 0x0100, CRC(bc04bf25) SHA1(37d0e89296760f51df5a0d434dca390fb60bb052) )   /* green */
754   ROM_LOAD( "wt_a-5p-.bpr", 0x0200, 0x0100, CRC(ed819a19) SHA1(76f13dcf1674f136375738756e175ceec469d545) )   /* blue */
755   ROM_LOAD( "wt_b-9l-.bpr", 0x0300, 0x0020, CRC(d2728744) SHA1(e6b1a570854ca90326414874432ab03ec85b9c8e) )   /* char palette */
756ROM_END
757
758ROM_START( fghtbskt )
759   ROM_REGION( 0x10000, REGION_CPU1, 0 )
760   ROM_LOAD( "fb14.0f",      0x0000, 0x2000, CRC(82032853) SHA1(e103ace4cac6df3a429b785f9789b302ae8cdade) )
761   ROM_LOAD( "fb13.2f",      0x2000, 0x2000, CRC(5306df0f) SHA1(11be226e7167703bb08e48510a113b2d43b211a4) )
762   ROM_LOAD( "fb12.3f",      0x4000, 0x2000, CRC(ee9210d4) SHA1(c63d036314d635f65a2b5bb192ceb312a587db6e) )
763   ROM_LOAD( "fb10.6f",      0x8000, 0x2000, CRC(6b47efba) SHA1(cb55c7a9d5afe748c1c88f87dd1909e106932798) )
764   ROM_LOAD( "fb09.7f",      0xa000, 0x2000, CRC(be69e087) SHA1(be95ecafa494cb0787ee18eb3ecea4ad545a6ae3) )
765
766   ROM_REGION( 0x1000, REGION_CPU2, 0 )   /* 8039 */
767   ROM_LOAD( "fb07.0b",      0x0000, 0x1000, CRC(50432dbd) SHA1(35a2218ed243bde47dbe06b5a11a65502ba734ea) )
768
769   ROM_REGION( 0x2000, REGION_GFX1, ROMREGION_DISPOSE )
770   ROM_LOAD( "fb08.12f",     0x0000, 0x1000, CRC(271cd7b8) SHA1(00cfeb6ba429cf6cc59d6542dea8de2ca79155ed) )
771   ROM_FILL(              0x1000, 0x1000, 0 )
772
773   ROM_REGION( 0x6000, REGION_GFX2, ROMREGION_DISPOSE )
774   ROM_LOAD( "fb21.25e",     0x0000, 0x2000, CRC(02843591) SHA1(e38ccc97dcbd642d0ac768837f7baf1573fdb91f) )
775   ROM_LOAD( "fb22.23e",     0x2000, 0x2000, CRC(cd51d8e7) SHA1(16d55d13b47dddb7c7e6b28b1512540938a4a596) )
776   ROM_LOAD( "fb23.22e",     0x4000, 0x2000, CRC(62bcac87) SHA1(dd2272d8c7e46bd0a742b4490c9e960b2bfe14c3) )
777
778   ROM_REGION( 0xc000, REGION_GFX3, ROMREGION_DISPOSE )
779   ROM_LOAD( "fb16.35a",     0x0000, 0x2000, CRC(a5df1652) SHA1(76d1443c523851aa418574c6a879f4a8e46dc887) )
780   ROM_LOAD( "fb15.37a",     0x2000, 0x2000, CRC(59c4de06) SHA1(594411f10d6bb3577c649c66133b90c6423184d7) )
781   ROM_LOAD( "fb18.32a",     0x4000, 0x2000, CRC(c23ddcd7) SHA1(f73d142ac0baae519ed633a923e132eb1836adbb) )
782   ROM_LOAD( "fb17.34a",     0x6000, 0x2000, CRC(7db28013) SHA1(305e6a6254f69625c81ae107f4420fd76f9a24ba) )
783   ROM_LOAD( "fb20.29a",     0x8000, 0x2000, CRC(1a1b48f8) SHA1(62f7774807aea86f73f0b9380bb1c237d55bf451) )
784   ROM_LOAD( "fb19.31a",     0xa000, 0x2000, CRC(7ff7e321) SHA1(4fe4eee9c6260599950080c600187ce8e9dab7d2) )
785
786   ROM_REGION( 0xa000, REGION_SOUND1, 0 ) /* Samples */
787   ROM_LOAD( "fb01.42a",     0x0000, 0x2000, CRC(1200b220) SHA1(8a5f896441c6a6507e72b9b302a8183cc361d118) )
788   ROM_LOAD( "fb02.41a",     0x2000, 0x2000, CRC(0b67aa82) SHA1(59b6cf733150eab0bd807beeeb1d2f784ccb6f58) )
789   ROM_LOAD( "fb03.40a",     0x4000, 0x2000, CRC(c71269ed) SHA1(71cc6f43877b28d50beb744587c189dabbbaa067) )
790   ROM_LOAD( "fb04.39a",     0x6000, 0x2000, CRC(02ddc42d) SHA1(9d40967071f674592c174b5a5470db56a5f99adf) )
791   ROM_LOAD( "fb05.38a",     0x8000, 0x2000, CRC(72ea6b49) SHA1(e081a1cad5abf373a2489169b5c86ee63dcf5823) )
792
793   ROM_REGION( 0x2000, REGION_USER1, 0 )
794   ROM_LOAD( "fb06.12a",     0x0000, 0x2000, CRC(bea3df99) SHA1(18b795f8626b22f6a1620e04c23f4967c3122c89) )
795
796   ROM_REGION( 0x0300, REGION_PROMS, 0 )
797   ROM_LOAD( "fb_r.9e",      0x0000, 0x0100, CRC(c5cdc8ba) SHA1(3fcef3ebe0dda72dfa35e042ff611758c345d749) )
798   ROM_LOAD( "fb_g.10e",     0x0100, 0x0100, CRC(1460c936) SHA1(f99a544c83931de098a6cfac391f63ae43f5cdd0) )
799   ROM_LOAD( "fb_b.11e",     0x0200, 0x0100, CRC(fca5bf0e) SHA1(5846f43aa2906cac58e300fdab197b99f896e3ef) )
800
801
802ROM_END
803
804static DRIVER_INIT( wilytowr )
805{
806   sy_offset = 238;
807}
808
809static DRIVER_INIT( fghtbskt )
810{
811   sy_offset = 240;
812}
813
814GAME( 1984, wilytowr, 0,        wilytowr, wilytowr, wilytowr, ROT180, "Irem",                    "Wily Tower", 0 )
815GAME( 1985, atomboy,  wilytowr, atomboy,  wilytowr, wilytowr, ROT180, "Irem (Memetron license)", "Atomic Boy (revision B)", 0 )
816GAME( 1985, atomboya, wilytowr, atomboy,  wilytowr, wilytowr, ROT180, "Irem (Memetron license)", "Atomic Boy (revision A)", 0 )
817GAME( 1984, fghtbskt, 0,        fghtbskt, fghtbskt, fghtbskt, ROT0,   "Paradise Co. Ltd.",       "Fighting Basketball", 0 )
src/mame/drivers/kinstb.c
r3053r3054
1/***************************************************************************
2
3    Killer Instinct bootleg/hack.
4    -----------------------------
5
6    Driver (based on nss.c ) by Tomasz Slanina  analog[at]op.pl
7
8    PCB Info:
9        ---------
10
11    (Nintendo SNES hardware)
12
13    PQFP 100(?)pin chip marked "SP-BE0"
14    PQFP 100(?)pin chip marked "SP-BH0"
15    PQFP 100(?)pin chip marked "SP-AF0"
16    Lattice pLSI 1024-60LJ B604S03
17    6116 SRAM    x2
18    AS7C256 SRAM x8
19    jumper pack (12)
20    dsw8         x2
21    Xtal 24.576 MHz
22    Xtal 21.47727 MHz
23    volume pot
24    27c801       x4
25    two empty eprom sockets
26
27    It's SNES version of KI with few mods (removed copyright messages,
28    extra code for coin input, etc).
29
30    256 bytes of RAM ( mapped to reserved area) are shared with some
31    device (probably Lattice PLD) used for handle coin inputs and dips
32
33    Data lines of eproms are bitswapped.
34
35***************************************************************************/
36#include "driver.h"
37#include "includes/snes.h"
38
39static INT8 shared_ram[0x100];
40
41static READ8_HANDLER(sharedram_r)
42{
43   //check coins
44   static INT32 oldinput=0;
45   INT32 coincnt;
46   INT32 input = input_port_read(machine, "COIN");
47
48   if(input&3)
49   {
50      if( ((input&1)==1)&&((oldinput&1)==0))   {shared_ram[0]++;}
51
52      coincnt=shared_ram[0];
53
54      if(coincnt>99){coincnt=99;}
55
56      shared_ram[0xb]=(coincnt/10)+'0';
57      shared_ram[0xa]=(coincnt%10)+'0';
58   }
59   oldinput=input;
60   return shared_ram[offset];
61}
62
63static WRITE8_HANDLER(sharedram_w)
64{
65   shared_ram[offset]=data;
66}
67
68static ADDRESS_MAP_START( kinstb_map, ADDRESS_SPACE_PROGRAM, 8)
69   AM_RANGE(0x000000, 0x2fffff) AM_READWRITE(snes_r_bank1, snes_w_bank1)   /* I/O and ROM (repeats for each bank) */
70   AM_RANGE(0x300000, 0x3fffff) AM_READWRITE(snes_r_bank2, snes_w_bank2)   /* I/O and ROM (repeats for each bank) */
71   AM_RANGE(0x400000, 0x5fffff) AM_READWRITE(snes_r_bank3, SMH_ROM)   /* ROM (and reserved in Mode 20) */
72   AM_RANGE(0x600000, 0x6fffff) AM_READWRITE(snes_r_bank6, snes_w_bank6)   /* used by Mode 20 DSP-1 */
73   AM_RANGE(0x700000, 0x77ffff) AM_READWRITE(snes_r_sram, snes_w_sram)   /* 256KB Mode 20 save ram + reserved from 0x8000 - 0xffff */
74   AM_RANGE(0x781000, 0x7810ff) AM_READWRITE(sharedram_r, sharedram_w) /*shared with some device - mcu ? */
75   AM_RANGE(0x7e0000, 0x7fffff) AM_RAM               /* 8KB Low RAM, 24KB High RAM, 96KB Expanded RAM */
76   AM_RANGE(0x800000, 0xffffff) AM_READWRITE(snes_r_bank4, snes_w_bank4)   /* Mirror and ROM */
77ADDRESS_MAP_END
78
79static READ8_HANDLER( spc_ram_100_r )
80{
81   return spc_ram_r(machine, offset + 0x100);
82}
83
84static WRITE8_HANDLER( spc_ram_100_w )
85{
86   spc_ram_w(machine, offset + 0x100, data);
87}
88
89static ADDRESS_MAP_START( spc_mem, ADDRESS_SPACE_PROGRAM, 8 )
90   AM_RANGE(0x0000, 0x00ef) AM_READWRITE(spc_ram_r, spc_ram_w) AM_BASE(&spc_ram)      /* lower 32k ram */
91   AM_RANGE(0x00f0, 0x00ff) AM_READWRITE(spc_io_r, spc_io_w)      /* spc io */
92   AM_RANGE(0x0100, 0xffff) AM_WRITE(spc_ram_100_w)
93   AM_RANGE(0x0100, 0xffbf) AM_READ(spc_ram_100_r)
94   AM_RANGE(0xffc0, 0xffff) AM_READ(spc_ipl_r)
95ADDRESS_MAP_END
96
97static INPUT_PORTS_START( kinstb )
98   PORT_START("PAD1L")      /* IN 0 : Joypad 1 - L */
99   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P1 Button A") PORT_PLAYER(1)
100   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("P1 Button X") PORT_PLAYER(1)
101   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("P1 Button L") PORT_PLAYER(1)
102   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("P1 Button R") PORT_PLAYER(1)
103   PORT_START("PAD1H")      /* IN 1 : Joypad 1 - H */
104   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Button B") PORT_PLAYER(1)
105   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P1 Button Y") PORT_PLAYER(1)
106   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_NAME("P1 Select")
107   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START1 ) PORT_NAME("P1 Start")
108   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
109   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
110   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
111   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
112
113   PORT_START("PAD2L")      /* IN 2 : Joypad 2 - L */
114   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P2 Button A") PORT_PLAYER(2)
115   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("P2 Button X") PORT_PLAYER(2)
116   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("P2 Button L") PORT_PLAYER(2)
117   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("P2 Button R") PORT_PLAYER(2)
118   PORT_START("PAD2H")      /* IN 3 : Joypad 2 - H */
119   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P2 Button B") PORT_PLAYER(2)
120   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P2 Button Y") PORT_PLAYER(2)
121   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SERVICE2 ) PORT_NAME("P2 Select")
122   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START2 ) PORT_NAME("P2 Start")
123   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
124   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
125   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
126   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
127
128   PORT_START("PAD3L")      /* IN 4 : Joypad 3 - L */
129   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P3 Button A") PORT_PLAYER(3)
130   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("P3 Button X") PORT_PLAYER(3)
131   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("P3 Button L") PORT_PLAYER(3)
132   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("P3 Button R") PORT_PLAYER(3)
133   PORT_START("PAD3H")      /* IN 5 : Joypad 3 - H */
134   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P3 Button B") PORT_PLAYER(3)
135   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P3 Button Y") PORT_PLAYER(3)
136   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SERVICE3 ) PORT_NAME("P3 Select")
137   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START3 ) PORT_NAME("P3 Start")
138   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(3)
139   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3)
140   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3)
141   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3)
142
143   PORT_START("PAD4L")      /* IN 6 : Joypad 4 - L */
144   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P4 Button A") PORT_PLAYER(4)
145   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("P4 Button X") PORT_PLAYER(4)
146   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("P4 Button L") PORT_PLAYER(4)
147   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("P4 Button R") PORT_PLAYER(4)
148   PORT_START("PAD4H")      /* IN 7 : Joypad 4 - H */
149   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P4 Button B") PORT_PLAYER(4)
150   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P4 Button Y") PORT_PLAYER(4)
151   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SERVICE4 ) PORT_NAME("P4 Select")
152   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START4 ) PORT_NAME("P4 Start")
153   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(4)
154   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4)
155   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4)
156   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4)
157
158   PORT_START("INTERNAL")      /* IN 8 : Internal switches */
159   PORT_DIPNAME( 0x1, 0x1, "Enforce 32 sprites/line" )
160   PORT_DIPSETTING(   0x0, DEF_STR( No )  )
161   PORT_DIPSETTING(   0x1, DEF_STR( Yes ) )
162
163#ifdef MAME_DEBUG
164   PORT_START("DEBUG1")   /* IN 9 : debug switches */
165   PORT_DIPNAME( 0x3, 0x0, "Browse tiles" )
166   PORT_DIPSETTING(   0x0, DEF_STR( Off ) )
167   PORT_DIPSETTING(   0x1, "2bpl"  )
168   PORT_DIPSETTING(   0x2, "4bpl"  )
169   PORT_DIPSETTING(   0x3, "8bpl"  )
170   PORT_DIPNAME( 0xc, 0x0, "Browse maps" )
171   PORT_DIPSETTING(   0x0, DEF_STR( Off ) )
172   PORT_DIPSETTING(   0x4, "2bpl"  )
173   PORT_DIPSETTING(   0x8, "4bpl"  )
174   PORT_DIPSETTING(   0xc, "8bpl"  )
175
176   PORT_START("DEBUG2")   /* IN 10 : debug switches */
177   PORT_BIT( 0x1, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Toggle BG 1") PORT_PLAYER(2)
178   PORT_BIT( 0x2, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_NAME("Toggle BG 2") PORT_PLAYER(2)
179   PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Toggle BG 3") PORT_PLAYER(2)
180   PORT_BIT( 0x8, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_NAME("Toggle BG 4") PORT_PLAYER(2)
181   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Toggle Objects") PORT_PLAYER(3)
182   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_NAME("Toggle Main/Sub") PORT_PLAYER(3)
183   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Toggle Back col") PORT_PLAYER(3)
184   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_NAME("Toggle Windows") PORT_PLAYER(3)
185
186   PORT_START("DEBUG3")   /* IN 11 : debug input */
187   PORT_BIT( 0x1, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Pal prev")
188   PORT_BIT( 0x2, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_NAME("Pal next")
189   PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Toggle Transparency") PORT_PLAYER(4)
190#endif
191
192   PORT_START("DSW")   /* IN 12 : dip-switches */
193
194   PORT_START("COIN")   /* IN 13 : coins */
195   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
196   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
197
198INPUT_PORTS_END
199
200static const struct CustomSound_interface snes_sound_interface =
201{ snes_sh_start };
202
203static MACHINE_DRIVER_START( kinstb )
204   /* basic machine hardware */
205   MDRV_CPU_ADD("main", G65816, 3580000)   /* 2.68Mhz, also 3.58Mhz */
206   MDRV_CPU_PROGRAM_MAP(kinstb_map, 0)
207
208   MDRV_CPU_ADD("sound", SPC700, 2048000/2)   /* 2.048 Mhz, but internal divider */
209   MDRV_CPU_PROGRAM_MAP(spc_mem, 0)
210
211   MDRV_INTERLEAVE(400)
212
213   MDRV_MACHINE_START( snes )
214   MDRV_MACHINE_RESET( snes )
215
216   /* video hardware */
217   MDRV_VIDEO_UPDATE( snes )
218
219
220   MDRV_SCREEN_ADD("main", RASTER)
221   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
222   MDRV_SCREEN_RAW_PARAMS(DOTCLK_NTSC, SNES_HTOTAL, 0, SNES_SCR_WIDTH, SNES_VTOTAL_NTSC, 0, SNES_SCR_HEIGHT_NTSC)
223
224   /* sound hardware */
225   MDRV_SPEAKER_STANDARD_STEREO("left", "right")
226
227   MDRV_SOUND_ADD("snes", CUSTOM, 0)
228   MDRV_SOUND_CONFIG(snes_sound_interface)
229   MDRV_SOUND_ROUTE(0, "left", 1.00)
230   MDRV_SOUND_ROUTE(1, "right", 1.00)
231MACHINE_DRIVER_END
232
233static DRIVER_INIT(kinstb)
234{
235   INT32 i;
236   UINT8 *rom = memory_region(machine, "user3");
237
238   for(i=0;i<0x400000;i++)
239   {
240      rom[i]=BITSWAP8(rom[i],5,0,6,1,7,4,3,2);
241   }
242   DRIVER_INIT_CALL(snes_hirom);
243}
244
245ROM_START( kinstb )
246   ROM_REGION( 0x400000, "user3", ROMREGION_DISPOSE )
247   ROM_LOAD( "1.u14", 0x000000, 0x100000, CRC(70889919) SHA1(1451714cbdacb7f6ced2bc7afa478ad7264cf3b7) )
248   ROM_LOAD( "2.u15", 0x100000, 0x100000, CRC(e4a5d1da) SHA1(6ae566bd2f740a251d7a81b8ebb92a651cfaac8d) )
249   ROM_LOAD( "3.u16", 0x200000, 0x100000, CRC(7a40f7dd) SHA1(cebe632e8d2d68d0619077cc1e931af73c9a723b) )
250   ROM_LOAD( "4.u17", 0x300000, 0x100000, CRC(3d7564c1) SHA1(392b513991897668d5dd469ac84a34f785895774) )
251
252   ROM_REGION(0x100,           "user5", 0)
253   ROM_LOAD("spc700.rom", 0, 0x40, CRC(44bb3a40) SHA1(97e352553e94242ae823547cd853eecda55c20f0) )
254
255   ROM_REGION(0x800,           "user6", ROMREGION_ERASEFF)
256
257ROM_END
258
259GAME( 199?, kinstb,       0,     kinstb,        kinstb,    kinstb,      ROT0, "bootleg",   "Killer Instinct (SNES bootleg)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND )
src/mame/drivers/m92.h
r3053r3054
1/*******************************************************************************
2
3    Irem M92 input port macros
4
5    Can probably be used for other Irem games..
6
7*******************************************************************************/
8
9#define IREM_JOYSTICKS_1_2 \
10   PORT_START("JOY12")   \
11   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) \
12   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) \
13   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) \
14   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) \
15   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNUSED ) \
16   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNUSED ) \
17   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) \
18   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) \
19   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) \
20   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) \
21   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) \
22   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) \
23   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNUSED ) \
24   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNUSED ) \
25   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) \
26   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
27
28#define IREM_JOYSTICKS_3_4 \
29   PORT_START("JOY34")   \
30   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3) \
31   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3) \
32   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3) \
33   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3) \
34   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_START3 ) /* If common slots, Coin3 if separate */ \
35   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_COIN3 ) \
36   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) \
37   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) \
38   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(4) \
39   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(4) \
40   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(4) \
41   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(4) \
42   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_START4 ) /* If common slots, Coin3 if separate */ \
43   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_COIN4 ) \
44   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4) \
45   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4)
46
47#define IREM_COINS \
48   PORT_START("SYSTEM")   \
49   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) \
50   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) \
51   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 ) \
52   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 ) \
53   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 ) \
54   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE )  \
55   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )  \
56   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* Actually vblank, handled above */ \
57
58   /* Coin Mode 1, the new one (m72 early games have different Coinage) */ \
59#define IREM_COIN_MODE_1_NEW \
60   PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW2:5,6,7,8") \
61   PORT_DIPSETTING(    0xa0, DEF_STR( 6C_1C ) ) \
62   PORT_DIPSETTING(    0xb0, DEF_STR( 5C_1C ) ) \
63   PORT_DIPSETTING(    0xc0, DEF_STR( 4C_1C ) ) \
64   PORT_DIPSETTING(    0xd0, DEF_STR( 3C_1C ) ) \
65   PORT_DIPSETTING(    0xe0, DEF_STR( 2C_1C ) ) \
66   PORT_DIPSETTING(    0x10, "2 Coins to Start/1 to Continue") \
67   PORT_DIPSETTING(    0x30, DEF_STR( 3C_2C ) ) \
68   PORT_DIPSETTING(    0x20, DEF_STR( 4C_3C ) ) \
69   PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) ) \
70   PORT_DIPSETTING(    0x40, DEF_STR( 2C_3C ) ) \
71   PORT_DIPSETTING(    0x90, DEF_STR( 1C_2C ) ) \
72   PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) ) \
73   PORT_DIPSETTING(    0x70, DEF_STR( 1C_4C ) ) \
74   PORT_DIPSETTING(    0x60, DEF_STR( 1C_5C ) ) \
75   PORT_DIPSETTING(    0x50, DEF_STR( 1C_6C ) ) \
76   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
77
78#define IREM_COIN_MODE_1_NEW_HIGH \
79   PORT_DIPNAME( 0xf000, 0xf000, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW2:5,6,7,8") \
80   PORT_DIPSETTING(    0xa000, DEF_STR( 6C_1C ) ) \
81   PORT_DIPSETTING(    0xb000, DEF_STR( 5C_1C ) ) \
82   PORT_DIPSETTING(    0xc000, DEF_STR( 4C_1C ) ) \
83   PORT_DIPSETTING(    0xd000, DEF_STR( 3C_1C ) ) \
84   PORT_DIPSETTING(    0xe000, DEF_STR( 2C_1C ) ) \
85   PORT_DIPSETTING(    0x1000, "2 Coins to Start/1 to Continue") \
86   PORT_DIPSETTING(    0x3000, DEF_STR( 3C_2C ) ) \
87   PORT_DIPSETTING(    0x2000, DEF_STR( 4C_3C ) ) \
88   PORT_DIPSETTING(    0xf000, DEF_STR( 1C_1C ) ) \
89   PORT_DIPSETTING(    0x4000, DEF_STR( 2C_3C ) ) \
90   PORT_DIPSETTING(    0x9000, DEF_STR( 1C_2C ) ) \
91   PORT_DIPSETTING(    0x8000, DEF_STR( 1C_3C ) ) \
92   PORT_DIPSETTING(    0x7000, DEF_STR( 1C_4C ) ) \
93   PORT_DIPSETTING(    0x6000, DEF_STR( 1C_5C ) ) \
94   PORT_DIPSETTING(    0x5000, DEF_STR( 1C_6C ) ) \
95   PORT_DIPSETTING(    0x0000, DEF_STR( Free_Play ) )
96
97#define IREM_COIN_MODE_2 \
98   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) \
99   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) ) \
100   PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) ) \
101   PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) ) \
102   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) ) \
103   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) ) \
104   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ) ) \
105   PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) ) \
106   PORT_DIPSETTING(    0x40, DEF_STR( 1C_5C ) ) \
107   PORT_DIPSETTING(    0x00, DEF_STR( 1C_6C ) )
108
src/mame/drivers/exctsccr.c
r3053r3054
1/***************************************************************************
2
3Exciting Soccer    - (c) 1983 Alpha Denshi Co.
4Exciting Soccer II - (c) 1984 Alpha Denshi Co.
5
6Supported sets:
7Exciting Soccer - Alpha Denshi
8Exciting Soccer (bootleg) - Kazutomi
9Exciting Soccer II - Alpha Denshi
10
11
12Preliminary driver by:
13Ernesto Corvi
14ernesto@imagina.com
15
16Jarek Parchanski
17jpdev@friko6.onet.pl
18ALPHA 8301 MCU handling by Tatsuyuki satoh
19
20NOTES:
21The game supports Coin 2, but the dip switches used for it are the same
22as Coin 1. Basically, this allowed to select an alternative coin table
23based on wich Coin input was connected.
24
25The Kazutomi bootleg board is a conversion from Champion Baseball:
26Alpha denshi co. LTD made in Japan
27cpu board 58AS1
28Display board 58AS2
29Voice board 58AS3
30KAZUTOMI board
311x Alpha8201 (CPU board)
321x AY-3-8910 (CPU board)
331x Sharp Z80ACPU (CPU board)
341x Sharp Z80ACPU (VOICE board)
353x 2764 (CPU board) (1-2-3)
363x 2764 (VOICE board) (a-b-c)
372x 2764 (DISPLAY board) (4-5)
381x 2764 (daughter board kazutomi) (6)
392x 2732 (daughter board kazutomi) (7-8)
40
41TODO:
42- interrupt source for sound CPU is unknown.
43
44- sound CPU writes to unknown ports on startup. Timer configure?
45
46- unknown writes to 8910 I/O ports (filters?)
47
48***************************************************************************/
49
50#include "driver.h"
51#include "sound/ay8910.h"
52#include "sound/dac.h"
53
54/* from video */
55extern WRITE8_HANDLER( exctsccr_videoram_w );
56extern WRITE8_HANDLER( exctsccr_colorram_w );
57extern WRITE8_HANDLER( exctsccr_gfx_bank_w );
58extern WRITE8_HANDLER( exctsccr_flipscreen_w );
59
60extern PALETTE_INIT( exctsccr );
61extern VIDEO_START( exctsccr );
62extern VIDEO_UPDATE( exctsccr );
63
64
65static TIMER_CALLBACK( exctsccr_fm_callback )
66{
67   cpunum_set_input_line_and_vector(machine, 1, 0, HOLD_LINE, 0xff );
68}
69
70static MACHINE_START( exctsccr )
71{
72   // FIXME
73   timer_pulse(ATTOTIME_IN_HZ(75), NULL, 0, exctsccr_fm_callback); /* updates fm */
74}
75
76
77static WRITE8_HANDLER( exctsccr_DAC_data_w )
78{
79   DAC_signed_data_w(offset,data << 2);
80}
81
82
83static WRITE8_HANDLER( exctsccr_mcu_halt_w )
84{
85   cpunum_set_input_line(machine, 2, INPUT_LINE_HALT, (data & 1) ? ASSERT_LINE : CLEAR_LINE);
86}
87
88/***************************************************************************
89
90    Memory definition(s)
91
92***************************************************************************/
93
94static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
95   AM_RANGE(0x0000, 0x5fff) AM_ROM
96   AM_RANGE(0x6000, 0x63ff) AM_RAM AM_SHARE(1)
97   AM_RANGE(0x7c00, 0x7fff) AM_RAM
98   AM_RANGE(0x8000, 0x83ff) AM_RAM_WRITE(exctsccr_videoram_w) AM_BASE(&videoram)
99   AM_RANGE(0x8400, 0x87ff) AM_RAM_WRITE(exctsccr_colorram_w) AM_BASE(&colorram)
100   AM_RANGE(0x8800, 0x8bff) AM_RAM AM_BASE(&spriteram_2) /* ??? */
101   AM_RANGE(0xa000, 0xa000) AM_READ(input_port_0_r)
102   AM_RANGE(0xa000, 0xa000) AM_WRITENOP   /* ??? toggled twice at end of irq handler */
103//  AM_RANGE(0xa001, 0xa001) AM_WRITENOP    /* ??? */
104   AM_RANGE(0xa002, 0xa002) AM_WRITE(exctsccr_gfx_bank_w)
105   AM_RANGE(0xa003, 0xa003) AM_WRITE(exctsccr_flipscreen_w)
106   AM_RANGE(0xa006, 0xa006) AM_WRITE(exctsccr_mcu_halt_w)
107   AM_RANGE(0xa007, 0xa007) AM_WRITENOP /* This is also MCU control, but i dont need it */
108   AM_RANGE(0xa040, 0xa06f) AM_WRITE(SMH_RAM) AM_BASE(&spriteram) /* Sprite pos */
109   AM_RANGE(0xa080, 0xa080) AM_WRITE(soundlatch_w)
110   AM_RANGE(0xa0c0, 0xa0c0) AM_WRITE(watchdog_reset_w)
111
112   AM_RANGE(0xa040, 0xa040) AM_READ(input_port_1_r)
113   AM_RANGE(0xa080, 0xa080) AM_READ(input_port_2_r)   // FIXME use champbas_dsw_r
114   AM_RANGE(0xa0c0, 0xa0c0) AM_READ(input_port_3_r)
115ADDRESS_MAP_END
116
117static ADDRESS_MAP_START( sub_map, ADDRESS_SPACE_PROGRAM, 8 )
118   AM_RANGE(0x0000, 0x8fff) AM_ROM
119   AM_RANGE(0xa000, 0xa7ff) AM_RAM
120   AM_RANGE(0xc008, 0xc009) AM_WRITE(exctsccr_DAC_data_w)
121   AM_RANGE(0xc00c, 0xc00c) AM_WRITE(soundlatch_clear_w)
122   AM_RANGE(0xc00d, 0xc00d) AM_READ(soundlatch_r)
123//  AM_RANGE(0xc00f, 0xc00f) AM_WRITE(MWA8_NOP) /* ??? */
124ADDRESS_MAP_END
125
126static ADDRESS_MAP_START( sound_writeport, ADDRESS_SPACE_IO, 8 )
127   ADDRESS_MAP_GLOBAL_MASK( 0x00ff )
128   AM_RANGE(0x82, 0x82) AM_WRITE(AY8910_write_port_0_w)
129   AM_RANGE(0x83, 0x83) AM_WRITE(AY8910_control_port_0_w)
130   AM_RANGE(0x86, 0x86) AM_WRITE(AY8910_write_port_1_w)
131   AM_RANGE(0x87, 0x87) AM_WRITE(AY8910_control_port_1_w)
132   AM_RANGE(0x8a, 0x8a) AM_WRITE(AY8910_write_port_2_w)
133   AM_RANGE(0x8b, 0x8b) AM_WRITE(AY8910_control_port_2_w)
134   AM_RANGE(0x8e, 0x8e) AM_WRITE(AY8910_write_port_3_w)
135   AM_RANGE(0x8f, 0x8f) AM_WRITE(AY8910_control_port_3_w)
136ADDRESS_MAP_END
137
138static ADDRESS_MAP_START( mcu_map, ADDRESS_SPACE_PROGRAM, 8 )
139   AM_RANGE(0x0000, 0x03ff) AM_RAM AM_SHARE(1) /* main CPU shared RAM */
140ADDRESS_MAP_END
141
142
143/* Bootleg */
144static ADDRESS_MAP_START( bl_map, ADDRESS_SPACE_PROGRAM, 8 )
145   AM_RANGE(0x0000, 0x5fff) AM_ROM
146   AM_RANGE(0x7000, 0x7000) AM_WRITE(AY8910_write_port_0_w)
147   AM_RANGE(0x7001, 0x7001) AM_WRITE(AY8910_control_port_0_w)
148
149   AM_RANGE(0x8000, 0x83ff) AM_RAM_WRITE(exctsccr_videoram_w) AM_BASE(&videoram)
150   AM_RANGE(0x8400, 0x87ff) AM_RAM_WRITE(exctsccr_colorram_w) AM_BASE(&colorram)
151   AM_RANGE(0x8800, 0x8fff) AM_RAM AM_BASE(&spriteram_2) /* ??? */
152
153   AM_RANGE(0xa000, 0xa000) AM_WRITENOP   /* ??? */
154   AM_RANGE(0xa001, 0xa001) AM_WRITENOP   /* ??? */
155   AM_RANGE(0xa002, 0xa002) AM_WRITE(exctsccr_gfx_bank_w)
156   AM_RANGE(0xa003, 0xa003) AM_WRITE(exctsccr_flipscreen_w)
157   AM_RANGE(0xa006, 0xa006) AM_WRITENOP   /* MCU is not used, but some leftover code still writes here */
158   AM_RANGE(0xa007, 0xa007) AM_WRITENOP   /* MCU is not used, but some leftover code still writes here */
159
160   AM_RANGE(0xa040, 0xa06f) AM_WRITE(SMH_RAM) AM_BASE(&spriteram) /* Sprite Pos */
161   AM_RANGE(0xa080, 0xa080) AM_WRITE(soundlatch_w)
162   AM_RANGE(0xa0c0, 0xa0c0) AM_WRITE(watchdog_reset_w)
163
164   AM_RANGE(0xa000, 0xa000) AM_READ(input_port_0_r)
165   AM_RANGE(0xa040, 0xa040) AM_READ(input_port_1_r)
166   AM_RANGE(0xa080, 0xa080) AM_READ(input_port_2_r)   // FIXME use champbas_dsw_r
167   AM_RANGE(0xa0c0, 0xa0c0) AM_READ(input_port_3_r)
168ADDRESS_MAP_END
169
170static ADDRESS_MAP_START( bl_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
171   AM_RANGE(0x0000, 0x5fff) AM_ROM
172   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r)
173//  AM_RANGE(0x8000, 0x8000) AM_WRITENOP    /* 0 = DAC sound off, 1 = DAC sound on */
174   AM_RANGE(0xa000, 0xa000) AM_WRITE(soundlatch_clear_w)
175   AM_RANGE(0xc000, 0xc000) AM_WRITE(exctsccr_DAC_data_w)
176   AM_RANGE(0xe000, 0xe3ff) AM_RAM
177ADDRESS_MAP_END
178
179/***************************************************************************
180
181    Input port(s)
182
183***************************************************************************/
184
185static INPUT_PORTS_START( exctsccr )
186   PORT_START      /* IN0 */
187   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
188   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
189   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
190   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 )
191   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
192   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
193   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
194   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
195
196   PORT_START      /* IN1 */
197   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
198   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
199   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
200   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
201   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
202   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
203   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
204   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
205
206   PORT_START      /* DSW0 */
207   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
208   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
209   PORT_DIPSETTING(    0x03, "A 1C/1C B 3C/1C" )
210   PORT_DIPSETTING(    0x01, "A 1C/2C B 1C/4C" )
211   PORT_DIPSETTING(    0x00, "A 1C/3C B 1C/6C" )
212   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Demo_Sounds ) )
213   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
214   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
215   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Cabinet ) )
216   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
217   PORT_DIPSETTING(    0x08, DEF_STR( Cocktail ) )
218   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Difficulty ) )
219   PORT_DIPSETTING(    0x10, DEF_STR( Easy ) )
220   PORT_DIPSETTING(    0x00, DEF_STR( Hard ) )
221   PORT_DIPNAME( 0x60, 0x00, DEF_STR( Game_Time ) )
222   PORT_DIPSETTING(    0x20, "1 Min." )
223   PORT_DIPSETTING(    0x00, "2 Min." )
224   PORT_DIPSETTING(    0x60, "3 Min." )
225   PORT_DIPSETTING(    0x40, "4 Min." )
226   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_SPECIAL )   // bit 2 of the watchdog counter
227
228   PORT_START      /* IN2 */
229   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
230   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
231   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
232   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
233   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
234   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
235   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
236   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
237INPUT_PORTS_END
238
239/***************************************************************************
240
241    Graphic(s) decoding
242
243***************************************************************************/
244
245static const gfx_layout charlayout_3bpp =
246{
247   8,8,
248   RGN_FRAC(1,2),
249   3,
250   { RGN_FRAC(1,2)+4, 0, 4 },
251   { STEP4(8*8,1), STEP4(0,1) },
252   { STEP8(0,8) },
253   16*8
254};
255
256static const gfx_layout spritelayout_3bpp =
257{
258   16,16,
259   RGN_FRAC(1,2),
260   3,
261   { RGN_FRAC(1,2)+4, 0, 4 },
262   { STEP4(8*8,1), STEP4(16*8,1), STEP4(24*8,1), STEP4(0,1) },
263   { STEP8(0,8), STEP8(32*8,8) },
264   64*8
265};
266
267static const gfx_layout spritelayout_4bpp =
268{
269   16,16,
270   RGN_FRAC(1,2),
271   4,
272   { RGN_FRAC(1,2)+0, RGN_FRAC(1,2)+4, 0, 4 },
273   { STEP4(8*8,1), STEP4(16*8,1), STEP4(24*8,1), STEP4(0,1) },
274   { STEP8(0,8), STEP8(32*8,8) },
275   64*8
276};
277
278static GFXDECODE_START( exctsccr )
279   GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout_3bpp,   0x000, 0x080/8 ) /* chars */
280   GFXDECODE_ENTRY( REGION_GFX2, 0, spritelayout_3bpp, 0x080, 0x080/8 ) /* sprites */
281   GFXDECODE_ENTRY( REGION_GFX3, 0, spritelayout_4bpp, 0x100, 0x100/16 ) /* sprites */
282GFXDECODE_END
283
284
285/***************************************************************************
286
287    Machine driver(s)
288
289***************************************************************************/
290
291static MACHINE_DRIVER_START( exctsccr )
292
293   /* basic machine hardware */
294   MDRV_CPU_ADD(Z80, 4000000)   /* 4.0 MHz (?) */
295   MDRV_CPU_PROGRAM_MAP(main_map,0)
296   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
297
298   MDRV_CPU_ADD(Z80, 4123456)   /* ??? with 4 MHz, nested NMIs might happen */
299   MDRV_CPU_PROGRAM_MAP(sub_map,0)
300   MDRV_CPU_IO_MAP(0,sound_writeport)
301   MDRV_CPU_PERIODIC_INT(nmi_line_pulse, 4000) /* 4 kHz, updates the dac */
302
303   /* MCU */
304   MDRV_CPU_ADD(ALPHA8301, 4000000/8)
305   MDRV_CPU_PROGRAM_MAP(mcu_map,0)
306
307   MDRV_MACHINE_START(exctsccr)
308
309   /* video hardware */
310   MDRV_SCREEN_ADD("main", RASTER)
311   MDRV_SCREEN_REFRESH_RATE(60)
312   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
313   MDRV_SCREEN_SIZE(32*8, 32*8)
314   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
315
316   MDRV_GFXDECODE(exctsccr)
317   MDRV_PALETTE_LENGTH(0x200)
318
319   MDRV_PALETTE_INIT(exctsccr)
320   MDRV_VIDEO_START(exctsccr)
321   MDRV_VIDEO_UPDATE(exctsccr)
322
323   /* sound hardware */
324   MDRV_SPEAKER_STANDARD_MONO("mono")
325
326   MDRV_SOUND_ADD(AY8910, 1500000)
327   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.08)
328
329   MDRV_SOUND_ADD(AY8910, 1500000)
330   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.08)
331
332   MDRV_SOUND_ADD(AY8910, 1500000)
333   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.08)
334
335   MDRV_SOUND_ADD(AY8910, 1500000)
336   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.08)
337
338   MDRV_SOUND_ADD(DAC, 0)
339   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
340
341   MDRV_SOUND_ADD(DAC, 0)
342   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
343MACHINE_DRIVER_END
344
345/* Bootleg on a modified Championship Baseball board */
346static MACHINE_DRIVER_START( exctsccb )
347
348   /* basic machine hardware */
349   MDRV_CPU_ADD(Z80, XTAL_18_432MHz/6)
350   MDRV_CPU_PROGRAM_MAP(bl_map,0)
351   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
352
353   MDRV_CPU_ADD(Z80, XTAL_18_432MHz/6)
354   MDRV_CPU_PROGRAM_MAP(bl_sound_map,0)
355
356   /* video hardware */
357   MDRV_SCREEN_ADD("main", RASTER)
358   MDRV_SCREEN_REFRESH_RATE(60)
359   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
360   MDRV_SCREEN_SIZE(32*8, 32*8)
361   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
362
363   MDRV_GFXDECODE(exctsccr)
364   MDRV_PALETTE_LENGTH(0x200)
365
366   MDRV_PALETTE_INIT(exctsccr)
367   MDRV_VIDEO_START(exctsccr)
368   MDRV_VIDEO_UPDATE(exctsccr)
369
370   /* sound hardware */
371   MDRV_SPEAKER_STANDARD_MONO("mono")
372
373   MDRV_SOUND_ADD(AY8910, XTAL_18_432MHz/12)
374   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15)
375
376   MDRV_SOUND_ADD(DAC, 0)
377   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
378MACHINE_DRIVER_END
379
380/***************************************************************************
381
382  Game driver(s)
383
384***************************************************************************/
385
386ROM_START( exctsccr )
387   ROM_REGION( 0x10000, REGION_CPU1, 0 )
388   ROM_LOAD( "1_g10.bin",    0x0000, 0x2000, CRC(aa68df66) SHA1(f10cac5a4c5aad1e1eb8835174dc8d517bb2921a) )
389   ROM_LOAD( "2_h10.bin",    0x2000, 0x2000, CRC(2d8f8326) SHA1(8809e7b081fa2a1966cb51ac969fd7b468d35be0) )
390   ROM_LOAD( "3_j10.bin",    0x4000, 0x2000, CRC(dce4a04d) SHA1(9c015e4597ec8921bea213d9841fc69c776a4e6d) )
391
392   ROM_REGION( 0x10000, REGION_CPU2, 0 )
393   ROM_LOAD( "0_h6.bin",     0x0000, 0x2000, CRC(3babbd6b) SHA1(b81bd47c4449f4f21f2d55d01eb9cb6db10664c7) )
394   ROM_LOAD( "9_f6.bin",     0x2000, 0x2000, CRC(639998f5) SHA1(c4ff5e5e75d53dea38449f323186d08d5b57bf90) )
395   ROM_LOAD( "8_d6.bin",     0x4000, 0x2000, CRC(88651ee1) SHA1(2052e1b3f9784439369f464e31f4a2b0d1bb0565) )
396   ROM_LOAD( "7_c6.bin",     0x6000, 0x2000, CRC(6d51521e) SHA1(2809bd2e61f40dcd31d43c62520982bdcfb0a865) )
397   ROM_LOAD( "1_a6.bin",     0x8000, 0x1000, CRC(20f2207e) SHA1(b1ed2237d0bd50ddbe593fd2fbff9f1d67c1eb11) )
398
399   ROM_REGION( 0x04000, REGION_GFX1, ROMREGION_DISPOSE )   // 3bpp chars + sprites: rearranged by DRIVER_INIT to leave only chars
400   ROM_LOAD( "4_a5.bin",     0x0000, 0x2000, CRC(c342229b) SHA1(a989d6c12521c77882a7e17d4d80afe7eae05906) ) /* planes 0,1 */
401   ROM_LOAD( "6_c5.bin",     0x2000, 0x2000, CRC(eda40e32) SHA1(6c08fd4f4fb35fd354d02e04548e960c545f6a88) ) /* plane 3 */
402
403   ROM_REGION( 0x04000, REGION_GFX2, ROMREGION_DISPOSE )   // 3bpp chars + sprites: rearranged by DRIVER_INIT to leave only sprites
404   ROM_LOAD( "5_b5.bin",     0x0000, 0x2000, CRC(35f4f8c9) SHA1(cdf5bbfea9abdd338938e5f4499d2d71ce3c6237) ) /* planes 0,1 */
405
406   ROM_REGION( 0x02000, REGION_GFX3, ROMREGION_DISPOSE )   // 4bpp sprites
407   ROM_LOAD( "2_k5.bin",     0x0000, 0x1000, CRC(7f9cace2) SHA1(bf05a31716f3ca1c2fd1034cd1f39e2d21cdaed3) )
408   ROM_LOAD( "3_l5.bin",     0x1000, 0x1000, CRC(db2d9e0d) SHA1(6ec09a47f7aea6bf31eb0ee78f44012f4d92de8a) )
409
410   ROM_REGION( 0x0220, REGION_PROMS, 0 )
411   ROM_LOAD( "prom1.e1",     0x0000, 0x0020, CRC(d9b10bf0) SHA1(bc1263331968f4bf37eb70ec4f56a8cb763c29d2) ) /* palette */
412   ROM_LOAD( "prom2.8r",     0x0020, 0x0100, CRC(8a9c0edf) SHA1(8aad387e9409cff0eeb42eeb57e9ea88770a8c9a) ) /* lookup table */
413   ROM_LOAD( "prom3.k5",     0x0120, 0x0100, CRC(b5db1c2c) SHA1(900aaaac6b674a9c5c7b7804a4b0c3d5cce761aa) ) /* lookup table */
414ROM_END
415
416ROM_START( exctscca )
417   ROM_REGION( 0x10000, REGION_CPU1, 0 )
418   ROM_LOAD( "1_g10.bin",    0x0000, 0x2000, CRC(aa68df66) SHA1(f10cac5a4c5aad1e1eb8835174dc8d517bb2921a) )
419   ROM_LOAD( "2_h10.bin",    0x2000, 0x2000, CRC(2d8f8326) SHA1(8809e7b081fa2a1966cb51ac969fd7b468d35be0) )
420   ROM_LOAD( "3_j10.bin",    0x4000, 0x2000, CRC(dce4a04d) SHA1(9c015e4597ec8921bea213d9841fc69c776a4e6d) )
421
422   ROM_REGION( 0x10000, REGION_CPU2, 0 )
423   ROM_LOAD( "exctsccc.000", 0x0000, 0x2000, CRC(642fc42f) SHA1(cfc849d18e347e3e23fc31c1ce7f2580d5d9b2b0) )
424   ROM_LOAD( "exctsccc.009", 0x2000, 0x2000, CRC(d88b3236) SHA1(80f083fb15243e9e68978677caed8aee8e3109a0) )
425   ROM_LOAD( "8_d6.bin",     0x4000, 0x2000, CRC(88651ee1) SHA1(2052e1b3f9784439369f464e31f4a2b0d1bb0565) )
426   ROM_LOAD( "7_c6.bin",     0x6000, 0x2000, CRC(6d51521e) SHA1(2809bd2e61f40dcd31d43c62520982bdcfb0a865) )
427   ROM_LOAD( "1_a6.bin",     0x8000, 0x1000, CRC(20f2207e) SHA1(b1ed2237d0bd50ddbe593fd2fbff9f1d67c1eb11) )
428
429   ROM_REGION( 0x04000, REGION_GFX1, ROMREGION_DISPOSE )   // 3bpp chars + sprites: rearranged by DRIVER_INIT to leave only chars
430   ROM_LOAD( "4_a5.bin",     0x0000, 0x2000, CRC(c342229b) SHA1(a989d6c12521c77882a7e17d4d80afe7eae05906) ) /* planes 0,1 */
431   ROM_LOAD( "6_c5.bin",     0x2000, 0x2000, CRC(eda40e32) SHA1(6c08fd4f4fb35fd354d02e04548e960c545f6a88) ) /* plane 3 */
432
433   ROM_REGION( 0x04000, REGION_GFX2, ROMREGION_DISPOSE )   // 3bpp chars + sprites: rearranged by DRIVER_INIT to leave only sprites
434   ROM_LOAD( "5_b5.bin",     0x0000, 0x2000, CRC(35f4f8c9) SHA1(cdf5bbfea9abdd338938e5f4499d2d71ce3c6237) ) /* planes 0,1 */
435
436   ROM_REGION( 0x02000, REGION_GFX3, ROMREGION_DISPOSE )   // 4bpp sprites
437   ROM_LOAD( "2_k5.bin",     0x0000, 0x1000, CRC(7f9cace2) SHA1(bf05a31716f3ca1c2fd1034cd1f39e2d21cdaed3) )
438   ROM_LOAD( "3_l5.bin",     0x1000, 0x1000, CRC(db2d9e0d) SHA1(6ec09a47f7aea6bf31eb0ee78f44012f4d92de8a) )
439
440   ROM_REGION( 0x0220, REGION_PROMS, 0 )
441   ROM_LOAD( "prom1.e1",     0x0000, 0x0020, CRC(d9b10bf0) SHA1(bc1263331968f4bf37eb70ec4f56a8cb763c29d2) ) /* palette */
442   ROM_LOAD( "prom2.8r",     0x0020, 0x0100, CRC(8a9c0edf) SHA1(8aad387e9409cff0eeb42eeb57e9ea88770a8c9a) ) /* lookup table */
443   ROM_LOAD( "prom3.k5",     0x0120, 0x0100, CRC(b5db1c2c) SHA1(900aaaac6b674a9c5c7b7804a4b0c3d5cce761aa) ) /* lookup table */
444ROM_END
445
446/* Bootleg */
447ROM_START( exctsccb )
448   ROM_REGION( 0x10000, REGION_CPU1, 0 )
449   ROM_LOAD( "es-1.e2",      0x0000, 0x2000, CRC(997c6a82) SHA1(60fe27a12eedd22c775b7e65c5ba692cfcf5ac74) )
450   ROM_LOAD( "es-2.g2",      0x2000, 0x2000, CRC(5c66e792) SHA1(f7a7f32806965fa926261217cee3159ccd198d49) )
451   ROM_LOAD( "es-3.h2",      0x4000, 0x2000, CRC(e0d504c0) SHA1(d9a9f37b3a44a05a3f3389aa9617c419a2cee661) )
452
453   ROM_REGION( 0x10000, REGION_CPU2, 0 )   /* sound */
454   ROM_LOAD( "es-a.k2",      0x0000, 0x2000, CRC(99e87b78) SHA1(f12006ff3f6f3c706e06288c97a1446141373432) )
455   ROM_LOAD( "es-b.l2",      0x2000, 0x2000, CRC(8b3db794) SHA1(dbfed2357c7631bfca6bbd63a23617bc3abf6ca3) )
456   ROM_LOAD( "es-c.m2",      0x4000, 0x2000, CRC(7bed2f81) SHA1(cbbb0480519cc04a99e8983228b18c9e49a9985d) )
457
458   /* the national flags are wrong. This happens on the real board */
459   ROM_REGION( 0x04000, REGION_GFX1, ROMREGION_DISPOSE )   // 3bpp chars + sprites: rearranged by DRIVER_INIT to leave only chars
460   ROM_LOAD( "4_a5.bin",     0x0000, 0x2000, CRC(c342229b) SHA1(a989d6c12521c77882a7e17d4d80afe7eae05906) ) /* planes 0,1 */
461   ROM_LOAD( "6_c5.bin",     0x2000, 0x2000, CRC(eda40e32) SHA1(6c08fd4f4fb35fd354d02e04548e960c545f6a88) ) /* plane 3 */
462
463   ROM_REGION( 0x04000, REGION_GFX2, ROMREGION_DISPOSE )   // 3bpp chars + sprites: rearranged by DRIVER_INIT to leave only sprites
464   ROM_LOAD( "5_b5.bin",     0x0000, 0x2000, CRC(35f4f8c9) SHA1(cdf5bbfea9abdd338938e5f4499d2d71ce3c6237) ) /* planes 0,1 */
465
466   ROM_REGION( 0x02000, REGION_GFX3, ROMREGION_DISPOSE )   // 4bpp sprites
467   ROM_LOAD( "2_k5.bin",     0x0000, 0x1000, CRC(7f9cace2) SHA1(bf05a31716f3ca1c2fd1034cd1f39e2d21cdaed3) )
468   ROM_LOAD( "3_l5.bin",     0x1000, 0x1000, CRC(db2d9e0d) SHA1(6ec09a47f7aea6bf31eb0ee78f44012f4d92de8a) )
469
470   ROM_REGION( 0x0220, REGION_PROMS, 0 )
471   ROM_LOAD( "prom1.e1",     0x0000, 0x0020, CRC(d9b10bf0) SHA1(bc1263331968f4bf37eb70ec4f56a8cb763c29d2) ) /* palette */
472   ROM_LOAD( "prom2.8r",     0x0020, 0x0100, CRC(8a9c0edf) SHA1(8aad387e9409cff0eeb42eeb57e9ea88770a8c9a) ) /* lookup table */
473   ROM_LOAD( "prom3.k5",     0x0120, 0x0100, CRC(b5db1c2c) SHA1(900aaaac6b674a9c5c7b7804a4b0c3d5cce761aa) ) /* lookup table */
474ROM_END
475
476ROM_START( exctscc2 )
477   ROM_REGION( 0x10000, REGION_CPU1, 0 )
478   ROM_LOAD( "vr.3j",        0x0000, 0x2000, CRC(c6115362) SHA1(6a258631abd72ef6b8d7968bb4b2bc88e89e597d) )
479   ROM_LOAD( "vr.3k",        0x2000, 0x2000, CRC(de36ba00) SHA1(0a0d92e710b8c749f145571bc8a204609456d19d) )
480   ROM_LOAD( "vr.3l",        0x4000, 0x2000, CRC(1ddfdf65) SHA1(313d0a7f13fc2de15aa32492c38a59fbafad9f01) )
481
482   ROM_REGION( 0x10000, REGION_CPU2, 0 )
483   ROM_LOAD( "vr.7d",        0x0000, 0x2000, CRC(2c675a43) SHA1(aa0a8dbcae955e3da92c435202f2a1ed238c377e) )
484   ROM_LOAD( "vr.7e",        0x2000, 0x2000, CRC(e571873d) SHA1(2dfff24f5dac86e92612f40cf3642005c7f36ad3) )
485   ROM_LOAD( "8_d6.bin",     0x4000, 0x2000, CRC(88651ee1) SHA1(2052e1b3f9784439369f464e31f4a2b0d1bb0565) )   /* vr.7f */
486   ROM_LOAD( "7_c6.bin",     0x6000, 0x2000, CRC(6d51521e) SHA1(2809bd2e61f40dcd31d43c62520982bdcfb0a865) )   /* vr.7h */
487   ROM_LOAD( "1_a6.bin",     0x8000, 0x1000, CRC(20f2207e) SHA1(b1ed2237d0bd50ddbe593fd2fbff9f1d67c1eb11) )   /* vr.7k */
488
489   ROM_REGION( 0x04000, REGION_GFX1, ROMREGION_DISPOSE )   // 3bpp chars + sprites: rearranged by DRIVER_INIT to leave only chars
490   ROM_LOAD( "vr.5a",        0x0000, 0x2000, CRC(4ff1783d) SHA1(c45074864c3a4bcbf3a87d164027ae16dca53d9c) ) /* planes 0,1 */
491   ROM_LOAD( "vr.5c",        0x2000, 0x2000, CRC(1fb84ee6) SHA1(56ceb86c509be783f806403ac21e7c9684760d5f) ) /* plane 3 */
492
493   ROM_REGION( 0x04000, REGION_GFX2, ROMREGION_DISPOSE )   // 3bpp chars + sprites: rearranged by DRIVER_INIT to leave only sprites
494   ROM_LOAD( "vr.5b",        0x0000, 0x2000, CRC(5605b60b) SHA1(19d5909896ae4a3d7552225c369d30475c56793b) ) /* planes 0,1 */
495
496   ROM_REGION( 0x02000, REGION_GFX3, ROMREGION_DISPOSE )   // 4bpp sprites
497   ROM_LOAD( "vr.5k",        0x0000, 0x1000, CRC(1d37edfa) SHA1(184fa6dd7b1b3fff4c5fc19b42301ccb7979ac84) )
498   ROM_LOAD( "vr.5l",        0x1000, 0x1000, CRC(b97f396c) SHA1(4ffe512acf047230bd593911a615fc0ef66b481d) )
499
500   ROM_REGION( 0x0220, REGION_PROMS, 0 )
501   ROM_LOAD( "prom1.e1",     0x0000, 0x0020, CRC(d9b10bf0) SHA1(bc1263331968f4bf37eb70ec4f56a8cb763c29d2) ) /* palette */
502   ROM_LOAD( "prom2.8r",     0x0020, 0x0100, CRC(8a9c0edf) SHA1(8aad387e9409cff0eeb42eeb57e9ea88770a8c9a) ) /* lookup table */
503   ROM_LOAD( "prom3.k5",     0x0120, 0x0100, CRC(b5db1c2c) SHA1(900aaaac6b674a9c5c7b7804a4b0c3d5cce761aa) ) /* lookup table */
504ROM_END
505
506
507
508static DRIVER_INIT( exctsccr )
509{
510   // chars and sprites are mixed in the same ROMs, so rearrange them for easier decoding
511   UINT8 *rom1 = memory_region(machine, REGION_GFX1);
512   UINT8 *rom2 = memory_region(machine, REGION_GFX2);
513   int i;
514
515   // planes 0,1
516   for (i = 0; i < 0x1000; ++i)
517   {
518      UINT8 t = rom1[i + 0x1000];
519      rom1[i + 0x1000] = rom2[i];
520      rom2[i] = t;
521   }
522
523   // plane 3
524   for (i = 0; i < 0x1000; ++i)
525   {
526      rom2[i + 0x3000] = rom1[i + 0x3000] >> 4;
527      rom2[i + 0x2000] = rom1[i + 0x3000] & 0x0f;
528   }
529   for (i = 0; i < 0x1000; ++i)
530   {
531      rom1[i + 0x3000] = rom1[i + 0x2000] >> 4;
532      rom1[i + 0x2000] &= 0x0f;
533   }
534}
535
536
537
538GAME( 1983, exctsccr, 0,        exctsccr, exctsccr, exctsccr, ROT90, "Alpha Denshi Co.", "Exciting Soccer", 0 )
539GAME( 1983, exctscca, exctsccr, exctsccr, exctsccr, exctsccr, ROT90, "Alpha Denshi Co.", "Exciting Soccer (alternate music)", 0 )
540GAME( 1983, exctsccb, exctsccr, exctsccb, exctsccr, exctsccr, ROT90, "bootleg",          "Exciting Soccer (bootleg)", 0 )
541GAME( 1984, exctscc2, 0       , exctsccr, exctsccr, exctsccr, ROT90, "Alpha Denshi Co.", "Exciting Soccer II", GAME_IMPERFECT_GRAPHICS )
src/emu/cpu/drcumld.c
r3053r3054
1/***************************************************************************
2
3    drcumld.c
4
5    Universal machine language disassembler.
6
7    Copyright Aaron Giles
8    Released for general non-commercial use under the MAME license
9    Visit http://mamedev.org for licensing and usage restrictions.
10
11***************************************************************************/
12
13#include "drcumld.h"
14#include "drcumlsh.h"
15#include "memory.h"
16
17
18
19/***************************************************************************
20    TYPE DEFINITIONS
21***************************************************************************/
22
23typedef char *(*output_function)(char *dest, int size, const drcuml_parameter *param);
24
25
26typedef struct _drcuml_opdesc drcuml_opdesc;
27struct _drcuml_opdesc
28{
29   UINT16         opcode;
30   const char *   opstring;
31   output_function   param[5];
32};
33
34
35
36/***************************************************************************
37    FUNCTION PROTOTYPES
38***************************************************************************/
39
40static char *output_cond(char *dest, int size, const drcuml_parameter *param);
41static char *output_flags(char *dest, int size, const drcuml_parameter *param);
42static char *output_flags_cmptest(char *dest, int size, const drcuml_parameter *param);
43static char *output_param(char *dest, int size, const drcuml_parameter *param);
44static char *output_param_string(char *dest, int size, const drcuml_parameter *param);
45static char *output_param_handle(char *dest, int size, const drcuml_parameter *param);
46static char *output_param_size(char *dest, int size, const drcuml_parameter *param);
47static char *output_param_space(char *dest, int size, const drcuml_parameter *param);
48static char *output_param_space_size(char *dest, int size, const drcuml_parameter *param);
49static char *output_param_round(char *dest, int size, const drcuml_parameter *param);
50
51
52
53/***************************************************************************
54    TABLES
55***************************************************************************/
56
57/* these define the conditions for the UML */
58static const char *condname[] =
59{
60   "z",   "nz",
61   "s",   "ns",
62   "c",   "nc",
63   "v",   "nv",
64   "u",   "nu",
65   "a",   "be",
66   "g",   "le",
67   "l",   "ge"
68};
69
70/* the source opcode table */
71static const drcuml_opdesc opcode_source_table[] =
72{
73   /* Compile-time opcodes */
74   { DRCUML_OP_HANDLE,      "handle",   { output_param_handle } },
75   { DRCUML_OP_HASH,      "hash",      { output_param, output_param } },
76   { DRCUML_OP_LABEL,      "label",   { output_param } },
77   { DRCUML_OP_COMMENT,   "comment",   { output_param_string } },
78   { DRCUML_OP_MAPVAR,      "mapvar",   { output_param, output_param } },
79
80   /* Control Flow Operations */
81   { DRCUML_OP_DEBUG,      "debug",   { output_param } },
82   { DRCUML_OP_EXIT,      "exit",      { output_param, output_cond } },
83   { DRCUML_OP_HASHJMP,   "hashjmp",   { output_param, output_param, output_param_handle } },
84   { DRCUML_OP_JMP,      "jmp",      { output_param, output_cond } },
85   { DRCUML_OP_EXH,      "exh",      { output_param_handle, output_param, output_cond } } ,
86   { DRCUML_OP_CALLH,      "callh",   { output_param_handle, output_cond } },
87   { DRCUML_OP_RET,      "ret",      { output_cond } },
88   { DRCUML_OP_CALLC,      "callc",   { output_param, output_param, output_cond } },
89   { DRCUML_OP_RECOVER,   "recover",   { output_param, output_param } },
90
91   /* Internal Register Operations */
92   { DRCUML_OP_SETFMOD,   "setfmod",   { output_param } },
93   { DRCUML_OP_GETFMOD,   "getfmod",   { output_param } },
94   { DRCUML_OP_GETEXP,      "getexp",   { output_param } },
95   { DRCUML_OP_GETFLGS,   "getflgs",   { output_param, output_flags } },
96   { DRCUML_OP_SAVE,      "save",      { output_param } },
97   { DRCUML_OP_RESTORE,   "restore",   { output_param } },
98
99   /* Integer Operations */
100   { DRCUML_OP_LOAD,      "!load",   { output_param, output_param, output_param, output_param_size } },
101   { DRCUML_OP_LOADS,      "!loads",   { output_param, output_param, output_param, output_param_size } },
102   { DRCUML_OP_STORE,      "!store",   { output_param, output_param, output_param, output_param_size } },
103   { DRCUML_OP_READ,      "!read",   { output_param, output_param, output_param_space_size } },
104   { DRCUML_OP_READM,      "!readm",   { output_param, output_param, output_param, output_param_space_size } },
105   { DRCUML_OP_WRITE,      "!write",   { output_param, output_param, output_param_space_size } },
106   { DRCUML_OP_WRITEM,      "!writem",   { output_param, output_param, output_param, output_param_space_size } },
107   { DRCUML_OP_CARRY,      "!carry",   { output_param, output_param } },
108   { DRCUML_OP_SET,      "!set",      { output_param, output_cond } },
109   { DRCUML_OP_MOV,      "!mov",      { output_param, output_param, output_cond } },
110   { DRCUML_OP_SEXT,      "!sext",   { output_param, output_param, output_param_size } },
111   { DRCUML_OP_ROLAND,      "!roland",   { output_param, output_param, output_param, output_param } },
112   { DRCUML_OP_ROLINS,      "!rolins",   { output_param, output_param, output_param, output_param } },
113   { DRCUML_OP_ADD,      "!add",      { output_param, output_param, output_param, output_flags } },
114   { DRCUML_OP_ADDC,      "!addc",   { output_param, output_param, output_param, output_flags } },
115   { DRCUML_OP_SUB,      "!sub",      { output_param, output_param, output_param, output_flags } },
116   { DRCUML_OP_SUBB,      "!subb",   { output_param, output_param, output_param, output_flags } },
117   { DRCUML_OP_CMP,      "!cmp",      { output_param, output_param, output_flags_cmptest } },
118   { DRCUML_OP_MULU,      "!mulu",   { output_param, output_param, output_param, output_param, output_flags } },
119   { DRCUML_OP_MULS,      "!muls",   { output_param, output_param, output_param, output_param, output_flags } },
120   { DRCUML_OP_DIVU,      "!divu",   { output_param, output_param, output_param, output_param, output_flags } },
121   { DRCUML_OP_DIVS,      "!divs",   { output_param, output_param, output_param, output_param, output_flags } },
122   { DRCUML_OP_AND,      "!and",      { output_param, output_param, output_param, output_flags } },
123   { DRCUML_OP_TEST,      "!test",   { output_param, output_param, output_flags_cmptest } },
124   { DRCUML_OP_OR,         "!or",      { output_param, output_param, output_param, output_flags } },
125   { DRCUML_OP_XOR,      "!xor",      { output_param, output_param, output_param, output_flags } },
126   { DRCUML_OP_LZCNT,      "!lzcnt",   { output_param, output_param } },
127   { DRCUML_OP_BSWAP,      "!bswap",   { output_param, output_param } },
128   { DRCUML_OP_SHL,      "!shl",      { output_param, output_param, output_param, output_flags } },
129   { DRCUML_OP_SHR,      "!shr",      { output_param, output_param, output_param, output_flags } },
130   { DRCUML_OP_SAR,      "!sar",      { output_param, output_param, output_param, output_flags } },
131   { DRCUML_OP_ROL,      "!rol",      { output_param, output_param, output_param, output_flags } },
132   { DRCUML_OP_ROLC,      "!rolc",   { output_param, output_param, output_param, output_flags } },
133   { DRCUML_OP_ROR,      "!ror",      { output_param, output_param, output_param, output_flags } },
134   { DRCUML_OP_RORC,      "!rorc",   { output_param, output_param, output_param, output_flags } },
135
136   /* Floating-Point Operations */
137   { DRCUML_OP_FLOAD,      "f!load",   { output_param, output_param, output_param } },
138   { DRCUML_OP_FSTORE,      "f!store",   { output_param, output_param, output_param } },
139   { DRCUML_OP_FREAD,      "f!read",   { output_param, output_param, output_param_space } },
140   { DRCUML_OP_FWRITE,      "f!write",   { output_param, output_param, output_param_space } },
141   { DRCUML_OP_FMOV,      "f!mov",   { output_param, output_param, output_cond } },
142   { DRCUML_OP_FTOINT,      "f!toint",   { output_param, output_param, output_param_size, output_param_round } },
143   { DRCUML_OP_FFRINT,      "f!frint",   { output_param, output_param, output_param_size } },
144   { DRCUML_OP_FFRFLT,      "f!frflt",   { output_param, output_param, output_param_size } },
145   { DRCUML_OP_FRNDS,      "f!rnds",   { output_param, output_param } },
146   { DRCUML_OP_FADD,      "f!add",   { output_param, output_param, output_param } },
147   { DRCUML_OP_FSUB,      "f!sub",   { output_param, output_param, output_param } },
148   { DRCUML_OP_FCMP,      "f!cmp",   { output_param, output_param, output_flags_cmptest } },
149   { DRCUML_OP_FMUL,      "f!mul",   { output_param, output_param, output_param } },
150   { DRCUML_OP_FDIV,      "f!div",   { output_param, output_param, output_param } },
151   { DRCUML_OP_FNEG,      "f!neg",   { output_param, output_param } },
152   { DRCUML_OP_FABS,      "f!abs",   { output_param, output_param } },
153   { DRCUML_OP_FSQRT,      "f!sqrt",   { output_param, output_param } },
154   { DRCUML_OP_FRECIP,      "f!recip",   { output_param, output_param } },
155   { DRCUML_OP_FRSQRT,      "f!rsqrt",   { output_param, output_param } },
156};
157
158
159
160/***************************************************************************
161    GLOBAL VARIABLES
162***************************************************************************/
163
164static const drcuml_opdesc *opcode_table[DRCUML_OP_MAX];
165
166
167
168/***************************************************************************
169    CORE DISASSEMBLER
170***************************************************************************/
171
172/*-------------------------------------------------
173    drcuml_disasm - disassemble one instruction
174-------------------------------------------------*/
175
176void drcuml_disasm(const drcuml_instruction *inst, char *buffer)
177{
178   const drcuml_opdesc *opdesc;
179   const char *stringptr;
180   char *dest = buffer;
181   int pnum, iparam = 0;
182
183   /* if this is the first time through, populate the opcode table */
184   if (opcode_table[DRCUML_OP_HASH] == NULL)
185   {
186      int tabledex;
187
188      for (tabledex = 0; tabledex < ARRAY_LENGTH(opcode_source_table); tabledex++)
189         opcode_table[opcode_source_table[tabledex].opcode] = &opcode_source_table[tabledex];
190   }
191
192   /* find the opcode in the list */
193   opdesc = opcode_table[inst->opcode];
194
195   /* NULL means invalid opcode */
196   if (opdesc == NULL)
197   {
198      strcpy(buffer, "???");
199      return;
200   }
201
202   /* start with the opcode itself */
203   stringptr = opdesc->opstring;
204
205   /* insert a prefix for integer operations */
206   if (stringptr[0] == '!')
207   {
208      stringptr++;
209      switch (inst->size)
210      {
211         case 1:   *dest++ = 'b'; break;
212         case 2:   *dest++ = 'w'; break;
213         case 4:   break;
214         case 8:   *dest++ = 'd'; break;
215         default: *dest++ = '?'; break;
216      }
217   }
218
219   /* insert a prefix for floating point operations */
220   if (stringptr[0] == 'f' && stringptr[1] == '!')
221   {
222      *dest++ = *stringptr++;
223      stringptr++;
224      switch (inst->size)
225      {
226         case 4:   *dest++ = 's'; break;
227         case 8:   *dest++ = 'd'; break;
228         default: *dest++ = '?'; break;
229      }
230   }
231
232   /* copy the rest of the string */
233   dest += sprintf(dest, "%s", stringptr);
234
235   /* iterate over parameters */
236   for (pnum = 0; pnum < ARRAY_LENGTH(opdesc->param); pnum++)
237   {
238      output_function func = opdesc->param[pnum];
239      drcuml_parameter param;
240
241      /* stop when we hit NULL */
242      if (func == NULL)
243         break;
244
245      /* if we are outputting a condition but it's "always", skip it */
246      if (func == output_cond)
247      {
248         if (inst->condflags == DRCUML_COND_ALWAYS)
249            continue;
250         param.value = inst->condflags;
251      }
252
253      /* if we are outputting flags but they are "none", skip it */
254      else if (func == output_flags)
255      {
256         if (inst->condflags == FLAGS_NONE)
257            continue;
258         param.value = inst->condflags;
259      }
260
261      /* if we are outputting test/cmp flags but they are "all", skip it */
262      else if (func == output_flags_cmptest)
263      {
264         if (inst->opcode == DRCUML_OP_CMP && inst->condflags == FLAGS_ALLI)
265            continue;
266         if (inst->opcode == DRCUML_OP_FCMP && inst->condflags == FLAGS_ALLF)
267            continue;
268         if (inst->opcode == DRCUML_OP_TEST && inst->condflags == (FLAGS_S|FLAGS_Z))
269            continue;
270         param.value = inst->condflags;
271      }
272
273      /* otherwise, we are fetching an actual parameter */
274      else
275         param = inst->param[iparam++];
276
277      /* if we are less than 8 characters, pad to 8 */
278      if (dest - buffer < 8)
279         dest += sprintf(dest, "%*s", (int)(8 - (dest - buffer)), "");
280
281      /* otherwise, add a comma */
282      else
283         dest += sprintf(dest, ",");
284
285      /* then append the parameter */
286      dest = (*func)(dest, inst->size, &param);
287   }
288}
289
290
291
292/***************************************************************************
293    OUTPUT HELPERS
294***************************************************************************/
295
296/*-------------------------------------------------
297    output_cond - output condition
298-------------------------------------------------*/
299
300static char *output_cond(char *dest, int size, const drcuml_parameter *param)
301{
302   if (param->value >= DRCUML_COND_Z && param->value < DRCUML_COND_MAX)
303      return dest + sprintf(dest, "%s", condname[param->value - DRCUML_COND_Z]);
304   else
305      return dest + sprintf(dest, "??");
306}
307
308
309/*-------------------------------------------------
310    output_flags - output flags
311-------------------------------------------------*/
312
313static char *output_flags(char *dest, int size, const drcuml_parameter *param)
314{
315   if ((param->value & (DRCUML_FLAG_C | DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0)
316      return dest + sprintf(dest, "noflags");
317   if (param->value & DRCUML_FLAG_C)
318      *dest++ = 'C';
319   if (param->value & DRCUML_FLAG_V)
320      *dest++ = 'V';
321   if (param->value & DRCUML_FLAG_Z)
322      *dest++ = 'Z';
323   if (param->value & DRCUML_FLAG_S)
324      *dest++ = 'S';
325   *dest = 0;
326   return dest;
327}
328
329
330/*-------------------------------------------------
331    output_flags_cmptest - output flags
332-------------------------------------------------*/
333
334static char *output_flags_cmptest(char *dest, int size, const drcuml_parameter *param)
335{
336   if ((param->value & (DRCUML_FLAG_C | DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S)) == (DRCUML_FLAG_C | DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S))
337      return dest + sprintf(dest, "allflags");
338   return output_flags(dest, size, param);
339}
340
341
342/*-------------------------------------------------
343    output_param - generic parameter output
344-------------------------------------------------*/
345
346static char *output_param(char *dest, int size, const drcuml_parameter *param)
347{
348   UINT64 value;
349   switch (param->type)
350   {
351      case DRCUML_PTYPE_NONE:
352         return dest += sprintf(dest, "<none?>");
353
354      case DRCUML_PTYPE_IMMEDIATE:
355         value = param->value;
356         if (size == 1) value = (UINT8)value;
357         if (size == 2) value = (UINT16)value;
358         if (size == 4) value = (UINT32)value;
359         if ((UINT32)value == value)
360            return dest += sprintf(dest, "$%X", (UINT32)value);
361         else
362            return dest += sprintf(dest, "$%X%08X", (UINT32)(value >> 32), (UINT32)value);
363
364      case DRCUML_PTYPE_MAPVAR:
365         if (param->value >= DRCUML_MAPVAR_M0 && param->value < DRCUML_MAPVAR_END)
366            return dest += sprintf(dest, "m%d", (UINT32)(param->value - DRCUML_MAPVAR_M0));
367         else
368            return dest += sprintf(dest, "m(%X?)", (UINT32)param->value);
369
370      case DRCUML_PTYPE_INT_REGISTER:
371         if (param->value >= DRCUML_REG_I0 && param->value < DRCUML_REG_I_END)
372            return dest += sprintf(dest, "i%d", (UINT32)(param->value - DRCUML_REG_I0));
373         else
374            return dest += sprintf(dest, "i(%X?)", (UINT32)param->value);
375
376      case DRCUML_PTYPE_FLOAT_REGISTER:
377         if (param->value >= DRCUML_REG_F0 && param->value < DRCUML_REG_F_END)
378            return dest += sprintf(dest, "f%d", (UINT32)(param->value - DRCUML_REG_F0));
379         else
380            return dest += sprintf(dest, "f(%X?)", (UINT32)param->value);
381
382      case DRCUML_PTYPE_MEMORY:
383         return dest += sprintf(dest, "[$%p]", (void *)(FPTR)param->value);
384
385      default:
386         return dest += sprintf(dest, "???");
387   }
388   return dest;
389}
390
391
392/*-------------------------------------------------
393    output_param_string - output parameter 0,
394    assuming it is a string
395-------------------------------------------------*/
396
397static char *output_param_string(char *dest, int size, const drcuml_parameter *param)
398{
399   if (param->type == DRCUML_PTYPE_MEMORY)
400      return dest += sprintf(dest, "%s", (char *)(FPTR)param->value);
401   return output_param(dest, size, param);
402}
403
404
405/*-------------------------------------------------
406    output_param_handle - output parameter 0,
407    assuming it is a handle
408-------------------------------------------------*/
409
410static char *output_param_handle(char *dest, int size, const drcuml_parameter *param)
411{
412   if (param->type == DRCUML_PTYPE_MEMORY)
413      return dest += sprintf(dest, "%s", drcuml_handle_name((drcuml_codehandle *)(FPTR)param->value));
414   return output_param(dest, size, param);
415}
416
417
418/*-------------------------------------------------
419    output_param_size - output parameter 0,
420    assuming it is size
421-------------------------------------------------*/
422
423static char *output_param_size(char *dest, int size, const drcuml_parameter *param)
424{
425   if (param->type == DRCUML_PTYPE_IMMEDIATE)
426   {
427      static const char *strings[] = { "byte", "word", "dword", "qword" };
428      return dest + sprintf(dest, "%s", strings[param->value & 3]);
429   }
430   return output_param(dest, size, param);
431}
432
433
434/*-------------------------------------------------
435    output_param_space - output parameter 0,
436    assuming it is an address space
437-------------------------------------------------*/
438
439static char *output_param_space(char *dest, int size, const drcuml_parameter *param)
440{
441   if (param->type == DRCUML_PTYPE_IMMEDIATE && param->value >= ADDRESS_SPACE_PROGRAM && param->value <= ADDRESS_SPACE_IO)
442      return dest + sprintf(dest, "%s", address_space_names[param->value]);
443   return output_param(dest, size, param);
444}
445
446
447/*-------------------------------------------------
448    output_param_space_size - output parameter 0,
449    assuming it is an address space/size combo
450-------------------------------------------------*/
451
452static char *output_param_space_size(char *dest, int size, const drcuml_parameter *param)
453{
454   if (param->type == DRCUML_PTYPE_IMMEDIATE && param->value / 16 >= ADDRESS_SPACE_PROGRAM && param->value / 16 <= ADDRESS_SPACE_IO)
455   {
456      dest += sprintf(dest, "%s_", address_space_names[param->value / 16]);
457      return output_param_size(dest, size, param);
458   }
459
460   return output_param(dest, size, param);
461}
462
463
464/*-------------------------------------------------
465    output_param_round - output parameter 0,
466    assuming it is a rounding mode
467-------------------------------------------------*/
468
469static char *output_param_round(char *dest, int size, const drcuml_parameter *param)
470{
471   if (param->type == DRCUML_PTYPE_IMMEDIATE && param->value >= DRCUML_FMOD_TRUNC && param->value <= DRCUML_FMOD_DEFAULT)
472   {
473      static const char *strings[] = { "trunc", "round", "ceil", "floor", "default" };
474      return dest + sprintf(dest, "%s", strings[param->value]);
475   }
476   return output_param(dest, size, param);
477}
src/emu/cpu/drcumld.h
r3053r3054
1/***************************************************************************
2
3    drcumld.h
4
5    Universal machine language disassembler.
6
7    Copyright Aaron Giles
8    Released for general non-commercial use under the MAME license
9    Visit http://mamedev.org for licensing and usage restrictions.
10
11***************************************************************************/
12
13#pragma once
14
15#ifndef __DRCUMLD_H__
16#define __DRCUMLD_H__
17
18#include "drcuml.h"
19
20
21
22/***************************************************************************
23    FUNCTION PROTOTYPES
24***************************************************************************/
25
26/* disassemble one instruction */
27void drcuml_disasm(const drcuml_instruction *inst, char *buffer);
28
29
30#endif

Previous 15994 Revisions Next


© 1998-2018 The MESS Team