~ubuntu-branches/debian/wheezy/mame/wheezy

« back to all changes in this revision

Viewing changes to src/mame/video/hexion.c

  • Committer: Bazaar Package Importer
  • Author(s): Jordi Mallach, Emmanuel Kasper, Félix Arreola Rodríguez, Jordi Mallach
  • Date: 2011-05-11 21:06:50 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110511210650-jizvh8a6x117y9hr
Tags: 0.142-1
[ Emmanuel Kasper ]
* New upstream release
* Set NOWERROR=1 to allow compiling with gcc-4.6
* Remove fix_powerpc_build.patch, as upstream has taken it in this release
* Add gnome-video-arcade front end as a suggested package

[ Félix Arreola Rodríguez ]
* Add kfreebsd-build.patch to quilt series, to fix build on kfreebsd

[ Jordi Mallach ]
* Remove unneeded and bogus addition of --with-quilt to the dh invocation.
* Add Cesare Falco (long time Ubuntu maintainer) to Uploaders, and wrap
  them into multiple lines.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#include "emu.h"
2
2
#include "includes/hexion.h"
3
3
 
4
 
static UINT8 *vram[2],*unkram;
5
 
static int bankctrl,rambank,pmcbank,gfxrom_select;
6
 
static tilemap_t *bg_tilemap[2];
7
4
 
8
5
 
9
6
 
13
10
 
14
11
***************************************************************************/
15
12
 
16
 
INLINE void get_tile_info(running_machine *machine,tile_data *tileinfo,int tile_index,UINT8 *ram)
 
