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

« back to all changes in this revision

Viewing changes to src/mame/drivers/multfish.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:
197
197
        UINT8 m_hopper;
198
198
 
199
199
        UINT8 m_vid[multfish_VIDRAM_SIZE];
 
200
        DECLARE_WRITE8_MEMBER(multfish_vid_w);
 
201
        DECLARE_WRITE8_MEMBER(multfish_bank_w);
 
202
        DECLARE_READ8_MEMBER(bankedram_r);
 
203
        DECLARE_WRITE8_MEMBER(bankedram_w);
 
204
        DECLARE_WRITE8_MEMBER(multfish_rambank_w);
 
205
        DECLARE_READ8_MEMBER(ray_r);
 
206
        DECLARE_WRITE8_MEMBER(multfish_hopper_w);
 
207
        DECLARE_WRITE8_MEMBER(rollfr_hopper_w);
 
208
        DECLARE_WRITE8_MEMBER(multfish_lamps1_w);
 
209
        DECLARE_WRITE8_MEMBER(multfish_lamps2_w);
 
210
        DECLARE_WRITE8_MEMBER(multfish_lamps3_w);
 
211
        DECLARE_WRITE8_MEMBER(multfish_counters_w);
 
212
        DECLARE_WRITE8_MEMBER(multfish_f3_w);
 
213
        DECLARE_WRITE8_MEMBER(multfish_dispenable_w);
 
214
        DECLARE_CUSTOM_INPUT_MEMBER(multfish_hopper_r);
200
215
};
201
216
 
202
217
static TILE_GET_INFO( get_multfish_tile_info )
267
282
        return 0;
268
283
}
269
284
 
270
 
static WRITE8_HANDLER( multfish_vid_w )
 
