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

« back to all changes in this revision

Viewing changes to src/mame/drivers/skykid.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:
20
20
#include "includes/skykid.h"
21
21
 
22
22
 
23
 
static WRITE8_HANDLER( inputport_select_w )
 
23
WRITE8_MEMBER(skykid_state::inputport_select_w)
24
24
{
25
 
        skykid_state *state = space->machine().driver_data<skykid_state>();
26
25
        if ((data & 0xe0) == 0x60)
27
 
                state->m_inputport_selected = data & 0x07;
 
26
                m_inputport_selected = data & 0x07;
28
27
        else if ((data & 0xe0) == 0xc0)
29
28
        {
30
 
                coin_lockout_global_w(space->machine(), ~data & 1);
31
 
                coin_counter_w(space->machine(), 0,data & 2);
32
 
                coin_counter_w(space->machine(), 1,data & 4);
 
29
                coin_lockout_global_w(machine(), ~data & 1);
 
30
                coin_counter_w(machine(), 0,data & 2);
 
31
                coin_counter_w(machine(), 1,data & 4);
33
32
        }
34
33
}
35
34
 
36
 
static READ8_HANDLER( inputport_r )
 
35
READ8_MEMBER(skykid_state::inputport_r)
37
36
{
38
 
        skykid_state *state = space->machine().driver_data<skykid_state>();
39
 
        switch (state->m_inputport_selected)
 
37
        switch (m_inputport_selected)
40
38
        {
41
39
                case 0x00:      /* DSW B (bits 0-4) */
42
 
                        return (input_port_read(space->machine(), "DSWB") & 0xf8) >> 3;
 
40
                        return (ioport("DSWB")->read() & 0xf8) >> 3;
43
41
                case 0x01:      /* DSW B (bits 5-7), DSW A (bits 0-1) */
44
 
                        return ((input_port_read(space->machine(), "DSWB") & 0x07) << 2) | ((input_port_read(space->machine(), "DSWA") & 0xc0) >> 6);
 
42
                        return ((ioport("DSWB")->read() & 0x07) << 2) | ((ioport("DSWA")->read() & 0xc0) >> 6);
45
43
                case 0x02:      /* DSW A (bits 2-6) */
46
 
                        return (input_port_read(space->machine(), "DSWA") & 0x3e) >> 1;
 
44
                        return (ioport("DSWA")->read() & 0x3e) >> 1;
47
45
                case 0x03:      /* DSW A (bit 7), DSW C (bits 0-3) */
48
 
                        return ((input_port_read(space->machine(), "DSWA") & 0x01) << 4) | (input_port_read(space->machine(), "BUTTON2") & 0x0f);
 
46
                        return ((ioport("DSWA")->read() & 0x01) << 4) | (ioport("BUTTON2")->read() & 0x0f);
49
47
                case 0x04:      /* coins, start */
50
 
                        return input_port_read(space->machine(), "SYSTEM");
 
48
                        return ioport("SYSTEM")->read();
51
49
                case 0x05:      /* 2P controls */
52
 
                        return input_port_read(space->machine(), "P2");
 
50
                        return ioport("P2")->read();
53
51
                case 0x06:      /* 1P controls */
54
 
                        return input_port_read(space->machine(), "P1");
 
52
                        return ioport("P1")->read();
55
53
                default:
56
54
                        return 0xff;
57
55
        }
58
56
}
59
57
 
60
 
static WRITE8_HANDLER( skykid_led_w )
61
 
{
62
 
        set_led_status(space->machine(), 0,data & 0x08);
63
 
        set_led_status(space->machine(), 1,data & 0x10);
64
 
}
65
 
 
66
 
static WRITE8_HANDLER( skykid_subreset_w )
67
 
{
68
 
        int bit = !BIT(offset,11);
69
 
        cputag_set_input_line(space->machine(), "mcu", INPUT_LINE_RESET, bit ? CLEAR_LINE : ASSERT_LINE);
70
 
}
71
 
 
72
 
static WRITE8_HANDLER( skykid_bankswitch_w )
73
 
{
74
 
        memory_set_bank(space->machine(), "bank1", !BIT(offset,11));
75
 
}
76
 
 
77
 
