39
39
4, resistances, bweights, 470, 0);
41
41
/* allocate the colortable */
42
machine->colortable = colortable_alloc(machine, 0x100);
42
machine.colortable = colortable_alloc(machine, 0x100);
44
44
/* create a lookup table for the palette */
45
45
for (i = 0; i < 0x100; i++)
68
68
bit3 = (color_prom[i + 0x200] >> 3) & 0x01;
69
69
b = combine_4_weights(bweights, bit0, bit1, bit2, bit3);
71
colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
71
colortable_palette_set_color(machine.colortable, i, MAKE_RGB(r, g, b));
74
74
/* color_prom now points to the beginning of the lookup table,*/
82
82
for (j = 0; j < 8; j++)
84
84
UINT8 ctabentry = (j << 5) | ((~i & 0x100) >> 4) | (color_prom[i] & 0x0f);
85
colortable_entry_set_value(machine->colortable, ((i & 0x100) << 3) | (j << 8) | (i & 0xff), ctabentry);
85
colortable_entry_set_value(machine.colortable, ((i & 0x100) << 3) | (j << 8) | (i & 0xff), ctabentry);
90
90
WRITE8_HANDLER( mikie_videoram_w )
92
mikie_state *state = space->machine->driver_data<mikie_state>();
92
mikie_state *state = space->machine().driver_data<mikie_state>();
94
state->videoram[offset] = data;
95
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
94
state->m_videoram[offset] = data;
95
tilemap_mark_tile_dirty(state->m_bg_tilemap, offset);
98
98
WRITE8_HANDLER( mikie_colorram_w )
100
mikie_state *state = space->machine->driver_data<mikie_state>();
100
mikie_state *state = space->machine().driver_data<mikie_state>();
102
state->colorram[offset] = data;
103
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
102
state->m_colorram[offset] = data;
103
tilemap_mark_tile_dirty(state->m_bg_tilemap, offset);
106
106
WRITE8_HANDLER( mikie_palettebank_w )
108
mikie_state *state = space->machine->driver_data<mikie_state>();
108
mikie_state *state = space->machine().driver_data<mikie_state>();
110
if (state->palettebank != (data & 0x07))
110
if (state->m_palettebank != (data & 0x07))
112
state->palettebank = data & 0x07;
113
tilemap_mark_all_tiles_dirty_all(space->machine);
112
state->m_palettebank = data & 0x07;
113
tilemap_mark_all_tiles_dirty_all(space->machine());
117
117
WRITE8_HANDLER( mikie_flipscreen_w )
119
if (flip_screen_get(space->machine) != (data & 0x01))
119
if (flip_screen_get(space->machine()) != (data & 0x01))
121
flip_screen_set(space->machine, data & 0x01);
122
tilemap_mark_all_tiles_dirty_all(space->machine);
121
flip_screen_set(space->machine(), data & 0x01);
122
tilemap_mark_all_tiles_dirty_all(space->machine());
126
126
static TILE_GET_INFO( get_bg_tile_info )
128
mikie_state *state = machine->driver_data<mikie_state>();
129
int code = state->videoram[tile_index] + ((state->colorram[tile_index] & 0x20) << 3);
130
int color = (state->colorram[tile_index] & 0x0f) + 16 * state->palettebank;
131
int flags = ((state->colorram[tile_index] & 0x40) ? TILE_FLIPX : 0) | ((state->colorram[tile_index] & 0x80) ? TILE_FLIPY : 0);
132
if (state->colorram[tile_index] & 0x10)
128
mikie_state *state = machine.driver_data<mikie_state>();
129
int code = state->m_videoram[tile_index] + ((state->m_colorram[tile_index] & 0x20) << 3);
130
int color = (state->m_colorram[tile_index] & 0x0f) + 16 * state->m_palettebank;
131
int flags = ((state->m_colorram[tile_index] & 0x40) ? TILE_FLIPX : 0) | ((state->m_colorram[tile_index] & 0x80) ? TILE_FLIPY : 0);
132
if (state->m_colorram[tile_index] & 0x10)
133
133
tileinfo->category = 1;
135
135
tileinfo->category = 0;
142
142
VIDEO_START( mikie )
144
mikie_state *state = machine->driver_data<mikie_state>();
145
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
144
mikie_state *state = machine.driver_data<mikie_state>();
145
state->m_bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
148
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
148
static void draw_sprites(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect)
150
mikie_state *state = machine->driver_data<mikie_state>();
151
UINT8 *spriteram = state->spriteram;
150
mikie_state *state = machine.driver_data<mikie_state>();
151
UINT8 *spriteram = state->m_spriteram;
154
for (offs = 0; offs < state->spriteram_size; offs += 4)
154
for (offs = 0; offs < state->m_spriteram_size; offs += 4)
156
156
int gfxbank = (spriteram[offs + 2] & 0x40) ? 2 : 1;
157
157
int code = (spriteram[offs + 2] & 0x3f) + ((spriteram[offs + 2] & 0x80) >> 1) + ((spriteram[offs] & 0x40) << 1);
158
int color = (spriteram[offs] & 0x0f) + 16 * state->palettebank;
158
int color = (spriteram[offs] & 0x0f) + 16 * state->m_palettebank;
159
159
int sx = spriteram[offs + 3];
160
160
int sy = 244 - spriteram[offs + 1];
161
161
int flipx = ~spriteram[offs] & 0x10;
170
170
drawgfx_transpen(bitmap, cliprect,
171
machine->gfx[gfxbank],
171
machine.gfx[gfxbank],
178
VIDEO_UPDATE( mikie )
178
SCREEN_UPDATE( mikie )
180
mikie_state *state = screen->machine->driver_data<mikie_state>();
181
tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_CATEGORY(0), 0);
182
draw_sprites(screen->machine, bitmap, cliprect);
183
tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_CATEGORY(1), 0);
180
mikie_state *state = screen->machine().driver_data<mikie_state>();
181
tilemap_draw(bitmap, cliprect, state->m_bg_tilemap, TILEMAP_DRAW_CATEGORY(0), 0);
182
draw_sprites(screen->machine(), bitmap, cliprect);
183
tilemap_draw(bitmap, cliprect, state->m_bg_tilemap, TILEMAP_DRAW_CATEGORY(1), 0);