285
WRITE8_MEMBER(multfish_state::multfish_vid_w)
271
286
{
272
 
        multfish_state *state = space->machine().driver_data<multfish_state>();
273
287
 
274
 
        state->m_vid[offset]=data;
 
288
        m_vid[offset]=data;
275
289
 
276
290
        // 0x0000 - 0x1fff is normal tilemap
277
291
        if (offset < 0x2000)
278
292
        {
279
 
                state->m_tilemap->mark_tile_dirty((offset&0xfff)/2);
 
293
                m_tilemap->mark_tile_dirty((offset&0xfff)/2);
280
294
 
281
295
        }
282
296
        // 0x2000 - 0x2fff is for the reels
283
297
        else if (offset < 0x4000)
284
298
        {
285
 
                state->m_reel_tilemap->mark_tile_dirty((offset&0x1fff)/2);
 
299
                m_reel_tilemap->mark_tile_dirty((offset&0x1fff)/2);
286
300
        }
287
301
        else if (offset < 0x6000)
288
302
        {
289
303
                int r,g,b;
290
304
                int coldat;
291
305
 
292
 
                coldat = state->m_vid[(offset&0xfffe)] | (state->m_vid[(offset&0xfffe)^1] << 8);
 
306
                coldat = m_vid[(offset&0xfffe)] | (m_vid[(offset&0xfffe)^1] << 8);
293
307
 
294
308
                /* xor and bitswap palette */
295
 
                switch (state->m_xor_paltype) {
 
309
                switch (m_xor_paltype) {
296
310
                        case 1:
297
 
                                coldat ^= state->m_xor_palette;
 
311
                                coldat ^= m_xor_palette;
298
312
                                coldat ^= ((coldat&0x2) >>1) | ((coldat&0x80) >>3) ;
299
313
                                coldat = BITSWAP16(coldat,10,15,5,13,8,12,11,2,0,4,7,14,9,3,1,6);
300
314
                                break;
301
315
                        case 2:
302
 
                                coldat ^= state->m_xor_palette;
 
316
                                coldat ^= m_xor_palette;
303
317
                                coldat ^= ((coldat&0x0001) <<1) ^ ((coldat&0x0010) <<1) ^ ((coldat&0x0010) <<2) ^ ((coldat&0x0020) <<1) ^ ((coldat&0x0080) >>1);
304
318
                                coldat = BITSWAP16(coldat,4,10,13,14,8,11,15,12,2,6,5,0,7,3,1,9);
305
319
                                break;
309
323
                b = ( (coldat &0x00e0)>> (5));
310
324
                b|= ( (coldat &0xe000)>> (8+5-3));
311
325
 
312
 
                palette_set_color_rgb(space->machine(), (offset-0x4000)/2, r<<3, g<<3, b<<2);
 
326
                palette_set_color_rgb(machine(), (offset-0x4000)/2, r<<3, g<<3, b<<2);
313
327
        }
314
328
        else
315
329
        {
317
331
        }
318
332
}
319
333
 
320
 
static WRITE8_HANDLER( multfish_bank_w )
 
334
WRITE8_MEMBER(multfish_state::multfish_bank_w)
321
335
{
322
 
        memory_set_bank(space->machine(), "bank1", data & 0x0f);
 
336
        membank("bank1")->set_entry(data & 0x0f);
323
337
}
324
338
 
325
339
static READ8_DEVICE_HANDLER( multfish_timekeeper_r )
332
346
        timekeeper_w(device, offset + 0x6000, data);
333
347
}
334
348
 
335
 
static READ8_HANDLER( bankedram_r )
336
 
{
337
 
        multfish_state *state = space->machine().driver_data<multfish_state>();
338
 
 
339
 
        if ((state->m_rambk & 0x80) == 0x00)
340
 
        {
341
 
                return timekeeper_r(space->machine().device("m48t35"), offset + 0x2000*(state->m_rambk & 0x03));
342
 
        }
343
 
        else
344
 
        {
345
 
                return state->m_vid[offset+0x2000*(state->m_rambk & 0x03)];
346
 
        }
347
 
 
348
 
}
349
 
 
350
 
static WRITE8_HANDLER( bankedram_w )
351
 
{
352
 
        multfish_state *state = space->machine().driver_data<multfish_state>();
353
 
 
354
 
        if ((state->m_rambk & 0x80) == 0x00)
355
 
        {
356
 
                timekeeper_w(space->machine().device("m48t35"), offset + 0x2000*(state->m_rambk & 0x03), data);
357
 
        }
358
 
        else
359
 
        {
360
 
                multfish_vid_w(space, offset+0x2000*(state->m_rambk & 0x03), data);
361
 
        }
362
 
}
363
 
 
364
 
static WRITE8_HANDLER( multfish_rambank_w )
365
 
{
366
 
        multfish_state *state = space->machine().driver_data<multfish_state>();
367
 
 
368
 
        state->m_rambk = data;
369
 
}
370
 
 
371
 
 
372
 
static READ8_HANDLER( ray_r )
 
349
READ8_MEMBER(multfish_state::bankedram_r)
 
350
{
 
351
 
 
352
        if ((m_rambk & 0x80) == 0x00)
 
353
        {
 
354
                return timekeeper_r(machine().device("m48t35"), offset + 0x2000*(m_rambk & 0x03));
 
355
        }
 
356
        else
 
357
        {
 
358
                return m_vid[offset+0x2000*(m_rambk & 0x03)];
 
359
        }
 
360
 
 
361
}
 
362
 
 
363
WRITE8_MEMBER(multfish_state::bankedram_w)
 
364
{
 
365
 
 
366
        if ((m_rambk & 0x80) == 0x00)
 
367
        {
 
368
                timekeeper_w(machine().device("m48t35"), offset + 0x2000*(m_rambk & 0x03), data);
 
369
        }
 
370
        else
 
371
        {
 
372
                multfish_vid_w(space, offset+0x2000*(m_rambk & 0x03), data);
 
373
        }
 
374
}
 
375
 
 
376
WRITE8_MEMBER(multfish_state::multfish_rambank_w)
 
377
{
 
378
 
 
379
        m_rambk = data;
 
380
}
 
381
 
 
382
 
 
383
READ8_MEMBER(multfish_state::ray_r)
373
384
{
374
385
        // the games read the raster beam position as part of the hardware checks..
375
386
        // with a 6mhz clock and 640x480 resolution this seems to give the right results.
376
 
        return space->machine().primary_screen->vpos();
 
387
        return machine().primary_screen->vpos();
377
388
}
378
389
 
379
 
static CUSTOM_INPUT( multfish_hopper_r )
 
390
CUSTOM_INPUT_MEMBER(multfish_state::multfish_hopper_r)
380
391
{
381
 
        multfish_state *state = field.machine().driver_data<multfish_state>();
382
392
 
383
 
        if ( state->m_hopper_motor != 0 )
 
393
        if ( m_hopper_motor != 0 )
384
394
        {
385
 
                        state->m_hopper++;
386
 
                        return state->m_hopper>>4;
 
395
                        m_hopper++;
 
396
                        return m_hopper>>4;
387
397
        }
388
398
        else
389
399
        {
391
401
        }
392
402
}
393
403
 
394
 
static WRITE8_HANDLER( multfish_hopper_w )
 
404
WRITE8_MEMBER(multfish_state::multfish_hopper_w)
395
405
{
396
406
/*  Port 0x33
397
407
 
400
410
    ---- -X-- Bill Acceptor Lock 24B
401
411
    ---X ---- Hopper Motor 33B
402
412
*/
403
 
        multfish_state *state = space->machine().driver_data<multfish_state>();
404
 
 
405
 
        state->m_hopper_motor = data & 0x10;
406
 
        coin_lockout_w(space->machine(), 0, data & 0x01);
407
 
        coin_lockout_w(space->machine(), 1, data & 0x01);
408
 
        coin_lockout_w(space->machine(), 2, data & 0x01);
409
 
        coin_lockout_w(space->machine(), 3, data & 0x01);
410
 
        coin_lockout_w(space->machine(), 4, data & 0x04);
411
 
        coin_lockout_w(space->machine(), 5, data & 0x04);
412
 
        coin_lockout_w(space->machine(), 6, data & 0x04);
413
 
        coin_lockout_w(space->machine(), 7, data & 0x04);
 
413
 
 
414
 
 
415
        m_hopper_motor = data & 0x10;
 
416
        coin_lockout_w(machine(), 0, data & 0x01);
 
417
        coin_lockout_w(machine(), 1, data & 0x01);
 
418
        coin_lockout_w(machine(), 2, data & 0x01);
 
419
        coin_lockout_w(machine(), 3, data & 0x01);
 
420
        coin_lockout_w(machine(), 4, data & 0x04);
 
421
        coin_lockout_w(machine(), 5, data & 0x04);
 
422
        coin_lockout_w(machine(), 6, data & 0x04);
 
423
        coin_lockout_w(machine(), 7, data & 0x04);
414
424
}
415
425
 
416
 
static WRITE8_HANDLER( rollfr_hopper_w )
 
426
WRITE8_MEMBER(multfish_state::rollfr_hopper_w)
417
427
{
418
428
/*
419
429
    By default RollFruit use inverted coinlock bit.
420
430
*/
421
 
        multfish_state *state = space->machine().driver_data<multfish_state>();
422
 
 
423
 
        state->m_hopper_motor = data & 0x10;
424
 
        coin_lockout_w(space->machine(), 0, !data & 0x01);
425
 
        coin_lockout_w(space->machine(), 1, !data & 0x01);
426
 
        coin_lockout_w(space->machine(), 2, !data & 0x01);
427
 
        coin_lockout_w(space->machine(), 3, !data & 0x01);
428
 
        coin_lockout_w(space->machine(), 4, data & 0x04);
429
 
        coin_lockout_w(space->machine(), 5, data & 0x04);
430
 
        coin_lockout_w(space->machine(), 6, data & 0x04);
431
 
        coin_lockout_w(space->machine(), 7, data & 0x04);
 
431
 
 
432
 
 
433
        m_hopper_motor = data & 0x10;
 
434
        coin_lockout_w(machine(), 0, !data & 0x01);
 
435
        coin_lockout_w(machine(), 1, !data & 0x01);
 
436
        coin_lockout_w(machine(), 2, !data & 0x01);
 
437
        coin_lockout_w(machine(), 3, !data & 0x01);
 
438
        coin_lockout_w(machine(), 4, data & 0x04);
 
439
        coin_lockout_w(machine(), 5, data & 0x04);
 
440
        coin_lockout_w(machine(), 6, data & 0x04);
 
441
        coin_lockout_w(machine(), 7, data & 0x04);
432
442
}
433
443
 
434
444
DRIVER_INIT( customl )
461
471
*/
462
472
 
463
473
        UINT32 i,j,jscr,romoffset;
464
 
        UINT8 *multfish_gfx = machine.region("gfx")->base();
 
474
        UINT8 *multfish_gfx = machine.root_device().memregion("gfx")->base();
465
475
        UINT8 *temprom = auto_alloc_array(machine, UINT8, multfish_ROM_SIZE);
466
476
 
467
477
 
533
543
 
534
544
static void lottery_decode(running_machine &machine, UINT8 xor12, UINT8 xor34, UINT8 xor56, UINT8 xor78, UINT32 xor_addr)
535
545
{
536
 
        UINT8 *multfish_gfx = machine.region("gfx")->base();
 
546
        UINT8 *multfish_gfx = machine.root_device().memregion("gfx")->base();
537
547
        UINT8 *temprom = auto_alloc_array(machine, UINT8, multfish_ROM_SIZE);
538
548
 
539
549
        /* ROMs decode */
574
584
 
575
585
static void ent_decode(running_machine &machine, UINT8 xor12, UINT8 xor34, UINT8 xor56, UINT8 xor78, UINT32 xor_addr)
576
586
{
577
 
        UINT8 *multfish_gfx = machine.region("gfx")->base();
 
587
        UINT8 *multfish_gfx = machine.root_device().memregion("gfx")->base();
578
588
        UINT8 *temprom = auto_alloc_array(machine, UINT8, multfish_ROM_SIZE);
579
589
 
580
590
        /* ROMs decode */
668
678
        ent_decode(machine, 0x22, 0x44, 0x44, 0xbb, 0x24240);
669
679
}
670
680
 
671
 
static ADDRESS_MAP_START( multfish_map, AS_PROGRAM, 8 )
 
681
static ADDRESS_MAP_START( multfish_map, AS_PROGRAM, 8, multfish_state )
672
682
        AM_RANGE(0x0000, 0x7fff) AM_ROM AM_WRITE(multfish_vid_w)
673
683
        AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
674
 
        AM_RANGE(0xc000, 0xdfff) AM_DEVREADWRITE("m48t35", multfish_timekeeper_r, multfish_timekeeper_w)
 
684
        AM_RANGE(0xc000, 0xdfff) AM_DEVREADWRITE_LEGACY("m48t35", multfish_timekeeper_r, multfish_timekeeper_w)
675
685
        AM_RANGE(0xe000, 0xffff) AM_READWRITE(bankedram_r, bankedram_w)
676
686
ADDRESS_MAP_END
677
687
 
694
704
        PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) // unused?
695
705
 
696
706
        PORT_START("IN1")
697
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM ( multfish_hopper_r, NULL )// Hopper SW (22 B)
 
707
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, multfish_state,multfish_hopper_r, NULL )// Hopper SW (22 B)
698
708
        PORT_DIPNAME(     0x02, 0x02, "BK Door (17 A)"  )
