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

« back to all changes in this revision

Viewing changes to src/mame/video/bionicc.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:
114
114
 
115
115
***************************************************************************/
116
116
 
117
 
WRITE16_HANDLER( bionicc_bgvideoram_w )
118
 
{
119
 
        bionicc_state *state = space->machine().driver_data<bionicc_state>();
120
 
 
121
 
        COMBINE_DATA(&state->m_bgvideoram[offset]);
122
 
        state->m_bg_tilemap->mark_tile_dirty(offset / 2);
123
 
}
124
 
 
125
 
WRITE16_HANDLER( bionicc_fgvideoram_w )
126
 
{
127
 
        bionicc_state *state = space->machine().driver_data<bionicc_state>();
128
 
 
129
 
        COMBINE_DATA(&state->m_fgvideoram[offset]);
130
 
        state->m_fg_tilemap->mark_tile_dirty(offset / 2);
131
 
}
132
 
 
133
 
WRITE16_HANDLER( bionicc_txvideoram_w )
134
 
{
135
 
        bionicc_state *state = space->machine().driver_data<bionicc_state>();
136
 
 
137
 
        COMBINE_DATA(&state->m_txvideoram[offset]);
138
 
        state->m_tx_tilemap->mark_tile_dirty(offset & 0x3ff);
139
 
}
140
 
 
141
 
WRITE16_HANDLER( bionicc_paletteram_w )
142
 
{
143
 
        bionicc_state *state = space->machine().driver_data<bionicc_state>();
 
117
WRITE16_MEMBER(bionicc_state::bionicc_bgvideoram_w)
 
118
{
 
119
 
 
120
        COMBINE_DATA(&m_bgvideoram[offset]);
 
121
        m_bg_tilemap->mark_tile_dirty(offset / 2);
 
122
}
 
123
 
 
124
WRITE16_MEMBER(bionicc_state::bionicc_fgvideoram_w)
 
125
{
 
126
 
 
127
        COMBINE_DATA(&m_fgvideoram[offset]);
 
128
        m_fg_tilemap->mark_tile_dirty(offset / 2);
 
129
}
 
130
 
 
131
WRITE16_MEMBER(bionicc_state::bionicc_txvideoram_w)
 
132
{
 
133
 
 
134
        COMBINE_DATA(&m_txvideoram[offset]);
 
135
        m_tx_tilemap->mark_tile_dirty(offset & 0x3ff);
 
136
}
 
137
 
 
138
WRITE16_MEMBER(bionicc_state::bionicc_paletteram_w)
 
139
{
144
140
        int r, g, b, bright;
145
 
        data = COMBINE_DATA(&state->m_paletteram[offset]);
 
141
        data = COMBINE_DATA(&m_paletteram[offset]);
146
142
 
147
143
        bright = (data & 0x0f);
148
144
 
157
153
                b = b * (0x07 + bright) / 0x0e;
158
154
        }
159
155
 
160
 
        palette_set_color (space->machine(), offset, MAKE_RGB(r, g, b));
 
156
        palette_set_color (machine(), offset, MAKE_RGB(r, g, b));
161
157
}
162
158
 
163
 
WRITE16_HANDLER( bionicc_scroll_w )
 
159
WRITE16_MEMBER(bionicc_state::bionicc_scroll_w)
164
160
{
165
 
        bionicc_state *state = space->machine().driver_data<bionicc_state>();
166
161
 
167
 
        data = COMBINE_DATA(&state->m_scroll[offset]);
 
162
        data = COMBINE_DATA(&m_scroll[offset]);
168
163
 
169
164
        switch (offset)
170
165
        {
171
166
                case 0:
172
 
                        state->m_fg_tilemap->set_scrollx(0, data);
 
167
                        m_fg_tilemap->set_scrollx(0, data);
173
168
                        break;
174
169
                case 1:
175
 
                        state->m_fg_tilemap->set_scrolly(0, data);
 
170
                        m_fg_tilemap->set_scrolly(0, data);
176
171
                        break;
177
172
                case 2:
178
 
                        state->m_bg_tilemap->set_scrollx(0, data);
 
173
                        m_bg_tilemap->set_scrollx(0, data);
179
174
                        break;
180
175
                case 3:
181
 
                        state->m_bg_tilemap->set_scrolly(0, data);
 
176
                        m_bg_tilemap->set_scrolly(0, data);
182
177
                        break;
183
178
        }
184
179
}
185
180
 
186
 
WRITE16_HANDLER( bionicc_gfxctrl_w )
 
181
WRITE16_MEMBER(bionicc_state::bionicc_gfxctrl_w)
187
182
{
188
 
        bionicc_state *state = space->machine().driver_data<bionicc_state>();
189
183
 
190
184
        if (ACCESSING_BITS_8_15)
191
185
        {
192
 
                flip_screen_set(space->machine(), data & 0x0100);
193
 
 
194
 
                state->m_bg_tilemap->enable(data & 0x2000);     /* guess */
195
 
                state->m_fg_tilemap->enable(data & 0x1000);     /* guess */
196
 
 
197
 
                coin_counter_w(space->machine(), 0, data & 0x8000);
198
 
                coin_counter_w(space->machine(), 1, data & 0x4000);
 
186
                flip_screen_set(data & 0x0100);
 
187
 
 
188
                m_bg_tilemap->enable(data & 0x2000);    /* guess */
 
189
                m_fg_tilemap->enable(data & 0x1000);    /* guess */
 
190
 
 
191
                coin_counter_w(machine(), 0, data & 0x8000);
 
192
                coin_counter_w(machine(), 1, data & 0x4000);
199
193
        }
200
194
}
201
195
 
209
203
 
210
204
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
211
205
{
212
 
        UINT16 *buffered_spriteram = machine.generic.buffered_spriteram.u16;
213
 
//  bionicc_state *state = machine.driver_data<bionicc_state>();
 
206
        bionicc_state *state = machine.driver_data<bionicc_state>();
 
207
        UINT16 *buffered_spriteram = state->m_spriteram->buffer();
214
208
        int offs;
215
209
        const gfx_element *gfx = machine.gfx[3];
216
210
 
217
 
        for (offs = (machine.generic.spriteram_size - 8) / 2; offs >= 0; offs -= 4)
 
211
        for (offs = (state->m_spriteram->bytes() - 8) / 2; offs >= 0; offs -= 4)
218
212
        {
219
213
                int tile_number = buffered_spriteram[offs] & 0x7ff;
220
214
                if( tile_number != 0x7ff )
229
223
                        if (sy > 512 - 16)
230
224
                                sy -= 512;
231
225
 
232
 
                        if (flip_screen_get(machine))
 
226
                        if (state->flip_screen())
233
227
                        {
234
228
                                sx = 240 - sx;
235
229
                                sy = 240 - sy;
259
253
        state->m_tx_tilemap->draw(bitmap, cliprect, 0, 0);
260
254
        return 0;
261
255
}
262
 
 
263
 
SCREEN_VBLANK( bionicc )
264
 
{
265
 
        // rising edge
266
 
        if (vblank_on)
267
 
        {
268
 
                address_space *space = screen.machine().device("maincpu")->memory().space(AS_PROGRAM);
269
 
 
270
 
                buffer_spriteram16_w(space, 0, 0, 0xffff);
271
 
        }
272
 
}