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

« back to all changes in this revision

Viewing changes to src/mame/drivers/shougi.c

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach, Emmanuel Kasper, Jordi Mallach
  • Date: 2012-06-05 20:02:23 UTC
  • mfrom: (0.3.1) (0.1.4)
  • Revision ID: package-import@ubuntu.com-20120605200223-gnlpogjrg6oqe9md
Tags: 0.146-1
[ Emmanuel Kasper ]
* New upstream release
* Drop patch to fix man pages section and patches to link with flac 
  and jpeg system lib: all this has been pushed upstream by Cesare Falco
* Add DM-Upload-Allowed: yes field.

[ Jordi Mallach ]
* Create a "gnu" TARGETOS stanza that defines NO_AFFINITY_NP.
* Stop setting TARGETOS to "unix" in d/rules. It should be autodetected,
  and set to the appropriate value.
* mame_manpage_section.patch: Change mame's manpage section to 6 (games),
  in the TH declaration.

Show diffs side-by-side

added added

removed removed

Lines of Context:
91
91
{
92
92
public:
93
93
        shougi_state(const machine_config &mconfig, device_type type, const char *tag)
94
 
                : driver_device(mconfig, type, tag) { }
 
94
                : driver_device(mconfig, type, tag) ,
 
95
                m_videoram(*this, "videoram"){ }
95
96
 
96
 
        UINT8 *m_videoram;
 
97
        required_shared_ptr<UINT8> m_videoram;
97
98
        int m_nmi_enabled;
98
99
        //UINT8 *m_cpu_sharedram;
99
100
        //UINT8 m_cpu_sharedram_control_val;
100
101
        int m_r;
 
102
        DECLARE_WRITE8_MEMBER(cpu_sharedram_sub_w);
 
103
        DECLARE_WRITE8_MEMBER(cpu_sharedram_main_w);
 
104
        DECLARE_READ8_MEMBER(cpu_sharedram_r);
 
105
        DECLARE_WRITE8_MEMBER(cpu_shared_ctrl_sub_w);
 
106
        DECLARE_WRITE8_MEMBER(cpu_shared_ctrl_main_w);
 
107
        DECLARE_WRITE8_MEMBER(shougi_watchdog_reset_w);
 
108
        DECLARE_WRITE8_MEMBER(shougi_mcu_halt_off_w);
 
109
        DECLARE_WRITE8_MEMBER(shougi_mcu_halt_on_w);
 
110
        DECLARE_WRITE8_MEMBER(nmi_disable_and_clear_line_w);
 
111
        DECLARE_WRITE8_MEMBER(nmi_enable_w);
 
112
        DECLARE_READ8_MEMBER(dummy_r);
101
113
};
102
114
 
103
115
 
121
133
 
122
134
static PALETTE_INIT( shougi )
123
135
{
 
136
        const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
124
137
        int i;
125
138
        static const int resistances_b[2]  = { 470, 220 };
126
139
        static const int resistances_rg[3] = { 1000, 470, 220 };
194
207
//to do:
195
208
// add separate sharedram/r/w() for both CPUs and use control value to verify access
196
209
 
197
 
static WRITE8_HANDLER ( cpu_sharedram_sub_w )
 
210
WRITE8_MEMBER(shougi_state::cpu_sharedram_sub_w)
198
211
{
199
212
        if (cpu_sharedram_control_val!=0) logerror("sub CPU access to shared RAM when access set for main cpu\n");
200
213
        cpu_sharedram[offset] = data;
201
214
}
202
215
 
203
 
static WRITE8_HANDLER ( cpu_sharedram_main_w )
 
216
WRITE8_MEMBER(shougi_state::cpu_sharedram_main_w)
204
217
{
205
218
        if (cpu_sharedram_control_val!=1) logerror("main CPU access to shared RAM when access set for sub cpu\n");
206
219
        cpu_sharedram[offset] = data;
207
220
}
208
221
 
209
 
static READ8_HANDLER ( cpu_sharedram_r )
 
222
READ8_MEMBER(shougi_state::cpu_sharedram_r)
210
223
{
211
224
        return cpu_sharedram[offset];
212
225
}
213
226
 
214
227
#endif
215
228
 
216
 
static WRITE8_HANDLER ( cpu_shared_ctrl_sub_w )
 
229
WRITE8_MEMBER(shougi_state::cpu_shared_ctrl_sub_w)
217
230
{
218
231
        //cpu_sharedram_control_val = 0;
219
232
        //logerror("cpu_sharedram_ctrl=SUB");
220
233
}
221
234
 
222
 
static WRITE8_HANDLER ( cpu_shared_ctrl_main_w )
 
235
WRITE8_MEMBER(shougi_state::cpu_shared_ctrl_main_w)
223
236
{
224
237
        //cpu_sharedram_control_val = 1;
225
238
        //logerror("cpu_sharedram_ctrl=MAIN");
226
239
}
227
240
 
228
 
static WRITE8_HANDLER( shougi_watchdog_reset_w )
 
241
WRITE8_MEMBER(shougi_state::shougi_watchdog_reset_w)
229
242
{
230
243
        watchdog_reset_w(space,0,data);
231
244
}
232
245
 
233
 
static WRITE8_HANDLER( shougi_mcu_halt_off_w )
 
246
WRITE8_MEMBER(shougi_state::shougi_mcu_halt_off_w)
234
247
{
235
248
        /* logerror("mcu HALT OFF"); */
236
 
        cputag_set_input_line(space->machine(), "mcu", INPUT_LINE_HALT, CLEAR_LINE);
 
249
        cputag_set_input_line(machine(), "mcu", INPUT_LINE_HALT, CLEAR_LINE);
237
250
}
238
251
 
239
 
static WRITE8_HANDLER( shougi_mcu_halt_on_w )
 
252
WRITE8_MEMBER(shougi_state::shougi_mcu_halt_on_w)
240
253
{
241
254
        /* logerror("mcu HALT ON"); */
242
 
        cputag_set_input_line(space->machine(), "mcu", INPUT_LINE_HALT,ASSERT_LINE);
 
255
        cputag_set_input_line(machine(), "mcu", INPUT_LINE_HALT,ASSERT_LINE);
243
256
}
244
257
 
245
258
 
246
 
static WRITE8_HANDLER( nmi_disable_and_clear_line_w )
 
259
WRITE8_MEMBER(shougi_state::nmi_disable_and_clear_line_w)
247
260
{
248
 
        shougi_state *state = space->machine().driver_data<shougi_state>();
249
261
 
250
 
        state->m_nmi_enabled = 0; /* disable NMIs */
 
262
        m_nmi_enabled = 0; /* disable NMIs */
251
263
 
252
264
        /* NMI lines are tied together on both CPUs and connected to the LS74 /Q output */
253
 
        cputag_set_input_line(space->machine(), "maincpu", INPUT_LINE_NMI, CLEAR_LINE);
254
 
        cputag_set_input_line(space->machine(), "sub", INPUT_LINE_NMI, CLEAR_LINE);
 
265
        cputag_set_input_line(machine(), "maincpu", INPUT_LINE_NMI, CLEAR_LINE);
 
266
        cputag_set_input_line(machine(), "sub", INPUT_LINE_NMI, CLEAR_LINE);
255
267
}
256
268
 
257
 
static WRITE8_HANDLER( nmi_enable_w )
 
269
WRITE8_MEMBER(shougi_state::nmi_enable_w)
258
270
{
259
 
        shougi_state *state = space->machine().driver_data<shougi_state>();
260
271
 
261
 
        state->m_nmi_enabled = 1; /* enable NMIs */
 
272
        m_nmi_enabled = 1; /* enable NMIs */
262
273
}
263
274
 
264
275
static INTERRUPT_GEN( shougi_vblank_nmi )
274
285
}
275
286
 