699
709
        PORT_DIPSETTING(  0x02, DEF_STR( Off ) )
700
710
        PORT_DIPSETTING(  0x00, DEF_STR( On ) )
787
797
        PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
788
798
 
789
799
        PORT_START("IN1")
790
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM ( multfish_hopper_r, NULL )// Hopper SW (22 B)
 
800
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, multfish_state,multfish_hopper_r, NULL )// Hopper SW (22 B)
791
801
        PORT_DIPNAME(     0x02, 0x02, "BK Door (17 A)"  )
792
802
        PORT_DIPSETTING(  0x02, DEF_STR( Off ) )
793
803
        PORT_DIPSETTING(  0x00, DEF_STR( On ) )
820
830
INPUT_PORTS_END
821
831
 
822
832
 
823
 
static WRITE8_HANDLER( multfish_lamps1_w )
 
833
WRITE8_MEMBER(multfish_state::multfish_lamps1_w)
824
834
{
825
835
/*  Port 0x30
826
836
 
844
854
        output_set_lamp_value(0, ((data >> 7) & 1)); /* Bet/Double Lamp */
845
855
}
846
856
 
847
 
static WRITE8_HANDLER( multfish_lamps2_w )
 
857
WRITE8_MEMBER(multfish_state::multfish_lamps2_w)
848
858
{
849
859
/*  Port 0x34
850
860
 
860
870
        output_set_lamp_value(10, ((data >> 4) & 1)); /* Upper Lamp Green */
861
871
}
862
872
 
