Previous 199869 Revisions Next

r33229 Wednesday 5th November, 2014 at 22:26:26 UTC by David Haywood
get rid of some global stuff by making this a device, need this step for now, will improve further later (nw)
[src/mame/drivers]atarig1.c atarisy1.c atarisy2.c atetris.c cyberbal.c gauntlet.c harddriv.c rampart.c starwars.c vindictr.c xybots.c
[src/mame/includes]atarigx2.h atarisy2.h atetris.h harddriv.h slapstic.h starwars.h
[src/mame/machine]atarigen.c atarigen.h harddriv.c slapstic.c
[src/mame/video]atarisy2.c

trunk/src/mame/drivers/atarig1.c
r241740r241741
428428   MCFG_CPU_PROGRAM_MAP(main_map)
429429   MCFG_DEVICE_VBLANK_INT_DRIVER("screen", atarigen_state, video_int_gen)
430430
431   MCFG_SLAPSTIC_ADD("slapstic")
432
431433   MCFG_MACHINE_START_OVERRIDE(atarig1_state,atarig1)
432434   MCFG_MACHINE_RESET_OVERRIDE(atarig1_state,atarig1)
433435
trunk/src/mame/drivers/atarisy1.c
r241740r241741
713713   MCFG_CPU_PROGRAM_MAP(main_map)
714714   MCFG_DEVICE_VBLANK_INT_DRIVER("screen", atarigen_state, video_int_gen)
715715
716   MCFG_SLAPSTIC_ADD("slapstic")
717
716718   MCFG_CPU_ADD("audiocpu", M6502, ATARI_CLOCK_14MHz/8)
717719   MCFG_CPU_PROGRAM_MAP(sound_map)
718720
trunk/src/mame/drivers/atarisy2.c
r241740r241741
126126
127127
128128#include "emu.h"
129#include "includes/slapstic.h"
130129#include "includes/atarisy2.h"
131130#include "sound/tms5220.h"
132131#include "sound/2151intf.h"
r241740r241741
222221MACHINE_RESET_MEMBER(atarisy2_state,atarisy2)
223222{
224223   atarigen_state::machine_reset();
225   slapstic_reset();
224   m_slapstic->slapstic_reset();
226225   scanline_timer_reset(*m_screen, 64);
227226
228227   m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(atarisy2_state::atarisy2_direct_handler), this));
r241740r241741
12081207   MCFG_CPU_PROGRAM_MAP(sound_map)
12091208   MCFG_DEVICE_PERIODIC_INT_DEVICE("soundcomm", atari_sound_comm_device, sound_irq_gen, (double)MASTER_CLOCK/2/16/16/16/10)
12101209
1210   MCFG_SLAPSTIC_ADD("slapstic")
1211
12111212   MCFG_MACHINE_START_OVERRIDE(atarisy2_state,atarisy2)
12121213   MCFG_MACHINE_RESET_OVERRIDE(atarisy2_state,atarisy2)
12131214
r241740r241741
31433144   int i;
31443145   UINT8 *cpu1 = memregion("maincpu")->base();
31453146
3146   slapstic_init(machine(), 105);
3147   m_slapstic->slapstic_init(machine(), 105);
31473148
31483149   /* expand the 16k program ROMs into full 64k chunks */
31493150   for (i = 0x10000; i < 0x90000; i += 0x20000)
r241740r241741
31643165   /* without the default EEPROM, 720 hangs at startup due to communication
31653166      issues with the sound CPU; temporarily increasing the sound CPU frequency
31663167      to ~2.2MHz "fixes" the problem */
3167   slapstic_init(machine(), 107);
3168   m_slapstic->slapstic_init(machine(), 107);
31683169
31693170   m_pedal_count = -1;
31703171   m_has_tms5220 = 1;
r241740r241741
31773178   int i;
31783179   UINT8 *cpu1 = memregion("maincpu")->base();
31793180
3180   slapstic_init(machine(), 108);
3181   m_slapstic->slapstic_init(machine(), 108);
31813182
31823183   /* expand the 32k program ROMs into full 64k chunks */
31833184   for (i = 0x10000; i < 0x90000; i += 0x20000)
r241740r241741
31933194   int i;
31943195   UINT8 *cpu1 = memregion("maincpu")->base();
31953196
3196   slapstic_init(machine(), 109);
3197   m_slapstic->slapstic_init(machine(), 109);
31973198
31983199   /* expand the 32k program ROMs into full 64k chunks */
31993200   for (i = 0x10000; i < 0x90000; i += 0x20000)
r241740r241741
32063207
32073208DRIVER_INIT_MEMBER(atarisy2_state,apb)
32083209{
3209   slapstic_init(machine(), 110);
3210   m_slapstic->slapstic_init(machine(), 110);
32103211
32113212   m_pedal_count = 2;
32123213   m_has_tms5220 = 1;
trunk/src/mame/drivers/atetris.c
r241740r241741
4949
5050#include "emu.h"
5151#include "cpu/m6502/m6502.h"
52#include "includes/slapstic.h"
5352#include "includes/atetris.h"
5453#include "sound/sn76496.h"
5554#include "sound/pokey.h"
r241740r241741
115114void atetris_state::machine_reset()
116115{
117116   /* reset the slapstic */
118   slapstic_reset();
119   m_current_bank = slapstic_bank() & 1;
117   m_slapstic_device->slapstic_reset();
118   m_current_bank = m_slapstic_device->slapstic_bank() & 1;
120119   reset_bank();
121120
122121   /* start interrupts going (32V clocked by 16V) */
r241740r241741
134133READ8_MEMBER(atetris_state::atetris_slapstic_r)
135134{
136135   int result = m_slapstic_base[0x2000 + offset];
137   int new_bank = slapstic_tweak(space, offset) & 1;
136   int new_bank = m_slapstic_device->slapstic_tweak(space, offset) & 1;
138137
139138   /* update for the new bank */
140139   if (new_bank != m_current_bank)
r241740r241741
308307   MCFG_CPU_ADD("maincpu", M6502,MASTER_CLOCK/8)
309308   MCFG_CPU_PROGRAM_MAP(main_map)
310309
310   MCFG_SLAPSTIC_ADD("slapstic")
311
311312   MCFG_NVRAM_ADD_1FILL("nvram")
312313
313314   /* video hardware */
r241740r241741
456457{
457458   UINT8 *rgn = memregion("maincpu")->base();
458459
459   slapstic_init(machine(), 101);
460   m_slapstic_device->slapstic_init(machine(), 101);
460461   m_slapstic_source = &rgn[0x10000];
461462   m_slapstic_base = &rgn[0x04000];
462463}
trunk/src/mame/drivers/cyberbal.c
r241740r241741
389389   MCFG_CPU_ADD("maincpu", M68000, ATARI_CLOCK_14MHz/2)
390390   MCFG_CPU_PROGRAM_MAP(main_map)
391391
392   MCFG_SLAPSTIC_ADD("slapstic")
393
392394   MCFG_CPU_ADD("audiocpu", M6502, ATARI_CLOCK_14MHz/8)
393395   MCFG_CPU_PROGRAM_MAP(sound_map)
394396   MCFG_DEVICE_PERIODIC_INT_DEVICE("soundcomm", atari_sound_comm_device, sound_irq_gen, (double)ATARI_CLOCK_14MHz/4/4/16/16/14)
trunk/src/mame/drivers/gauntlet.c
r241740r241741
499499   MCFG_CPU_PROGRAM_MAP(main_map)
500500   MCFG_DEVICE_VBLANK_INT_DRIVER("screen", atarigen_state, video_int_gen)
501501
502   MCFG_SLAPSTIC_ADD("slapstic")
503
502504   MCFG_CPU_ADD("audiocpu", M6502, ATARI_CLOCK_14MHz/8)
503505   MCFG_CPU_PROGRAM_MAP(sound_map)
504506
trunk/src/mame/drivers/harddriv.c
r241740r241741
209209Notes:
210210      68000 clock input - 8.000MHz [16/2]
211211
212
212     
213213DSK
214214A047724-01
215215|-----------------------------------------------|
r241740r241741
12321232   MCFG_DEVICE_VBLANK_INT_DRIVER("screen", atarigen_state, video_int_gen)
12331233   MCFG_CPU_PERIODIC_INT_DRIVER(harddriv_state, hd68k_irq_gen,  (double)HARDDRIV_MASTER_CLOCK/16/16/16/16/2)
12341234
1235   MCFG_SLAPSTIC_ADD("slapstic")
1236   MCFG_SLAPSTIC_68K_ACCESS(1)
1237
12351238   MCFG_CPU_ADD("gsp", TMS34010, HARDDRIV_GSP_CLOCK)
12361239   MCFG_CPU_PROGRAM_MAP(driver_gsp_map)
12371240   MCFG_TMS340X0_HALT_ON_RESET(TRUE) /* halt on reset */
r241740r241741
44034406   init_driver_sound();
44044407
44054408   /* set up the slapstic */
4406   slapstic_init(machine(), 117);
4409   m_slapstic_device->slapstic_init(machine(), 117);
44074410   m_m68k_slapstic_base = m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xe0000, 0xfffff, read16_delegate(FUNC(harddriv_state::rd68k_slapstic_r), this), write16_delegate(FUNC(harddriv_state::rd68k_slapstic_w), this));
44084411
44094412   /* synchronization */
r241740r241741
44244427   init_driver_sound();
44254428
44264429   /* set up the slapstic */
4427   slapstic_init(machine(), 117);
4430   m_slapstic_device->slapstic_init(machine(), 117);
44284431   m_m68k_slapstic_base = m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xe0000, 0xfffff, read16_delegate(FUNC(harddriv_state::rd68k_slapstic_r), this), write16_delegate(FUNC(harddriv_state::rd68k_slapstic_w), this));
44294432
44304433   /* synchronization */
r241740r241741
45234526   init_dsk();
45244527
45254528   /* set up the slapstic */
4526   slapstic_init(machine(), 117);
4529   m_slapstic_device->slapstic_init(machine(), 117);
45274530   m_m68k_slapstic_base = m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xe0000, 0xfffff, read16_delegate(FUNC(harddriv_state::rd68k_slapstic_r), this), write16_delegate(FUNC(harddriv_state::rd68k_slapstic_w), this));
45284531
45294532   m_maincpu->space(AS_PROGRAM).install_read_handler(0xa80000, 0xafffff, read16_delegate(FUNC(harddriv_state::hda68k_port1_r), this));
trunk/src/mame/drivers/rampart.c
r241740r241741
339339   MCFG_CPU_PROGRAM_MAP(main_map)
340340   MCFG_DEVICE_VBLANK_INT_DRIVER("screen", atarigen_state, video_int_gen)
341341
342   MCFG_SLAPSTIC_ADD("slapstic")
343
342344   MCFG_MACHINE_RESET_OVERRIDE(rampart_state,rampart)
343345
344346   MCFG_ATARI_EEPROM_2816_ADD("eeprom")
trunk/src/mame/drivers/starwars.c
r241740r241741
6262      address_space &space = m_maincpu->space(AS_PROGRAM);
6363
6464      /* reset the slapstic */
65      slapstic_reset();
66      m_slapstic_current_bank = slapstic_bank();
65      m_slapstic_device->slapstic_reset();
66      m_slapstic_current_bank = m_slapstic_device->slapstic_bank();
6767      memcpy(m_slapstic_base, &m_slapstic_source[m_slapstic_current_bank * 0x2000], 0x2000);
6868
6969      /* reset all the banks */
r241740r241741
9797
9898void starwars_state::esb_slapstic_tweak(address_space &space, offs_t offset)
9999{
100   int new_bank = slapstic_tweak(space, offset);
100   int new_bank = m_slapstic_device->slapstic_tweak(space, offset);
101101
102102   /* update for the new bank */
103103   if (new_bank != m_slapstic_current_bank)
r241740r241741
331331   MCFG_CPU_PERIODIC_INT_DRIVER(starwars_state, irq0_line_assert, CLOCK_3KHZ / 12)
332332   MCFG_WATCHDOG_TIME_INIT(attotime::from_hz(CLOCK_3KHZ / 128))
333333
334   MCFG_SLAPSTIC_ADD("slapstic")
335
334336   MCFG_CPU_ADD("audiocpu", M6809, MASTER_CLOCK / 8)
335337   MCFG_CPU_PROGRAM_MAP(sound_map)
336338
r241740r241741
524526   UINT8 *rom = memregion("maincpu")->base();
525527
526528   /* init the slapstic */
527   slapstic_init(machine(), 101);
529   m_slapstic_device->slapstic_init(machine(), 101);
528530   m_slapstic_source = &rom[0x14000];
529531   m_slapstic_base = &rom[0x08000];
530532
trunk/src/mame/drivers/vindictr.c
r241740r241741
184184   MCFG_CPU_ADD("maincpu", M68010, ATARI_CLOCK_14MHz/2)
185185   MCFG_CPU_PROGRAM_MAP(main_map)
186186
187   MCFG_SLAPSTIC_ADD("slapstic") // where is this hooked up here?
188
187189   MCFG_MACHINE_RESET_OVERRIDE(vindictr_state,vindictr)
188190
189191   MCFG_ATARI_EEPROM_2804_ADD("eeprom")
trunk/src/mame/drivers/xybots.c
r241740r241741
184184   MCFG_CPU_PROGRAM_MAP(main_map)
185185   MCFG_DEVICE_VBLANK_INT_DRIVER("screen", atarigen_state, video_int_gen)
186186
187   MCFG_SLAPSTIC_ADD("slapstic")
188
187189   MCFG_MACHINE_RESET_OVERRIDE(xybots_state,xybots)
188190
189191   MCFG_ATARI_EEPROM_2804_ADD("eeprom")
trunk/src/mame/includes/atarigx2.h
r241740r241741
88
99#include "machine/atarigen.h"
1010#include "audio/atarijsa.h"
11#include "includes/slapstic.h"
1112
13
1214class atarigx2_state : public atarigen_state
1315{
1416public:
r241740r241741
1921         m_protection_base(*this, "protection_base"),
2022         m_playfield_tilemap(*this, "playfield"),
2123         m_alpha_tilemap(*this, "alpha"),
22         m_rle(*this, "rle") { }
24         m_rle(*this, "rle")
25         { }
2326
2427   UINT16          m_playfield_base;
2528
trunk/src/mame/includes/atarisy2.h
r241740r241741
1010#include "video/atarimo.h"
1111#include "cpu/m6502/m6502.h"
1212#include "cpu/t11/t11.h"
13#include "slapstic.h"
1314
1415class atarisy2_state : public atarigen_state
1516{
r241740r241741
2526         m_alpha_tilemap(*this, "alpha"),
2627         m_rombank1(*this, "rombank1"),
2728         m_rombank2(*this, "rombank2"),
28         m_generic_paletteram_16(*this, "paletteram") { }
29         m_generic_paletteram_16(*this, "paletteram"),
30         m_slapstic(*this, "slapstic")
31         { }
2932
3033   required_device<t11_device> m_maincpu;
3134   required_device<m6502_device> m_audiocpu;
r241740r241741
5053   required_shared_ptr<UINT16> m_rombank1;
5154   required_shared_ptr<UINT16> m_rombank2;
5255   required_shared_ptr<UINT16> m_generic_paletteram_16;
56   required_device<atari_slapstic_device> m_slapstic;
5357
5458   UINT8           m_sound_reset_state;
5559
trunk/src/mame/includes/atetris.h
r241740r241741
44
55*************************************************************************/
66
7#include "includes/slapstic.h"
8
79class atetris_state : public driver_device
810{
911public:
r241740r241741
1315      m_videoram(*this, "videoram"),
1416      m_maincpu(*this, "maincpu"),
1517      m_gfxdecode(*this, "gfxdecode"),
16      m_screen(*this, "screen") { }
18      m_screen(*this, "screen"),
19      m_slapstic_device(*this, "slapstic")
20      { }
1721
1822   required_shared_ptr<UINT8>  m_nvram;
1923   required_shared_ptr<UINT8> m_videoram;
r241740r241741
4044   required_device<cpu_device> m_maincpu;
4145   required_device<gfxdecode_device> m_gfxdecode;
4246   required_device<screen_device> m_screen;
47   optional_device<atari_slapstic_device> m_slapstic_device;
4348};
trunk/src/mame/includes/harddriv.h
r241740r241741
5959         m_ds3xdsp_internal_timer(*this, "ds3xdsp_timer"),
6060         m_dac(*this, "dac"),
6161         m_duart(*this, "duartn68681"),
62         m_asic65(*this, "asic65") {}
62         m_asic65(*this, "asic65"),
63         m_slapstic_device(*this, "slapstic")
64         {}
6365
6466   required_device<cpu_device> m_maincpu;
6567   required_device<tms34010_device> m_gsp;
r241740r241741
469471
470472   TMS340X0_SCANLINE_IND16_CB_MEMBER(scanline_driver);
471473   TMS340X0_SCANLINE_IND16_CB_MEMBER(scanline_multisync);
474
475   optional_device<atari_slapstic_device> m_slapstic_device;
472476};
trunk/src/mame/includes/slapstic.h
r241740r241741
99
1010*************************************************************************/
1111
12/*----------- defined in machine/slapstic.c -----------*/
12#pragma once
1313
14void slapstic_init(running_machine &machine, int chip);
15void slapstic_reset(void);
14#ifndef __SLAPSTIC__
15#define __SLAPSTIC__
1616
17int slapstic_bank(void);
18int slapstic_tweak(address_space &space, offs_t offset);
17#include "emu.h"
18#include "cpu/m6800/m6800.h"
19#include "cpu/m68000/m68000.h"
20
21
22extern const device_type SLAPSTIC;
23
24#define MCFG_SLAPSTIC_ADD(_tag) \
25   MCFG_DEVICE_ADD(_tag, SLAPSTIC, 0)
26
27
28/*************************************
29 *
30 *  Debugging
31 *
32 *************************************/
33
34#define LOG_SLAPSTIC    (0)
35
36
37
38/*************************************
39 *
40 *  Structure of slapstic params
41 *
42 *************************************/
43
44struct mask_value
45{
46   int mask, value;
47};
48
49
50struct slapstic_data
51{
52   int bankstart;
53   int bank[4];
54
55   struct mask_value alt1;
56   struct mask_value alt2;
57   struct mask_value alt3;
58   struct mask_value alt4;
59   int altshift;
60
61   struct mask_value bit1;
62   struct mask_value bit2c0;
63   struct mask_value bit2s0;
64   struct mask_value bit2c1;
65   struct mask_value bit2s1;
66   struct mask_value bit3;
67
68   struct mask_value add1;
69   struct mask_value add2;
70   struct mask_value addplus1;
71   struct mask_value addplus2;
72   struct mask_value add3;
73};
74
75
76
77/*************************************
78 *
79 *  Shorthand
80 *
81 *************************************/
82
83#define UNKNOWN 0xffff
84#define NO_BITWISE          \
85   { UNKNOWN,UNKNOWN },    \
86   { UNKNOWN,UNKNOWN },    \
87   { UNKNOWN,UNKNOWN },    \
88   { UNKNOWN,UNKNOWN },    \
89   { UNKNOWN,UNKNOWN },    \
90   { UNKNOWN,UNKNOWN }
91#define NO_ADDITIVE         \
92   { UNKNOWN,UNKNOWN },    \
93   { UNKNOWN,UNKNOWN },    \
94   { UNKNOWN,UNKNOWN },    \
95   { UNKNOWN,UNKNOWN },    \
96   { UNKNOWN,UNKNOWN }
97
98#define MATCHES_MASK_VALUE(val, maskval)    (((val) & (maskval).mask) == (maskval).value)
99
100
101
102/*************************************
103 *
104 *  Constants
105 *
106 *************************************/
107
108enum
109{
110   DISABLED,
111   ENABLED,
112   ALTERNATE1,
113   ALTERNATE2,
114   ALTERNATE3,
115   BITWISE1,
116   BITWISE2,
117   BITWISE3,
118   ADDITIVE1,
119   ADDITIVE2,
120   ADDITIVE3
121};
122
123
124#define MCFG_SLAPSTIC_68K_ACCESS(_type) \
125   atari_slapstic_device::static_set_access68k(*device, _type);
126
127
128
129class atari_slapstic_device :  public device_t
130{
131public:
132   // construction/destruction
133   atari_slapstic_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
134
135   void slapstic_init(running_machine &machine, int chip);
136   void slapstic_reset(void);
137
138   int slapstic_bank(void);
139   int slapstic_tweak(address_space &space, offs_t offset);
140
141   int alt2_kludge(address_space &space, offs_t offset);
142
143   static void static_set_access68k(device_t &device, int type)
144   {
145      atari_slapstic_device &dev = downcast<atari_slapstic_device &>(device);
146      dev.access_68k = type;
147   }
148
149
150   UINT8 state;
151   UINT8 current_bank;
152   int access_68k;
153
154   UINT8 alt_bank;
155   UINT8 bit_bank;
156   UINT8 add_bank;
157   UINT8 bit_xor;
158
159   struct slapstic_data slapstic;
160
161
162   void slapstic_log(running_machine &machine, offs_t offset);
163   FILE *slapsticlog;
164
165
166protected:
167   virtual void device_start();
168   virtual void device_reset();
169
170
171private:
172
173
174
175
176};
177
178
179
180
181#endif
trunk/src/mame/includes/starwars.h
r241740r241741
55***************************************************************************/
66
77#include "machine/6532riot.h"
8#include "includes/slapstic.h"
89
910
1011class starwars_state : public driver_device
r241740r241741
1516      m_riot(*this, "riot"),
1617      m_mathram(*this, "mathram"),
1718      m_maincpu(*this, "maincpu"),
18      m_audiocpu(*this, "audiocpu")  { }
19      m_audiocpu(*this, "audiocpu"),
20      m_slapstic_device(*this, "slapstic")
21      { }
1922
2023   UINT8 m_sound_data;
2124   UINT8 m_main_data;
r241740r241741
7881   void esb_slapstic_tweak(address_space &space, offs_t offset);
7982   required_device<cpu_device> m_maincpu;
8083   required_device<cpu_device> m_audiocpu;
84   optional_device<atari_slapstic_device> m_slapstic_device;
8185};
trunk/src/mame/machine/atarigen.c
r241740r241741
1616#include "sound/okim6295.h"
1717#include "sound/pokey.h"
1818#include "video/atarimo.h"
19#include "includes/slapstic.h"
2019#include "atarigen.h"
2120
2221
r241740r241741
975974      m_gfxdecode(*this, "gfxdecode"),
976975      m_screen(*this, "screen"),
977976      m_palette(*this, "palette"),
978      m_generic_paletteram_16(*this, "paletteram")
977      m_generic_paletteram_16(*this, "paletteram"),
978      m_slapstic_device(*this, ":slapstic")
979979{
980980}
981981
r241740r241741
10221022   // reset the slapstic
10231023   if (m_slapstic_num != 0)
10241024   {
1025      slapstic_reset();
1026      slapstic_update_bank(slapstic_bank());
1025      if (!m_slapstic_device)
1026         fatalerror("Slapstic device is missing?\n");
1027
1028      m_slapstic_device->slapstic_reset();
1029      slapstic_update_bank(m_slapstic_device->slapstic_bank());
10271030   }
10281031}
10291032
r241740r241741
11921195
11931196void atarigen_state::device_post_load()
11941197{
1195   slapstic_update_bank(slapstic_bank());
1198   if (!m_slapstic_device)
1199      fatalerror("Slapstic device is missing?\n");
1200
1201   slapstic_update_bank(m_slapstic_device->slapstic_bank());
11961202}
11971203
11981204
r241740r241741
12321238   // if we have a chip, install it
12331239   if (chipnum != 0)
12341240   {
1241      if (!m_slapstic_device)
1242         fatalerror("Slapstic device is missing\n");
1243
12351244      // initialize the slapstic
1236      slapstic_init(machine(), chipnum);
1245      m_slapstic_device->slapstic_init(machine(), chipnum);
12371246
12381247      // install the memory handlers
12391248      address_space &program = device.space(AS_PROGRAM);
r241740r241741
12621271
12631272WRITE16_MEMBER(atarigen_state::slapstic_w)
12641273{
1265   slapstic_update_bank(slapstic_tweak(space, offset));
1274   if (!m_slapstic_device)
1275      fatalerror("Slapstic device is missing?\n");
1276
1277   slapstic_update_bank(m_slapstic_device->slapstic_tweak(space, offset));
12661278}
12671279
12681280
r241740r241741
12731285
12741286READ16_MEMBER(atarigen_state::slapstic_r)
12751287{
1288   if (!m_slapstic_device)
1289      fatalerror("Slapstic device is missing?\n");
1290
12761291   // fetch the result from the current bank first
12771292   int result = m_slapstic[offset & 0xfff];
12781293
12791294   // then determine the new one
1280   slapstic_update_bank(slapstic_tweak(space, offset));
1295   slapstic_update_bank(m_slapstic_device->slapstic_tweak(space, offset));
12811296   return result;
12821297}
12831298
trunk/src/mame/machine/atarigen.h
r241740r241741
1717#include "video/atarimo.h"
1818#include "cpu/m6502/m6502.h"
1919#include "sound/okim6295.h"
20#include "includes/slapstic.h"
2021
2122
2223/***************************************************************************
r241740r241741
431432   optional_device<screen_device> m_screen;
432433   optional_device<palette_device> m_palette;
433434   optional_shared_ptr<UINT16> m_generic_paletteram_16;
435   optional_device<atari_slapstic_device> m_slapstic_device;
434436};
435437
436438
trunk/src/mame/machine/harddriv.c
r241740r241741
5151{
5252   /* generic reset */
5353   atarigen_state::machine_reset();
54   slapstic_reset();
54   m_slapstic_device->slapstic_reset();
5555
5656   /* halt several of the DSPs to start */
5757   if (m_adsp != NULL) m_adsp->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
r241740r241741
16711671
16721672WRITE16_MEMBER( harddriv_state::rd68k_slapstic_w )
16731673{
1674   slapstic_tweak(space, offset & 0x3fff);
1674   m_slapstic_device->slapstic_tweak(space, offset & 0x3fff);
16751675}
16761676
16771677
16781678READ16_MEMBER( harddriv_state::rd68k_slapstic_r )
16791679{
1680   int bank = slapstic_tweak(space, offset & 0x3fff) * 0x4000;
1680   int bank = m_slapstic_device->slapstic_tweak(space, offset & 0x3fff) * 0x4000;
16811681   return m_m68k_slapstic_base[bank + (offset & 0x3fff)];
16821682}
16831683
trunk/src/mame/machine/slapstic.c
r241740r241741
180180
181181*************************************************************************/
182182
183#include "emu.h"
184#include "cpu/m6800/m6800.h"
183
185184#include "includes/slapstic.h"
186#include "cpu/m68000/m68000.h"
187185
188186
189/*************************************
190 *
191 *  Debugging
192 *
193 *************************************/
187extern const device_type SLAPSTIC = &device_creator<atari_slapstic_device>;
194188
195#define LOG_SLAPSTIC    (0)
189atari_slapstic_device::atari_slapstic_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
190   : device_t(mconfig, SLAPSTIC, "Atari Slapstic", tag, owner, clock, "slapstic", __FILE__),
191   state(0),
192   current_bank(0),
193   access_68k(-1),
194   alt_bank(0),
195   bit_bank(0),
196   add_bank(0),
197   bit_xor(0)
198{
199   slapstic.bankstart = 0;
200   slapstic.bank[0] = slapstic.bank[1] = slapstic.bank[2] = slapstic.bank[3] = 0;
201   slapstic.alt1.mask = 0;
202   slapstic.alt1.value = 0;
203   slapstic.alt2.mask = 0;
204   slapstic.alt2.value = 0;
205   slapstic.alt3.mask = 0;
206   slapstic.alt3.value = 0;
207   slapstic.alt4.mask = 0;
208   slapstic.alt4.value = 0;
209   slapstic.altshift = 0;
210   slapstic.bit1.mask = 0;
211   slapstic.bit1.value = 0;
212   slapstic.bit2c0.mask = 0;
213   slapstic.bit2c0.value = 0;
214   slapstic.bit2s0.mask = 0;
215   slapstic.bit2s0.value = 0;
216   slapstic.bit2c1.mask = 0;
217   slapstic.bit2c1.value = 0;
218   slapstic.bit2s1.mask = 0;
219   slapstic.bit2s1.value = 0;
220   slapstic.bit3.mask = 0;
221   slapstic.bit3.value = 0;
222   slapstic.add1.mask = 0;
223   slapstic.add1.value = 0;
224   slapstic.add2.mask = 0;
225   slapstic.add2.value = 0;
226   slapstic.addplus1.mask = 0;
227   slapstic.addplus1.value = 0;
228   slapstic.addplus2.mask = 0;
229   slapstic.addplus2.value = 0;
230   slapstic.add3.mask = 0;
231   slapstic.add3.value = 0;
232}
196233
197234
198235
199/*************************************
200 *
201 *  Structure of slapstic params
202 *
203 *************************************/
204
205struct mask_value
236void atari_slapstic_device::device_start()
206237{
207   int mask, value;
208};
209238
239}
210240
211struct slapstic_data
241void atari_slapstic_device::device_reset()
212242{
213   int bankstart;
214   int bank[4];
215243
216   struct mask_value alt1;
217   struct mask_value alt2;
218   struct mask_value alt3;
219   struct mask_value alt4;
220   int altshift;
244}
221245
222   struct mask_value bit1;
223   struct mask_value bit2c0;
224   struct mask_value bit2s0;
225   struct mask_value bit2c1;
226   struct mask_value bit2s1;
227   struct mask_value bit3;
228
229   struct mask_value add1;
230   struct mask_value add2;
231   struct mask_value addplus1;
232   struct mask_value addplus2;
233   struct mask_value add3;
234};
235
236
237
238246/*************************************
239247 *
240 *  Shorthand
241 *
242 *************************************/
243
244#define UNKNOWN 0xffff
245#define NO_BITWISE          \
246   { UNKNOWN,UNKNOWN },    \
247   { UNKNOWN,UNKNOWN },    \
248   { UNKNOWN,UNKNOWN },    \
249   { UNKNOWN,UNKNOWN },    \
250   { UNKNOWN,UNKNOWN },    \
251   { UNKNOWN,UNKNOWN }
252#define NO_ADDITIVE         \
253   { UNKNOWN,UNKNOWN },    \
254   { UNKNOWN,UNKNOWN },    \
255   { UNKNOWN,UNKNOWN },    \
256   { UNKNOWN,UNKNOWN },    \
257   { UNKNOWN,UNKNOWN }
258
259#define MATCHES_MASK_VALUE(val, maskval)    (((val) & (maskval).mask) == (maskval).value)
260
261
262
263/*************************************
264 *
265 *  Constants
266 *
267 *************************************/
268
269enum
270{
271   DISABLED,
272   ENABLED,
273   ALTERNATE1,
274   ALTERNATE2,
275   ALTERNATE3,
276   BITWISE1,
277   BITWISE2,
278   BITWISE3,
279   ADDITIVE1,
280   ADDITIVE2,
281   ADDITIVE3
282};
283
284
285
286/*************************************
287 *
288248 *  Slapstic definitions
289249 *
290250 *************************************/
r241740r241741
779739
780740
781741
782/*************************************
783 *
784 *  Statics
785 *
786 *************************************/
787742
788static UINT8 state;
789static UINT8 current_bank;
790static UINT8 access_68k;
791
792static UINT8 alt_bank;
793static UINT8 bit_bank;
794static UINT8 add_bank;
795static UINT8 bit_xor;
796
797static struct slapstic_data slapstic;
798
799
800static void slapstic_log(running_machine &machine, offs_t offset);
801static FILE *slapsticlog;
802
803
804743/*************************************
805744 *
806745 *  Initialization
807746 *
808747 *************************************/
809748
810void slapstic_init(running_machine &machine, int chip)
749void atari_slapstic_device::slapstic_init(running_machine &machine, int chip)
811750{
812   device_type cputype = machine.device("maincpu")->type();
751   if (access_68k == -1)
752   {
753      device_type cputype = machine.device(":maincpu")->type();
754      access_68k = (cputype == M68000 || cputype == M68010);
755   }
813756
814757   /* only a small number of chips are known to exist */
815758   if (chip < 101 || chip > 118)
r241740r241741
824767   slapstic_reset();
825768
826769   /* see if we're 68k or 6502/6809 based */
827   access_68k = (cputype == M68000 || cputype == M68010);
828770
829771   /* save state */
830772   state_save_register_item(machine, "slapstic", NULL, 0, state);
r241740r241741
836778}
837779
838780
839void slapstic_reset(void)
781void atari_slapstic_device::slapstic_reset(void)
840782{
841783   /* reset the chip */
842784   state = DISABLED;
r241740r241741
853795 *
854796 *************************************/
855797
856int slapstic_bank(void)
798int atari_slapstic_device::slapstic_bank(void)
857799{
858800   return current_bank;
859801}
r241740r241741
866808 *
867809 *************************************/
868810
869static int alt2_kludge(address_space &space, offs_t offset)
811int atari_slapstic_device::alt2_kludge(address_space &space, offs_t offset)
870812{
871813   /* Of the 3 alternate addresses, only the middle one needs to actually hit
872814      in the slapstic region; the first and third ones can be anywhere in the
r241740r241741
913855 *
914856 *************************************/
915857
916int slapstic_tweak(address_space &space, offs_t offset)
858int atari_slapstic_device::slapstic_tweak(address_space &space, offs_t offset)
917859{
918860   /* reset is universal */
919861   if (offset == 0x0000)
r241740r241741
11371079 *
11381080 *************************************/
11391081
1140static void slapstic_log(running_machine &machine, offs_t offset)
1082void atari_slapstic_device::slapstic_log(running_machine &machine, offs_t offset)
11411083{
11421084   static attotime last_time;
11431085
trunk/src/mame/video/atarisy2.c
r241740r241741
208208READ16_MEMBER( atarisy2_state::slapstic_r )
209209{
210210   int result = m_slapstic_base[offset];
211   slapstic_tweak(space, offset);
211   m_slapstic->slapstic_tweak(space, offset);
212212
213213   /* an extra tweak for the next opcode fetch */
214   m_videobank = slapstic_tweak(space, 0x1234) * 0x1000;
214   m_videobank = m_slapstic->slapstic_tweak(space, 0x1234) * 0x1000;
215215   return result;
216216}
217217
218218
219219WRITE16_MEMBER( atarisy2_state::slapstic_w )
220220{
221   slapstic_tweak(space, offset);
221   m_slapstic->slapstic_tweak(space, offset);
222222
223223   /* an extra tweak for the next opcode fetch */
224   m_videobank = slapstic_tweak(space, 0x1234) * 0x1000;
224   m_videobank = m_slapstic->slapstic_tweak(space, 0x1234) * 0x1000;
225225}
226226
227227


Previous 199869 Revisions Next


© 1997-2024 The MAME Team