276
287
 
277
 
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8 )
 
288
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, shougi_state )
278
289
        AM_RANGE(0x0000, 0x3fff) AM_ROM
279
290
        AM_RANGE(0x4000, 0x43ff) AM_RAM         /* 2114 x 2 (0x400 x 4bit each) */
280
291
 
294
305
 
295
306
        AM_RANGE(0x5000, 0x5000) AM_READ_PORT("P1")
296
307
        AM_RANGE(0x5800, 0x5800) AM_READ_PORT("P2") AM_WRITE(shougi_watchdog_reset_w)   /* game won't boot if watchdog doesn't work */
297
 
        AM_RANGE(0x6000, 0x6000) AM_DEVWRITE("aysnd", ay8910_address_w)
298
 
        AM_RANGE(0x6800, 0x6800) AM_DEVWRITE("aysnd", ay8910_data_w)
 
308
        AM_RANGE(0x6000, 0x6000) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_w)
 
309
        AM_RANGE(0x6800, 0x6800) AM_DEVWRITE_LEGACY("aysnd", ay8910_data_w)
299
310
        AM_RANGE(0x7000, 0x73ff) AM_RAM AM_SHARE("share1") /* 2114 x 2 (0x400 x 4bit each) */
300
311
        AM_RANGE(0x7800, 0x7bff) AM_RAM AM_SHARE("share2") /* 2114 x 2 (0x400 x 4bit each) */
301
312
 
302
 
        AM_RANGE(0x8000, 0xffff) AM_RAM AM_BASE_MEMBER(shougi_state,m_videoram) /* 4116 x 16 (32K) */
 
313
        AM_RANGE(0x8000, 0xffff) AM_RAM AM_SHARE("videoram")    /* 4116 x 16 (32K) */
303
314
ADDRESS_MAP_END
304
315
 
305
316
/* sub */
306
 
static READ8_HANDLER ( dummy_r )
 
317
READ8_MEMBER(shougi_state::dummy_r)
307
318
{
308
 
        shougi_state *state = space->machine().driver_data<shougi_state>();
309
 
        state->m_r ^= 1;
 
319
        m_r ^= 1;
310
320
 
311
 
        if(state->m_r)
 
321
        if(m_r)
312
322
                return 0xff;
313
323
        else
314
324
                return 0;
315
325
}
316
326
 
317
 
static ADDRESS_MAP_START( readport_sub, AS_IO, 8 )
 
327
static ADDRESS_MAP_START( readport_sub, AS_IO, 8, shougi_state )
318
328
        ADDRESS_MAP_GLOBAL_MASK( 0x00ff )
319
329
        AM_RANGE(0x00, 0x00) AM_READ(dummy_r)
320
330
ADDRESS_MAP_END
321
331
 
322
 
static ADDRESS_MAP_START( sub_map, AS_PROGRAM, 8 )
 
332
static ADDRESS_MAP_START( sub_map, AS_PROGRAM, 8, shougi_state )
323
333
        AM_RANGE(0x0000, 0x5fff) AM_ROM
324
334
        AM_RANGE(0x6000, 0x63ff) AM_RAM AM_SHARE("share2") /* 2114 x 2 (0x400 x 4bit each) */
325
335
ADDRESS_MAP_END
326
336
 
327
 
static ADDRESS_MAP_START( mcu_map, AS_PROGRAM, 8 )
 
337
static ADDRESS_MAP_START( mcu_map, AS_PROGRAM, 8, shougi_state )
328
338
        AM_RANGE(0x0000, 0x03ff) AM_RAM AM_SHARE("share1")
329
339
ADDRESS_MAP_END
330
340