863
 
static WRITE8_HANDLER( multfish_lamps3_w )
 
873
WRITE8_MEMBER(multfish_state::multfish_lamps3_w)
864
874
{
865
875
/*  Port 0x35
866
876
 
870
880
        output_set_lamp_value(11, ((data >> 1) & 1)); /* Upper Lamp Red */
871
881
}
872
882
 
873
 
static WRITE8_HANDLER( multfish_counters_w )
 
883
WRITE8_MEMBER(multfish_state::multfish_counters_w)
874
884
{
875
885
/*  Port 0x31
876
886
 
882
892
    -X-- ---- Key Out Counter 27A
883
893
    X--- ---- Total Bet Counter 28B
884
894
*/
885
 
        coin_counter_w(space->machine(), 0, data & 0x01);
886
 
        coin_counter_w(space->machine(), 1, data & 0x02);
887
 
        coin_counter_w(space->machine(), 2, data & 0x04);
888
 
        coin_counter_w(space->machine(), 3, data & 0x10);
889
 
        coin_counter_w(space->machine(), 4, data & 0x40);
890
 
        coin_counter_w(space->machine(), 5, data & 0x80);
 
895
        coin_counter_w(machine(), 0, data & 0x01);
 
896
        coin_counter_w(machine(), 1, data & 0x02);
 
897
        coin_counter_w(machine(), 2, data & 0x04);
 
898
        coin_counter_w(machine(), 3, data & 0x10);
 
899
        coin_counter_w(machine(), 4, data & 0x40);
 
900
        coin_counter_w(machine(), 5, data & 0x80);
891
901
}
892
902
 
