43
43
WRITE8_HANDLER( ssozumo_videoram_w )
45
ssozumo_state *state = space->machine->driver_data<ssozumo_state>();
45
ssozumo_state *state = space->machine().driver_data<ssozumo_state>();
47
state->videoram[offset] = data;
48
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
47
state->m_videoram[offset] = data;
48
tilemap_mark_tile_dirty(state->m_bg_tilemap, offset);
51
51
WRITE8_HANDLER( ssozumo_colorram_w )
53
ssozumo_state *state = space->machine->driver_data<ssozumo_state>();
53
ssozumo_state *state = space->machine().driver_data<ssozumo_state>();
55
state->colorram[offset] = data;
56
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
55
state->m_colorram[offset] = data;
56
tilemap_mark_tile_dirty(state->m_bg_tilemap, offset);
59
59
WRITE8_HANDLER( ssozumo_videoram2_w )
61
ssozumo_state *state = space->machine->driver_data<ssozumo_state>();
61
ssozumo_state *state = space->machine().driver_data<ssozumo_state>();
63
state->videoram2[offset] = data;
64
tilemap_mark_tile_dirty(state->fg_tilemap, offset);
63
state->m_videoram2[offset] = data;
64
tilemap_mark_tile_dirty(state->m_fg_tilemap, offset);
67
67
WRITE8_HANDLER( ssozumo_colorram2_w )
69
ssozumo_state *state = space->machine->driver_data<ssozumo_state>();
69
ssozumo_state *state = space->machine().driver_data<ssozumo_state>();
71
state->colorram2[offset] = data;
72
tilemap_mark_tile_dirty(state->fg_tilemap, offset);
71
state->m_colorram2[offset] = data;
72
tilemap_mark_tile_dirty(state->m_fg_tilemap, offset);
75
75
WRITE8_HANDLER( ssozumo_paletteram_w )
77
ssozumo_state *state = space->machine->driver_data<ssozumo_state>();
77
ssozumo_state *state = space->machine().driver_data<ssozumo_state>();
78
78
int bit0, bit1, bit2, bit3, val;
82
state->paletteram[offset] = data;
82
state->m_paletteram[offset] = data;
83
83
offs2 = offset & 0x0f;
85
val = state->paletteram[offs2];
85
val = state->m_paletteram[offs2];
86
86
bit0 = (val >> 0) & 0x01;
87
87
bit1 = (val >> 1) & 0x01;
88
88
bit2 = (val >> 2) & 0x01;
89
89
bit3 = (val >> 3) & 0x01;
90
90
r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
92
val = state->paletteram[offs2 | 0x10];
92
val = state->m_paletteram[offs2 | 0x10];
93
93
bit0 = (val >> 0) & 0x01;
94
94
bit1 = (val >> 1) & 0x01;
95
95
bit2 = (val >> 2) & 0x01;
96
96
bit3 = (val >> 3) & 0x01;
97
97
g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
99
val = state->paletteram[offs2 | 0x20];
99
val = state->m_paletteram[offs2 | 0x20];
100
100
bit0 = (val >> 0) & 0x01;
101
101
bit1 = (val >> 1) & 0x01;
102
102
bit2 = (val >> 2) & 0x01;
103
103
bit3 = (val >> 3) & 0x01;
104
104
b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
106
palette_set_color(space->machine, offs2 + 64, MAKE_RGB(r, g, b));
106
palette_set_color(space->machine(), offs2 + 64, MAKE_RGB(r, g, b));
109
109
WRITE8_HANDLER( ssozumo_scroll_w )
111
ssozumo_state *state = space->machine->driver_data<ssozumo_state>();
111
ssozumo_state *state = space->machine().driver_data<ssozumo_state>();
113
tilemap_set_scrolly(state->bg_tilemap, 0, data);
113
tilemap_set_scrolly(state->m_bg_tilemap, 0, data);
116
116
WRITE8_HANDLER( ssozumo_flipscreen_w )
118
flip_screen_set(space->machine, data & 0x80);
118
flip_screen_set(space->machine(), data & 0x80);
121
121
static TILE_GET_INFO( get_bg_tile_info )
123
ssozumo_state *state = machine->driver_data<ssozumo_state>();
124
int code = state->videoram[tile_index] + ((state->colorram[tile_index] & 0x08) << 5);
125
int color = (state->colorram[tile_index] & 0x30) >> 4;
123
ssozumo_state *state = machine.driver_data<ssozumo_state>();
124
int code = state->m_videoram[tile_index] + ((state->m_colorram[tile_index] & 0x08) << 5);
125
int color = (state->m_colorram[tile_index] & 0x30) >> 4;
126
126
int flags = ((tile_index % 32) >= 16) ? TILE_FLIPY : 0;
128
128
SET_TILE_INFO(1, code, color, flags);
131
131
static TILE_GET_INFO( get_fg_tile_info )
133
ssozumo_state *state = machine->driver_data<ssozumo_state>();
134
int code = state->videoram2[tile_index] + 256 * (state->colorram2[tile_index] & 0x07);
135
int color = (state->colorram2[tile_index] & 0x30) >> 4;
133
ssozumo_state *state = machine.driver_data<ssozumo_state>();
134
int code = state->m_videoram2[tile_index] + 256 * (state->m_colorram2[tile_index] & 0x07);
135
int color = (state->m_colorram2[tile_index] & 0x30) >> 4;
137
137
SET_TILE_INFO(0, code, color, 0);
140
140
VIDEO_START( ssozumo )
142
ssozumo_state *state = machine->driver_data<ssozumo_state>();
142
ssozumo_state *state = machine.driver_data<ssozumo_state>();
144
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_cols_flip_x,
144
state->m_bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_cols_flip_x,
147
state->fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_cols_flip_x,
147
state->m_fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_cols_flip_x,
150
tilemap_set_transparent_pen(state->fg_tilemap, 0);
150
tilemap_set_transparent_pen(state->m_fg_tilemap, 0);
153
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
153
static void draw_sprites(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect)
155
ssozumo_state *state = machine->driver_data<ssozumo_state>();
156
UINT8 *spriteram = state->spriteram;
155
ssozumo_state *state = machine.driver_data<ssozumo_state>();
156
UINT8 *spriteram = state->m_spriteram;
159
for (offs = 0; offs < state->spriteram_size; offs += 4)
159
for (offs = 0; offs < state->m_spriteram_size; offs += 4)
161
161
if (spriteram[offs] & 0x01)
187
VIDEO_UPDATE( ssozumo )
187
SCREEN_UPDATE( ssozumo )
189
ssozumo_state *state = screen->machine->driver_data<ssozumo_state>();
189
ssozumo_state *state = screen->machine().driver_data<ssozumo_state>();
191
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
192
tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0);
193
draw_sprites(screen->machine, bitmap, cliprect);
191
tilemap_draw(bitmap, cliprect, state->m_bg_tilemap, 0, 0);
192
tilemap_draw(bitmap, cliprect, state->m_fg_tilemap, 0, 0);
193
draw_sprites(screen->machine(), bitmap, cliprect);