13
INLINE void get_tile_info(running_machine &machine,tile_data *tileinfo,int tile_index,UINT8 *ram)
17
14
{
18
15
        tile_index *= 4;
19
16
        SET_TILE_INFO(
25
22
 
26
23
static TILE_GET_INFO( get_tile_info0 )
27
24
{
28
 
        get_tile_info(machine,tileinfo,tile_index,vram[0]);
 
25
        hexion_state *state = machine.driver_data<hexion_state>();
 
26
        get_tile_info(machine,tileinfo,tile_index,state->m_vram[0]);
29
27
}
30
28
 
31
29
static TILE_GET_INFO( get_tile_info1 )
32
30
{
33
 
        get_tile_info(machine,tileinfo,tile_index,vram[1]);
 
31
        hexion_state *state = machine.driver_data<hexion_state>();
 
32
        get_tile_info(machine,tileinfo,tile_index,state->m_vram[1]);
34
33
}
35
34
 
36
35
 
43
42
 
44
43
VIDEO_START( hexion )
45
44
{
46
 
        bg_tilemap[0] = tilemap_create(machine, get_tile_info0,tilemap_scan_rows,8,8,64,32);
47
 
        bg_tilemap[1] = tilemap_create(machine, get_tile_info1,tilemap_scan_rows,     8,8,64,32);
48
 
 
49
 
        tilemap_set_transparent_pen(bg_tilemap[0],0);
50
 
        tilemap_set_scrollx(bg_tilemap[1],0,-4);
51
 
        tilemap_set_scrolly(bg_tilemap[1],0,4);
52
 
 
53
 
        vram[0] = machine->region("maincpu")->base() + 0x30000;
54
 
        vram[1] = vram[0] + 0x2000;
55
 
        unkram = vram[1] + 0x2000;
 
45
        hexion_state *state = machine.driver_data<hexion_state>();
 
46
        state->m_bg_tilemap[0] = tilemap_create(machine, get_tile_info0,tilemap_scan_rows,8,8,64,32);
 
47
        state->m_bg_tilemap[1] = tilemap_create(machine, get_tile_info1,tilemap_scan_rows,     8,8,64,32);
 
48
 
 
49
        tilemap_set_transparent_pen(state->m_bg_tilemap[0],0);
 
50
        tilemap_set_scrollx(state->m_bg_tilemap[1],0,-4);
 
51
        tilemap_set_scrolly(state->m_bg_tilemap[1],0,4);
 
52
 
 
53
        state->m_vram[0] = machine.region("maincpu")->base() + 0x30000;
 
54
        state->m_vram[1] = state->m_vram[0] + 0x2000;
 
55
        state->m_unkram = state->m_vram[1] + 0x2000;
56
56
}
57
57
 
58
58
 
65
65
 
66
66
WRITE8_HANDLER( hexion_bankswitch_w )
67
67
{
68
 
        UINT8 *rom = space->machine->region("maincpu")->base() + 0x10000;
 
68
        hexion_state *state = space->machine().driver_data<hexion_state>();
 
69
        UINT8 *rom = space->machine().region("maincpu")->base() + 0x10000;
69
70
 
70
71
        /* bits 0-3 select ROM bank */
71
 
        memory_set_bankptr(space->machine, "bank1",rom + 0x2000 * (data & 0x0f));
 
72
        memory_set_bankptr(space->machine(), "bank1",rom + 0x2000 * (data & 0x0f));
72
73
 
73
74
        /* does bit 6 trigger the 052591? */
74
75
        if (data & 0x40)
75
76
        {
76
 
                int bank = unkram[0]&1;
77
 
                memset(vram[bank],unkram[1],0x2000);
78
 
                tilemap_mark_all_tiles_dirty(bg_tilemap[bank]);
 
77
                int bank = state->m_unkram[0]&1;
 
78
                memset(state->m_vram[bank],state->m_unkram[1],0x2000);
 
79
                tilemap_mark_all_tiles_dirty(state->m_bg_tilemap[bank]);
79
80
        }
80
81
        /* bit 7 = PMC-BK */
81
 
        pmcbank = (data & 0x80) >> 7;
 
82
        state->m_pmcbank = (data & 0x80) >> 7;
82
83
 
83
84
        /* other bits unknown */
84
85
if (data & 0x30)
85
86
        popmessage("bankswitch %02x",data&0xf0);
86
87
 
87
 
//logerror("%04x: bankswitch_w %02x\n",cpu_get_pc(space->cpu),data);
 
88
//logerror("%04x: bankswitch_w %02x\n",cpu_get_pc(&space->device()),data);
88
89
}
89
90
 
90
91
READ8_HANDLER( hexion_bankedram_r )
91
92
{
92
 
        if (gfxrom_select && offset < 0x1000)
93
 
        {
94
 
                return space->machine->region("gfx1")->base()[((gfxrom_select & 0x7f) << 12) + offset];
95
 
        }
96
 
        else if (bankctrl == 0)
97
 
        {
98
 
                return vram[rambank][offset];
99
 
        }
100
 
        else if (bankctrl == 2 && offset < 0x800)
101
 
        {
102
 
                return unkram[offset];
 
93
        hexion_state *state = space->machine().driver_data<hexion_state>();
 
94
        if (state->m_gfxrom_select && offset < 0x1000)
 
95
        {
 
96
                return space->machine().region("gfx1")->base()[((state->m_gfxrom_select & 0x7f) << 12) + offset];
 
97
        }
 
98
        else if (state->m_bankctrl == 0)
 
99
        {
 
100
                return state->m_vram[state->m_rambank][offset];
 
101
        }
 
102
        else if (state->m_bankctrl == 2 && offset < 0x800)
 
103
        {
 
104
                return state->m_unkram[offset];
103
105
        }
104
106
        else
105
107
        {
106
 
//logerror("%04x: bankedram_r offset %04x, bankctrl = %02x\n",cpu_get_pc(space->cpu),offset,bankctrl);
 
108
//logerror("%04x: bankedram_r offset %04x, bankctrl = %02x\n",cpu_get_pc(&space->device()),offset,state->m_bankctrl);
107
109
                return 0;
108
110
        }
109
111
}
110
112
 
111
113
WRITE8_HANDLER( hexion_bankedram_w )
112
114
{
113
 
        if (bankctrl == 3 && offset == 0 && (data & 0xfe) == 0)
114
 
        {
115
 
//logerror("%04x: bankedram_w offset %04x, data %02x, bankctrl = %02x\n",cpu_get_pc(space->cpu),offset,data,bankctrl);
116
 
                rambank = data & 1;
117
 
        }
118
 
        else if (bankctrl == 0)
119
 
        {
120
 
                if (pmcbank)
121
 
                {
122
 
//logerror("%04x: bankedram_w offset %04x, data %02x, bankctrl = %02x\n",cpu_get_pc(space->cpu),offset,data,bankctrl);
123
 
                        vram[rambank][offset] = data;
124
 
                        tilemap_mark_tile_dirty(bg_tilemap[rambank],offset/4);
125
 
                }
126
 
                else
127
 
                        logerror("%04x pmc internal ram %04x = %02x\n",cpu_get_pc(space->cpu),offset,data);
128
 
        }
129
 
        else if (bankctrl == 2 && offset < 0x800)
130
 
        {
131
 
                if (pmcbank)
132
 
                {
133
 
//logerror("%04x: unkram_w offset %04x, data %02x, bankctrl = %02x\n",cpu_get_pc(space->cpu),offset,data,bankctrl);
134
 
                        unkram[offset] = data;
135
 
                }
136
 
                else
137
 
                        logerror("%04x pmc internal ram %04x = %02x\n",cpu_get_pc(space->cpu),offset,data);
 
115
        hexion_state *state = space->machine().driver_data<hexion_state>();
 
116
        if (state->m_bankctrl == 3 && offset == 0 && (data & 0xfe) == 0)
 
117
        {
 
118
//logerror("%04x: bankedram_w offset %04x, data %02x, bankctrl = %02x\n",cpu_get_pc(&space->device()),offset,data,state->m_bankctrl);
 
119
                state->m_rambank = data & 1;
 
120
        }
 
121
        else if (state->m_bankctrl == 0)
 
122
        {
 
123
                if (state->m_pmcbank)
 
124
                {
 
125
//logerror("%04x: bankedram_w offset %04x, data %02x, bankctrl = %02x\n",cpu_get_pc(&space->device()),offset,data,state->m_bankctrl);
 
126
                        state->m_vram[state->m_rambank][offset] = data;
 
127
                        tilemap_mark_tile_dirty(state->m_bg_tilemap[state->m_rambank],offset/4);
 
128
                }
 
129
                else
 
130
                        logerror("%04x pmc internal ram %04x = %02x\n",cpu_get_pc(&space->device()),offset,data);
 
131
        }
 
132
        else if (state->m_bankctrl == 2 && offset < 0x800)
 
133
        {
 
134
                if (state->m_pmcbank)
 
135
                {
 
136
//logerror("%04x: unkram_w offset %04x, data %02x, bankctrl = %02x\n",cpu_get_pc(&space->device()),offset,data,state->m_bankctrl);
 
137
                        state->m_unkram[offset] = data;
 
138
                }
 
139
                else
 
140
                        logerror("%04x pmc internal ram %04x = %02x\n",cpu_get_pc(&space->device()),offset,data);
138
141
        }
139
142
        else
140
 
logerror("%04x: bankedram_w offset %04x, data %02x, bankctrl = %02x\n",cpu_get_pc(space->cpu),offset,data,bankctrl);
 
143
logerror("%04x: bankedram_w offset %04x, data %02x, bankctrl = %02x\n",cpu_get_pc(&space->device()),offset,data,state->m_bankctrl);
141
144
}
142
145
 
143
146
WRITE8_HANDLER( hexion_bankctrl_w )
144
147
{
145
 
//logerror("%04x: bankctrl_w %02x\n",cpu_get_pc(space->cpu),data);
146
 
        bankctrl = data;
 
148
        hexion_state *state = space->machine().driver_data<hexion_state>();
 
149
//logerror("%04x: bankctrl_w %02x\n",cpu_get_pc(&space->device()),data);
 
150
        state->m_bankctrl = data;
147
151
}
148
152
 
149
153
WRITE8_HANDLER( hexion_gfxrom_select_w )
150
154
{
151
 
//logerror("%04x: gfxrom_select_w %02x\n",cpu_get_pc(space->cpu),data);
152
 
        gfxrom_select = data;
 
155
        hexion_state *state = space->machine().driver_data<hexion_state>();
 
156
//logerror("%04x: gfxrom_select_w %02x\n",cpu_get_pc(&space->device()),data);
 
157
        state->m_gfxrom_select = data;
153
158
}
154
159
 
155
160
 
160
165
 
161
166
***************************************************************************/
162
167
 
163
 
VIDEO_UPDATE( hexion )
 
168
SCREEN_UPDATE( hexion )
164
169
{
165
 
        tilemap_draw(bitmap,cliprect,bg_tilemap[1],0,0);
166
 
        tilemap_draw(bitmap,cliprect,bg_tilemap[0],0,0);
 
170
        hexion_state *state = screen->machine().driver_data<hexion_state>();
 
171
        tilemap_draw(bitmap,cliprect,state->m_bg_tilemap[1],0,0);
 
172
        tilemap_draw(bitmap,cliprect,state->m_bg_tilemap[0],0,0);
167
173
        return 0;
168
174
}