893
 
static WRITE8_HANDLER( multfish_f3_w )
 
903
WRITE8_MEMBER(multfish_state::multfish_f3_w)
894
904
{
895
905
        //popmessage("multfish_f3_w %02x",data);
896
906
}
897
907
 
898
 
static WRITE8_HANDLER( multfish_dispenable_w )
 
908
WRITE8_MEMBER(multfish_state::multfish_dispenable_w)
899
909
{
900
 
        multfish_state *state = space->machine().driver_data<multfish_state>();
901
910
        //popmessage("multfish_f4_w %02x",data); // display enable?
902
 
        state->m_disp_enable = data;
 
911
        m_disp_enable = data;
903
912
}
904
913
 
905
 
static ADDRESS_MAP_START( multfish_portmap, AS_IO, 8 )
 
914
static ADDRESS_MAP_START( multfish_portmap, AS_IO, 8, multfish_state )
906
915
        ADDRESS_MAP_GLOBAL_MASK(0xff)
907
916
        AM_RANGE(0x10, 0x10) AM_READ_PORT("IN0")
908
917
        AM_RANGE(0x11, 0x11) AM_READ_PORT("IN1")
916
925
        /* Write ports not hooked up yet */
917
926
        AM_RANGE(0x30, 0x30) AM_WRITE(multfish_lamps1_w)
918
927
        AM_RANGE(0x31, 0x31) AM_WRITE(multfish_counters_w)
919
 
//  AM_RANGE(0x32, 0x32) AM_WRITE(multfish_port32_w)
 
928
//  AM_RANGE(0x32, 0x32) AM_WRITE_LEGACY(multfish_port32_w)
920
929
        AM_RANGE(0x33, 0x33) AM_WRITE(multfish_hopper_w)
921
930
        AM_RANGE(0x34, 0x34) AM_WRITE(multfish_lamps2_w)
922
931
        AM_RANGE(0x35, 0x35) AM_WRITE(multfish_lamps3_w)
923
 
//  AM_RANGE(0x36, 0x36) AM_WRITE(multfish_port36_w)
 
932
//  AM_RANGE(0x36, 0x36) AM_WRITE_LEGACY(multfish_port36_w)
924
933
        AM_RANGE(0x37, 0x37) AM_WRITE(watchdog_reset_w)
925
 
        AM_RANGE(0x38, 0x38) AM_DEVWRITE("aysnd", ay8910_address_w)
926
 
        AM_RANGE(0x39, 0x39) AM_DEVWRITE("aysnd", ay8910_data_w)
927
 
        AM_RANGE(0x3a, 0x3a) AM_DEVREAD("aysnd", ay8910_r)
 
934
        AM_RANGE(0x38, 0x38) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_w)
 
935
        AM_RANGE(0x39, 0x39) AM_DEVWRITE_LEGACY("aysnd", ay8910_data_w)
 
936
        AM_RANGE(0x3a, 0x3a) AM_DEVREAD_LEGACY("aysnd", ay8910_r)
928
937
 
929
938
        AM_RANGE(0x60, 0x60) AM_WRITE(multfish_dispenable_w) // display enable mirror for lottery sets
930
939
 
958
967
        AM_RANGE(0xf8, 0xfd)  AM_WRITE(multfish_bank_w)
959
968
ADDRESS_MAP_END
960
969
 
961
 
static ADDRESS_MAP_START( rollfr_portmap, AS_IO, 8 )
 
970
static ADDRESS_MAP_START( rollfr_portmap, AS_IO, 8, multfish_state )
962
971
        AM_RANGE(0x33, 0x33) AM_WRITE(rollfr_hopper_w)
963
972
        AM_IMPORT_FROM(multfish_portmap)
964
973
ADDRESS_MAP_END
1000
1009
{
1001
1010
        multfish_state *state = machine.driver_data<multfish_state>();
1002
1011
 
1003
 
        memory_configure_bank(machine, "bank1", 0, 16, machine.region("maincpu")->base(), 0x4000);
1004
 
        memory_set_bank(machine, "bank1", 0);
 
1012
        state->membank("bank1")->configure_entries(0, 16, state->memregion("maincpu")->base(), 0x4000);
 
1013
        state->membank("bank1")->set_entry(0);
1005
1014
 
1006
1015
        state->m_disp_enable = 0;
1007
1016
        state->m_rambk = 0;