static WRITE8_HANDLER( skykid_irq_1_ctrl_w )
78
 
{
79
 
        skykid_state *state = space->machine().driver_data<skykid_state>();
80
 
        int bit = !BIT(offset,11);
81
 
        state->m_main_irq_mask = bit;
 
58
WRITE8_MEMBER(skykid_state::skykid_led_w)
 
59
{
 
60
        set_led_status(machine(), 0,data & 0x08);
 
61
        set_led_status(machine(), 1,data & 0x10);
 
62
}
 
63
 
 
64
WRITE8_MEMBER(skykid_state::skykid_subreset_w)
 
65
{
 
66
        int bit = !BIT(offset,11);
 
67
        cputag_set_input_line(machine(), "mcu", INPUT_LINE_RESET, bit ? CLEAR_LINE : ASSERT_LINE);
 
68
}
 
69
 
 
70
WRITE8_MEMBER(skykid_state::skykid_bankswitch_w)
 
71
{
 
72
        membank("bank1")->set_entry(!BIT(offset,11));
 
73
}
 
74
 
 
75
WRITE8_MEMBER(skykid_state::skykid_irq_1_ctrl_w)
 
76
{
 
77
        int bit = !BIT(offset,11);
 
78
        m_main_irq_mask = bit;
82
79
        if (!bit)
83
 
                cputag_set_input_line(space->machine(), "maincpu", 0, CLEAR_LINE);
 
80
                cputag_set_input_line(machine(), "maincpu", 0, CLEAR_LINE);
84
81
}
85
82
 
86
 
static WRITE8_HANDLER( skykid_irq_2_ctrl_w )
 
83
WRITE8_MEMBER(skykid_state::skykid_irq_2_ctrl_w)
87
84
{
88
 
        skykid_state *state = space->machine().driver_data<skykid_state>();
89
85
        int bit = !BIT(offset,13);
90
 
        state->m_mcu_irq_mask = bit;
 
86
        m_mcu_irq_mask = bit;
91
87
        if (!bit)
92
 
                cputag_set_input_line(space->machine(), "mcu", 0, CLEAR_LINE);
 
88
                cputag_set_input_line(machine(), "mcu", 0, CLEAR_LINE);
93
89
}
94
90
 
95
91
static MACHINE_START( skykid )
96
92
{
97
93
        skykid_state *state = machine.driver_data<skykid_state>();
98
94
        /* configure the banks */
99
 
        memory_configure_bank(machine, "bank1", 0, 2, machine.region("maincpu")->base() + 0x10000, 0x2000);
 
95
        state->membank("bank1")->configure_entries(0, 2, state->memregion("maincpu")->base() + 0x10000, 0x2000);
100
96
 
101
97
        state_save_register_global(machine, state->m_inputport_selected);
102
98
}
103
99
 
104
100
 
105
101
 
106
 
static ADDRESS_MAP_START( skykid_map, AS_PROGRAM, 8 )
 
102
static ADDRESS_MAP_START( skykid_map, AS_PROGRAM, 8, skykid_state )
107
103
        AM_RANGE(0x0000, 0x1fff) AM_ROMBANK("bank1")                            /* banked ROM */
108
 
        AM_RANGE(0x2000, 0x2fff) AM_READWRITE(skykid_videoram_r,skykid_videoram_w) AM_BASE_MEMBER(skykid_state, m_videoram)/* Video RAM (background) */
109
 
        AM_RANGE(0x4000, 0x47ff) AM_READWRITE(skykid_textram_r,skykid_textram_w) AM_BASE_MEMBER(skykid_state, m_textram)        /* video RAM (text layer) */
110
 
        AM_RANGE(0x4800, 0x5fff) AM_RAM AM_BASE_MEMBER(skykid_state, m_spriteram)       /* RAM + Sprite RAM */
 
104
        AM_RANGE(0x2000, 0x2fff) AM_READWRITE(skykid_videoram_r,skykid_videoram_w) AM_SHARE("videoram")/* Video RAM (background) */
 
105
        AM_RANGE(0x4000, 0x47ff) AM_READWRITE(skykid_textram_r,skykid_textram_w) AM_SHARE("textram")    /* video RAM (text layer) */
 
106
        AM_RANGE(0x4800, 0x5fff) AM_RAM AM_SHARE("spriteram")   /* RAM + Sprite RAM */
111
107
        AM_RANGE(0x6000, 0x60ff) AM_WRITE(skykid_scroll_y_w)            /* Y scroll register map */
112
108
        AM_RANGE(0x6200, 0x63ff) AM_WRITE(skykid_scroll_x_w)            /* X scroll register map */
113
 
        AM_RANGE(0x6800, 0x6bff) AM_DEVREADWRITE("namco", namcos1_cus30_r, namcos1_cus30_w) /* PSG device, shared RAM */
 
109
        AM_RANGE(0x6800, 0x6bff) AM_DEVREADWRITE_LEGACY("namco", namcos1_cus30_r, namcos1_cus30_w) /* PSG device, shared RAM */
114
110
        AM_RANGE(0x7000, 0x7fff) AM_WRITE(skykid_irq_1_ctrl_w)          /* IRQ control */
115
111
        AM_RANGE(0x7800, 0x7fff) AM_READ(watchdog_reset_r)                      /* watchdog reset */
116
112
        AM_RANGE(0x8000, 0xffff) AM_ROM                                 /* ROM */
119
115
        AM_RANGE(0xa000, 0xa001) AM_WRITE(skykid_flipscreen_priority_w) /* flip screen & priority */
120
116
ADDRESS_MAP_END
121
117
 
122
 
static ADDRESS_MAP_START( mcu_map, AS_PROGRAM, 8 )
123
 
        AM_RANGE(0x0000, 0x001f) AM_READWRITE(m6801_io_r, m6801_io_w)
 
118
static ADDRESS_MAP_START( mcu_map, AS_PROGRAM, 8, skykid_state )
 
119
        AM_RANGE(0x0000, 0x001f) AM_READWRITE_LEGACY(m6801_io_r, m6801_io_w)
124
120
        AM_RANGE(0x0080, 0x00ff) AM_RAM
125
 
        AM_RANGE(0x1000, 0x13ff) AM_DEVREADWRITE("namco", namcos1_cus30_r, namcos1_cus30_w) /* PSG device, shared RAM */
 
121
        AM_RANGE(0x1000, 0x13ff) AM_DEVREADWRITE_LEGACY("namco", namcos1_cus30_r, namcos1_cus30_w) /* PSG device, shared RAM */
126
122
        AM_RANGE(0x2000, 0x3fff) AM_WRITE(watchdog_reset_w)             /* watchdog? */
127
123
        AM_RANGE(0x4000, 0x7fff) AM_WRITE(skykid_irq_2_ctrl_w)
128
124
        AM_RANGE(0x8000, 0xbfff) AM_ROM
131
127
ADDRESS_MAP_END
132
128
 
133
129
 
134
 
static READ8_HANDLER( readFF )
 
130
READ8_MEMBER(skykid_state::readFF)
135
131
{
136
132
        return 0xff;
137
133
}
138
134
 
139
 
static ADDRESS_MAP_START( mcu_port_map, AS_IO, 8 )
 
135
static ADDRESS_MAP_START( mcu_port_map, AS_IO, 8, skykid_state )
140
136
        AM_RANGE(M6801_PORT1, M6801_PORT1) AM_READ(inputport_r)                 /* input ports read */
141
137
        AM_RANGE(M6801_PORT1, M6801_PORT1) AM_WRITE(inputport_select_w) /* input port select */
142
138
        AM_RANGE(M6801_PORT2, M6801_PORT2) AM_READ(readFF)      /* leds won't work otherwise */
642
638
        int i;
643
639
 
644
640
        /* unpack the third sprite ROM */
645
 
        rom = machine.region("gfx3")->base() + 0x4000;
 
641
        rom = machine.root_device().memregion("gfx3")->base() + 0x4000;
646
642
        for (i = 0;i < 0x2000;i++)
647
643
        {
648
644
                rom[i + 0x4000] = rom[i];               // sprite set #1, plane 3