summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/video
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2013-04-18 08:44:08 +0000
committer Miodrag Milanovic <mmicko@gmail.com>2013-04-18 08:44:08 +0000
commitf30a3117806c7190217a6a1bccf344ff730a6bb7 (patch)
tree240d47327de16ed57117be50c49d42c70265dc7c /src/mess/video
parenteb0b5a552e90e20fd042ee694078a8f76e1513ef (diff)
moving some static functions in driver state for MESS drivers plus some other modernization (nw)
Diffstat (limited to 'src/mess/video')
-rw-r--r--src/mess/video/apple1.c98
-rw-r--r--src/mess/video/apple2.c153
-rw-r--r--src/mess/video/apple2gs.c2
-rw-r--r--src/mess/video/apple3.c103
-rw-r--r--src/mess/video/bbc.c101
-rw-r--r--src/mess/video/cgenie.c192
-rw-r--r--src/mess/video/channelf.c2
-rw-r--r--src/mess/video/dgn_beta.c7
-rw-r--r--src/mess/video/electron.c24
-rw-r--r--src/mess/video/fm7.c262
-rw-r--r--src/mess/video/fmtowns.c679
-rw-r--r--src/mess/video/gb.c2
-rw-r--r--src/mess/video/hec2video.c52
-rw-r--r--src/mess/video/intv.c106
-rw-r--r--src/mess/video/lviv.c43
-rw-r--r--src/mess/video/mac.c24
-rw-r--r--src/mess/video/nc.c5
-rw-r--r--src/mess/video/oric.c2
-rw-r--r--src/mess/video/pcw.c2
-rw-r--r--src/mess/video/pcw16.c24
-rw-r--r--src/mess/video/pdp1.c266
-rw-r--r--src/mess/video/primo.c7
-rw-r--r--src/mess/video/samcoupe.c64
-rw-r--r--src/mess/video/spectrum.c4
-rw-r--r--src/mess/video/ssystem3.c30
-rw-r--r--src/mess/video/super80.c10
-rw-r--r--src/mess/video/tx0.c187
-rw-r--r--src/mess/video/vc4000.c61
-rw-r--r--src/mess/video/wswan.c365
-rw-r--r--src/mess/video/x68k.c2
30 files changed, 1396 insertions, 1483 deletions
diff --git a/src/mess/video/apple1.c b/src/mess/video/apple1.c
index e98746d1fca..e0430c3ee49 100644
--- a/src/mess/video/apple1.c
+++ b/src/mess/video/apple1.c
@@ -89,15 +89,14 @@ TILE_GET_INFO_MEMBER(apple1_state::terminal_gettileinfo)
0); /* flags */
}
-static void terminal_draw(running_machine &machine, bitmap_ind16 &dest, const rectangle &cliprect, terminal_t *terminal)
+void apple1_state::terminal_draw(bitmap_ind16 &dest, const rectangle &cliprect, terminal_t *terminal)
{
- apple1_state *state = machine.driver_data<apple1_state>();
- state->m_current_terminal = terminal;
+ m_current_terminal = terminal;
terminal->tm->draw(dest, cliprect, 0, 0);
- state->m_current_terminal = NULL;
+ m_current_terminal = NULL;
}
-static void verify_coords(terminal_t *terminal, int x, int y)
+void apple1_state::verify_coords(terminal_t *terminal, int x, int y)
{
assert(x >= 0);
assert(y >= 0);
@@ -105,7 +104,7 @@ static void verify_coords(terminal_t *terminal, int x, int y)
assert(y < terminal->num_rows);
}
-static void terminal_putchar(terminal_t *terminal, int x, int y, int ch)
+void apple1_state::terminal_putchar(terminal_t *terminal, int x, int y, int ch)
{
int offs;
@@ -119,7 +118,7 @@ static void terminal_putchar(terminal_t *terminal, int x, int y, int ch)
}
}
-static int terminal_getchar(terminal_t *terminal, int x, int y)
+int apple1_state::terminal_getchar(terminal_t *terminal, int x, int y)
{
int offs;
@@ -128,43 +127,43 @@ static int terminal_getchar(terminal_t *terminal, int x, int y)
return terminal->mem[offs];
}
-static void terminal_putblank(terminal_t *terminal, int x, int y)
+void apple1_state::terminal_putblank(terminal_t *terminal, int x, int y)
{
terminal_putchar(terminal, x, y, terminal->blank_char);
}
-static void terminal_dirtycursor(terminal_t *terminal)
+void apple1_state::terminal_dirtycursor(terminal_t *terminal)
{
if (terminal->cur_offset >= 0)
terminal->tm->mark_tile_dirty(terminal->cur_offset);
}
-static void terminal_setcursor(terminal_t *terminal, int x, int y)
+void apple1_state::terminal_setcursor(terminal_t *terminal, int x, int y)
{
terminal_dirtycursor(terminal);
terminal->cur_offset = y * terminal->num_cols + x;
terminal_dirtycursor(terminal);
}
-static void terminal_hidecursor(terminal_t *terminal)
+void apple1_state::terminal_hidecursor(terminal_t *terminal)
{
terminal->cur_hidden = 1;
terminal_dirtycursor(terminal);
}
-static void terminal_showcursor(terminal_t *terminal)
+void apple1_state::terminal_showcursor(terminal_t *terminal)
{
terminal->cur_hidden = 0;
terminal_dirtycursor(terminal);
}
-static void terminal_getcursor(terminal_t *terminal, int *x, int *y)
+void apple1_state::terminal_getcursor(terminal_t *terminal, int *x, int *y)
{
*x = terminal->cur_offset % terminal->num_cols;
*y = terminal->cur_offset / terminal->num_cols;
}
-static void terminal_fill(terminal_t *terminal, int val)
+void apple1_state::terminal_fill(terminal_t *terminal, int val)
{
int i;
for (i = 0; i < terminal->num_cols * terminal->num_rows; i++)
@@ -172,28 +171,26 @@ static void terminal_fill(terminal_t *terminal, int val)
terminal->tm->mark_all_dirty();
}
-static void terminal_clear(terminal_t *terminal)
+void apple1_state::terminal_clear(terminal_t *terminal)
{
terminal_fill(terminal, terminal->blank_char);
}
-static terminal_t *terminal_create(
- running_machine &machine,
+terminal_t *apple1_state::terminal_create(
int gfx, int blank_char, int char_bits,
int (*getcursorcode)(int original_code),
int num_cols, int num_rows)
{
terminal_t *term;
int char_width, char_height;
- apple1_state *state = machine.driver_data<apple1_state>();
- char_width = machine.gfx[gfx]->width();
- char_height = machine.gfx[gfx]->height();
+ char_width = machine().gfx[gfx]->width();
+ char_height = machine().gfx[gfx]->height();
- term = (terminal_t *) auto_alloc_array(machine, char, sizeof(terminal_t) - sizeof(term->mem)
+ term = (terminal_t *) auto_alloc_array(machine(), char, sizeof(terminal_t) - sizeof(term->mem)
+ (num_cols * num_rows * sizeof(termchar_t)));
- term->tm = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(apple1_state::terminal_gettileinfo),state), TILEMAP_SCAN_ROWS,
+ term->tm = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(apple1_state::terminal_gettileinfo),this), TILEMAP_SCAN_ROWS,
char_width, char_height, num_cols, num_rows);
term->gfx = gfx;
@@ -232,7 +229,6 @@ void apple1_state::video_start()
{
m_blink_on = 1; /* cursor is visible initially */
m_terminal = terminal_create(
- machine(),
0, /* graphics font 0 (the only one we have) */
32, /* Blank character is symbol 32 in the ROM */
8, /* use 8 bits for the character code */
@@ -243,21 +239,20 @@ void apple1_state::video_start()
}
/* This function handles all writes to the video display. */
-void apple1_vh_dsp_w (running_machine &machine, int data)
+void apple1_state::apple1_vh_dsp_w (int data)
{
- apple1_state *state = machine.driver_data<apple1_state>();
int x, y;
int cursor_x, cursor_y;
/* While CLEAR SCREEN is being held down, the hardware is forced
to clear the video memory, so video writes have no effect. */
- if (state->m_vh_clrscrn_pressed)
+ if (m_vh_clrscrn_pressed)
return;
/* The video display port only accepts the 7 lowest bits of the char. */
data &= 0x7f;
- terminal_getcursor(state->m_terminal, &cursor_x, &cursor_y);
+ terminal_getcursor(m_terminal, &cursor_x, &cursor_y);
if (data == '\r') {
/* Carriage-return moves the cursor to the start of the next
@@ -282,7 +277,7 @@ void apple1_vh_dsp_w (running_machine &machine, int data)
int romindx = (data & 0x1f) | (((data ^ 0x40) & 0x40) >> 1);
- terminal_putchar(state->m_terminal, cursor_x, cursor_y, romindx);
+ terminal_putchar(m_terminal, cursor_x, cursor_y, romindx);
if (cursor_x < 39)
{
cursor_x++;
@@ -299,37 +294,35 @@ void apple1_vh_dsp_w (running_machine &machine, int data)
{
for (y = 1; y < 24; y++)
for (x = 0; x < 40; x++)
- terminal_putchar(state->m_terminal, x, y-1,
- terminal_getchar(state->m_terminal, x, y));
+ terminal_putchar(m_terminal, x, y-1,
+ terminal_getchar(m_terminal, x, y));
for (x = 0; x < 40; x++)
- terminal_putblank(state->m_terminal, x, 23);
+ terminal_putblank(m_terminal, x, 23);
cursor_y--;
}
- terminal_setcursor(state->m_terminal, cursor_x, cursor_y);
+ terminal_setcursor(m_terminal, cursor_x, cursor_y);
}
/* This function handles clearing the video display on cold-boot or in
response to a press of the CLEAR SCREEN switch. */
-void apple1_vh_dsp_clr (running_machine &machine)
+void apple1_state::apple1_vh_dsp_clr ()
{
- apple1_state *state = machine.driver_data<apple1_state>();
- terminal_setcursor(state->m_terminal, 0, 0);
- terminal_clear(state->m_terminal);
+ terminal_setcursor(m_terminal, 0, 0);
+ terminal_clear(m_terminal);
}
/* Calculate how long it will take for the display to assert the RDA
signal in response to a video display write. This signal indicates
the display has completed the write and is ready to accept another
write. */
-attotime apple1_vh_dsp_time_to_ready (running_machine &machine)
+attotime apple1_state::apple1_vh_dsp_time_to_ready ()
{
- apple1_state *state = machine.driver_data<apple1_state>();
int cursor_x, cursor_y;
int cursor_scanline;
- double scanline_period = machine.primary_screen->scan_period().as_double();
+ double scanline_period = machine().primary_screen->scan_period().as_double();
double cursor_hfrac;
/* The video hardware refreshes the screen by reading the
@@ -340,7 +333,7 @@ attotime apple1_vh_dsp_time_to_ready (running_machine &machine)
the cursor's character line, when the beam reaches the cursor's
horizontal position. */
- terminal_getcursor(state->m_terminal, &cursor_x, &cursor_y);
+ terminal_getcursor(m_terminal, &cursor_x, &cursor_y);
cursor_scanline = cursor_y * apple1_charlayout.height;
/* Each scanline is composed of 455 pixel times. The first 175 of
@@ -348,27 +341,26 @@ attotime apple1_vh_dsp_time_to_ready (running_machine &machine)
for the visible part of the scanline. */
cursor_hfrac = (175 + cursor_x * apple1_charlayout.width) / 455;
- if (machine.primary_screen->vpos() == cursor_scanline) {
+ if (machine().primary_screen->vpos() == cursor_scanline) {
/* video_screen_get_hpos() doesn't account for the horizontal
blanking interval; it acts as if the scanline period is
entirely composed of visible pixel times. However, we can
still use it to find what fraction of the current scanline
period has elapsed. */
- double current_hfrac = machine.primary_screen->hpos() /
- machine.first_screen()->width();
+ double current_hfrac = machine().primary_screen->hpos() /
+ machine().first_screen()->width();
if (current_hfrac < cursor_hfrac)
return attotime::from_double(scanline_period * (cursor_hfrac - current_hfrac));
}
return attotime::from_double(
- machine.primary_screen->time_until_pos(cursor_scanline, 0).as_double() +
+ machine().primary_screen->time_until_pos(cursor_scanline, 0).as_double() +
scanline_period * cursor_hfrac);
}
/* Blink the cursor on or off, as appropriate. */
-static void apple1_vh_cursor_blink (running_machine &machine)
+void apple1_state::apple1_vh_cursor_blink ()
{
- apple1_state *state = machine.driver_data<apple1_state>();
int new_blink_on;
/* The cursor is on for 2/3 of its blink period and off for 1/3.
@@ -377,23 +369,23 @@ static void apple1_vh_cursor_blink (running_machine &machine)
number of one-third-cycles elapsed, then checking the result
modulo 3. */
- if (((int) (machine.time().as_double() / CURSOR_OFF_LENGTH)) % 3 < 2)
+ if (((int) (machine().time().as_double() / CURSOR_OFF_LENGTH)) % 3 < 2)
new_blink_on = 1;
else
new_blink_on = 0;
- if (new_blink_on != state->m_blink_on) { /* have we changed state? */
+ if (new_blink_on != m_blink_on) { /* have we changed state? */
if (new_blink_on)
- terminal_showcursor(state->m_terminal);
+ terminal_showcursor(m_terminal);
else
- terminal_hidecursor(state->m_terminal);
- state->m_blink_on = new_blink_on;
+ terminal_hidecursor(m_terminal);
+ m_blink_on = new_blink_on;
}
}
UINT32 apple1_state::screen_update_apple1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- apple1_vh_cursor_blink(machine());
- terminal_draw(machine(), bitmap, cliprect, m_terminal);
+ apple1_vh_cursor_blink();
+ terminal_draw(bitmap, cliprect, m_terminal);
return 0;
}
diff --git a/src/mess/video/apple2.c b/src/mess/video/apple2.c
index d2dca0fcc35..c8b543dad2c 100644
--- a/src/mess/video/apple2.c
+++ b/src/mess/video/apple2.c
@@ -40,9 +40,9 @@
register
-------------------------------------------------*/
-INLINE UINT32 effective_a2(apple2_state *state)
+inline UINT32 apple2_state::effective_a2()
{
- return state->m_flags & state->m_a2_videomask;
+ return m_flags & m_a2_videomask;
}
@@ -51,7 +51,7 @@ INLINE UINT32 effective_a2(apple2_state *state)
video address lookup
-------------------------------------------------*/
-static UINT32 compute_video_address(int col, int row)
+UINT32 apple2_state::compute_video_address(int col, int row)
{
/* special Apple II addressing - gotta love it */
return (((row & 0x07) << 7) | ((row & 0x18) * 5 + col));
@@ -63,7 +63,7 @@ static UINT32 compute_video_address(int col, int row)
adjust_begin_and_end_row - processes the cliprect
-------------------------------------------------*/
-static void adjust_begin_and_end_row(const rectangle &cliprect, int *beginrow, int *endrow)
+void apple2_state::adjust_begin_and_end_row(const rectangle &cliprect, int *beginrow, int *endrow)
{
/* assumptions of the code */
assert((*beginrow % 8) == 0);
@@ -88,22 +88,21 @@ static void adjust_begin_and_end_row(const rectangle &cliprect, int *beginrow, i
textual character
-------------------------------------------------*/
-INLINE void apple2_plot_text_character(running_machine &machine, bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, UINT32 code,
+inline void apple2_state::apple2_plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, UINT32 code,
const UINT8 *textgfx_data, UINT32 textgfx_datalen, UINT32 my_a2)
{
- apple2_state *state = machine.driver_data<apple2_state>();
int x, y, i;
- int fg = state->m_fgcolor;
- int bg = state->m_bgcolor;
+ int fg = m_fgcolor;
+ int bg = m_bgcolor;
const UINT8 *chardata;
UINT16 color;
if (my_a2 & VAR_ALTCHARSET)
{
/* we're using an alternate charset */
- code |= state->m_alt_charset_value;
+ code |= m_alt_charset_value;
}
- else if (state->m_flash && (code >= 0x40) && (code <= 0x7f))
+ else if (m_flash && (code >= 0x40) && (code <= 0x7f))
{
/* we're flashing; swap */
i = fg;
@@ -115,7 +114,7 @@ INLINE void apple2_plot_text_character(running_machine &machine, bitmap_ind16 &b
chardata = &textgfx_data[(code * 8) % textgfx_datalen];
/* and finally, plot the character itself */
- if (state->m_machinetype == SPACE84)
+ if (m_machinetype == SPACE84)
{
for (y = 0; y < 8; y++)
{
@@ -154,13 +153,12 @@ INLINE void apple2_plot_text_character(running_machine &machine, bitmap_ind16 &b
column or 80 column)
-------------------------------------------------*/
-static void apple2_text_draw(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int page, int beginrow, int endrow)
+void apple2_state::apple2_text_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int page, int beginrow, int endrow)
{
- apple2_state *state = machine.driver_data<apple2_state>();
int row, col;
UINT32 start_address = (page ? 0x0800 : 0x0400);
UINT32 address;
- UINT32 my_a2 = effective_a2(state);
+ UINT32 my_a2 = effective_a2();
/* perform adjustments */
adjust_begin_and_end_row(cliprect, &beginrow, &endrow);
@@ -174,15 +172,15 @@ static void apple2_text_draw(running_machine &machine, bitmap_ind16 &bitmap, con
if (my_a2 & VAR_80COL)
{
- apple2_plot_text_character(machine, bitmap, col * 14 + 0, row, 1, state->m_a2_videoaux[address],
- state->m_textgfx_data, state->m_textgfx_datalen, my_a2);
- apple2_plot_text_character(machine, bitmap, col * 14 + 7, row, 1, state->m_a2_videoram[address],
- state->m_textgfx_data, state->m_textgfx_datalen, my_a2);
+ apple2_plot_text_character(bitmap, col * 14 + 0, row, 1, m_a2_videoaux[address],
+ m_textgfx_data, m_textgfx_datalen, my_a2);
+ apple2_plot_text_character(bitmap, col * 14 + 7, row, 1, m_a2_videoram[address],
+ m_textgfx_data, m_textgfx_datalen, my_a2);
}
else
{
- apple2_plot_text_character(machine, bitmap, col * 14, row, 2, state->m_a2_videoram[address],
- state->m_textgfx_data, state->m_textgfx_datalen, my_a2);
+ apple2_plot_text_character(bitmap, col * 14, row, 2, m_a2_videoram[address],
+ m_textgfx_data, m_textgfx_datalen, my_a2);
}
}
}
@@ -193,9 +191,8 @@ static void apple2_text_draw(running_machine &machine, bitmap_ind16 &bitmap, con
apple2_lores_draw - renders lo-res text
-------------------------------------------------*/
-static void apple2_lores_draw(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int page, int beginrow, int endrow)
+void apple2_state::apple2_lores_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int page, int beginrow, int endrow)
{
- apple2_state *state = machine.driver_data<apple2_state>();
int row, col, y, x;
UINT8 code;
UINT32 start_address = (page ? 0x0800 : 0x0400);
@@ -212,7 +209,7 @@ static void apple2_lores_draw(running_machine &machine, bitmap_ind16 &bitmap, co
address = start_address + compute_video_address(col, row / 8);
/* perform the lookup */
- code = state->m_a2_videoram[address];
+ code = m_a2_videoram[address];
/* and now draw */
for (y = 0; y < 4; y++)
@@ -234,9 +231,8 @@ static void apple2_lores_draw(running_machine &machine, bitmap_ind16 &bitmap, co
HIGH RESOLUTION GRAPHICS
***************************************************************************/
-static void apple2_hires_draw(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int page, int beginrow, int endrow)
+void apple2_state::apple2_hires_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int page, int beginrow, int endrow)
{
- apple2_state *state = machine.driver_data<apple2_state>();
const UINT8 *vram, *vaux;
int row, col, b;
int offset;
@@ -255,17 +251,17 @@ static void apple2_hires_draw(running_machine &machine, bitmap_ind16 &bitmap, co
if (endrow < beginrow)
return;
- if (state->m_machinetype == TK2000)
+ if (m_machinetype == TK2000)
{
- vram = state->m_a2_videoram + (page ? 0xa000 : 0x2000);
- vaux = state->m_a2_videoaux + (page ? 0xa000 : 0x2000);
+ vram = m_a2_videoram + (page ? 0xa000 : 0x2000);
+ vaux = m_a2_videoaux + (page ? 0xa000 : 0x2000);
}
else
{
- vram = state->m_a2_videoram + (page ? 0x4000 : 0x2000);
- vaux = state->m_a2_videoaux + (page ? 0x4000 : 0x2000);
+ vram = m_a2_videoram + (page ? 0x4000 : 0x2000);
+ vaux = m_a2_videoaux + (page ? 0x4000 : 0x2000);
}
- columns = ((effective_a2(state) & (VAR_DHIRES|VAR_80COL)) == (VAR_DHIRES|VAR_80COL)) ? 80 : 40;
+ columns = ((effective_a2() & (VAR_DHIRES|VAR_80COL)) == (VAR_DHIRES|VAR_80COL)) ? 80 : 40;
vram_row[0] = 0;
vram_row[columns + 1] = 0;
@@ -304,7 +300,7 @@ static void apple2_hires_draw(running_machine &machine, bitmap_ind16 &bitmap, co
switch(columns)
{
case 40:
- artifact_map_ptr = &state->m_hires_artifact_map[((vram_row[col+1] & 0x80) >> 7) * 16];
+ artifact_map_ptr = &m_hires_artifact_map[((vram_row[col+1] & 0x80) >> 7) * 16];
for (b = 0; b < 7; b++)
{
v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)];
@@ -314,7 +310,7 @@ static void apple2_hires_draw(running_machine &machine, bitmap_ind16 &bitmap, co
break;
case 80:
- if (state->m_monochrome_dhr)
+ if (m_monochrome_dhr)
{
for (b = 0; b < 7; b++)
{
@@ -327,7 +323,7 @@ static void apple2_hires_draw(running_machine &machine, bitmap_ind16 &bitmap, co
{
for (b = 0; b < 7; b++)
{
- v = state->m_dhires_artifact_map[((((w >> (b + 7-1)) & 0x0F) * 0x11) >> (((2-(col*7+b))) & 0x03)) & 0x0F];
+ v = m_dhires_artifact_map[((((w >> (b + 7-1)) & 0x0F) * 0x11) >> (((2-(col*7+b))) & 0x03)) & 0x0F];
*(p++) = v;
}
}
@@ -347,9 +343,8 @@ static void apple2_hires_draw(running_machine &machine, bitmap_ind16 &bitmap, co
VIDEO CORE
***************************************************************************/
-void apple2_video_start(running_machine &machine, const UINT8 *vram, const UINT8 *aux_vram, UINT32 ignored_softswitches, int hires_modulo)
+void apple2_state::apple2_video_start(const UINT8 *vram, const UINT8 *aux_vram, UINT32 ignored_softswitches, int hires_modulo)
{
- apple2_state *state = machine.driver_data<apple2_state>();
int i, j;
UINT16 c;
UINT8 *apple2_font;
@@ -368,22 +363,22 @@ void apple2_video_start(running_machine &machine, const UINT8 *vram, const UINT8
PURPLE, LTBLUE, PINK, WHITE
};
- state->m_fgcolor = 15;
- state->m_bgcolor = 0;
- state->m_flash = 0;
- apple2_font = machine.root_device().memregion("gfx1")->base();
- state->m_alt_charset_value = machine.root_device().memregion("gfx1")->bytes() / 16;
- state->m_a2_videoram = vram;
- state->m_a2_videoaux = aux_vram;
+ m_fgcolor = 15;
+ m_bgcolor = 0;
+ m_flash = 0;
+ apple2_font = machine().root_device().memregion("gfx1")->base();
+ m_alt_charset_value = machine().root_device().memregion("gfx1")->bytes() / 16;
+ m_a2_videoram = vram;
+ m_a2_videoaux = aux_vram;
- state->m_textgfx_data = machine.root_device().memregion("gfx1")->base();
- state->m_textgfx_datalen = state->memregion("gfx1")->bytes();
+ m_textgfx_data = machine().root_device().memregion("gfx1")->base();
+ m_textgfx_datalen = memregion("gfx1")->bytes();
/* 2^3 dependent pixels * 2 color sets * 2 offsets */
- state->m_hires_artifact_map = auto_alloc_array(machine, UINT16, 8 * 2 * 2);
+ m_hires_artifact_map = auto_alloc_array(machine(), UINT16, 8 * 2 * 2);
/* 2^4 dependent pixels */
- state->m_dhires_artifact_map = auto_alloc_array(machine, UINT16, 16);
+ m_dhires_artifact_map = auto_alloc_array(machine(), UINT16, 16);
/* build hires artifact map */
for (i = 0; i < 8; i++)
@@ -404,14 +399,14 @@ void apple2_video_start(running_machine &machine, const UINT8 *vram, const UINT8
else
c = 0;
}
- state->m_hires_artifact_map[ 0 + j*8 + i] = hires_artifact_color_table[(c + 0) % hires_modulo];
- state->m_hires_artifact_map[16 + j*8 + i] = hires_artifact_color_table[(c + 4) % hires_modulo];
+ m_hires_artifact_map[ 0 + j*8 + i] = hires_artifact_color_table[(c + 0) % hires_modulo];
+ m_hires_artifact_map[16 + j*8 + i] = hires_artifact_color_table[(c + 4) % hires_modulo];
}
}
/* Fix for Ivel Ultra */
- if (!strcmp(machine.system().name, "ivelultr")) {
- int len = machine.root_device().memregion("gfx1")->bytes();
+ if (!strcmp(machine().system().name, "ivelultr")) {
+ int len = machine().root_device().memregion("gfx1")->bytes();
for (i = 0; i < len; i++)
{
apple2_font[i] = BITSWAP8(apple2_font[i], 7, 7, 6, 5, 4, 3, 2, 1);
@@ -419,14 +414,14 @@ void apple2_video_start(running_machine &machine, const UINT8 *vram, const UINT8
}
/* do we need to flip the gfx? */
- if (!strcmp(machine.system().name, "apple2")
- || !strcmp(machine.system().name, "apple2p")
- || !strcmp(machine.system().name, "prav82")
- || !strcmp(machine.system().name, "prav8m")
- || !strcmp(machine.system().name, "ace100")
- || !strcmp(machine.system().name, "apple2jp"))
+ if (!strcmp(machine().system().name, "apple2")
+ || !strcmp(machine().system().name, "apple2p")
+ || !strcmp(machine().system().name, "prav82")
+ || !strcmp(machine().system().name, "prav8m")
+ || !strcmp(machine().system().name, "ace100")
+ || !strcmp(machine().system().name, "apple2jp"))
{
- int len = machine.root_device().memregion("gfx1")->bytes();
+ int len = machine().root_device().memregion("gfx1")->bytes();
for (i = 0; i < len; i++)
{
apple2_font[i] = BITSWAP8(apple2_font[i], 7, 0, 1, 2, 3, 4, 5, 6);
@@ -437,18 +432,18 @@ void apple2_video_start(running_machine &machine, const UINT8 *vram, const UINT8
/* build double hires artifact map */
for (i = 0; i < 16; i++)
{
- state->m_dhires_artifact_map[i] = dhires_artifact_color_table[i];
+ m_dhires_artifact_map[i] = dhires_artifact_color_table[i];
}
- memset(&state->m_old_a2, 0, sizeof(state->m_old_a2));
- state->m_a2_videomask = ~ignored_softswitches;
+ memset(&m_old_a2, 0, sizeof(m_old_a2));
+ m_a2_videomask = ~ignored_softswitches;
}
VIDEO_START_MEMBER(apple2_state,apple2)
{
- apple2_video_start(machine(), m_ram->pointer(), m_ram->pointer()+0x10000, VAR_80COL | VAR_ALTCHARSET | VAR_DHIRES, 4);
+ apple2_video_start(m_ram->pointer(), m_ram->pointer()+0x10000, VAR_80COL | VAR_ALTCHARSET | VAR_DHIRES, 4);
/* hack to fix the colors on apple2/apple2p */
m_fgcolor = 0;
@@ -460,7 +455,7 @@ VIDEO_START_MEMBER(apple2_state,apple2)
VIDEO_START_MEMBER(apple2_state,apple2p)
{
- apple2_video_start(machine(), m_ram->pointer(), m_ram->pointer(), VAR_80COL | VAR_ALTCHARSET | VAR_DHIRES, 8);
+ apple2_video_start(m_ram->pointer(), m_ram->pointer(), VAR_80COL | VAR_ALTCHARSET | VAR_DHIRES, 8);
/* hack to fix the colors on apple2/apple2p */
m_fgcolor = 0;
@@ -475,18 +470,18 @@ VIDEO_START_MEMBER(apple2_state,apple2e)
device_a2eauxslot_card_interface *auxslotdevice = m_a2eauxslot->get_a2eauxslot_card();
if (auxslotdevice)
{
- apple2_video_start(machine(), m_ram->pointer(), auxslotdevice->get_vram_ptr(), auxslotdevice->allow_dhr() ? 0 : VAR_DHIRES, 8);
+ apple2_video_start(m_ram->pointer(), auxslotdevice->get_vram_ptr(), auxslotdevice->allow_dhr() ? 0 : VAR_DHIRES, 8);
}
else
{
- apple2_video_start(machine(), m_ram->pointer(), m_ram->pointer(), VAR_80COL | VAR_DHIRES, 8);
+ apple2_video_start(m_ram->pointer(), m_ram->pointer(), VAR_80COL | VAR_DHIRES, 8);
}
}
VIDEO_START_MEMBER(apple2_state,apple2c)
{
- apple2_video_start(machine(), m_ram->pointer(), m_ram->pointer()+0x10000, 0, 8);
+ apple2_video_start(m_ram->pointer(), m_ram->pointer()+0x10000, 0, 8);
}
UINT32 apple2_state::screen_update_apple2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
@@ -498,7 +493,7 @@ UINT32 apple2_state::screen_update_apple2(screen_device &screen, bitmap_ind16 &b
m_flash = ((machine().time() * 4).seconds & 1) ? 1 : 0;
/* read out relevant softswitch variables; to see what has changed */
- new_a2 = effective_a2(this);
+ new_a2 = effective_a2();
if (new_a2 & VAR_80STORE)
new_a2 &= ~VAR_PAGE2;
new_a2 &= VAR_TEXT | VAR_MIXED | VAR_HIRES | VAR_DHIRES | VAR_80COL | VAR_PAGE2 | VAR_ALTCHARSET;
@@ -512,39 +507,39 @@ UINT32 apple2_state::screen_update_apple2(screen_device &screen, bitmap_ind16 &b
page = (new_a2 & VAR_PAGE2) ? 1 : 0;
/* choose the video mode to draw */
- if (effective_a2(this) & VAR_TEXT)
+ if (effective_a2() & VAR_TEXT)
{
/* text screen - TK2000 uses HGR for text */
if (m_machinetype == TK2000)
{
- apple2_hires_draw(machine(), bitmap, cliprect, page, 0, 191);
+ apple2_hires_draw(bitmap, cliprect, page, 0, 191);
}
else
{
- apple2_text_draw(machine(), bitmap, cliprect, page, 0, 191);
+ apple2_text_draw(bitmap, cliprect, page, 0, 191);
}
}
- else if ((effective_a2(this) & VAR_HIRES) && (effective_a2(this) & VAR_MIXED))
+ else if ((effective_a2() & VAR_HIRES) && (effective_a2() & VAR_MIXED))
{
/* hi-res on top; text at bottom */
- apple2_hires_draw(machine(), bitmap, cliprect, page, 0, 159);
- apple2_text_draw(machine(), bitmap, cliprect, page, 160, 191);
+ apple2_hires_draw(bitmap, cliprect, page, 0, 159);
+ apple2_text_draw(bitmap, cliprect, page, 160, 191);
}
- else if (effective_a2(this) & VAR_HIRES)
+ else if (effective_a2() & VAR_HIRES)
{
/* hi-res screen */
- apple2_hires_draw(machine(), bitmap, cliprect, page, 0, 191);
+ apple2_hires_draw(bitmap, cliprect, page, 0, 191);
}
- else if (effective_a2(this) & VAR_MIXED)
+ else if (effective_a2() & VAR_MIXED)
{
/* lo-res on top; text at bottom */
- apple2_lores_draw(machine(), bitmap, cliprect, page, 0, 159);
- apple2_text_draw(machine(), bitmap, cliprect, page, 160, 191);
+ apple2_lores_draw(bitmap, cliprect, page, 0, 159);
+ apple2_text_draw(bitmap, cliprect, page, 160, 191);
}
else
{
/* lo-res screen */
- apple2_lores_draw(machine(), bitmap, cliprect, page, 0, 191);
+ apple2_lores_draw(bitmap, cliprect, page, 0, 191);
}
return 0;
}
diff --git a/src/mess/video/apple2gs.c b/src/mess/video/apple2gs.c
index d80f28a07e4..f9d35936c3c 100644
--- a/src/mess/video/apple2gs.c
+++ b/src/mess/video/apple2gs.c
@@ -16,7 +16,7 @@
VIDEO_START_MEMBER(apple2gs_state,apple2gs)
{
m_bordercolor = 0;
- apple2_video_start(machine(), m_slowmem, m_slowmem+0x10000, 0, 8);
+ apple2_video_start(m_slowmem, m_slowmem+0x10000, 0, 8);
m_legacy_gfx = auto_bitmap_ind16_alloc(machine(), 560, 192);
state_save_register_item(machine(), "BORDERCLR", NULL, 0, m_bordercolor);
diff --git a/src/mess/video/apple3.c b/src/mess/video/apple3.c
index c7813168599..53f7319ad9a 100644
--- a/src/mess/video/apple3.c
+++ b/src/mess/video/apple3.c
@@ -37,10 +37,9 @@ static const UINT32 text_map[] =
};
-void apple3_write_charmem(running_machine &machine)
+void apple3_state::apple3_write_charmem()
{
- apple3_state *state = machine.driver_data<apple3_state>();
- address_space& space = state->m_maincpu->space(AS_PROGRAM);
+ address_space& space = m_maincpu->space(AS_PROGRAM);
static const UINT32 screen_hole_map[] =
{
0x478, 0x4f8, 0x578, 0x5f8, 0x678, 0x6f8, 0x778, 0x7f8
@@ -54,11 +53,11 @@ void apple3_write_charmem(running_machine &machine)
{
addr = 0x7f & space.read_byte(screen_hole_map[i] + 0x400 + j + 0);
val = space.read_byte(screen_hole_map[i] + j + 0);
- state->m_char_mem[((addr * 8) + ((i & 3) * 2) + 0) & 0x3ff] = val;
+ m_char_mem[((addr * 8) + ((i & 3) * 2) + 0) & 0x3ff] = val;
addr = 0x7f & space.read_byte(screen_hole_map[i] + 0x400 + j + 4);
val = space.read_byte(screen_hole_map[i] + j + 4);
- state->m_char_mem[((addr * 8) + ((i & 3) * 2) + 1) & 0x3ff] = val;
+ m_char_mem[((addr * 8) + ((i & 3) * 2) + 1) & 0x3ff] = val;
}
}
}
@@ -86,29 +85,28 @@ VIDEO_START_MEMBER(apple3_state,apple3)
-static void apple3_video_text40(running_machine &machine,bitmap_ind16 &bitmap)
+void apple3_state::apple3_video_text40(bitmap_ind16 &bitmap)
{
- apple3_state *state = machine.driver_data<apple3_state>();
int x, y, col, row;
offs_t offset;
UINT8 ch;
const UINT8 *char_data;
pen_t fg, bg, temp;
UINT16 *dest;
- UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer();
- UINT32 ram_size = machine.device<ram_device>(RAM_TAG)->size();
+ UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer();
+ UINT32 ram_size = machine().device<ram_device>(RAM_TAG)->size();
for (y = 0; y < 24; y++)
{
for (x = 0; x < 40; x++)
{
- offset = ram_size - 0x8000 + text_map[y] + x + (state->m_flags & VAR_VM2 ? 0x0400 : 0x0000);
+ offset = ram_size - 0x8000 + text_map[y] + x + (m_flags & VAR_VM2 ? 0x0400 : 0x0000);
ch = ram[offset];
- if (state->m_flags & VAR_VM0)
+ if (m_flags & VAR_VM0)
{
/* color text */
- offset = ram_size - 0x8000 + text_map[y] + x + (state->m_flags & VAR_VM2 ? 0x0000 : 0x0400);
+ offset = ram_size - 0x8000 + text_map[y] + x + (m_flags & VAR_VM2 ? 0x0000 : 0x0400);
bg = (ram[offset] >> 0) & 0x0F;
fg = (ram[offset] >> 4) & 0x0F;
}
@@ -127,7 +125,7 @@ static void apple3_video_text40(running_machine &machine,bitmap_ind16 &bitmap)
bg = temp;
}
- char_data = &state->m_char_mem[(ch & 0x7F) * 8];
+ char_data = &m_char_mem[(ch & 0x7F) * 8];
for (row = 0; row < 8; row++)
{
@@ -144,17 +142,16 @@ static void apple3_video_text40(running_machine &machine,bitmap_ind16 &bitmap)
-static void apple3_video_text80(running_machine &machine,bitmap_ind16 &bitmap)
+void apple3_state::apple3_video_text80(bitmap_ind16 &bitmap)
{
- apple3_state *state = machine.driver_data<apple3_state>();
int x, y, col, row;
offs_t offset;
UINT8 ch;
const UINT8 *char_data;
pen_t fg, bg;
UINT16 *dest;
- UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer();
- UINT32 ram_size = machine.device<ram_device>(RAM_TAG)->size();
+ UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer();
+ UINT32 ram_size = machine().device<ram_device>(RAM_TAG)->size();
for (y = 0; y < 24; y++)
{
@@ -164,7 +161,7 @@ static void apple3_video_text80(running_machine &machine,bitmap_ind16 &bitmap)
/* first character */
ch = ram[offset + 0x0000];
- char_data = &state->m_char_mem[(ch & 0x7F) * 8];
+ char_data = &m_char_mem[(ch & 0x7F) * 8];
fg = (ch & 0x80) ? GREEN : BLACK;
bg = (ch & 0x80) ? BLACK : GREEN;
@@ -179,7 +176,7 @@ static void apple3_video_text80(running_machine &machine,bitmap_ind16 &bitmap)
/* second character */
ch = ram[offset + 0x0400];
- char_data = &state->m_char_mem[(ch & 0x7F) * 8];
+ char_data = &m_char_mem[(ch & 0x7F) * 8];
fg = (ch & 0x80) ? GREEN : BLACK;
bg = (ch & 0x80) ? BLACK : GREEN;
@@ -197,22 +194,21 @@ static void apple3_video_text80(running_machine &machine,bitmap_ind16 &bitmap)
-static void apple3_video_graphics_hgr(running_machine &machine,bitmap_ind16 &bitmap)
+void apple3_state::apple3_video_graphics_hgr(bitmap_ind16 &bitmap)
{
- apple3_state *state = machine.driver_data<apple3_state>();
/* hi-res mode: 280x192x2 */
int y, i, x;
const UINT8 *pix_info;
UINT16 *ptr;
UINT8 b;
- UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer();
+ UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer();
for (y = 0; y < 192; y++)
{
- if (state->m_flags & VAR_VM2)
- pix_info = &ram[state->m_hgr_map[y]];
+ if (m_flags & VAR_VM2)
+ pix_info = &ram[m_hgr_map[y]];
else
- pix_info = &ram[state->m_hgr_map[y] - 0x2000];
+ pix_info = &ram[m_hgr_map[y] - 0x2000];
ptr = &bitmap.pix16(y);
for (i = 0; i < 40; i++)
@@ -231,7 +227,7 @@ static void apple3_video_graphics_hgr(running_machine &machine,bitmap_ind16 &bit
-static UINT8 swap_bits(UINT8 b)
+UINT8 apple3_state::swap_bits(UINT8 b)
{
return (b & 0x08 ? 0x01 : 0x00)
| (b & 0x04 ? 0x02 : 0x00)
@@ -241,9 +237,8 @@ static UINT8 swap_bits(UINT8 b)
-static void apple3_video_graphics_chgr(running_machine &machine,bitmap_ind16 &bitmap)
+void apple3_state::apple3_video_graphics_chgr(bitmap_ind16 &bitmap)
{
- apple3_state *state = machine.driver_data<apple3_state>();
/* color hi-res mode: 280x192x16 */
int y, i, x;
const UINT8 *pix_info;
@@ -251,19 +246,19 @@ static void apple3_video_graphics_chgr(running_machine &machine,bitmap_ind16 &bi
UINT16 *ptr;
UINT8 b;
UINT16 fgcolor, bgcolor;
- UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer();
+ UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer();
for (y = 0; y < 192; y++)
{
- if (state->m_flags & VAR_VM2)
+ if (m_flags & VAR_VM2)
{
- pix_info = &ram[state->m_hgr_map[y]];
- col_info = &ram[state->m_hgr_map[y] - 0x2000];
+ pix_info = &ram[m_hgr_map[y]];
+ col_info = &ram[m_hgr_map[y] - 0x2000];
}
else
{
- pix_info = &ram[state->m_hgr_map[y] - 0x2000];
- col_info = &ram[state->m_hgr_map[y]];
+ pix_info = &ram[m_hgr_map[y] - 0x2000];
+ col_info = &ram[m_hgr_map[y]];
}
ptr = &bitmap.pix16(y);
@@ -288,28 +283,27 @@ static void apple3_video_graphics_chgr(running_machine &machine,bitmap_ind16 &bi
-static void apple3_video_graphics_shgr(running_machine &machine,bitmap_ind16 &bitmap)
+void apple3_state::apple3_video_graphics_shgr(bitmap_ind16 &bitmap)
{
- apple3_state *state = machine.driver_data<apple3_state>();
/* super hi-res mode: 560x192x2 */
int y, i, x;
const UINT8 *pix_info1;
const UINT8 *pix_info2;
UINT16 *ptr;
UINT8 b1, b2;
- UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer();
+ UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer();
for (y = 0; y < 192; y++)
{
- if (state->m_flags & VAR_VM2)
+ if (m_flags & VAR_VM2)
{
- pix_info1 = &ram[state->m_hgr_map[y]];
- pix_info2 = &ram[state->m_hgr_map[y] + 0x2000];
+ pix_info1 = &ram[m_hgr_map[y]];
+ pix_info2 = &ram[m_hgr_map[y] + 0x2000];
}
else
{
- pix_info1 = &ram[state->m_hgr_map[y] - 0x2000];
- pix_info2 = &ram[state->m_hgr_map[y]];
+ pix_info1 = &ram[m_hgr_map[y] - 0x2000];
+ pix_info2 = &ram[m_hgr_map[y]];
}
ptr = &bitmap.pix16(y);
@@ -331,23 +325,22 @@ static void apple3_video_graphics_shgr(running_machine &machine,bitmap_ind16 &bi
-static void apple3_video_graphics_chires(running_machine &machine,bitmap_ind16 &bitmap)
+void apple3_state::apple3_video_graphics_chires(bitmap_ind16 &bitmap)
{
- apple3_state *state = machine.driver_data<apple3_state>();
UINT16 *pen;
PAIR pix;
int y, i;
- UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer();
+ UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer();
for (y = 0; y < 192; y++)
{
pen = &bitmap.pix16(y);
for (i = 0; i < 20; i++)
{
- pix.b.l = ram[state->m_hgr_map[y] - 0x2000 + (i * 2) + (state->m_flags & VAR_VM2 ? 1 : 0) + 0];
- pix.b.h = ram[state->m_hgr_map[y] - 0x0000 + (i * 2) + (state->m_flags & VAR_VM2 ? 1 : 0) + 0];
- pix.b.h2 = ram[state->m_hgr_map[y] - 0x2000 + (i * 2) + (state->m_flags & VAR_VM2 ? 1 : 0) + 1];
- pix.b.h3 = ram[state->m_hgr_map[y] - 0x0000 + (i * 2) + (state->m_flags & VAR_VM2 ? 1 : 0) + 1];
+ pix.b.l = ram[m_hgr_map[y] - 0x2000 + (i * 2) + (m_flags & VAR_VM2 ? 1 : 0) + 0];
+ pix.b.h = ram[m_hgr_map[y] - 0x0000 + (i * 2) + (m_flags & VAR_VM2 ? 1 : 0) + 0];
+ pix.b.h2 = ram[m_hgr_map[y] - 0x2000 + (i * 2) + (m_flags & VAR_VM2 ? 1 : 0) + 1];
+ pix.b.h3 = ram[m_hgr_map[y] - 0x0000 + (i * 2) + (m_flags & VAR_VM2 ? 1 : 0) + 1];
pen[ 0] = pen[ 1] = pen[ 2] = pen[ 3] = ((pix.d >> 0) & 0x0F);
pen[ 4] = pen[ 5] = pen[ 6] = pen[ 7] = ((pix.d >> 4) & 0x07) | ((pix.d >> 1) & 0x08);
@@ -369,28 +362,28 @@ UINT32 apple3_state::screen_update_apple3(screen_device &screen, bitmap_ind16 &b
{
case 0:
case VAR_VM0:
- apple3_video_text40(machine(),bitmap);
+ apple3_video_text40(bitmap);
break;
case VAR_VM1:
case VAR_VM1|VAR_VM0:
- apple3_video_text80(machine(),bitmap);
+ apple3_video_text80(bitmap);
break;
case VAR_VM3:
- apple3_video_graphics_hgr(machine(),bitmap); /* hgr mode */
+ apple3_video_graphics_hgr(bitmap); /* hgr mode */
break;
case VAR_VM3|VAR_VM0:
- apple3_video_graphics_chgr(machine(),bitmap);
+ apple3_video_graphics_chgr(bitmap);
break;
case VAR_VM3|VAR_VM1:
- apple3_video_graphics_shgr(machine(),bitmap);
+ apple3_video_graphics_shgr(bitmap);
break;
case VAR_VM3|VAR_VM1|VAR_VM0:
- apple3_video_graphics_chires(machine(),bitmap);
+ apple3_video_graphics_chires(bitmap);
break;
}
return 0;
diff --git a/src/mess/video/bbc.c b/src/mess/video/bbc.c
index 10779db8bbb..9b13c799a07 100644
--- a/src/mess/video/bbc.c
+++ b/src/mess/video/bbc.c
@@ -163,18 +163,18 @@ WRITE8_MEMBER(bbc_state::bbc_videoULA_w)
// VideoULA Internal Cursor controls
/*
-static void set_cursor(bbc_state *state)
+void bbc_state::set_cursor(bbc_state *state)
{
- state->m_cursor_state=state->m_VideoULA_CR?0:7;
+ m_cursor_state=m_VideoULA_CR?0:7;
}
-static void BBC_Clock_CR(bbc_state *state)
+void bbc_state::BBC_Clock_CR(bbc_state *state)
{
- if (state->m_VideoULA_CR)
+ if (m_VideoULA_CR)
{
- state->m_VideoULA_CR_counter-=1;
- if (state->m_VideoULA_CR_counter<=0) {
- state->m_VideoULA_CR=0;
+ m_VideoULA_CR_counter-=1;
+ if (m_VideoULA_CR_counter<=0) {
+ m_VideoULA_CR=0;
set_cursor(state);
}
}
@@ -395,27 +395,26 @@ static void BBC_draw_teletext(running_machine &machine);
-static void BBC_draw_teletext(running_machine &machine)
+void bbc_state::BBC_draw_teletext()
{
- bbc_state *state = machine.driver_data<bbc_state>();
//Teletext Latch bits 0 to 5 go to bits 0 to 5 on the Teletext chip
//Teletext Latch bit 6 is only passed onto bits 6 on the Teletext chip if DE is true
//Teletext Latch bit 7 goes to LOSE on the Teletext chip
- teletext_LOSE_w(state->m_saa505x, 0, (state->m_Teletext_Latch>>7)&1);
+ teletext_LOSE_w(m_saa505x, 0, (m_Teletext_Latch>>7)&1);
- teletext_F1(state->m_saa505x);
+ teletext_F1(m_saa505x);
- teletext_data_w(state->m_saa505x, 0, (state->m_Teletext_Latch&0x3f)|((state->m_Teletext_Latch&0x40)|(m6845_display_enabled_r(0)?0:0x40)));
+ teletext_data_w(m_saa505x, 0, (m_Teletext_Latch&0x3f)|((m_Teletext_Latch&0x40)|(m6845_display_enabled_r(0)?0:0x40)));
int meml=m6845_memory_address_r(0);
if (((meml>>13)&1)==0)
{
- state->m_Teletext_Latch=0;
+ m_Teletext_Latch=0;
} else {
- state->m_Teletext_Latch=(state->m_BBC_Video_RAM[calculate_video_address(state,meml)]&0x7f)|(m6845_display_enabled_r(0)?0x80:0);
+ m_Teletext_Latch=(m_BBC_Video_RAM[calculate_video_address(state,meml)]&0x7f)|(m6845_display_enabled_r(0)?0x80:0);
}
}
@@ -426,20 +425,20 @@ static void BBC_draw_teletext(running_machine &machine)
// This is the actual output of the Video ULA this fuction does all the output to the screen in the BBC emulator
-static void BBC_ula_drawpixel(bbc_state *state, int col, int number_of_pixels)
+void bbc_state::BBC_ula_drawpixel(bbc_state *state, int col, int number_of_pixels)
{
int pixel_count;
int pixel_temp;
- if ((state->m_BBC_display>=state->m_BBC_display_left) && ((state->m_BBC_display+number_of_pixels)<state->m_BBC_display_right))
+ if ((m_BBC_display>=m_BBC_display_left) && ((m_BBC_display+number_of_pixels)<m_BBC_display_right))
{
- pixel_temp=col^state->m_cursor_state;
+ pixel_temp=col^m_cursor_state;
for(pixel_count=0;pixel_count<number_of_pixels;pixel_count++)
{
- *(state->m_BBC_display++) = pixel_temp;
+ *(m_BBC_display++) = pixel_temp;
}
} else {
- state->m_BBC_display += number_of_pixels;
+ m_BBC_display += number_of_pixels;
}
}
@@ -463,9 +462,8 @@ static const struct m6845_interface BBC6845 =
-static void BBC_draw_hi_res(running_machine &machine)
+void bbc_state::BBC_draw_hi_res()
{
- bbc_state *state = machine.driver_data<bbc_state>();
int meml;
unsigned char i=0;
int sc1;
@@ -478,17 +476,17 @@ static void BBC_draw_hi_res(running_machine &machine)
// read the memory location for the next screen location.
meml=calculate_video_address(state,m6845_memory_address_r(0));
- i=state->m_BBC_Video_RAM[meml];
+ i=m_BBC_Video_RAM[meml];
- for(sc1=0;sc1<state->m_pixels_per_byte;sc1++)
+ for(sc1=0;sc1<m_pixels_per_byte;sc1++)
{
- BBC_ula_drawpixel(state, state->m_videoULA_pallet_lookup[state->m_pixel_bits[i]], state->m_emulation_pixels_per_real_pixel);
+ BBC_ula_drawpixel(state, m_videoULA_pallet_lookup[m_pixel_bits[i]], m_emulation_pixels_per_real_pixel);
i=(i<<1)|1;
}
} else {
// if the display is not enable, just draw a blank area.
- BBC_ula_drawpixel(state, 0, state->m_emulation_pixels_per_byte);
+ BBC_ula_drawpixel(state, 0, m_emulation_pixels_per_byte);
}
}
@@ -507,64 +505,61 @@ void bbc_draw_RGB_in(device_t *device, int offset,int data)
// called when the 6845 changes the HSync
-static void BBC_Set_HSync(running_machine &machine, int offset, int data)
+void bbc_state::BBC_Set_HSync(int offset, int data)
{
- bbc_state *state = machine.driver_data<bbc_state>();
// catch the falling edge
- if((!data)&&(state->m_BBC_HSync))
+ if((!data)&&(m_BBC_HSync))
{
- state->m_y_screen_pos+=1;
+ m_y_screen_pos+=1;
- if ((state->m_y_screen_pos>=0) && (state->m_y_screen_pos<300))
+ if ((m_y_screen_pos>=0) && (m_y_screen_pos<300))
{
- state->m_BBC_display_left = &state->m_BBC_bitmap->pix16(state->m_y_screen_pos);
- state->m_BBC_display_right = state->m_BBC_display_left + 800;
+ m_BBC_display_left = &m_BBC_bitmap->pix16(m_y_screen_pos);
+ m_BBC_display_right = m_BBC_display_left + 800;
} else {
- state->m_BBC_display_left = &state->m_BBC_bitmap->pix16(0);
- state->m_BBC_display_right = state->m_BBC_display_left;
+ m_BBC_display_left = &m_BBC_bitmap->pix16(0);
+ m_BBC_display_right = m_BBC_display_left;
}
- state->m_BBC_display = state->m_BBC_display_left + state->m_x_screen_offset;
+ m_BBC_display = m_BBC_display_left + m_x_screen_offset;
}
- state->m_BBC_HSync=data;
+ m_BBC_HSync=data;
}
// called when the 6845 changes the VSync
-static void BBC_Set_VSync(running_machine &machine, int offset, int data)
+void bbc_state::BBC_Set_VSync(int offset, int data)
{
- bbc_state *state = machine.driver_data<bbc_state>();
// catch the falling edge
- if ((!data)&&(state->m_BBC_VSync))
+ if ((!data)&&(m_BBC_VSync))
{
- state->m_y_screen_pos=state->m_y_screen_offset;
+ m_y_screen_pos=m_y_screen_offset;
- if ((state->m_y_screen_pos>=0) && (state->m_y_screen_pos<300))
+ if ((m_y_screen_pos>=0) && (m_y_screen_pos<300))
{
- state->m_BBC_display_left = &state->m_BBC_bitmap->pix16(state->m_y_screen_pos);
- state->m_BBC_display_right = state->m_BBC_display_left + 800;
+ m_BBC_display_left = &m_BBC_bitmap->pix16(m_y_screen_pos);
+ m_BBC_display_right = m_BBC_display_left + 800;
} else {
- state->m_BBC_display_left = &state->m_BBC_bitmap->pix16(0);
- state->m_BBC_display_right = state->m_BBC_display_left;
+ m_BBC_display_left = &m_BBC_bitmap->pix16(0);
+ m_BBC_display_right = m_BBC_display_left;
}
- state->m_BBC_display = state->m_BBC_display_left + state->m_x_screen_offset;
+ m_BBC_display = m_BBC_display_left + m_x_screen_offset;
- teletext_DEW(state->m_saa505x);
+ teletext_DEW(m_saa505x);
}
- state->m_BBC_VSync=data;
+ m_BBC_VSync=data;
}
// called when the 6845 changes the Cursor Enabled
-static void BBC_Set_CRE(running_machine &machine, int offset, int data)
+void bbc_state::BBC_Set_CRE(int offset, int data)
{
- bbc_state *state = machine.driver_data<bbc_state>();
if (data&2) {
- state->m_VideoULA_CR_counter=state->m_emulation_cursor_size;
- state->m_VideoULA_CR=1;
+ m_VideoULA_CR_counter=m_emulation_cursor_size;
+ m_VideoULA_CR=1;
// set the pallet on
if (data&1) set_cursor(state);
}
@@ -651,7 +646,7 @@ UINT32 bbc_state::screen_update_bbc(screen_device &screen, bitmap_ind16 &bitmap,
return 0;
}
-void bbc_frameclock(running_machine &machine)
+void bbc_state::bbc_frameclock()
{
m6845_frameclock();
}
diff --git a/src/mess/video/cgenie.c b/src/mess/video/cgenie.c
index 14cb56f36ea..2147e477d19 100644
--- a/src/mess/video/cgenie.c
+++ b/src/mess/video/cgenie.c
@@ -32,24 +32,24 @@ void cgenie_state::video_start()
current register settings of the 6845 CRTC
***************************************************************************/
-static void cgenie_offset_xy(cgenie_state *state)
+void cgenie_state::cgenie_offset_xy()
{
- if( state->m_crt.horizontal_sync_pos )
- state->m_off_x = state->m_crt.horizontal_total - state->m_crt.horizontal_sync_pos - 14;
+ if( m_crt.horizontal_sync_pos )
+ m_off_x = m_crt.horizontal_total - m_crt.horizontal_sync_pos - 14;
else
- state->m_off_x = -15;
+ m_off_x = -15;
- state->m_off_y = (state->m_crt.vertical_total - state->m_crt.vertical_sync_pos) *
- (state->m_crt.scan_lines + 1) + state->m_crt.vertical_adjust
+ m_off_y = (m_crt.vertical_total - m_crt.vertical_sync_pos) *
+ (m_crt.scan_lines + 1) + m_crt.vertical_adjust
- 32;
- if( state->m_off_y < 0 )
- state->m_off_y = 0;
+ if( m_off_y < 0 )
+ m_off_y = 0;
- if( state->m_off_y > 128 )
- state->m_off_y = 128;
+ if( m_off_y > 128 )
+ m_off_y = 128;
-// logerror("cgenie offset x:%d y:%d\n", state->m_off_x, state->m_off_y);
+// logerror("cgenie offset x:%d y:%d\n", m_off_x, m_off_y);
}
@@ -67,7 +67,7 @@ WRITE8_HANDLER ( cgenie_register_w )
if( state->m_crt.horizontal_total == data )
break;
state->m_crt.horizontal_total = data;
- cgenie_offset_xy(state);
+ state->cgenie_offset_xy();
break;
case 1:
if( state->m_crt.horizontal_displayed == data )
@@ -78,7 +78,7 @@ WRITE8_HANDLER ( cgenie_register_w )
if( state->m_crt.horizontal_sync_pos == data )
break;
state->m_crt.horizontal_sync_pos = data;
- cgenie_offset_xy(state);
+ state->cgenie_offset_xy();
break;
case 3:
state->m_crt.horizontal_length = data;
@@ -87,13 +87,13 @@ WRITE8_HANDLER ( cgenie_register_w )
if( state->m_crt.vertical_total == data )
break;
state->m_crt.vertical_total = data;
- cgenie_offset_xy(state);
+ state->cgenie_offset_xy();
break;
case 5:
if( state->m_crt.vertical_adjust == data )
break;
state->m_crt.vertical_adjust = data;
- cgenie_offset_xy(state);
+ state->cgenie_offset_xy();
break;
case 6:
if( state->m_crt.vertical_displayed == data )
@@ -104,7 +104,7 @@ WRITE8_HANDLER ( cgenie_register_w )
if( state->m_crt.vertical_sync_pos == data )
break;
state->m_crt.vertical_sync_pos = data;
- cgenie_offset_xy(state);
+ state->cgenie_offset_xy();
break;
case 8:
state->m_crt.crt_mode = data;
@@ -114,7 +114,7 @@ WRITE8_HANDLER ( cgenie_register_w )
if( state->m_crt.scan_lines == data )
break;
state->m_crt.scan_lines = data;
- cgenie_offset_xy(state);
+ state->cgenie_offset_xy();
break;
case 10:
if( state->m_crt.cursor_top == data )
@@ -167,52 +167,51 @@ WRITE8_HANDLER ( cgenie_index_w )
/***************************************************************************
Read from an indexed register of the 6845 CRTC
***************************************************************************/
- READ8_HANDLER ( cgenie_register_r )
+READ8_HANDLER ( cgenie_register_r )
{
cgenie_state *state = space.machine().driver_data<cgenie_state>();
- return cgenie_get_register(space.machine(), state->m_crt.idx);
+ return state->cgenie_get_register(state->m_crt.idx);
}
/***************************************************************************
Read from a register of the 6845 CRTC
***************************************************************************/
-int cgenie_get_register(running_machine &machine, int indx)
+int cgenie_state::cgenie_get_register(int indx)
{
- cgenie_state *state = machine.driver_data<cgenie_state>();
switch (indx)
{
case 0:
- return state->m_crt.horizontal_total;
+ return m_crt.horizontal_total;
case 1:
- return state->m_crt.horizontal_displayed;
+ return m_crt.horizontal_displayed;
case 2:
- return state->m_crt.horizontal_sync_pos;
+ return m_crt.horizontal_sync_pos;
case 3:
- return state->m_crt.horizontal_length;
+ return m_crt.horizontal_length;
case 4:
- return state->m_crt.vertical_total;
+ return m_crt.vertical_total;
case 5:
- return state->m_crt.vertical_adjust;
+ return m_crt.vertical_adjust;
case 6:
- return state->m_crt.vertical_displayed;
+ return m_crt.vertical_displayed;
case 7:
- return state->m_crt.vertical_sync_pos;
+ return m_crt.vertical_sync_pos;
case 8:
- return state->m_crt.crt_mode;
+ return m_crt.crt_mode;
case 9:
- return state->m_crt.scan_lines;
+ return m_crt.scan_lines;
case 10:
- return state->m_crt.cursor_top;
+ return m_crt.cursor_top;
case 11:
- return state->m_crt.cursor_bottom;
+ return m_crt.cursor_bottom;
case 12:
- return state->m_crt.screen_address_hi;
+ return m_crt.screen_address_hi;
case 13:
- return state->m_crt.screen_address_lo;
+ return m_crt.screen_address_lo;
case 14:
- return state->m_crt.cursor_address_hi;
+ return m_crt.cursor_address_hi;
case 15:
- return state->m_crt.cursor_address_lo;
+ return m_crt.cursor_address_lo;
}
return 0;
}
@@ -229,27 +228,25 @@ int cgenie_get_register(running_machine &machine, int indx)
/***************************************************************************
Switch mode between character generator and graphics
***************************************************************************/
-void cgenie_mode_select(running_machine &machine, int mode)
+void cgenie_state::cgenie_mode_select(int mode)
{
- cgenie_state *state = machine.driver_data<cgenie_state>();
- state->m_graphics = (mode) ? 1 : 0;
+ m_graphics = (mode) ? 1 : 0;
}
-static void cgenie_refresh_monitor(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
+void cgenie_state::cgenie_refresh_monitor(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- cgenie_state *state = machine.driver_data<cgenie_state>();
- UINT8 *videoram = state->m_videoram;
+ UINT8 *videoram = m_videoram;
int i, address, offset, cursor, size, code, x, y;
rectangle r;
- bitmap.fill(get_black_pen(machine), cliprect);
+ bitmap.fill(get_black_pen(machine()), cliprect);
- if(state->m_crt.vertical_displayed || state->m_crt.horizontal_displayed)
+ if(m_crt.vertical_displayed || m_crt.horizontal_displayed)
{
- offset = 256 * state->m_crt.screen_address_hi + state->m_crt.screen_address_lo;
- size = state->m_crt.horizontal_displayed * state->m_crt.vertical_displayed;
- cursor = 256 * state->m_crt.cursor_address_hi + state->m_crt.cursor_address_lo;
+ offset = 256 * m_crt.screen_address_hi + m_crt.screen_address_lo;
+ size = m_crt.horizontal_displayed * m_crt.vertical_displayed;
+ cursor = 256 * m_crt.cursor_address_hi + m_crt.cursor_address_lo;
/*
* for every character in the Video RAM, check if it has been modified since
@@ -258,19 +255,19 @@ static void cgenie_refresh_monitor(running_machine &machine, bitmap_ind16 &bitma
for( address = 0; address < size; address++ )
{
i = (offset + address) & 0x3fff;
- x = address % state->m_crt.horizontal_displayed + state->m_off_x;
- y = address / state->m_crt.horizontal_displayed;
+ x = address % m_crt.horizontal_displayed + m_off_x;
+ y = address / m_crt.horizontal_displayed;
r.min_x = x * 8;
r.max_x = r.min_x + 7;
- r.min_y = y * (state->m_crt.scan_lines + 1) + state->m_off_y;
- r.max_y = r.min_y + state->m_crt.scan_lines;
+ r.min_y = y * (m_crt.scan_lines + 1) + m_off_y;
+ r.max_y = r.min_y + m_crt.scan_lines;
- if( state->m_graphics )
+ if( m_graphics )
{
/* get graphics code */
code = videoram[i];
- drawgfx_opaque(bitmap, r, machine.gfx[1], code, 0,
+ drawgfx_opaque(bitmap, r, machine().gfx[1], code, 0,
0, 0, r.min_x, r.min_y);
}
else
@@ -279,8 +276,8 @@ static void cgenie_refresh_monitor(running_machine &machine, bitmap_ind16 &bitma
code = videoram[i];
/* translate defined character sets */
- code += state->m_font_offset[(code >> 6) & 3];
- drawgfx_opaque(bitmap, r, machine.gfx[0], code, state->m_colorram[i&0x3ff],
+ code += m_font_offset[(code >> 6) & 3];
+ drawgfx_opaque(bitmap, r, machine().gfx[0], code, m_colorram[i&0x3ff],
0, 0, r.min_x, r.min_y);
}
@@ -289,48 +286,47 @@ static void cgenie_refresh_monitor(running_machine &machine, bitmap_ind16 &bitma
rectangle rc;
/* check if cursor turned off */
- if( (state->m_crt.cursor_top & 0x60) == 0x20 )
+ if( (m_crt.cursor_top & 0x60) == 0x20 )
continue;
- if( (state->m_crt.cursor_top & 0x60) == 0x60 )
+ if( (m_crt.cursor_top & 0x60) == 0x60 )
{
- state->m_crt.cursor_visible = 1;
+ m_crt.cursor_visible = 1;
}
else
{
- state->m_crt.cursor_phase++;
- state->m_crt.cursor_visible = (state->m_crt.cursor_phase >> 3) & 1;
+ m_crt.cursor_phase++;
+ m_crt.cursor_visible = (m_crt.cursor_phase >> 3) & 1;
}
- if( !state->m_crt.cursor_visible )
+ if( !m_crt.cursor_visible )
continue;
rc.min_x = r.min_x;
rc.max_x = r.max_x;
- rc.min_y = r.min_y + (state->m_crt.cursor_top & 15);
- rc.max_y = r.min_y + (state->m_crt.cursor_bottom & 15);
- drawgfx_opaque(bitmap, rc, machine.gfx[0], 0x7f, state->m_colorram[i&0x3ff],
+ rc.min_y = r.min_y + (m_crt.cursor_top & 15);
+ rc.max_y = r.min_y + (m_crt.cursor_bottom & 15);
+ drawgfx_opaque(bitmap, rc, machine().gfx[0], 0x7f, m_colorram[i&0x3ff],
0, 0, rc.min_x, rc.min_y);
}
}
}
}
-static void cgenie_refresh_tv_set(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
+void cgenie_state::cgenie_refresh_tv_set(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- cgenie_state *state = machine.driver_data<cgenie_state>();
- UINT8 *videoram = state->m_videoram;
+ UINT8 *videoram = m_videoram;
int i, address, offset, cursor, size, code, x, y;
rectangle r;
- state->m_bitmap.fill(get_black_pen(machine), cliprect);
- state->m_dlybitmap.fill(get_black_pen(machine), cliprect);
+ m_bitmap.fill(get_black_pen(machine()), cliprect);
+ m_dlybitmap.fill(get_black_pen(machine()), cliprect);
- if(state->m_crt.vertical_displayed || state->m_crt.horizontal_displayed)
+ if(m_crt.vertical_displayed || m_crt.horizontal_displayed)
{
- offset = 256 * state->m_crt.screen_address_hi + state->m_crt.screen_address_lo;
- size = state->m_crt.horizontal_displayed * state->m_crt.vertical_displayed;
- cursor = 256 * state->m_crt.cursor_address_hi + state->m_crt.cursor_address_lo;
+ offset = 256 * m_crt.screen_address_hi + m_crt.screen_address_lo;
+ size = m_crt.horizontal_displayed * m_crt.vertical_displayed;
+ cursor = 256 * m_crt.cursor_address_hi + m_crt.cursor_address_lo;
/*
* for every character in the Video RAM, check if it has been modified since
@@ -339,21 +335,21 @@ static void cgenie_refresh_tv_set(running_machine &machine, bitmap_ind16 &bitmap
for( address = 0; address < size; address++ )
{
i = (offset + address) & 0x3fff;
- x = address % state->m_crt.horizontal_displayed + state->m_off_x;
- y = address / state->m_crt.horizontal_displayed;
+ x = address % m_crt.horizontal_displayed + m_off_x;
+ y = address / m_crt.horizontal_displayed;
r.min_x = x * 8;
r.max_x = r.min_x + 7;
- r.min_y = y * (state->m_crt.scan_lines + 1) + state->m_off_y;
- r.max_y = r.min_y + state->m_crt.scan_lines;
+ r.min_y = y * (m_crt.scan_lines + 1) + m_off_y;
+ r.max_y = r.min_y + m_crt.scan_lines;
- if( state->m_graphics )
+ if( m_graphics )
{
/* get graphics code */
code = videoram[i];
- drawgfx_opaque(state->m_bitmap, r, machine.gfx[1], code, 1,
+ drawgfx_opaque(m_bitmap, r, machine().gfx[1], code, 1,
0, 0, r.min_x, r.min_y);
- drawgfx_opaque(state->m_dlybitmap, r, machine.gfx[1], code, 2,
+ drawgfx_opaque(m_dlybitmap, r, machine().gfx[1], code, 2,
0, 0, r.min_x, r.min_y);
}
else
@@ -362,10 +358,10 @@ static void cgenie_refresh_tv_set(running_machine &machine, bitmap_ind16 &bitmap
code = videoram[i];
/* translate defined character sets */
- code += state->m_font_offset[(code >> 6) & 3];
- drawgfx_opaque(state->m_bitmap, r, machine.gfx[0], code, state->m_colorram[i&0x3ff] + 16,
+ code += m_font_offset[(code >> 6) & 3];
+ drawgfx_opaque(m_bitmap, r, machine().gfx[0], code, m_colorram[i&0x3ff] + 16,
0, 0, r.min_x, r.min_y);
- drawgfx_opaque(state->m_dlybitmap, r, machine.gfx[0], code, state->m_colorram[i&0x3ff] + 32,
+ drawgfx_opaque(m_dlybitmap, r, machine().gfx[0], code, m_colorram[i&0x3ff] + 32,
0, 0, r.min_x, r.min_y);
}
@@ -374,37 +370,37 @@ static void cgenie_refresh_tv_set(running_machine &machine, bitmap_ind16 &bitmap
rectangle rc;
/* check if cursor turned off */
- if( (state->m_crt.cursor_top & 0x60) == 0x20 )
+ if( (m_crt.cursor_top & 0x60) == 0x20 )
continue;
- if( (state->m_crt.cursor_top & 0x60) == 0x60 )
+ if( (m_crt.cursor_top & 0x60) == 0x60 )
{
- state->m_crt.cursor_visible = 1;
+ m_crt.cursor_visible = 1;
}
else
{
- state->m_crt.cursor_phase++;
- state->m_crt.cursor_visible = (state->m_crt.cursor_phase >> 3) & 1;
+ m_crt.cursor_phase++;
+ m_crt.cursor_visible = (m_crt.cursor_phase >> 3) & 1;
}
- if( !state->m_crt.cursor_visible )
+ if( !m_crt.cursor_visible )
continue;
rc.min_x = r.min_x;
rc.max_x = r.max_x;
- rc.min_y = r.min_y + (state->m_crt.cursor_top & 15);
- rc.max_y = r.min_y + (state->m_crt.cursor_bottom & 15);
+ rc.min_y = r.min_y + (m_crt.cursor_top & 15);
+ rc.max_y = r.min_y + (m_crt.cursor_bottom & 15);
- drawgfx_opaque(state->m_bitmap, rc, machine.gfx[0], 0x7f, state->m_colorram[i&0x3ff] + 16,
+ drawgfx_opaque(m_bitmap, rc, machine().gfx[0], 0x7f, m_colorram[i&0x3ff] + 16,
0, 0, rc.min_x, rc.min_y);
- drawgfx_opaque(state->m_dlybitmap, rc, machine.gfx[0], 0x7f, state->m_colorram[i&0x3ff] + 32,
+ drawgfx_opaque(m_dlybitmap, rc, machine().gfx[0], 0x7f, m_colorram[i&0x3ff] + 32,
0, 0, rc.min_x, rc.min_y);
}
}
}
- copybitmap(bitmap, state->m_bitmap, 0, 0, 0, 0, cliprect);
- copybitmap_trans(bitmap, state->m_dlybitmap, 0, 0, 1, 0, cliprect, 0);
+ copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect);
+ copybitmap_trans(bitmap, m_dlybitmap, 0, 0, 1, 0, cliprect, 0);
}
/***************************************************************************
@@ -413,8 +409,8 @@ static void cgenie_refresh_tv_set(running_machine &machine, bitmap_ind16 &bitmap
UINT32 cgenie_state::screen_update_cgenie(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
if( m_tv_mode )
- cgenie_refresh_tv_set(machine(), bitmap, cliprect);
+ cgenie_refresh_tv_set(bitmap, cliprect);
else
- cgenie_refresh_monitor(machine(), bitmap, cliprect);
+ cgenie_refresh_monitor(bitmap, cliprect);
return 0;
}
diff --git a/src/mess/video/channelf.c b/src/mess/video/channelf.c
index 20c181b33a9..7f83190ade4 100644
--- a/src/mess/video/channelf.c
+++ b/src/mess/video/channelf.c
@@ -39,7 +39,7 @@ void channelf_state::video_start()
m_p_videoram = memregion("vram")->base();
}
-static int recalc_palette_offset(int reg1, int reg2)
+int channelf_state::recalc_palette_offset(int reg1, int reg2)
{
/* Note: This is based on the decoding they used to */
/* determine which palette this line is using */
diff --git a/src/mess/video/dgn_beta.c b/src/mess/video/dgn_beta.c
index 6929f958a18..a93ee936855 100644
--- a/src/mess/video/dgn_beta.c
+++ b/src/mess/video/dgn_beta.c
@@ -253,7 +253,7 @@ WRITE_LINE_MEMBER(dgn_beta_state::dgnbeta_vsync_changed)
}
}
- dgn_beta_frame_interrupt(machine(), state);
+ dgn_beta_frame_interrupt(state);
}
MC6845_INTERFACE( dgnbeta_crtc6845_interface )
@@ -287,10 +287,9 @@ MC6845_INTERFACE( dgnbeta_crtc6845_interface )
/* 6821-I28, this allows the 6845 to access the full 64K address range, however */
/* since the ram data is addressed as a 16bit wide unit, this allows the 6845 */
/* access to the first 128K or ram. */
-void dgnbeta_vid_set_gctrl(running_machine &machine, int data)
+void dgn_beta_state::dgnbeta_vid_set_gctrl(int data)
{
- dgn_beta_state *state = machine.driver_data<dgn_beta_state>();
- state->m_GCtrl=data;
+ m_GCtrl=data;
}
diff --git a/src/mess/video/electron.c b/src/mess/video/electron.c
index 00f367e1d33..3d854a6e709 100644
--- a/src/mess/video/electron.c
+++ b/src/mess/video/electron.c
@@ -49,12 +49,12 @@ void electron_state::video_start()
m_scanline_timer->adjust( machine().primary_screen->time_until_pos(0), 0, machine().primary_screen->scan_period() );
}
-INLINE UINT8 read_vram( electron_state *state, UINT16 addr )
+inline UINT8 electron_state::read_vram( UINT16 addr )
{
- return state->m_ula.vram[ addr % state->m_ula.screen_size ];
+ return m_ula.vram[ addr % m_ula.screen_size ];
}
-INLINE void electron_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color)
+inline void electron_state::electron_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color)
{
bitmap.pix16(y, x) = (UINT16)color;
}
@@ -92,7 +92,7 @@ UINT32 electron_state::screen_update_electron(screen_device &screen, bitmap_ind1
case 0:
for( i = 0; i < 80; i++ )
{
- UINT8 pattern = read_vram( this, m_ula.screen_addr + (i << 3) );
+ UINT8 pattern = read_vram( m_ula.screen_addr + (i << 3) );
electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>7)& 1] );
electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>6)& 1] );
electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>5)& 1] );
@@ -110,7 +110,7 @@ UINT32 electron_state::screen_update_electron(screen_device &screen, bitmap_ind1
case 1:
for( i = 0; i < 80; i++ )
{
- UINT8 pattern = read_vram( this, m_ula.screen_addr + i * 8 );
+ UINT8 pattern = read_vram( m_ula.screen_addr + i * 8 );
electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>3]] );
electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>3]] );
electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>2]] );
@@ -128,7 +128,7 @@ UINT32 electron_state::screen_update_electron(screen_device &screen, bitmap_ind1
case 2:
for( i = 0; i < 80; i++ )
{
- UINT8 pattern = read_vram( this, m_ula.screen_addr + i * 8 );
+ UINT8 pattern = read_vram( m_ula.screen_addr + i * 8 );
electron_plot_pixel( bitmap, x++, scanline, pal[m_map16[pattern>>1]] );
electron_plot_pixel( bitmap, x++, scanline, pal[m_map16[pattern>>1]] );
electron_plot_pixel( bitmap, x++, scanline, pal[m_map16[pattern>>1]] );
@@ -150,7 +150,7 @@ UINT32 electron_state::screen_update_electron(screen_device &screen, bitmap_ind1
{
for( i = 0; i < 80; i++ )
{
- UINT8 pattern = read_vram( this, m_ula.screen_addr + i * 8 );
+ UINT8 pattern = read_vram( m_ula.screen_addr + i * 8 );
electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>7)&1] );
electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>6)&1] );
electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>5)&1] );
@@ -170,7 +170,7 @@ UINT32 electron_state::screen_update_electron(screen_device &screen, bitmap_ind1
case 7:
for( i = 0; i < 40; i++ )
{
- UINT8 pattern = read_vram( this, m_ula.screen_addr + i * 8 );
+ UINT8 pattern = read_vram( m_ula.screen_addr + i * 8 );
electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>7)&1] );
electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>7)&1] );
electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>6)&1] );
@@ -196,7 +196,7 @@ UINT32 electron_state::screen_update_electron(screen_device &screen, bitmap_ind1
case 5:
for( i = 0; i < 40; i++ )
{
- UINT8 pattern = read_vram( this, m_ula.screen_addr + i * 8 );
+ UINT8 pattern = read_vram( m_ula.screen_addr + i * 8 );
electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>3]] );
electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>3]] );
electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>3]] );
@@ -226,7 +226,7 @@ UINT32 electron_state::screen_update_electron(screen_device &screen, bitmap_ind1
{
for( i = 0; i < 40; i++ )
{
- UINT8 pattern = read_vram( this, m_ula.screen_addr + i * 8 );
+ UINT8 pattern = read_vram( m_ula.screen_addr + i * 8 );
electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>7)&1] );
electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>7)&1] );
electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>6)&1] );
@@ -259,10 +259,10 @@ TIMER_CALLBACK_MEMBER(electron_state::electron_scanline_interrupt)
switch (machine().primary_screen->vpos())
{
case 43:
- electron_interrupt_handler( machine(), INT_SET, INT_RTC );
+ electron_interrupt_handler( INT_SET, INT_RTC );
break;
case 199:
- electron_interrupt_handler( machine(), INT_SET, INT_DISPLAY_END );
+ electron_interrupt_handler( INT_SET, INT_DISPLAY_END );
break;
case 0:
m_ula.screen_addr = m_ula.screen_start - m_ula.screen_base;
diff --git a/src/mess/video/fm7.c b/src/mess/video/fm7.c
index 6279710ce90..126623ecb53 100644
--- a/src/mess/video/fm7.c
+++ b/src/mess/video/fm7.c
@@ -99,7 +99,7 @@ TIMER_CALLBACK_MEMBER(fm7_state::fm77av_alu_task_end)
m_alu.busy = 0;
}
-static void fm7_alu_mask_write(fm7_state *state, UINT32 offset, int bank, UINT8 dat)
+void fm7_state::fm7_alu_mask_write(UINT32 offset, int bank, UINT8 dat)
{
UINT8 temp;
int page = 0;
@@ -107,28 +107,28 @@ static void fm7_alu_mask_write(fm7_state *state, UINT32 offset, int bank, UINT8
if(offset >= 0xc000)
page = 1;
- if((state->m_alu.command & 0x40) == 0)
+ if((m_alu.command & 0x40) == 0)
{ // "always" write mode
- state->m_video_ram[(offset & 0x3fff) + (bank * 0x4000) + (page * 0xc000)] = dat;
+ m_video_ram[(offset & 0x3fff) + (bank * 0x4000) + (page * 0xc000)] = dat;
return;
}
- temp = state->m_video_ram[(offset & 0x3fff) + (bank * 0x4000) + (page * 0xc000)];
- if(state->m_alu.command & 0x20)
+ temp = m_video_ram[(offset & 0x3fff) + (bank * 0x4000) + (page * 0xc000)];
+ if(m_alu.command & 0x20)
{ // "not equal" write mode
- temp &= state->m_alu.compare_data;
- dat &= ~state->m_alu.compare_data;
+ temp &= m_alu.compare_data;
+ dat &= ~m_alu.compare_data;
}
else
{ // "equal" write mode
- temp &= ~state->m_alu.compare_data;
- dat &= state->m_alu.compare_data;
+ temp &= ~m_alu.compare_data;
+ dat &= m_alu.compare_data;
}
- state->m_video_ram[(offset & 0x3fff) + (bank * 0x4000) + (page * 0xc000)] = temp | dat;
+ m_video_ram[(offset & 0x3fff) + (bank * 0x4000) + (page * 0xc000)] = temp | dat;
}
-static void fm7_alu_function_compare(fm7_state *state, UINT32 offset)
+void fm7_state::fm7_alu_function_compare(UINT32 offset)
{
// COMPARE - compares which colors match those in the compare registers
// can be used on its own, or when bit 6 of the command register is high.
@@ -145,16 +145,16 @@ static void fm7_alu_function_compare(fm7_state *state, UINT32 offset)
if(offset >= 0xc000)
{
page = 1;
- offset += state->m_video.vram_offset2;
+ offset += m_video.vram_offset2;
}
else
- offset += state->m_video.vram_offset;
+ offset += m_video.vram_offset;
- blue = state->m_video_ram[(offset & 0x3fff) + (page * 0xc000)];
- red = state->m_video_ram[(offset & 0x3fff) + 0x4000 + (page * 0xc000)];
- green = state->m_video_ram[(offset & 0x3fff) + 0x8000 + (page * 0xc000)];
+ blue = m_video_ram[(offset & 0x3fff) + (page * 0xc000)];
+ red = m_video_ram[(offset & 0x3fff) + 0x4000 + (page * 0xc000)];
+ green = m_video_ram[(offset & 0x3fff) + 0x8000 + (page * 0xc000)];
- banks = (~state->m_alu.bank_disable) & 0x07;
+ banks = (~m_alu.bank_disable) & 0x07;
for(x=0;x<8;x++) // loop through each pixel
{
@@ -169,9 +169,9 @@ static void fm7_alu_function_compare(fm7_state *state, UINT32 offset)
match = 0;
for(y=0;y<8;y++) // loop through each compare register
{
- if(!(state->m_alu.compare[y] & 0x80)) // don't compare if register is masked
+ if(!(m_alu.compare[y] & 0x80)) // don't compare if register is masked
{
- if((state->m_alu.compare[y] & banks) == (colour & banks))
+ if((m_alu.compare[y] & banks) == (colour & banks))
match = 1;
}
}
@@ -180,10 +180,10 @@ static void fm7_alu_function_compare(fm7_state *state, UINT32 offset)
bit >>= 1;
}
- state->m_alu.compare_data = dat;
+ m_alu.compare_data = dat;
}
-static void fm7_alu_function_pset(fm7_state *state, UINT32 offset)
+void fm7_state::fm7_alu_function_pset(UINT32 offset)
{
// PSET - simply sets the pixels to the selected logical colour
int x;
@@ -191,192 +191,192 @@ static void fm7_alu_function_pset(fm7_state *state, UINT32 offset)
int page = 0;
UINT8 mask;
- if(state->m_alu.command & 0x40)
- fm7_alu_function_compare(state, offset);
+ if(m_alu.command & 0x40)
+ fm7_alu_function_compare(offset);
if(offset >= 0xc000)
{
page = 1;
- offset += state->m_video.vram_offset2;
+ offset += m_video.vram_offset2;
}
else
- offset += state->m_video.vram_offset;
+ offset += m_video.vram_offset;
for(x=0;x<3;x++) // cycle through banks
{
- if(!(state->m_alu.bank_disable & (1 << x)))
+ if(!(m_alu.bank_disable & (1 << x)))
{
- if(state->m_alu.lcolour & (1 << x))
+ if(m_alu.lcolour & (1 << x))
dat = 0xff;
else
dat = 0;
- mask = (state->m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]) & state->m_alu.mask;
- dat &= ~state->m_alu.mask;
+ mask = (m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]) & m_alu.mask;
+ dat &= ~m_alu.mask;
dat |= mask;
- fm7_alu_mask_write(state, offset,x,dat);
+ fm7_alu_mask_write(offset,x,dat);
}
}
}
-static void fm7_alu_function_or(fm7_state *state, UINT32 offset)
+void fm7_state::fm7_alu_function_or(UINT32 offset)
{
int x;
UINT8 dat;
int page = 0;
UINT8 mask;
- if(state->m_alu.command & 0x40)
- fm7_alu_function_compare(state, offset);
+ if(m_alu.command & 0x40)
+ fm7_alu_function_compare(offset);
if(offset >= 0xc000)
{
page = 1;
- offset += state->m_video.vram_offset2;
+ offset += m_video.vram_offset2;
}
else
- offset += state->m_video.vram_offset;
+ offset += m_video.vram_offset;
for(x=0;x<3;x++) // cycle through banks
{
- if(!(state->m_alu.bank_disable & (1 << x)))
+ if(!(m_alu.bank_disable & (1 << x)))
{
- if(state->m_alu.lcolour & (1 << x))
+ if(m_alu.lcolour & (1 << x))
dat = 0xff;
else
dat = 0;
- mask = (state->m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]);
+ mask = (m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]);
dat |= mask;
- mask &= state->m_alu.mask;
- dat &= ~state->m_alu.mask;
+ mask &= m_alu.mask;
+ dat &= ~m_alu.mask;
dat |= mask;
- fm7_alu_mask_write(state, offset,x,dat);
+ fm7_alu_mask_write(offset,x,dat);
}
}
}
-static void fm7_alu_function_and(fm7_state *state, UINT32 offset)
+void fm7_state::fm7_alu_function_and(UINT32 offset)
{
int x;
UINT8 dat;
int page = 0;
UINT8 mask;
- if(state->m_alu.command & 0x40)
- fm7_alu_function_compare(state, offset);
+ if(m_alu.command & 0x40)
+ fm7_alu_function_compare(offset);
if(offset >= 0xc000)
{
page = 1;
- offset += state->m_video.vram_offset2;
+ offset += m_video.vram_offset2;
}
else
- offset += state->m_video.vram_offset;
+ offset += m_video.vram_offset;
for(x=0;x<3;x++) // cycle through banks
{
- if(!(state->m_alu.bank_disable & (1 << x)))
+ if(!(m_alu.bank_disable & (1 << x)))
{
- if(state->m_alu.lcolour & (1 << x))
+ if(m_alu.lcolour & (1 << x))
dat = 0xff;
else
dat = 0;
- mask = (state->m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]);
+ mask = (m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]);
dat &= mask;
- mask &= state->m_alu.mask;
- dat &= ~state->m_alu.mask;
+ mask &= m_alu.mask;
+ dat &= ~m_alu.mask;
dat |= mask;
- fm7_alu_mask_write(state, offset,x,dat);
+ fm7_alu_mask_write(offset,x,dat);
}
}
}
-static void fm7_alu_function_xor(fm7_state *state, UINT32 offset)
+void fm7_state::fm7_alu_function_xor(UINT32 offset)
{
int x;
UINT8 dat;
int page = 0;
UINT8 mask;
- if(state->m_alu.command & 0x40)
- fm7_alu_function_compare(state, offset);
+ if(m_alu.command & 0x40)
+ fm7_alu_function_compare(offset);
if(offset >= 0xc000)
{
page = 1;
- offset += state->m_video.vram_offset2;
+ offset += m_video.vram_offset2;
}
else
- offset += state->m_video.vram_offset;
+ offset += m_video.vram_offset;
for(x=0;x<3;x++) // cycle through banks
{
- if(!(state->m_alu.bank_disable & (1 << x)))
+ if(!(m_alu.bank_disable & (1 << x)))
{
- if(state->m_alu.lcolour & (1 << x))
+ if(m_alu.lcolour & (1 << x))
dat = 0xff;
else
dat = 0;
- mask = (state->m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]);
+ mask = (m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]);
dat ^= mask;
- mask &= state->m_alu.mask;
- dat &= ~state->m_alu.mask;
+ mask &= m_alu.mask;
+ dat &= ~m_alu.mask;
dat |= mask;
- fm7_alu_mask_write(state, offset,x,dat);
+ fm7_alu_mask_write(offset,x,dat);
}
}
}
-static void fm7_alu_function_not(fm7_state *state, UINT32 offset)
+void fm7_state::fm7_alu_function_not(UINT32 offset)
{
int x;
UINT8 dat;
int page = 0;
UINT8 mask;
- if(state->m_alu.command & 0x40)
- fm7_alu_function_compare(state, offset);
+ if(m_alu.command & 0x40)
+ fm7_alu_function_compare(offset);
if(offset >= 0xc000)
{
page = 1;
- offset += state->m_video.vram_offset2;
+ offset += m_video.vram_offset2;
}
else
- offset += state->m_video.vram_offset;
+ offset += m_video.vram_offset;
for(x=0;x<3;x++) // cycle through banks
{
- if(!(state->m_alu.bank_disable & (1 << x)))
+ if(!(m_alu.bank_disable & (1 << x)))
{
- if(state->m_alu.lcolour & (1 << x))
+ if(m_alu.lcolour & (1 << x))
dat = 0xff;
else
dat = 0;
- mask = (state->m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]);
+ mask = (m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]);
dat = ~mask;
- mask &= state->m_alu.mask;
- dat &= ~state->m_alu.mask;
+ mask &= m_alu.mask;
+ dat &= ~m_alu.mask;
dat |= mask;
- fm7_alu_mask_write(state, offset,x,dat);
+ fm7_alu_mask_write(offset,x,dat);
}
}
}
-static void fm7_alu_function_invalid(fm7_state *state, UINT32 offset)
+void fm7_state::fm7_alu_function_invalid(UINT32 offset)
{
// Invalid function, still does something though (used by Laydock)
int x;
@@ -384,31 +384,31 @@ static void fm7_alu_function_invalid(fm7_state *state, UINT32 offset)
int page = 0;
UINT8 mask;
- if(state->m_alu.command & 0x40)
- fm7_alu_function_compare(state, offset);
+ if(m_alu.command & 0x40)
+ fm7_alu_function_compare(offset);
if(offset >= 0xc000)
{
page = 1;
- offset += state->m_video.vram_offset2;
+ offset += m_video.vram_offset2;
}
else
- offset += state->m_video.vram_offset;
+ offset += m_video.vram_offset;
for(x=0;x<3;x++) // cycle through banks
{
- if(!(state->m_alu.bank_disable & (1 << x)))
+ if(!(m_alu.bank_disable & (1 << x)))
{
- mask = (state->m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]);
+ mask = (m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]);
- dat = mask & state->m_alu.mask;
+ dat = mask & m_alu.mask;
- fm7_alu_mask_write(state, offset,x,dat);
+ fm7_alu_mask_write(offset,x,dat);
}
}
}
-static void fm7_alu_function_tilepaint(fm7_state *state, UINT32 offset)
+void fm7_state::fm7_alu_function_tilepaint(UINT32 offset)
{
// TILEPAINT - writes to VRAM based on the tilepaint colour registers
int x;
@@ -416,80 +416,80 @@ static void fm7_alu_function_tilepaint(fm7_state *state, UINT32 offset)
int page = 0;
UINT8 mask;
- if(state->m_alu.command & 0x40)
- fm7_alu_function_compare(state, offset);
+ if(m_alu.command & 0x40)
+ fm7_alu_function_compare(offset);
if(offset >= 0xc000)
{
page = 1;
- offset += state->m_video.vram_offset2;
+ offset += m_video.vram_offset2;
}
else
- offset += state->m_video.vram_offset;
+ offset += m_video.vram_offset;
for(x=0;x<3;x++) // cycle through banks
{
- if(!(state->m_alu.bank_disable & (1 << x)))
+ if(!(m_alu.bank_disable & (1 << x)))
{
switch(x)
{
case 0:
- dat = state->m_alu.tilepaint_b;
+ dat = m_alu.tilepaint_b;
break;
case 1:
- dat = state->m_alu.tilepaint_r;
+ dat = m_alu.tilepaint_r;
break;
case 2:
- dat = state->m_alu.tilepaint_g;
+ dat = m_alu.tilepaint_g;
break;
}
- dat &= ~state->m_alu.mask;
- mask = (state->m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]) & state->m_alu.mask;
+ dat &= ~m_alu.mask;
+ mask = (m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]) & m_alu.mask;
dat |= mask;
- fm7_alu_mask_write(state, offset,x,dat);
+ fm7_alu_mask_write(offset,x,dat);
}
}
}
-static void fm7_alu_function(fm7_state *state, UINT32 offset)
+void fm7_state::fm7_alu_function(UINT32 offset)
{
- switch(state->m_alu.command & 0x07)
+ switch(m_alu.command & 0x07)
{
case 0x00: // PSET
- fm7_alu_function_pset(state, offset);
+ fm7_alu_function_pset(offset);
break;
case 0x02: // OR
- fm7_alu_function_or(state, offset);
+ fm7_alu_function_or(offset);
break;
case 0x03: // AND
- fm7_alu_function_and(state, offset);
+ fm7_alu_function_and(offset);
break;
case 0x04: // XOR
- fm7_alu_function_xor(state, offset);
+ fm7_alu_function_xor(offset);
break;
case 0x05: // NOT
- fm7_alu_function_not(state, offset);
+ fm7_alu_function_not(offset);
break;
case 0x06: // TILEPAINT
- fm7_alu_function_tilepaint(state, offset);
+ fm7_alu_function_tilepaint(offset);
break;
case 0x07: // COMPARE
- fm7_alu_function_compare(state, offset);
+ fm7_alu_function_compare(offset);
break;
case 0x01:
default:
- fm7_alu_function_invalid(state, offset);
+ fm7_alu_function_invalid(offset);
}
}
-static UINT32 fm7_line_set_pixel(fm7_state *state, int x, int y)
+UINT32 fm7_state::fm7_line_set_pixel(int x, int y)
{
UINT32 addr;
static const UINT8 pixel_mask[8] = {0x7f, 0xbf, 0xdf, 0xef, 0xf7, 0xfb, 0xfd, 0xfe };
- if(state->m_video.modestatus & 0x40) // 320 pixels wide
+ if(m_video.modestatus & 0x40) // 320 pixels wide
{
addr = (x >> 3) + (y * 40);
}
@@ -497,27 +497,26 @@ static UINT32 fm7_line_set_pixel(fm7_state *state, int x, int y)
{
addr = (x >> 3) + (y * 80);
}
- addr += (state->m_alu.addr_offset << 1);
+ addr += (m_alu.addr_offset << 1);
addr &= 0x3fff;
- if(state->m_video.active_video_page != 0)
+ if(m_video.active_video_page != 0)
addr += 0xc000;
- if(state->m_alu.command & 0x80) // ALU must be active
+ if(m_alu.command & 0x80) // ALU must be active
{
- state->m_alu.mask = pixel_mask[x & 0x07];
- fm7_alu_function(state, addr);
+ m_alu.mask = pixel_mask[x & 0x07];
+ fm7_alu_function(addr);
}
return addr;
}
-static void fm77av_line_draw(running_machine &machine)
+void fm7_state::fm77av_line_draw()
{
- fm7_state *state = machine.driver_data<fm7_state>();
- int x1 = state->m_alu.x0;
- int x2 = state->m_alu.x1;
- int y1 = state->m_alu.y0;
- int y2 = state->m_alu.y1;
+ int x1 = m_alu.x0;
+ int x2 = m_alu.x1;
+ int y1 = m_alu.y0;
+ int y2 = m_alu.y1;
int horiz,vert;
int dirx,diry;
int rep;
@@ -525,7 +524,7 @@ static void fm77av_line_draw(running_machine &machine)
UINT16 old_addr = 0xffff;
UINT16 addr;
- state->m_alu.busy = 1;
+ m_alu.busy = 1;
horiz = x2 - x1;
vert = y2 - y1;
@@ -547,14 +546,14 @@ static void fm77av_line_draw(running_machine &machine)
if(horiz == 0 && vert == 0)
{
- fm7_line_set_pixel(state, x1, y1);
+ fm7_line_set_pixel(x1, y1);
byte_count = 1;
}
else if(horiz == 0)
{
for(;;)
{
- addr = fm7_line_set_pixel(state, x1, y1);
+ addr = fm7_line_set_pixel(x1, y1);
if(addr != old_addr)
{
byte_count++;
@@ -569,7 +568,7 @@ static void fm77av_line_draw(running_machine &machine)
{
for(;;)
{
- addr = fm7_line_set_pixel(state, x1, y1);
+ addr = fm7_line_set_pixel(x1, y1);
if(addr != old_addr)
{
byte_count++;
@@ -585,7 +584,7 @@ static void fm77av_line_draw(running_machine &machine)
rep = horiz >> 1;
for(;;)
{
- addr = fm7_line_set_pixel(state, x1, y1);
+ addr = fm7_line_set_pixel(x1, y1);
if(addr != old_addr)
{
byte_count++;
@@ -607,7 +606,7 @@ static void fm77av_line_draw(running_machine &machine)
rep = vert >> 1;
for(;;)
{
- addr = fm7_line_set_pixel(state, x1, y1);
+ addr = fm7_line_set_pixel(x1, y1);
if(addr != old_addr)
{
byte_count++;
@@ -627,7 +626,7 @@ static void fm77av_line_draw(running_machine &machine)
// set timer to disable busy flag
// 1/16 us for each byte changed
- machine.scheduler().timer_set(attotime::from_usec(byte_count/16), timer_expired_delegate(FUNC(fm7_state::fm77av_alu_task_end),state));
+ machine().scheduler().timer_set(attotime::from_usec(byte_count/16), timer_expired_delegate(FUNC(fm7_state::fm77av_alu_task_end),this));
}
READ8_MEMBER(fm7_state::fm7_vram_r)
@@ -646,9 +645,8 @@ READ8_MEMBER(fm7_state::fm7_vram_r)
return 0xff;
if(m_alu.command & 0x80) // ALU active, writes to VRAM even when reading it (go figure)
- {
- fm7_state *state = machine().driver_data<fm7_state>();
- fm7_alu_function(state, offset+page);
+ {
+ fm7_alu_function(offset+page);
}
if(m_video.modestatus & 0x40)
@@ -685,8 +683,7 @@ WRITE8_MEMBER(fm7_state::fm7_vram_w)
if(m_alu.command & 0x80) // ALU active
{
- fm7_state *state = machine().driver_data<fm7_state>();
- fm7_alu_function(state, offset+page);
+ fm7_alu_function(offset+page);
return;
}
@@ -729,8 +726,7 @@ WRITE8_MEMBER(fm7_state::fm7_vram_banked_w)
if(m_alu.command & 0x80) // ALU active
{
- fm7_state *state = machine().driver_data<fm7_state>();
- fm7_alu_function(state, offset+page);
+ fm7_alu_function(offset+page);
return;
}
@@ -1341,7 +1337,7 @@ WRITE8_MEMBER(fm7_state::fm77av_alu_w)
dat = (m_alu.y1 & 0xff00) | data;
m_alu.y1 = dat;
// draw line
- fm77av_line_draw(machine());
+ fm77av_line_draw();
// logerror("ALU: write to Y1 (low) register - %02x (%04x)\n",data,m_alu.y1);
break;
default:
diff --git a/src/mess/video/fmtowns.c b/src/mess/video/fmtowns.c
index 4fdcbd6e1af..d23d34b3d8d 100644
--- a/src/mess/video/fmtowns.c
+++ b/src/mess/video/fmtowns.c
@@ -94,30 +94,27 @@
//static UINT32 pshift; // for debugging
-static void draw_sprites(running_machine &machine, const rectangle* rect);
-
-static void towns_crtc_refresh_mode(running_machine &machine)
+void towns_state::towns_crtc_refresh_mode()
{
- towns_state* state = machine.driver_data<towns_state>();
unsigned int width,height;
- rectangle scr(0, state->m_video.towns_crtc_reg[4], 0, state->m_video.towns_crtc_reg[8] / 2);
+ rectangle scr(0, m_video.towns_crtc_reg[4], 0, m_video.towns_crtc_reg[8] / 2);
// layer 0
- width = state->m_video.towns_crtc_reg[10] - state->m_video.towns_crtc_reg[9];
- height = (state->m_video.towns_crtc_reg[14] - state->m_video.towns_crtc_reg[13]) / 2;
- state->m_video.towns_crtc_layerscr[0].min_x = scr.xcenter() - (width / 2);
- state->m_video.towns_crtc_layerscr[0].min_y = scr.ycenter() - (height / 2);
- state->m_video.towns_crtc_layerscr[0].max_x = scr.xcenter() + (width / 2);
- state->m_video.towns_crtc_layerscr[0].max_y = scr.ycenter() + (height / 2);
+ width = m_video.towns_crtc_reg[10] - m_video.towns_crtc_reg[9];
+ height = (m_video.towns_crtc_reg[14] - m_video.towns_crtc_reg[13]) / 2;
+ m_video.towns_crtc_layerscr[0].min_x = scr.xcenter() - (width / 2);
+ m_video.towns_crtc_layerscr[0].min_y = scr.ycenter() - (height / 2);
+ m_video.towns_crtc_layerscr[0].max_x = scr.xcenter() + (width / 2);
+ m_video.towns_crtc_layerscr[0].max_y = scr.ycenter() + (height / 2);
// layer 1
- width = state->m_video.towns_crtc_reg[12] - state->m_video.towns_crtc_reg[11];
- height = (state->m_video.towns_crtc_reg[16] - state->m_video.towns_crtc_reg[15]) / 2;
- state->m_video.towns_crtc_layerscr[1].min_x = scr.xcenter() - (width / 2);
- state->m_video.towns_crtc_layerscr[1].min_y = scr.ycenter() - (height / 2);
- state->m_video.towns_crtc_layerscr[1].max_x = scr.xcenter() + (width / 2);
- state->m_video.towns_crtc_layerscr[1].max_y = scr.ycenter() + (height / 2);
+ width = m_video.towns_crtc_reg[12] - m_video.towns_crtc_reg[11];
+ height = (m_video.towns_crtc_reg[16] - m_video.towns_crtc_reg[15]) / 2;
+ m_video.towns_crtc_layerscr[1].min_x = scr.xcenter() - (width / 2);
+ m_video.towns_crtc_layerscr[1].min_y = scr.ycenter() - (height / 2);
+ m_video.towns_crtc_layerscr[1].max_x = scr.xcenter() + (width / 2);
+ m_video.towns_crtc_layerscr[1].max_y = scr.ycenter() + (height / 2);
// sanity checks
if(scr.max_x == 0 || scr.max_y == 0)
@@ -125,7 +122,7 @@ static void towns_crtc_refresh_mode(running_machine &machine)
if(scr.max_x <= scr.min_x || scr.max_y <= scr.min_y)
return;
- machine.primary_screen->configure(scr.max_x+1,scr.max_y+1,scr,HZ_TO_ATTOSECONDS(60));
+ machine().primary_screen->configure(scr.max_x+1,scr.max_y+1,scr,HZ_TO_ATTOSECONDS(60));
}
READ8_MEMBER( towns_state::towns_gfx_high_r )
@@ -218,31 +215,30 @@ WRITE8_MEMBER( towns_state::towns_gfx_w )
}
}
-static void towns_update_kanji_offset(running_machine &machine)
+void towns_state::towns_update_kanji_offset()
{
- towns_state* state = machine.driver_data<towns_state>();
// this is a little over the top...
- if(state->m_video.towns_kanji_code_h < 0x30)
+ if(m_video.towns_kanji_code_h < 0x30)
{
- state->m_video.towns_kanji_offset = ((state->m_video.towns_kanji_code_l & 0x1f) << 4)
- | (((state->m_video.towns_kanji_code_l - 0x20) & 0x20) << 8)
- | (((state->m_video.towns_kanji_code_l - 0x20) & 0x40) << 6)
- | ((state->m_video.towns_kanji_code_h & 0x07) << 9);
+ m_video.towns_kanji_offset = ((m_video.towns_kanji_code_l & 0x1f) << 4)
+ | (((m_video.towns_kanji_code_l - 0x20) & 0x20) << 8)
+ | (((m_video.towns_kanji_code_l - 0x20) & 0x40) << 6)
+ | ((m_video.towns_kanji_code_h & 0x07) << 9);
}
- else if(state->m_video.towns_kanji_code_h < 0x70)
+ else if(m_video.towns_kanji_code_h < 0x70)
{
- state->m_video.towns_kanji_offset = ((state->m_video.towns_kanji_code_l & 0x1f) << 4)
- + (((state->m_video.towns_kanji_code_l - 0x20) & 0x60) << 8)
- + ((state->m_video.towns_kanji_code_h & 0x0f) << 9)
- + (((state->m_video.towns_kanji_code_h - 0x30) & 0x70) * 0xc00)
+ m_video.towns_kanji_offset = ((m_video.towns_kanji_code_l & 0x1f) << 4)
+ + (((m_video.towns_kanji_code_l - 0x20) & 0x60) << 8)
+ + ((m_video.towns_kanji_code_h & 0x0f) << 9)
+ + (((m_video.towns_kanji_code_h - 0x30) & 0x70) * 0xc00)
+ 0x8000;
}
else
{
- state->m_video.towns_kanji_offset = ((state->m_video.towns_kanji_code_l & 0x1f) << 4)
- | (((state->m_video.towns_kanji_code_l - 0x20) & 0x20) << 8)
- | (((state->m_video.towns_kanji_code_l - 0x20) & 0x40) << 6)
- | ((state->m_video.towns_kanji_code_h & 0x07) << 9)
+ m_video.towns_kanji_offset = ((m_video.towns_kanji_code_l & 0x1f) << 4)
+ | (((m_video.towns_kanji_code_l - 0x20) & 0x20) << 8)
+ | (((m_video.towns_kanji_code_l - 0x20) & 0x40) << 6)
+ | ((m_video.towns_kanji_code_h & 0x07) << 9)
| 0x38000;
}
}
@@ -307,12 +303,12 @@ WRITE8_MEMBER( towns_state::towns_video_cff80_w )
break;
case 0x14: // Kanji offset (high)
m_video.towns_kanji_code_h = data & 0x7f;
- towns_update_kanji_offset(space.machine());
+ towns_update_kanji_offset();
//logerror("VID: Kanji code set (high) = %02x %02x\n",towns_kanji_code_h,towns_kanji_code_l);
break;
case 0x15: // Kanji offset (low)
m_video.towns_kanji_code_l = data & 0x7f;
- towns_update_kanji_offset(space.machine());
+ towns_update_kanji_offset();
//logerror("VID: Kanji code set (low) = %02x %02x\n",towns_kanji_code_h,towns_kanji_code_l);
break;
case 0x19: // ANK CG ROM
@@ -424,13 +420,13 @@ WRITE8_MEMBER(towns_state::towns_video_440_w)
// logerror("CRTC: writing register %i (0x442) [%02x]\n",towns_crtc_sel,data);
m_video.towns_crtc_reg[m_video.towns_crtc_sel] =
(m_video.towns_crtc_reg[m_video.towns_crtc_sel] & 0xff00) | data;
- towns_crtc_refresh_mode(space.machine());
+ towns_crtc_refresh_mode();
break;
case 0x03:
// logerror("CRTC: writing register %i (0x443) [%02x]\n",towns_crtc_sel,data);
m_video.towns_crtc_reg[m_video.towns_crtc_sel] =
(m_video.towns_crtc_reg[m_video.towns_crtc_sel] & 0x00ff) | (data << 8);
- towns_crtc_refresh_mode(space.machine());
+ towns_crtc_refresh_mode();
break;
case 0x08:
m_video.towns_video_sel = data & 0x01;
@@ -682,16 +678,15 @@ WRITE8_MEMBER( towns_state::towns_spriteram_w )
* +6: Sprite Colour
* bit 15: use colour data in located in sprite RAM offset in bits 11-0 (x32)
*/
-static void render_sprite_4(running_machine &machine, UINT32 poffset, UINT32 coffset, UINT16 x, UINT16 y, UINT16 xflip, UINT16 yflip, const rectangle* rect)
+void towns_state::render_sprite_4(UINT32 poffset, UINT32 coffset, UINT16 x, UINT16 y, UINT16 xflip, UINT16 yflip, const rectangle* rect)
{
- towns_state* state = machine.driver_data<towns_state>();
UINT16 xpos,ypos;
UINT16 col,pixel;
UINT32 voffset;
UINT16 xstart,xend,ystart,yend;
int xdir,ydir;
- int width = (state->m_video.towns_crtc_reg[12] - state->m_video.towns_crtc_reg[11]) / (((state->m_video.towns_crtc_reg[27] & 0x0f00) >> 8)+1);
- int height = (state->m_video.towns_crtc_reg[16] - state->m_video.towns_crtc_reg[15]) / (((state->m_video.towns_crtc_reg[27] & 0xf000) >> 12)+2);
+ int width = (m_video.towns_crtc_reg[12] - m_video.towns_crtc_reg[11]) / (((m_video.towns_crtc_reg[27] & 0x0f00) >> 8)+1);
+ int height = (m_video.towns_crtc_reg[16] - m_video.towns_crtc_reg[15]) / (((m_video.towns_crtc_reg[27] & 0xf000) >> 12)+2);
if(xflip)
{
@@ -727,36 +722,36 @@ static void render_sprite_4(running_machine &machine, UINT32 poffset, UINT32 cof
{
for(xpos=xstart;xpos!=xend;xpos+=xdir,xpos&=0x1ff)
{
- if(state->m_video.towns_sprite_page != 0)
+ if(m_video.towns_sprite_page != 0)
voffset = 0x20000;
else
voffset = 0x00000;
- pixel = (state->m_towns_txtvram[poffset] & 0xf0) >> 4;
- col = state->m_towns_txtvram[coffset+(pixel*2)] | (state->m_towns_txtvram[coffset+(pixel*2)+1] << 8);
- voffset += (state->m_video.towns_crtc_reg[24] * 4) * (ypos & 0x1ff); // scanline size in bytes * y pos
+ pixel = (m_towns_txtvram[poffset] & 0xf0) >> 4;
+ col = m_towns_txtvram[coffset+(pixel*2)] | (m_towns_txtvram[coffset+(pixel*2)+1] << 8);
+ voffset += (m_video.towns_crtc_reg[24] * 4) * (ypos & 0x1ff); // scanline size in bytes * y pos
voffset += (xpos & 0x1ff) * 2;
- if((state->m_video.towns_sprite_page != 0 && voffset > 0x1ffff && voffset < 0x40000)
- || (state->m_video.towns_sprite_page == 0 && voffset < 0x20000))
+ if((m_video.towns_sprite_page != 0 && voffset > 0x1ffff && voffset < 0x40000)
+ || (m_video.towns_sprite_page == 0 && voffset < 0x20000))
{
if(xpos < width && ypos < height && pixel != 0)
{
- state->m_towns_gfxvram[0x40000+voffset+1] = (col & 0xff00) >> 8;
- state->m_towns_gfxvram[0x40000+voffset] = col & 0x00ff;
+ m_towns_gfxvram[0x40000+voffset+1] = (col & 0xff00) >> 8;
+ m_towns_gfxvram[0x40000+voffset] = col & 0x00ff;
}
}
if(xflip)
voffset+=2;
else
voffset-=2;
- pixel = state->m_towns_txtvram[poffset] & 0x0f;
- col = state->m_towns_txtvram[coffset+(pixel*2)] | (state->m_towns_txtvram[coffset+(pixel*2)+1] << 8);
- if((state->m_video.towns_sprite_page != 0 && voffset > 0x1ffff && voffset < 0x40000)
- || (state->m_video.towns_sprite_page == 0 && voffset < 0x20000))
+ pixel = m_towns_txtvram[poffset] & 0x0f;
+ col = m_towns_txtvram[coffset+(pixel*2)] | (m_towns_txtvram[coffset+(pixel*2)+1] << 8);
+ if((m_video.towns_sprite_page != 0 && voffset > 0x1ffff && voffset < 0x40000)
+ || (m_video.towns_sprite_page == 0 && voffset < 0x20000))
{
if(xpos < width && ypos < height && pixel != 0)
{
- state->m_towns_gfxvram[0x40000+voffset+1] = (col & 0xff00) >> 8;
- state->m_towns_gfxvram[0x40000+voffset] = col & 0x00ff;
+ m_towns_gfxvram[0x40000+voffset+1] = (col & 0xff00) >> 8;
+ m_towns_gfxvram[0x40000+voffset] = col & 0x00ff;
}
}
poffset++;
@@ -765,16 +760,15 @@ static void render_sprite_4(running_machine &machine, UINT32 poffset, UINT32 cof
}
}
-static void render_sprite_16(running_machine &machine, UINT32 poffset, UINT16 x, UINT16 y, UINT16 xflip, UINT16 yflip, const rectangle* rect)
+void towns_state::render_sprite_16(UINT32 poffset, UINT16 x, UINT16 y, UINT16 xflip, UINT16 yflip, const rectangle* rect)
{
- towns_state* state = machine.driver_data<towns_state>();
UINT16 xpos,ypos;
UINT16 col;
UINT32 voffset;
UINT16 xstart,ystart,xend,yend;
int xdir,ydir;
- int width = (state->m_video.towns_crtc_reg[12] - state->m_video.towns_crtc_reg[11]) / (((state->m_video.towns_crtc_reg[27] & 0x0f00) >> 8)+1);
- int height = (state->m_video.towns_crtc_reg[16] - state->m_video.towns_crtc_reg[15]) / (((state->m_video.towns_crtc_reg[27] & 0xf000) >> 12)+2);
+ int width = (m_video.towns_crtc_reg[12] - m_video.towns_crtc_reg[11]) / (((m_video.towns_crtc_reg[27] & 0x0f00) >> 8)+1);
+ int height = (m_video.towns_crtc_reg[16] - m_video.towns_crtc_reg[15]) / (((m_video.towns_crtc_reg[27] & 0xf000) >> 12)+2);
if(xflip)
{
@@ -810,20 +804,20 @@ static void render_sprite_16(running_machine &machine, UINT32 poffset, UINT16 x,
{
for(xpos=xstart;xpos!=xend;xpos+=xdir,xpos&=0x1ff)
{
- if(state->m_video.towns_sprite_page != 0)
+ if(m_video.towns_sprite_page != 0)
voffset = 0x20000;
else
voffset = 0x00000;
- col = state->m_towns_txtvram[poffset] | (state->m_towns_txtvram[poffset+1] << 8);
- voffset += (state->m_video.towns_crtc_reg[24] * 4) * (ypos & 0x1ff); // scanline size in bytes * y pos
+ col = m_towns_txtvram[poffset] | (m_towns_txtvram[poffset+1] << 8);
+ voffset += (m_video.towns_crtc_reg[24] * 4) * (ypos & 0x1ff); // scanline size in bytes * y pos
voffset += (xpos & 0x1ff) * 2;
- if((state->m_video.towns_sprite_page != 0 && voffset > 0x1ffff && voffset < 0x40000)
- || (state->m_video.towns_sprite_page == 0 && voffset < 0x20000))
+ if((m_video.towns_sprite_page != 0 && voffset > 0x1ffff && voffset < 0x40000)
+ || (m_video.towns_sprite_page == 0 && voffset < 0x20000))
{
if(xpos < width && ypos < height && col < 0x8000)
{
- state->m_towns_gfxvram[0x40000+voffset+1] = (col & 0xff00) >> 8;
- state->m_towns_gfxvram[0x40000+voffset] = col & 0x00ff;
+ m_towns_gfxvram[0x40000+voffset+1] = (col & 0xff00) >> 8;
+ m_towns_gfxvram[0x40000+voffset] = col & 0x00ff;
}
}
poffset+=2;
@@ -832,31 +826,30 @@ static void render_sprite_16(running_machine &machine, UINT32 poffset, UINT16 x,
}
}
-static void draw_sprites(running_machine &machine, const rectangle* rect)
+void towns_state::draw_sprites(const rectangle* rect)
{
- towns_state* state = machine.driver_data<towns_state>();
- UINT16 sprite_limit = (state->m_video.towns_sprite_reg[0] | (state->m_video.towns_sprite_reg[1] << 8)) & 0x3ff;
+ UINT16 sprite_limit = (m_video.towns_sprite_reg[0] | (m_video.towns_sprite_reg[1] << 8)) & 0x3ff;
int n;
UINT16 x,y,attr,colour;
- UINT16 xoff = (state->m_video.towns_sprite_reg[2] | (state->m_video.towns_sprite_reg[3] << 8)) & 0x1ff;
- UINT16 yoff = (state->m_video.towns_sprite_reg[4] | (state->m_video.towns_sprite_reg[5] << 8)) & 0x1ff;
+ UINT16 xoff = (m_video.towns_sprite_reg[2] | (m_video.towns_sprite_reg[3] << 8)) & 0x1ff;
+ UINT16 yoff = (m_video.towns_sprite_reg[4] | (m_video.towns_sprite_reg[5] << 8)) & 0x1ff;
UINT32 poffset,coffset;
- if(!(state->m_video.towns_sprite_reg[1] & 0x80))
+ if(!(m_video.towns_sprite_reg[1] & 0x80))
return;
// clears VRAM for each frame?
- if(state->m_video.towns_sprite_page == 0)
- memset(state->m_towns_gfxvram+0x40000,0x80,0x20000);
+ if(m_video.towns_sprite_page == 0)
+ memset(m_towns_gfxvram+0x40000,0x80,0x20000);
else
- memset(state->m_towns_gfxvram+0x60000,0x80,0x20000);
+ memset(m_towns_gfxvram+0x60000,0x80,0x20000);
for(n=sprite_limit;n<1024;n++)
{
- x = state->m_towns_txtvram[8*n] | (state->m_towns_txtvram[8*n+1] << 8);
- y = state->m_towns_txtvram[8*n+2] | (state->m_towns_txtvram[8*n+3] << 8);
- attr = state->m_towns_txtvram[8*n+4] | (state->m_towns_txtvram[8*n+5] << 8);
- colour = state->m_towns_txtvram[8*n+6] | (state->m_towns_txtvram[8*n+7] << 8);
+ x = m_towns_txtvram[8*n] | (m_towns_txtvram[8*n+1] << 8);
+ y = m_towns_txtvram[8*n+2] | (m_towns_txtvram[8*n+3] << 8);
+ attr = m_towns_txtvram[8*n+4] | (m_towns_txtvram[8*n+5] << 8);
+ colour = m_towns_txtvram[8*n+6] | (m_towns_txtvram[8*n+7] << 8);
if(attr & 0x8000)
{
x += xoff;
@@ -874,7 +867,7 @@ static void draw_sprites(running_machine &machine, const rectangle* rect)
n,x,y,attr,colour,poffset,coffset);
#endif
if(!(colour & 0x2000))
- render_sprite_4(machine,(poffset)&0x1ffff,coffset,x,y,attr&0x2000,attr&0x1000,rect);
+ render_sprite_4((poffset)&0x1ffff,coffset,x,y,attr&0x2000,attr&0x1000,rect);
}
else
{
@@ -884,22 +877,21 @@ static void draw_sprites(running_machine &machine, const rectangle* rect)
n,x,y,attr,colour,poffset);
#endif
if(!(colour & 0x2000))
- render_sprite_16(machine,(poffset)&0x1ffff,x,y,attr&0x2000,attr&0x1000,rect);
+ render_sprite_16((poffset)&0x1ffff,x,y,attr&0x2000,attr&0x1000,rect);
}
}
- if(state->m_video.towns_sprite_page == 0) // flip VRAM page
- state->m_video.towns_sprite_page = 1;
+ if(m_video.towns_sprite_page == 0) // flip VRAM page
+ m_video.towns_sprite_page = 1;
else
- state->m_video.towns_sprite_page = 0;
+ m_video.towns_sprite_page = 0;
- state->m_video.towns_sprite_flag = 1; // we are now drawing
- state->m_video.sprite_timer->adjust(state->m_maincpu->cycles_to_attotime(128 * (1025-sprite_limit)));
+ m_video.towns_sprite_flag = 1; // we are now drawing
+ m_video.sprite_timer->adjust(m_maincpu->cycles_to_attotime(128 * (1025-sprite_limit)));
}
-static void towns_crtc_draw_scan_layer_hicolour(running_machine &machine, bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline)
+void towns_state::towns_crtc_draw_scan_layer_hicolour(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline)
{
- towns_state* state = machine.driver_data<towns_state>();
UINT32 off = 0;
int x;
UINT16 colour;
@@ -908,41 +900,41 @@ static void towns_crtc_draw_scan_layer_hicolour(running_machine &machine, bitmap
UINT32 scroll;
if(layer == 0)
- linesize = state->m_video.towns_crtc_reg[20] * 4;
+ linesize = m_video.towns_crtc_reg[20] * 4;
else
- linesize = state->m_video.towns_crtc_reg[24] * 4;
+ linesize = m_video.towns_crtc_reg[24] * 4;
- if(state->m_video.towns_display_page_sel != 0)
+ if(m_video.towns_display_page_sel != 0)
off = 0x20000;
-// if((layer == 1) && (state->m_video.towns_sprite_reg[1] & 0x80) && (state->m_video.towns_sprite_page == 1))
+// if((layer == 1) && (m_video.towns_sprite_reg[1] & 0x80) && (m_video.towns_sprite_page == 1))
// off = 0x20000;
if(layer != 0)
{
- if(!(state->m_video.towns_video_reg[0] & 0x10))
+ if(!(m_video.towns_video_reg[0] & 0x10))
return;
- if(!(state->m_video.towns_crtc_reg[28] & 0x10))
- off += (state->m_video.towns_crtc_reg[21]) << 2; // initial offset
+ if(!(m_video.towns_crtc_reg[28] & 0x10))
+ off += (m_video.towns_crtc_reg[21]) << 2; // initial offset
else
{
- scroll = ((state->m_video.towns_crtc_reg[21] & 0xfc00) << 2) | (((state->m_video.towns_crtc_reg[21] & 0x3ff) << 2));
+ scroll = ((m_video.towns_crtc_reg[21] & 0xfc00) << 2) | (((m_video.towns_crtc_reg[21] & 0x3ff) << 2));
off += scroll;
}
- off += (state->m_video.towns_crtc_reg[11] - state->m_video.towns_crtc_reg[22]);
- hzoom = ((state->m_video.towns_crtc_reg[27] & 0x0f00) >> 8) + 1;
+ off += (m_video.towns_crtc_reg[11] - m_video.towns_crtc_reg[22]);
+ hzoom = ((m_video.towns_crtc_reg[27] & 0x0f00) >> 8) + 1;
}
else
{
- if(!(state->m_video.towns_crtc_reg[28] & 0x20))
- off += (state->m_video.towns_crtc_reg[17]) << 2; // initial offset
+ if(!(m_video.towns_crtc_reg[28] & 0x20))
+ off += (m_video.towns_crtc_reg[17]) << 2; // initial offset
else
{
- scroll = ((state->m_video.towns_crtc_reg[17] & 0xfc00) << 2) | (((state->m_video.towns_crtc_reg[17] & 0x3ff) << 2));
+ scroll = ((m_video.towns_crtc_reg[17] & 0xfc00) << 2) | (((m_video.towns_crtc_reg[17] & 0x3ff) << 2));
off += scroll;
}
- off += (state->m_video.towns_crtc_reg[9] - state->m_video.towns_crtc_reg[18]);
- hzoom = (state->m_video.towns_crtc_reg[27] & 0x000f) + 1;
+ off += (m_video.towns_crtc_reg[9] - m_video.towns_crtc_reg[18]);
+ hzoom = (m_video.towns_crtc_reg[27] & 0x000f) + 1;
}
off += line * linesize;
@@ -952,12 +944,12 @@ static void towns_crtc_draw_scan_layer_hicolour(running_machine &machine, bitmap
{
for(x=rect->min_x;x<rect->max_x;x++)
{
- if(state->m_video.towns_video_reg[0] & 0x10)
+ if(m_video.towns_video_reg[0] & 0x10)
off &= 0x3ffff; // 2 layers
else
off &= 0x7ffff; // 1 layer
- colour = (state->m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | state->m_towns_gfxvram[off+(layer*0x40000)];
+ colour = (m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | m_towns_gfxvram[off+(layer*0x40000)];
if(colour < 0x8000)
{
bitmap.pix32(scanline, x) =
@@ -973,11 +965,11 @@ static void towns_crtc_draw_scan_layer_hicolour(running_machine &machine, bitmap
{ // x2 horizontal zoom
for(x=rect->min_x;x<rect->max_x;x+=2)
{
- if(state->m_video.towns_video_reg[0] & 0x10)
+ if(m_video.towns_video_reg[0] & 0x10)
off &= 0x3ffff; // 2 layers
else
off &= 0x7ffff; // 1 layer
- colour = (state->m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | state->m_towns_gfxvram[off+(layer*0x40000)];
+ colour = (m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | m_towns_gfxvram[off+(layer*0x40000)];
if(colour < 0x8000)
{
bitmap.pix32(scanline, x) =
@@ -997,11 +989,11 @@ static void towns_crtc_draw_scan_layer_hicolour(running_machine &machine, bitmap
{ // x3 horizontal zoom
for(x=rect->min_x;x<rect->max_x;x+=3)
{
- if(state->m_video.towns_video_reg[0] & 0x10)
+ if(m_video.towns_video_reg[0] & 0x10)
off &= 0x3ffff; // 2 layers
else
off &= 0x7ffff; // 1 layer
- colour = (state->m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | state->m_towns_gfxvram[off+(layer*0x40000)];
+ colour = (m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | m_towns_gfxvram[off+(layer*0x40000)];
if(colour < 0x8000)
{
bitmap.pix32(scanline, x) =
@@ -1025,11 +1017,11 @@ static void towns_crtc_draw_scan_layer_hicolour(running_machine &machine, bitmap
{ // x4 horizontal zoom
for(x=rect->min_x;x<rect->max_x;x+=4)
{
- if(state->m_video.towns_video_reg[0] & 0x10)
+ if(m_video.towns_video_reg[0] & 0x10)
off &= 0x3ffff; // 2 layers
else
off &= 0x7ffff; // 1 layer
- colour = (state->m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | state->m_towns_gfxvram[off+(layer*0x40000)];
+ colour = (m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | m_towns_gfxvram[off+(layer*0x40000)];
if(colour < 0x8000)
{
bitmap.pix32(scanline, x) =
@@ -1057,11 +1049,11 @@ static void towns_crtc_draw_scan_layer_hicolour(running_machine &machine, bitmap
{ // x5 horizontal zoom
for(x=rect->min_x;x<rect->max_x;x+=5)
{
- if(state->m_video.towns_video_reg[0] & 0x10)
+ if(m_video.towns_video_reg[0] & 0x10)
off &= 0x3ffff; // 2 layers
else
off &= 0x7ffff; // 1 layer
- colour = (state->m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | state->m_towns_gfxvram[off+(layer*0x40000)];
+ colour = (m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | m_towns_gfxvram[off+(layer*0x40000)];
if(colour < 0x8000)
{
bitmap.pix32(scanline, x) =
@@ -1090,9 +1082,8 @@ static void towns_crtc_draw_scan_layer_hicolour(running_machine &machine, bitmap
}
}
-static void towns_crtc_draw_scan_layer_256(running_machine &machine, bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline)
+void towns_state::towns_crtc_draw_scan_layer_256(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline)
{
- towns_state* state = machine.driver_data<towns_state>();
int off = 0;
int x;
UINT8 colour;
@@ -1100,42 +1091,42 @@ static void towns_crtc_draw_scan_layer_256(running_machine &machine, bitmap_rgb3
int linesize;
UINT32 scroll;
- if(state->m_video.towns_display_page_sel != 0)
+ if(m_video.towns_display_page_sel != 0)
off = 0x20000;
-// if((layer == 1) && (state->m_video.towns_sprite_reg[1] & 0x80) && (state->m_video.towns_sprite_page == 1))
+// if((layer == 1) && (m_video.towns_sprite_reg[1] & 0x80) && (m_video.towns_sprite_page == 1))
// off = 0x20000;
if(layer == 0)
- linesize = state->m_video.towns_crtc_reg[20] * 8;
+ linesize = m_video.towns_crtc_reg[20] * 8;
else
- linesize = state->m_video.towns_crtc_reg[24] * 8;
+ linesize = m_video.towns_crtc_reg[24] * 8;
if(layer != 0)
{
- if(!(state->m_video.towns_video_reg[0] & 0x10))
+ if(!(m_video.towns_video_reg[0] & 0x10))
return;
- if(!(state->m_video.towns_crtc_reg[28] & 0x10))
- off += state->m_video.towns_crtc_reg[21] << 3; // initial offset
+ if(!(m_video.towns_crtc_reg[28] & 0x10))
+ off += m_video.towns_crtc_reg[21] << 3; // initial offset
else
{
- scroll = ((state->m_video.towns_crtc_reg[21] & 0xfc00) << 3) | (((state->m_video.towns_crtc_reg[21] & 0x3ff) << 3));
+ scroll = ((m_video.towns_crtc_reg[21] & 0xfc00) << 3) | (((m_video.towns_crtc_reg[21] & 0x3ff) << 3));
off += scroll;
}
- off += (state->m_video.towns_crtc_reg[11] - state->m_video.towns_crtc_reg[22]);
- hzoom = ((state->m_video.towns_crtc_reg[27] & 0x0f00) >> 8) + 1;
+ off += (m_video.towns_crtc_reg[11] - m_video.towns_crtc_reg[22]);
+ hzoom = ((m_video.towns_crtc_reg[27] & 0x0f00) >> 8) + 1;
}
else
{
- if(!(state->m_video.towns_crtc_reg[28] & 0x20))
- off += state->m_video.towns_crtc_reg[17] << 3; // initial offset
+ if(!(m_video.towns_crtc_reg[28] & 0x20))
+ off += m_video.towns_crtc_reg[17] << 3; // initial offset
else
{
- scroll = ((state->m_video.towns_crtc_reg[17] & 0xfc00) << 3) | (((state->m_video.towns_crtc_reg[17] & 0x3ff) << 3));
+ scroll = ((m_video.towns_crtc_reg[17] & 0xfc00) << 3) | (((m_video.towns_crtc_reg[17] & 0x3ff) << 3));
off += scroll;
}
- off += (state->m_video.towns_crtc_reg[9] - state->m_video.towns_crtc_reg[18]);
- hzoom = (state->m_video.towns_crtc_reg[27] & 0x000f) + 1;
+ off += (m_video.towns_crtc_reg[9] - m_video.towns_crtc_reg[18]);
+ hzoom = (m_video.towns_crtc_reg[27] & 0x000f) + 1;
}
off += line * linesize;
@@ -1144,17 +1135,17 @@ static void towns_crtc_draw_scan_layer_256(running_machine &machine, bitmap_rgb3
{
for(x=rect->min_x;x<rect->max_x;x++)
{
- if(state->m_video.towns_video_reg[0] & 0x10)
+ if(m_video.towns_video_reg[0] & 0x10)
off &= 0x3ffff; // 2 layers
else
off &= 0x7ffff; // 1 layer
- colour = state->m_towns_gfxvram[off+(layer*0x40000)];
+ colour = m_towns_gfxvram[off+(layer*0x40000)];
if(colour != 0)
{
bitmap.pix32(scanline, x) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
}
off++;
}
@@ -1164,21 +1155,21 @@ static void towns_crtc_draw_scan_layer_256(running_machine &machine, bitmap_rgb3
{ // x2 horizontal zoom
for(x=rect->min_x;x<rect->max_x;x+=2)
{
- if(state->m_video.towns_video_reg[0] & 0x10)
+ if(m_video.towns_video_reg[0] & 0x10)
off &= 0x3ffff; // 2 layers
else
off &= 0x7ffff; // 1 layer
- colour = state->m_towns_gfxvram[off+(layer*0x40000)+1];
+ colour = m_towns_gfxvram[off+(layer*0x40000)+1];
if(colour != 0)
{
bitmap.pix32(scanline, x) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
bitmap.pix32(scanline, x+1) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
}
off++;
}
@@ -1188,25 +1179,25 @@ static void towns_crtc_draw_scan_layer_256(running_machine &machine, bitmap_rgb3
{ // x3 horizontal zoom
for(x=rect->min_x;x<rect->max_x;x+=3)
{
- if(state->m_video.towns_video_reg[0] & 0x10)
+ if(m_video.towns_video_reg[0] & 0x10)
off &= 0x3ffff; // 2 layers
else
off &= 0x7ffff; // 1 layer
- colour = state->m_towns_gfxvram[off+(layer*0x40000)+1];
+ colour = m_towns_gfxvram[off+(layer*0x40000)+1];
if(colour != 0)
{
bitmap.pix32(scanline, x) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
bitmap.pix32(scanline, x+1) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
bitmap.pix32(scanline, x+2) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
}
off++;
}
@@ -1216,29 +1207,29 @@ static void towns_crtc_draw_scan_layer_256(running_machine &machine, bitmap_rgb3
{ // x4 horizontal zoom
for(x=rect->min_x;x<rect->max_x;x+=4)
{
- if(state->m_video.towns_video_reg[0] & 0x10)
+ if(m_video.towns_video_reg[0] & 0x10)
off &= 0x3ffff; // 2 layers
else
off &= 0x7ffff; // 1 layer
- colour = state->m_towns_gfxvram[off+(layer*0x40000)+1];
+ colour = m_towns_gfxvram[off+(layer*0x40000)+1];
if(colour != 0)
{
bitmap.pix32(scanline, x) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
bitmap.pix32(scanline, x+1) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
bitmap.pix32(scanline, x+2) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
bitmap.pix32(scanline, x+3) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
}
off++;
}
@@ -1248,42 +1239,41 @@ static void towns_crtc_draw_scan_layer_256(running_machine &machine, bitmap_rgb3
{ // x5 horizontal zoom
for(x=rect->min_x;x<rect->max_x;x+=5)
{
- if(state->m_video.towns_video_reg[0] & 0x10)
+ if(m_video.towns_video_reg[0] & 0x10)
off &= 0x3ffff; // 2 layers
else
off &= 0x7ffff; // 1 layer
- colour = state->m_towns_gfxvram[off+(layer*0x40000)+1];
+ colour = m_towns_gfxvram[off+(layer*0x40000)+1];
if(colour != 0)
{
bitmap.pix32(scanline, x) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
bitmap.pix32(scanline, x+1) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
bitmap.pix32(scanline, x+2) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
bitmap.pix32(scanline, x+3) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
bitmap.pix32(scanline, x+4) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
}
off++;
}
}
}
-static void towns_crtc_draw_scan_layer_16(running_machine &machine, bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline)
+void towns_state::towns_crtc_draw_scan_layer_16(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline)
{
- towns_state* state = machine.driver_data<towns_state>();
int off = 0;
int x;
UINT8 colour;
@@ -1291,42 +1281,42 @@ static void towns_crtc_draw_scan_layer_16(running_machine &machine, bitmap_rgb32
int linesize;
UINT32 scroll;
- if(state->m_video.towns_display_page_sel != 0)
+ if(m_video.towns_display_page_sel != 0)
off = 0x20000;
-// if((layer == 1) && (state->m_video.towns_sprite_reg[1] & 0x80) && (state->m_video.towns_sprite_page == 1))
+// if((layer == 1) && (m_video.towns_sprite_reg[1] & 0x80) && (m_video.towns_sprite_page == 1))
// off = 0x20000;
if(layer == 0)
- linesize = state->m_video.towns_crtc_reg[20] * 4;
+ linesize = m_video.towns_crtc_reg[20] * 4;
else
- linesize = state->m_video.towns_crtc_reg[24] * 4;
+ linesize = m_video.towns_crtc_reg[24] * 4;
if(layer != 0)
{
- if(!(state->m_video.towns_video_reg[0] & 0x10))
+ if(!(m_video.towns_video_reg[0] & 0x10))
return;
- if(!(state->m_video.towns_crtc_reg[28] & 0x10))
- off += state->m_video.towns_crtc_reg[21]; // initial offset
+ if(!(m_video.towns_crtc_reg[28] & 0x10))
+ off += m_video.towns_crtc_reg[21]; // initial offset
else
{
- scroll = ((state->m_video.towns_crtc_reg[21] & 0xfc00)<<2) | (((state->m_video.towns_crtc_reg[21] & 0x3ff)<<2));
+ scroll = ((m_video.towns_crtc_reg[21] & 0xfc00)<<2) | (((m_video.towns_crtc_reg[21] & 0x3ff)<<2));
off += scroll;
}
- off += (state->m_video.towns_crtc_reg[11] - state->m_video.towns_crtc_reg[22]);
- hzoom = ((state->m_video.towns_crtc_reg[27] & 0x0f00) >> 8) + 1;
+ off += (m_video.towns_crtc_reg[11] - m_video.towns_crtc_reg[22]);
+ hzoom = ((m_video.towns_crtc_reg[27] & 0x0f00) >> 8) + 1;
}
else
{
- if(!(state->m_video.towns_crtc_reg[28] & 0x20))
- off += state->m_video.towns_crtc_reg[17]; // initial offset
+ if(!(m_video.towns_crtc_reg[28] & 0x20))
+ off += m_video.towns_crtc_reg[17]; // initial offset
else
{
- scroll = ((state->m_video.towns_crtc_reg[17] & 0xfc00)<<2) | (((state->m_video.towns_crtc_reg[17] & 0x3ff)<<2));
+ scroll = ((m_video.towns_crtc_reg[17] & 0xfc00)<<2) | (((m_video.towns_crtc_reg[17] & 0x3ff)<<2));
off += scroll;
}
- off += (state->m_video.towns_crtc_reg[9] - state->m_video.towns_crtc_reg[18]);
- hzoom = (state->m_video.towns_crtc_reg[27] & 0x000f) + 1;
+ off += (m_video.towns_crtc_reg[9] - m_video.towns_crtc_reg[18]);
+ hzoom = (m_video.towns_crtc_reg[27] & 0x000f) + 1;
}
off += line * linesize;
@@ -1335,25 +1325,25 @@ static void towns_crtc_draw_scan_layer_16(running_machine &machine, bitmap_rgb32
{
for(x=rect->min_x;x<rect->max_x;x+=2)
{
- if(state->m_video.towns_video_reg[0] & 0x10)
+ if(m_video.towns_video_reg[0] & 0x10)
off &= 0x3ffff; // 2 layers
else
off &= 0x7ffff; // 1 layer
- colour = state->m_towns_gfxvram[off+(layer*0x40000)] >> 4;
+ colour = m_towns_gfxvram[off+(layer*0x40000)] >> 4;
if(colour != 0)
{
bitmap.pix32(scanline, x+1) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
}
- colour = state->m_towns_gfxvram[off+(layer*0x40000)] & 0x0f;
+ colour = m_towns_gfxvram[off+(layer*0x40000)] & 0x0f;
if(colour != 0)
{
bitmap.pix32(scanline, x) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
}
off++;
}
@@ -1363,33 +1353,33 @@ static void towns_crtc_draw_scan_layer_16(running_machine &machine, bitmap_rgb32
{ // x2 horizontal zoom
for(x=rect->min_x;x<rect->max_x;x+=4)
{
- if(state->m_video.towns_video_reg[0] & 0x10)
+ if(m_video.towns_video_reg[0] & 0x10)
off &= 0x3ffff; // 2 layers
else
off &= 0x7ffff; // 1 layer
- colour = state->m_towns_gfxvram[off+(layer*0x40000)] >> 4;
+ colour = m_towns_gfxvram[off+(layer*0x40000)] >> 4;
if(colour != 0)
{
bitmap.pix32(scanline, x+2) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
bitmap.pix32(scanline, x+3) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
}
- colour = state->m_towns_gfxvram[off+(layer*0x40000)] & 0x0f;
+ colour = m_towns_gfxvram[off+(layer*0x40000)] & 0x0f;
if(colour != 0)
{
bitmap.pix32(scanline, x) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
bitmap.pix32(scanline, x+1) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
}
off++;
}
@@ -1399,41 +1389,41 @@ static void towns_crtc_draw_scan_layer_16(running_machine &machine, bitmap_rgb32
{ // x3 horizontal zoom
for(x=rect->min_x;x<rect->max_x;x+=6)
{
- if(state->m_video.towns_video_reg[0] & 0x10)
+ if(m_video.towns_video_reg[0] & 0x10)
off &= 0x3ffff; // 2 layers
else
off &= 0x7ffff; // 1 layer
- colour = state->m_towns_gfxvram[off+(layer*0x40000)] >> 4;
+ colour = m_towns_gfxvram[off+(layer*0x40000)] >> 4;
if(colour != 0)
{
bitmap.pix32(scanline, x+3) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
bitmap.pix32(scanline, x+4) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
bitmap.pix32(scanline, x+5) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
}
- colour = state->m_towns_gfxvram[off+(layer*0x40000)] & 0x0f;
+ colour = m_towns_gfxvram[off+(layer*0x40000)] & 0x0f;
if(colour != 0)
{
bitmap.pix32(scanline, x) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
bitmap.pix32(scanline, x+1) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
bitmap.pix32(scanline, x+2) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
}
off++;
}
@@ -1443,49 +1433,49 @@ static void towns_crtc_draw_scan_layer_16(running_machine &machine, bitmap_rgb32
{ // x4 horizontal zoom
for(x=rect->min_x;x<rect->max_x;x+=8)
{
- if(state->m_video.towns_video_reg[0] & 0x10)
+ if(m_video.towns_video_reg[0] & 0x10)
off &= 0x3ffff; // 2 layers
else
off &= 0x7ffff; // 1 layer
- colour = state->m_towns_gfxvram[off+(layer*0x40000)] >> 4;
+ colour = m_towns_gfxvram[off+(layer*0x40000)] >> 4;
if(colour != 0)
{
bitmap.pix32(scanline, x+4) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
bitmap.pix32(scanline, x+5) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
bitmap.pix32(scanline, x+6) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
bitmap.pix32(scanline, x+7) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
}
- colour = state->m_towns_gfxvram[off+(layer*0x40000)] & 0x0f;
+ colour = m_towns_gfxvram[off+(layer*0x40000)] & 0x0f;
if(colour != 0)
{
bitmap.pix32(scanline, x) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
bitmap.pix32(scanline, x+1) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
bitmap.pix32(scanline, x+2) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
bitmap.pix32(scanline, x+3) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
}
off++;
}
@@ -1495,66 +1485,65 @@ static void towns_crtc_draw_scan_layer_16(running_machine &machine, bitmap_rgb32
{ // x5 horizontal zoom
for(x=rect->min_x;x<rect->max_x;x+=10)
{
- if(state->m_video.towns_video_reg[0] & 0x10)
+ if(m_video.towns_video_reg[0] & 0x10)
off &= 0x3ffff; // 2 layers
else
off &= 0x7ffff; // 1 layer
- colour = state->m_towns_gfxvram[off+(layer*0x40000)] >> 4;
+ colour = m_towns_gfxvram[off+(layer*0x40000)] >> 4;
if(colour != 0)
{
bitmap.pix32(scanline, x+5) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
bitmap.pix32(scanline, x+6) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
bitmap.pix32(scanline, x+7) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
bitmap.pix32(scanline, x+8) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
bitmap.pix32(scanline, x+9) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
}
- colour = state->m_towns_gfxvram[off+(layer*0x40000)] & 0x0f;
+ colour = m_towns_gfxvram[off+(layer*0x40000)] & 0x0f;
if(colour != 0)
{
bitmap.pix32(scanline, x) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
bitmap.pix32(scanline, x+1) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
bitmap.pix32(scanline, x+2) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
bitmap.pix32(scanline, x+3) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
bitmap.pix32(scanline, x+4) =
- (state->m_video.towns_palette_r[colour] << 16)
- | (state->m_video.towns_palette_g[colour] << 8)
- | (state->m_video.towns_palette_b[colour]);
+ (m_video.towns_palette_r[colour] << 16)
+ | (m_video.towns_palette_g[colour] << 8)
+ | (m_video.towns_palette_b[colour]);
}
off++;
}
}
}
-static void towns_crtc_draw_layer(running_machine &machine,bitmap_rgb32 &bitmap,const rectangle* rect,int layer)
+void towns_state::towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* rect,int layer)
{
- towns_state* state = machine.driver_data<towns_state>();
int line;
int scanline;
int height;
@@ -1563,18 +1552,18 @@ static void towns_crtc_draw_layer(running_machine &machine,bitmap_rgb32 &bitmap,
{
scanline = rect->min_y;
height = (rect->max_y - rect->min_y);
- if(state->m_video.towns_crtc_reg[27] & 0x0010)
+ if(m_video.towns_crtc_reg[27] & 0x0010)
height /= 2;
- switch(state->m_video.towns_video_reg[0] & 0x03)
+ switch(m_video.towns_video_reg[0] & 0x03)
{
case 0x01:
for(line=0;line<height;line++)
{
- towns_crtc_draw_scan_layer_16(machine,bitmap,rect,layer,line,scanline);
+ towns_crtc_draw_scan_layer_16(bitmap,rect,layer,line,scanline);
scanline++;
- if(state->m_video.towns_crtc_reg[27] & 0x0010) // vertical zoom
+ if(m_video.towns_crtc_reg[27] & 0x0010) // vertical zoom
{
- towns_crtc_draw_scan_layer_16(machine,bitmap,rect,layer,line,scanline);
+ towns_crtc_draw_scan_layer_16(bitmap,rect,layer,line,scanline);
scanline++;
}
}
@@ -1582,11 +1571,11 @@ static void towns_crtc_draw_layer(running_machine &machine,bitmap_rgb32 &bitmap,
case 0x02:
for(line=0;line<height;line++)
{
- towns_crtc_draw_scan_layer_256(machine,bitmap,rect,layer,line,scanline);
+ towns_crtc_draw_scan_layer_256(bitmap,rect,layer,line,scanline);
scanline++;
- if(state->m_video.towns_crtc_reg[27] & 0x0010) // vertical zoom
+ if(m_video.towns_crtc_reg[27] & 0x0010) // vertical zoom
{
- towns_crtc_draw_scan_layer_256(machine,bitmap,rect,layer,line,scanline);
+ towns_crtc_draw_scan_layer_256(bitmap,rect,layer,line,scanline);
scanline++;
}
}
@@ -1594,11 +1583,11 @@ static void towns_crtc_draw_layer(running_machine &machine,bitmap_rgb32 &bitmap,
case 0x03:
for(line=0;line<height;line++)
{
- towns_crtc_draw_scan_layer_hicolour(machine,bitmap,rect,layer,line,scanline);
+ towns_crtc_draw_scan_layer_hicolour(bitmap,rect,layer,line,scanline);
scanline++;
- if(state->m_video.towns_crtc_reg[27] & 0x0010) // vertical zoom
+ if(m_video.towns_crtc_reg[27] & 0x0010) // vertical zoom
{
- towns_crtc_draw_scan_layer_hicolour(machine,bitmap,rect,layer,line,scanline);
+ towns_crtc_draw_scan_layer_hicolour(bitmap,rect,layer,line,scanline);
scanline++;
}
}
@@ -1609,18 +1598,18 @@ static void towns_crtc_draw_layer(running_machine &machine,bitmap_rgb32 &bitmap,
{
scanline = rect->min_y;
height = (rect->max_y - rect->min_y);
- if(state->m_video.towns_crtc_reg[27] & 0x1000)
+ if(m_video.towns_crtc_reg[27] & 0x1000)
height /= 2;
- switch(state->m_video.towns_video_reg[0] & 0x0c)
+ switch(m_video.towns_video_reg[0] & 0x0c)
{
case 0x04:
for(line=0;line<height;line++)
{
- towns_crtc_draw_scan_layer_16(machine,bitmap,rect,layer,line,scanline);
+ towns_crtc_draw_scan_layer_16(bitmap,rect,layer,line,scanline);
scanline++;
- if(state->m_video.towns_crtc_reg[27] & 0x1000) // vertical zoom
+ if(m_video.towns_crtc_reg[27] & 0x1000) // vertical zoom
{
- towns_crtc_draw_scan_layer_16(machine,bitmap,rect,layer,line,scanline);
+ towns_crtc_draw_scan_layer_16(bitmap,rect,layer,line,scanline);
scanline++;
}
}
@@ -1628,11 +1617,11 @@ static void towns_crtc_draw_layer(running_machine &machine,bitmap_rgb32 &bitmap,
case 0x08:
for(line=0;line<height;line++)
{
- towns_crtc_draw_scan_layer_256(machine,bitmap,rect,layer,line,scanline);
+ towns_crtc_draw_scan_layer_256(bitmap,rect,layer,line,scanline);
scanline++;
- if(state->m_video.towns_crtc_reg[27] & 0x1000) // vertical zoom
+ if(m_video.towns_crtc_reg[27] & 0x1000) // vertical zoom
{
- towns_crtc_draw_scan_layer_256(machine,bitmap,rect,layer,line,scanline);
+ towns_crtc_draw_scan_layer_256(bitmap,rect,layer,line,scanline);
scanline++;
}
}
@@ -1640,11 +1629,11 @@ static void towns_crtc_draw_layer(running_machine &machine,bitmap_rgb32 &bitmap,
case 0x0c:
for(line=0;line<height;line++)
{
- towns_crtc_draw_scan_layer_hicolour(machine,bitmap,rect,layer,line,scanline);
+ towns_crtc_draw_scan_layer_hicolour(bitmap,rect,layer,line,scanline);
scanline++;
- if(state->m_video.towns_crtc_reg[27] & 0x1000) // vertical zoom
+ if(m_video.towns_crtc_reg[27] & 0x1000) // vertical zoom
{
- towns_crtc_draw_scan_layer_hicolour(machine,bitmap,rect,layer,line,scanline);
+ towns_crtc_draw_scan_layer_hicolour(bitmap,rect,layer,line,scanline);
scanline++;
}
}
@@ -1653,17 +1642,16 @@ static void towns_crtc_draw_layer(running_machine &machine,bitmap_rgb32 &bitmap,
}
}
-static void render_text_char(running_machine &machine, UINT8 x, UINT8 y, UINT8 ascii, UINT16 jis, UINT8 attr)
+void towns_state::render_text_char(UINT8 x, UINT8 y, UINT8 ascii, UINT16 jis, UINT8 attr)
{
- towns_state* state = machine.driver_data<towns_state>();
UINT32 rom_addr;
UINT32 vram_addr;
- UINT16 linesize = state->m_video.towns_crtc_reg[24] * 4;
+ UINT16 linesize = m_video.towns_crtc_reg[24] * 4;
UINT8 code_h,code_l;
UINT8 colour;
UINT8 data;
UINT8 temp;
- UINT8* font_rom = state->memregion("user")->base();
+ UINT8* font_rom = memregion("user")->base();
int a,b;
// all characters are 16 pixels high
@@ -1726,7 +1714,7 @@ static void render_text_char(running_machine &machine, UINT8 x, UINT8 y, UINT8 a
temp |= ((colour & 0x0f) << 4);
if(data & (1<<(b+1)))
temp |= (colour & 0x0f);
- //state->m_towns_gfxvram[0x40000+vram_addr+(b/2)] = temp;
+ //m_towns_gfxvram[0x40000+vram_addr+(b/2)] = temp;
}
vram_addr += linesize;
@@ -1734,7 +1722,7 @@ static void render_text_char(running_machine &machine, UINT8 x, UINT8 y, UINT8 a
}
}
-static void draw_text_layer(running_machine &machine)
+void towns_state::draw_text_layer()
{
/*
* Text format
@@ -1753,14 +1741,13 @@ static void draw_text_layer(running_machine &machine)
*
* The video hardware renders text to VRAM layer 1, there is no separate text layer
*/
- towns_state* state = machine.driver_data<towns_state>();
int x,y,c = 0;
for(y=0;y<40;y++)
{
for(x=0;x<80;x++)
{
- render_text_char(machine,x,y,state->m_towns_txtvram[c],((state->m_towns_txtvram[c+0x2000] << 8)|(state->m_towns_txtvram[c+0x2001])),state->m_towns_txtvram[c+1]);
+ render_text_char(x,y,m_towns_txtvram[c],((m_towns_txtvram[c+0x2000] << 8)|(m_towns_txtvram[c+0x2001])),m_towns_txtvram[c+1]);
c+=2;
}
}
@@ -1793,9 +1780,9 @@ INTERRUPT_GEN_MEMBER(towns_state::towns_vsync_irq)
m_video.towns_vblank_flag = 1;
machine().scheduler().timer_set(machine().primary_screen->time_until_vblank_end(), timer_expired_delegate(FUNC(towns_state::towns_vblank_end),this), 0, (void*)dev);
if(m_video.towns_tvram_enable)
- draw_text_layer(dev->machine());
+ draw_text_layer();
if(m_video.towns_sprite_reg[1] & 0x80)
- draw_sprites(dev->machine(),&m_video.towns_crtc_layerscr[1]);
+ draw_sprites(&m_video.towns_crtc_layerscr[1]);
}
void towns_state::video_start()
@@ -1814,12 +1801,12 @@ UINT32 towns_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, c
if(!machine().input().code_pressed(KEYCODE_Q))
{
if((m_video.towns_layer_ctrl & 0x03) != 0)
- towns_crtc_draw_layer(machine(),bitmap,&m_video.towns_crtc_layerscr[1],1);
+ towns_crtc_draw_layer(bitmap,&m_video.towns_crtc_layerscr[1],1);
}
if(!machine().input().code_pressed(KEYCODE_W))
{
if((m_video.towns_layer_ctrl & 0x0c) != 0)
- towns_crtc_draw_layer(machine(),bitmap,&m_video.towns_crtc_layerscr[0],0);
+ towns_crtc_draw_layer(bitmap,&m_video.towns_crtc_layerscr[0],0);
}
}
else
@@ -1827,12 +1814,12 @@ UINT32 towns_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, c
if(!machine().input().code_pressed(KEYCODE_Q))
{
if((m_video.towns_layer_ctrl & 0x0c) != 0)
- towns_crtc_draw_layer(machine(),bitmap,&m_video.towns_crtc_layerscr[0],0);
+ towns_crtc_draw_layer(bitmap,&m_video.towns_crtc_layerscr[0],0);
}
if(!machine().input().code_pressed(KEYCODE_W))
{
if((m_video.towns_layer_ctrl & 0x03) != 0)
- towns_crtc_draw_layer(machine(),bitmap,&m_video.towns_crtc_layerscr[1],1);
+ towns_crtc_draw_layer(bitmap,&m_video.towns_crtc_layerscr[1],1);
}
}
diff --git a/src/mess/video/gb.c b/src/mess/video/gb.c
index a4eea04d8ff..d8b6e83d3c1 100644
--- a/src/mess/video/gb.c
+++ b/src/mess/video/gb.c
@@ -142,7 +142,7 @@ PALETTE_INIT_MEMBER(megaduck_state,megaduck)
}
-INLINE void gb_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color)
+inline void gb_state::gb_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color)
{
bitmap.pix16(y, x) = (UINT16)color;
}
diff --git a/src/mess/video/hec2video.c b/src/mess/video/hec2video.c
index 628656bd003..4706450717d 100644
--- a/src/mess/video/hec2video.c
+++ b/src/mess/video/hec2video.c
@@ -37,10 +37,9 @@
#include "includes/hec2hrp.h"
-static void Init_Hector_Palette( running_machine &machine)
+void hec2hrp_state::Init_Hector_Palette()
{
- hec2hrp_state *state = machine.driver_data<hec2hrp_state>();
- UINT8 *hector_color = state->m_hector_color;
+ UINT8 *hector_color = m_hector_color;
// basic colors !
hector_color[0] = 0; // fond (noir)
hector_color[1] = 1; // HECTOR HRX (rouge)
@@ -48,30 +47,29 @@ static void Init_Hector_Palette( running_machine &machine)
hector_color[3] = 3; // Ecriture de choix (jaune)
// Color initialisation : full lightning
- palette_set_color( machine, 0,MAKE_RGB(000,000,000));//Noir
- palette_set_color( machine, 1,MAKE_RGB(255,000,000));//Rouge
- palette_set_color( machine, 2,MAKE_RGB(000,255,000));//Vert
- palette_set_color( machine, 3,MAKE_RGB(255,255,000));//Jaune
- palette_set_color( machine, 4,MAKE_RGB(000,000,255));//Bleu
- palette_set_color( machine, 5,MAKE_RGB(255,000,255));//Magneta
- palette_set_color( machine, 6,MAKE_RGB(000,255,255));//Cyan
- palette_set_color( machine, 7,MAKE_RGB(255,255,255));//Blanc
+ palette_set_color( machine(), 0,MAKE_RGB(000,000,000));//Noir
+ palette_set_color( machine(), 1,MAKE_RGB(255,000,000));//Rouge
+ palette_set_color( machine(), 2,MAKE_RGB(000,255,000));//Vert
+ palette_set_color( machine(), 3,MAKE_RGB(255,255,000));//Jaune
+ palette_set_color( machine(), 4,MAKE_RGB(000,000,255));//Bleu
+ palette_set_color( machine(), 5,MAKE_RGB(255,000,255));//Magneta
+ palette_set_color( machine(), 6,MAKE_RGB(000,255,255));//Cyan
+ palette_set_color( machine(), 7,MAKE_RGB(255,255,255));//Blanc
// 1/2 lightning
- palette_set_color( machine, 8,MAKE_RGB(000,000,000));//Noir
- palette_set_color( machine, 9,MAKE_RGB(128,000,000));//Rouge
- palette_set_color( machine,10,MAKE_RGB(000,128,000));//Vert
- palette_set_color( machine,11,MAKE_RGB(128,128,000));//Jaune
- palette_set_color( machine,12,MAKE_RGB(000,000,128));//Bleu
- palette_set_color( machine,13,MAKE_RGB(128,000,128));//Magneta
- palette_set_color( machine,14,MAKE_RGB(000,128,128));//Cyan
- palette_set_color( machine,15,MAKE_RGB(128,128,128));//Blanc
+ palette_set_color( machine(), 8,MAKE_RGB(000,000,000));//Noir
+ palette_set_color( machine(), 9,MAKE_RGB(128,000,000));//Rouge
+ palette_set_color( machine(),10,MAKE_RGB(000,128,000));//Vert
+ palette_set_color( machine(),11,MAKE_RGB(128,128,000));//Jaune
+ palette_set_color( machine(),12,MAKE_RGB(000,000,128));//Bleu
+ palette_set_color( machine(),13,MAKE_RGB(128,000,128));//Magneta
+ palette_set_color( machine(),14,MAKE_RGB(000,128,128));//Cyan
+ palette_set_color( machine(),15,MAKE_RGB(128,128,128));//Blanc
}
-void hector_hr(running_machine &machine, bitmap_ind16 &bitmap, UINT8 *page, int ymax, int yram)
+void hec2hrp_state::hector_hr(bitmap_ind16 &bitmap, UINT8 *page, int ymax, int yram)
{
- hec2hrp_state *state = machine.driver_data<hec2hrp_state>();
- UINT8 *hector_color = state->m_hector_color;
+ UINT8 *hector_color = m_hector_color;
UINT8 gfx,y;
UINT16 sy=0,ma=0,x;
for (y = 0; y <= ymax; y++) { //224
@@ -88,7 +86,7 @@ void hector_hr(running_machine &machine, bitmap_ind16 &bitmap, UINT8 *page, int
}
}
-void hector_80c(running_machine &machine, bitmap_ind16 &bitmap, UINT8 *page, int ymax, int yram)
+void hec2hrp_state::hector_80c(bitmap_ind16 &bitmap, UINT8 *page, int ymax, int yram)
{
UINT8 gfx,y;
UINT16 sy=0,ma=0,x;
@@ -113,7 +111,7 @@ void hector_80c(running_machine &machine, bitmap_ind16 &bitmap, UINT8 *page, int
VIDEO_START_MEMBER(hec2hrp_state,hec2hrp)
{
- Init_Hector_Palette(machine());
+ Init_Hector_Palette();
}
UINT32 hec2hrp_state::screen_update_hec2hrp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
@@ -125,18 +123,18 @@ UINT32 hec2hrp_state::screen_update_hec2hrp(screen_device &screen, bitmap_ind16
if (m_hector_flag_80c==0)
{
screen.set_visible_area(0, 243, 0, 227);
- hector_hr( machine(), bitmap , &videoram_HR[0], 227, 64);
+ hector_hr(bitmap , &videoram_HR[0], 227, 64);
}
else
{
screen.set_visible_area(0, 243*2, 0, 227);
- hector_80c( machine(), bitmap , &videoram_HR[0], 227, 64);
+ hector_80c(bitmap , &videoram_HR[0], 227, 64);
}
}
else
{
screen.set_visible_area(0, 113, 0, 75);
- hector_hr( machine(), bitmap, videoram, 77, 32);
+ hector_hr(bitmap, videoram, 77, 32);
}
return 0;
}
diff --git a/src/mess/video/intv.c b/src/mess/video/intv.c
index 75d607cdf62..f688ff6a17f 100644
--- a/src/mess/video/intv.c
+++ b/src/mess/video/intv.c
@@ -423,9 +423,8 @@ void intv_state::render_background(bitmap_ind16 &bitmap)
}
#ifdef UNUSED_CODE
-static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, int transparency)
+void intv_state::draw_background(bitmap_ind16 &bitmap, int transparency)
{
- intv_state *state = machine.driver_data<intv_state>();
// First, draw the background
int offs = 0;
int value = 0;
@@ -441,17 +440,17 @@ static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, int
int j;
- int x0 = STIC_OVERSCAN_LEFT_WIDTH + state->m_col_delay;
- int y0 = STIC_OVERSCAN_TOP_HEIGHT + state->m_row_delay;
+ int x0 = STIC_OVERSCAN_LEFT_WIDTH + m_col_delay;
+ int y0 = STIC_OVERSCAN_TOP_HEIGHT + m_row_delay;
- if (state->m_color_stack_mode == 1)
+ if (m_color_stack_mode == 1)
{
- state->m_color_stack_offset = 0;
+ m_color_stack_offset = 0;
for(row = 0; row < STIC_BACKTAB_HEIGHT; row++)
{
for(col = 0; col < STIC_BACKTAB_WIDTH; col++)
{
- value = state->m_ram16[offs];
+ value = m_ram16[offs];
n_bit = value & STIC_CSTM_ADV;
p_bit = value & STIC_CSTM_FG3;
@@ -464,10 +463,10 @@ static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, int
colorc = (value & STIC_CSQM_C) >> 6;
colord = ((n_bit & STIC_CSQM_D2) >> 11) + ((value & STIC_CSQM_D10) >> 9);
// color 7 if the top of the color stack in this mode
- if (colora == 7) colora = state->m_stic_registers[STIC_CSR + STIC_CSR3];
- if (colorb == 7) colorb = state->m_stic_registers[STIC_CSR + STIC_CSR3];
- if (colorc == 7) colorc = state->m_stic_registers[STIC_CSR + STIC_CSR3];
- if (colord == 7) colord = state->m_stic_registers[STIC_CSR + STIC_CSR3];
+ if (colora == 7) colora = m_stic_registers[STIC_CSR + STIC_CSR3];
+ if (colorb == 7) colorb = m_stic_registers[STIC_CSR + STIC_CSR3];
+ if (colorc == 7) colorc = m_stic_registers[STIC_CSR + STIC_CSR3];
+ if (colord == 7) colord = m_stic_registers[STIC_CSR + STIC_CSR3];
intv_plot_box(bitmap, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colora);
intv_plot_box(bitmap, (x0 + col * STIC_CARD_WIDTH + STIC_CSQM_WIDTH)) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colorb);
intv_plot_box(bitmap, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + STIC_CSQM_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colorc);
@@ -477,8 +476,8 @@ static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, int
{
if (n_bit) // next color
{
- state->m_color_stack_offset += 1;
- state->m_color_stack_offset &= (STIC_CSRS - 1);
+ m_color_stack_offset += 1;
+ m_color_stack_offset &= (STIC_CSRS - 1);
}
if (p_bit) // pastel color set
@@ -486,22 +485,22 @@ static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, int
else
fgcolor = value & STIC_CSTM_FG20;
- bgcolor = state->m_stic_registers[STIC_CSR + state->m_color_stack_offset];
+ bgcolor = m_stic_registers[STIC_CSR + m_color_stack_offset];
code = (value & STIC_CSTM_C)>>3;
if (g_bit) // read from gram
{
code &= (STIC_CSTM_C50 >> 3); // keep from going outside the array
- //if (state->m_gramdirtybytes[code] == 1)
+ //if (m_gramdirtybytes[code] == 1)
{
- decodechar(machine.gfx[1],
+ decodechar(machine().gfx[1],
code,
- state->m_gram,
- machine.config()->gfxdecodeinfo[1].gfxlayout);
- state->m_gramdirtybytes[code] = 0;
+ m_gram,
+ machine().config()->gfxdecodeinfo[1].gfxlayout);
+ m_gramdirtybytes[code] = 0;
}
// Draw GRAM char
- drawgfx(bitmap,machine.gfx[1],
+ drawgfx(bitmap,machine().gfx[1],
code,
bgcolor*16+fgcolor,
0,0, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE,
@@ -515,7 +514,7 @@ static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, int
}
else // read from grom
{
- drawgfx(bitmap,machine.gfx[0],
+ drawgfx(bitmap,machine().gfx[0],
code,
bgcolor*16+fgcolor,
0,0, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE,
@@ -538,23 +537,23 @@ static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, int
{
for(col = 0; col < STIC_BACKTAB_WIDTH; col++)
{
- value = state->m_ram16[offs];
+ value = m_ram16[offs];
fgcolor = value & STIC_FBM_FG;
bgcolor = ((value & STIC_FBM_BG2) >> 11) + ((value & STIC_FBM_BG310) >> 9);
code = (value & STIC_FBM_C) >> 3;
if (value & STIC_FBM_SEL) // read for GRAM
{
- //if (state->m_gramdirtybytes[code] == 1)
+ //if (m_gramdirtybytes[code] == 1)
{
- decodechar(machine.gfx[1],
+ decodechar(machine().gfx[1],
code,
- state->m_gram,
- machine.config()->gfxdecodeinfo[1].gfxlayout);
- state->m_gramdirtybytes[code] = 0;
+ m_gram,
+ machine().config()->gfxdecodeinfo[1].gfxlayout);
+ m_gramdirtybytes[code] = 0;
}
// Draw GRAM char
- drawgfx(bitmap,machine.gfx[1],
+ drawgfx(bitmap,machine().gfx[1],
code,
bgcolor*16+fgcolor,
0,0, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE,
@@ -562,7 +561,7 @@ static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, int
}
else // read from GROM
{
- drawgfx(bitmap,machine.gfx[0],
+ drawgfx(bitmap,machine().gfx[0],
code,
bgcolor*16+fgcolor,
0,0, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE,
@@ -577,17 +576,16 @@ static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, int
/* TBD: need to handle sprites behind foreground? */
#ifdef UNUSED_FUNCTION
-static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, int behind_foreground)
+void intv_state::draw_sprites(bitmap_ind16 &bitmap, int behind_foreground)
{
- intv_state *state = machine.driver_data<intv_state>();
int i;
int code;
- int x0 = STIC_OVERSCAN_LEFT_WIDTH + state->m_col_delay - STIC_CARD_WIDTH;
- int y0 = STIC_OVERSCAN_TOP_HEIGHT + state->m_row_delay - STIC_CARD_HEIGHT;
+ int x0 = STIC_OVERSCAN_LEFT_WIDTH + m_col_delay - STIC_CARD_WIDTH;
+ int y0 = STIC_OVERSCAN_TOP_HEIGHT + m_row_delay - STIC_CARD_HEIGHT;
for(i = STIC_MOBS - 1; i >= 0; --i)
{
- intv_sprite_type *s = &state->m_sprite[i];
+ intv_sprite_type *s = &m_sprite[i];
if (s->visible && (s->behind_foreground == behind_foreground))
{
code = s->card;
@@ -596,16 +594,16 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, int beh
code %= 64; // keep from going outside the array
if (s->yres == 1)
{
- //if (state->m_gramdirtybytes[code] == 1)
+ //if (m_gramdirtybytes[code] == 1)
{
- decodechar(machine.gfx[1],
+ decodechar(machine().gfx[1],
code,
- state->m_gram,
- machine.config()->gfxdecodeinfo[1].gfxlayout);
- state->m_gramdirtybytes[code] = 0;
+ m_gram,
+ machine().config()->gfxdecodeinfo[1].gfxlayout);
+ m_gramdirtybytes[code] = 0;
}
// Draw GRAM char
- drawgfxzoom_transpen(bitmap,&machine.screen[0].visarea,machine.gfx[1],
+ drawgfxzoom_transpen(bitmap,&machine().screen[0].visarea,machine().gfx[1],
code,
s->color,
s->xflip,s->yflip,
@@ -614,27 +612,27 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, int beh
}
else
{
- //if ((state->m_gramdirtybytes[code] == 1) || (state->m_gramdirtybytes[code+1] == 1))
+ //if ((m_gramdirtybytes[code] == 1) || (m_gramdirtybytes[code+1] == 1))
{
- decodechar(machine.gfx[1],
+ decodechar(machine().gfx[1],
code,
- state->m_gram,
- machine.config()->gfxdecodeinfo[1].gfxlayout);
- decodechar(machine.gfx[1],
+ m_gram,
+ machine().config()->gfxdecodeinfo[1].gfxlayout);
+ decodechar(machine().gfx[1],
code+1,
- state->m_gram,
- machine.config()->gfxdecodeinfo[1].gfxlayout);
- state->m_gramdirtybytes[code] = 0;
- state->m_gramdirtybytes[code+1] = 0;
+ m_gram,
+ machine().config()->gfxdecodeinfo[1].gfxlayout);
+ m_gramdirtybytes[code] = 0;
+ m_gramdirtybytes[code+1] = 0;
}
// Draw GRAM char
- drawgfxzoom_transpen(bitmap,&machine.screen[0].visarea,machine.gfx[1],
+ drawgfxzoom_transpen(bitmap,&machine().screen[0].visarea,machine().gfx[1],
code,
s->color,
s->xflip,s->yflip,
(s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE + s->yflip * s->ysize * STIC_CARD_HEIGHT,
0x8000*s->xsize, 0x8000*s->ysize,0);
- drawgfxzoom_transpen(bitmap,&machine.screen[0].visarea,machine.gfx[1],
+ drawgfxzoom_transpen(bitmap,&machine().screen[0].visarea,machine().gfx[1],
code+1,
s->color,
s->xflip,s->yflip,
@@ -647,7 +645,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, int beh
if (s->yres == 1)
{
// Draw GROM char
- drawgfxzoom_transpen(bitmap,&machine.screen[0].visarea,machine.gfx[0],
+ drawgfxzoom_transpen(bitmap,&machine().screen[0].visarea,machine().gfx[0],
code,
s->color,
s->xflip,s->yflip,
@@ -656,13 +654,13 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, int beh
}
else
{
- drawgfxzoom_transpen(bitmap,&machine.screen[0].visarea,machine.gfx[0],
+ drawgfxzoom_transpen(bitmap,&machine().screen[0].visarea,machine().gfx[0],
code,
s->color,
s->xflip,s->yflip,
(s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE + s->yflip * s->ysize * STIC_CARD_HEIGHT,
0x8000*s->xsize, 0x8000*s->ysize,0);
- drawgfxzoom_transpen(bitmap,&machine.screen[0].visarea,machine.gfx[0],
+ drawgfxzoom_transpen(bitmap,&machine().screen[0].visarea,machine().gfx[0],
code+1,
s->color,
s->xflip,s->yflip,
diff --git a/src/mess/video/lviv.c b/src/mess/video/lviv.c
index 711daa4c599..c9e770e0277 100644
--- a/src/mess/video/lviv.c
+++ b/src/mess/video/lviv.c
@@ -34,29 +34,28 @@ void lviv_state::palette_init()
}
-void lviv_update_palette(running_machine &machine, UINT8 pal)
+void lviv_state::lviv_update_palette(UINT8 pal)
{
- lviv_state *state = machine.driver_data<lviv_state>();
- state->m_colortable[0][0] = 0;
- state->m_colortable[0][1] = 0;
- state->m_colortable[0][2] = 0;
- state->m_colortable[0][3] = 0;
-
- state->m_colortable[0][0] |= (((pal>>3)&0x01) == ((pal>>4)&0x01)) ? 0x04 : 0x00;
- state->m_colortable[0][0] |= ((pal>>5)&0x01) ? 0x02 : 0x00;
- state->m_colortable[0][0] |= (((pal>>2)&0x01) == ((pal>>6)&0x01)) ? 0x01 : 0x00;
-
- state->m_colortable[0][1] |= ((pal&0x01) == ((pal>>4)&0x01)) ? 0x04 : 0x00;
- state->m_colortable[0][1] |= ((pal>>5)&0x01) ? 0x02 : 0x00;
- state->m_colortable[0][1] |= ((pal>>6)&0x01) ? 0x00 : 0x01;
-
- state->m_colortable[0][2] |= ((pal>>4)&0x01) ? 0x04 : 0x00;
- state->m_colortable[0][2] |= ((pal>>5)&0x01) ? 0x00 : 0x02;
- state->m_colortable[0][2] |= ((pal>>6)&0x01) ? 0x01 : 0x00;
-
- state->m_colortable[0][3] |= ((pal>>4)&0x01) ? 0x00 : 0x04;
- state->m_colortable[0][3] |= (((pal>>1)&0x01) == ((pal>>5)&0x01)) ? 0x02 : 0x00;
- state->m_colortable[0][3] |= ((pal>>6)&0x01) ? 0x01 : 0x00;
+ m_colortable[0][0] = 0;
+ m_colortable[0][1] = 0;
+ m_colortable[0][2] = 0;
+ m_colortable[0][3] = 0;
+
+ m_colortable[0][0] |= (((pal>>3)&0x01) == ((pal>>4)&0x01)) ? 0x04 : 0x00;
+ m_colortable[0][0] |= ((pal>>5)&0x01) ? 0x02 : 0x00;
+ m_colortable[0][0] |= (((pal>>2)&0x01) == ((pal>>6)&0x01)) ? 0x01 : 0x00;
+
+ m_colortable[0][1] |= ((pal&0x01) == ((pal>>4)&0x01)) ? 0x04 : 0x00;
+ m_colortable[0][1] |= ((pal>>5)&0x01) ? 0x02 : 0x00;
+ m_colortable[0][1] |= ((pal>>6)&0x01) ? 0x00 : 0x01;
+
+ m_colortable[0][2] |= ((pal>>4)&0x01) ? 0x04 : 0x00;
+ m_colortable[0][2] |= ((pal>>5)&0x01) ? 0x00 : 0x02;
+ m_colortable[0][2] |= ((pal>>6)&0x01) ? 0x01 : 0x00;
+
+ m_colortable[0][3] |= ((pal>>4)&0x01) ? 0x00 : 0x04;
+ m_colortable[0][3] |= (((pal>>1)&0x01) == ((pal>>5)&0x01)) ? 0x02 : 0x00;
+ m_colortable[0][3] |= ((pal>>6)&0x01) ? 0x01 : 0x00;
}
void lviv_state::video_start()
diff --git a/src/mess/video/mac.c b/src/mess/video/mac.c
index 3fe0bbc5d8b..8057d8c49b4 100644
--- a/src/mess/video/mac.c
+++ b/src/mess/video/mac.c
@@ -860,22 +860,22 @@ UINT32 mac_state::screen_update_macsonora(screen_device &screen, bitmap_rgb32 &b
// DAFB: video for Quadra 700/900
-static void dafb_recalc_ints(mac_state *mac)
+void mac_state::dafb_recalc_ints()
{
- if (mac->m_dafb_int_status != 0)
+ if (m_dafb_int_status != 0)
{
- mac->nubus_slot_interrupt(0xf, ASSERT_LINE);
+ nubus_slot_interrupt(0xf, ASSERT_LINE);
}
else
{
- mac->nubus_slot_interrupt(0xf, CLEAR_LINE);
+ nubus_slot_interrupt(0xf, CLEAR_LINE);
}
}
TIMER_CALLBACK_MEMBER(mac_state::dafb_vbl_tick)
{
m_dafb_int_status |= 1;
- dafb_recalc_ints(this);
+ dafb_recalc_ints();
m_vbl_timer->adjust(m_screen->time_until_pos(480, 0), 0);
}
@@ -883,7 +883,7 @@ TIMER_CALLBACK_MEMBER(mac_state::dafb_vbl_tick)
TIMER_CALLBACK_MEMBER(mac_state::dafb_cursor_tick)
{
m_dafb_int_status |= 4;
- dafb_recalc_ints(this);
+ dafb_recalc_ints();
m_cursor_timer->adjust(m_screen->time_until_pos(m_cursor_line, 0), 0);
}
@@ -932,12 +932,12 @@ READ32_MEMBER(mac_state::dafb_r)
case 0x10c: // clear cursor scanline int
m_dafb_int_status &= ~4;
- dafb_recalc_ints(this);
+ dafb_recalc_ints();
break;
case 0x114: // clear VBL int
m_dafb_int_status &= ~1;
- dafb_recalc_ints(this);
+ dafb_recalc_ints();
break;
}
return 0;
@@ -975,7 +975,7 @@ WRITE32_MEMBER(mac_state::dafb_w)
{
m_vbl_timer->adjust(attotime::never);
m_dafb_int_status &= ~1;
- dafb_recalc_ints(this);
+ dafb_recalc_ints();
}
if (data & 2) // aux scanline interrupt enable
@@ -991,18 +991,18 @@ WRITE32_MEMBER(mac_state::dafb_w)
{
m_cursor_timer->adjust(attotime::never);
m_dafb_int_status &= ~4;
- dafb_recalc_ints(this);
+ dafb_recalc_ints();
}
break;
case 0x10c: // clear cursor scanline int
m_dafb_int_status &= ~4;
- dafb_recalc_ints(this);
+ dafb_recalc_ints();
break;
case 0x114: // clear VBL int
m_dafb_int_status &= ~1;
- dafb_recalc_ints(this);
+ dafb_recalc_ints();
break;
}
}
diff --git a/src/mess/video/nc.c b/src/mess/video/nc.c
index 706ce99597c..5bbcca01bdd 100644
--- a/src/mess/video/nc.c
+++ b/src/mess/video/nc.c
@@ -41,10 +41,9 @@ void nc_state::palette_init()
}
-void nc200_video_set_backlight(running_machine &machine, int state)
+void nc_state::nc200_video_set_backlight(int state)
{
- nc_state *drvstate = machine.driver_data<nc_state>();
- drvstate->m_nc200_backlight = state;
+ m_nc200_backlight = state;
}
diff --git a/src/mess/video/oric.c b/src/mess/video/oric.c
index 007c7f3e5eb..054515d1e92 100644
--- a/src/mess/video/oric.c
+++ b/src/mess/video/oric.c
@@ -137,7 +137,7 @@ void oric_state::oric_vh_update_attribute(UINT8 c)
/* render 6-pixels using foreground and background colours specified */
/* used in hires and text mode */
-static void oric_vh_render_6pixels(bitmap_ind16 &bitmap, int x, UINT8 y, UINT8 fg, UINT8 bg, UINT8 data, bool invert_flag)
+void oric_state::oric_vh_render_6pixels(bitmap_ind16 &bitmap, int x, UINT8 y, UINT8 fg, UINT8 bg, UINT8 data, bool invert_flag)
{
/* invert? */
if (invert_flag)
diff --git a/src/mess/video/pcw.c b/src/mess/video/pcw.c
index ff4ef0c02f7..d8e18d7973f 100644
--- a/src/mess/video/pcw.c
+++ b/src/mess/video/pcw.c
@@ -10,7 +10,7 @@
#include "includes/pcw.h"
#include "machine/ram.h"
-INLINE void pcw_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color)
+inline void pcw_state::pcw_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color)
{
bitmap.pix16(y, x) = (UINT16)color;
}
diff --git a/src/mess/video/pcw16.c b/src/mess/video/pcw16.c
index 6c9c1aac058..e7bba7267c5 100644
--- a/src/mess/video/pcw16.c
+++ b/src/mess/video/pcw16.c
@@ -48,7 +48,7 @@ static const rgb_t pcw16_palette[PCW16_NUM_COLOURS] =
};
-INLINE void pcw16_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color)
+inline void pcw16_state::pcw16_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color)
{
bitmap.pix16(y, x) = (UINT16)color;
}
@@ -64,7 +64,7 @@ void pcw16_state::video_start()
}
/* 640, 1 bit per pixel */
-static void pcw16_vh_decode_mode0(pcw16_state *state, bitmap_ind16 &bitmap, int x, int y, unsigned char byte)
+void pcw16_state::pcw16_vh_decode_mode0(bitmap_ind16 &bitmap, int x, int y, unsigned char byte)
{
int b;
int local_byte;
@@ -73,8 +73,8 @@ static void pcw16_vh_decode_mode0(pcw16_state *state, bitmap_ind16 &bitmap, int
local_byte = byte;
- cols[0] = state->m_colour_palette[0];
- cols[1] = state->m_colour_palette[1];
+ cols[0] = m_colour_palette[0];
+ cols[1] = m_colour_palette[1];
px = x;
for (b=0; b<8; b++)
@@ -87,7 +87,7 @@ static void pcw16_vh_decode_mode0(pcw16_state *state, bitmap_ind16 &bitmap, int
}
/* 320, 2 bits per pixel */
-static void pcw16_vh_decode_mode1(pcw16_state *state, bitmap_ind16 &bitmap, int x, int y, unsigned char byte)
+void pcw16_state::pcw16_vh_decode_mode1(bitmap_ind16 &bitmap, int x, int y, unsigned char byte)
{
int b;
int px;
@@ -96,7 +96,7 @@ static void pcw16_vh_decode_mode1(pcw16_state *state, bitmap_ind16 &bitmap, int
for (b=0; b<3; b++)
{
- cols[b] = state->m_colour_palette[b];
+ cols[b] = m_colour_palette[b];
}
local_byte = byte;
@@ -118,15 +118,15 @@ static void pcw16_vh_decode_mode1(pcw16_state *state, bitmap_ind16 &bitmap, int
}
/* 160, 4 bits per pixel */
-static void pcw16_vh_decode_mode2(pcw16_state *state, bitmap_ind16 &bitmap, int x, int y, unsigned char byte)
+void pcw16_state::pcw16_vh_decode_mode2(bitmap_ind16 &bitmap, int x, int y, unsigned char byte)
{
int px;
int b;
int local_byte;
int cols[2];
- cols[0] = state->m_colour_palette[0];
- cols[1] = state->m_colour_palette[1];
+ cols[0] = m_colour_palette[0];
+ cols[1] = m_colour_palette[1];
local_byte = byte;
px = x;
@@ -233,20 +233,20 @@ UINT32 pcw16_state::screen_update_pcw16(screen_device &screen, bitmap_ind16 &bit
{
case 0:
{
- pcw16_vh_decode_mode0(this, bitmap, x, y+PCW16_BORDER_HEIGHT, byte);
+ pcw16_vh_decode_mode0(bitmap, x, y+PCW16_BORDER_HEIGHT, byte);
}
break;
case 1:
{
- pcw16_vh_decode_mode1(this, bitmap, x, y+PCW16_BORDER_HEIGHT, byte);
+ pcw16_vh_decode_mode1(bitmap, x, y+PCW16_BORDER_HEIGHT, byte);
}
break;
case 3:
case 2:
{
- pcw16_vh_decode_mode2(this, bitmap, x, y+PCW16_BORDER_HEIGHT, byte);
+ pcw16_vh_decode_mode2(bitmap, x, y+PCW16_BORDER_HEIGHT, byte);
}
break;
}
diff --git a/src/mess/video/pdp1.c b/src/mess/video/pdp1.c
index b7064d984af..509950077b5 100644
--- a/src/mess/video/pdp1.c
+++ b/src/mess/video/pdp1.c
@@ -25,15 +25,7 @@
-
-
-static void pdp1_draw_panel_backdrop(running_machine &machine, bitmap_ind16 &bitmap);
-static void pdp1_draw_panel(running_machine &machine, bitmap_ind16 &bitmap);
-
-static void pdp1_erase_lightpen(pdp1_state *state, bitmap_ind16 &bitmap);
-static void pdp1_draw_lightpen(pdp1_state *state, bitmap_ind16 &bitmap);
-
-INLINE void pdp1_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color)
+inline void pdp1_state::pdp1_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color)
{
bitmap.pix16(y, x) = color;
}
@@ -50,7 +42,7 @@ void pdp1_state::video_start()
m_typewriter_bitmap.allocate(typewriter_window_width, typewriter_window_height, BITMAP_FORMAT_IND16);
/* set up out bitmaps */
- pdp1_draw_panel_backdrop(machine(), m_panel_bitmap);
+ pdp1_draw_panel_backdrop(m_panel_bitmap);
const rectangle typewriter_bitmap_bounds(0, typewriter_window_width-1, 0, typewriter_window_height-1);
m_typewriter_bitmap.fill(pen_typewriter_bg, typewriter_bitmap_bounds);
@@ -71,13 +63,12 @@ void pdp1_state::screen_eof_pdp1(screen_device &screen, bool state)
/*
schedule a pixel to be plotted
*/
-void pdp1_plot(running_machine &machine, int x, int y)
+void pdp1_state::pdp1_plot(int x, int y)
{
- pdp1_state *state = machine.driver_data<pdp1_state>();
/* compute pixel coordinates and plot */
x = x*crt_window_width/01777;
y = y*crt_window_height/01777;
- state->m_crt->plot(x, y);
+ m_crt->plot(x, y);
}
@@ -86,11 +77,11 @@ void pdp1_plot(running_machine &machine, int x, int y)
*/
UINT32 pdp1_state::screen_update_pdp1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- pdp1_erase_lightpen(this, bitmap);
+ pdp1_erase_lightpen(bitmap);
m_crt->update(bitmap);
- pdp1_draw_lightpen(this, bitmap);
+ pdp1_draw_lightpen(bitmap);
- pdp1_draw_panel(machine(), m_panel_bitmap);
+ pdp1_draw_panel(m_panel_bitmap);
copybitmap(bitmap, m_panel_bitmap, 0, 0, panel_window_offset_x, panel_window_offset_y, cliprect);
copybitmap(bitmap, m_typewriter_bitmap, 0, 0, typewriter_window_offset_x, typewriter_window_offset_y, cliprect);
@@ -148,7 +139,7 @@ enum
};
/* draw a small 8*8 LED (or is this a lamp? ) */
-static void pdp1_draw_led(running_machine &machine, bitmap_ind16 &bitmap, int x, int y, int state)
+void pdp1_state::pdp1_draw_led(bitmap_ind16 &bitmap, int x, int y, int state)
{
int xx, yy;
@@ -158,13 +149,13 @@ static void pdp1_draw_led(running_machine &machine, bitmap_ind16 &bitmap, int x,
}
/* draw nb_bits leds which represent nb_bits bits in value */
-static void pdp1_draw_multipleled(running_machine &machine, bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits)
+void pdp1_state::pdp1_draw_multipleled(bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits)
{
while (nb_bits)
{
nb_bits--;
- pdp1_draw_led(machine, bitmap, x, y, (value >> nb_bits) & 1);
+ pdp1_draw_led(bitmap, x, y, (value >> nb_bits) & 1);
x += 8;
}
@@ -172,7 +163,7 @@ static void pdp1_draw_multipleled(running_machine &machine, bitmap_ind16 &bitmap
/* draw a small 8*8 switch */
-static void pdp1_draw_switch(running_machine &machine, bitmap_ind16 &bitmap, int x, int y, int state)
+void pdp1_state::pdp1_draw_switch(bitmap_ind16 &bitmap, int x, int y, int state)
{
int xx, yy;
int i;
@@ -213,13 +204,13 @@ static void pdp1_draw_switch(running_machine &machine, bitmap_ind16 &bitmap, int
/* draw nb_bits switches which represent nb_bits bits in value */
-static void pdp1_draw_multipleswitch(running_machine &machine, bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits)
+void pdp1_state::pdp1_draw_multipleswitch(bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits)
{
while (nb_bits)
{
nb_bits--;
- pdp1_draw_switch(machine, bitmap, x, y, (value >> nb_bits) & 1);
+ pdp1_draw_switch(bitmap, x, y, (value >> nb_bits) & 1);
x += 8;
}
@@ -227,18 +218,18 @@ static void pdp1_draw_multipleswitch(running_machine &machine, bitmap_ind16 &bit
/* write a single char on screen */
-static void pdp1_draw_char(running_machine &machine, bitmap_ind16 &bitmap, char character, int x, int y, int color)
+void pdp1_state::pdp1_draw_char(bitmap_ind16 &bitmap, char character, int x, int y, int color)
{
- drawgfx_transpen(bitmap, bitmap.cliprect(), machine.gfx[0], character-32, color, 0, 0,
+ drawgfx_transpen(bitmap, bitmap.cliprect(), machine().gfx[0], character-32, color, 0, 0,
x+1, y, 0);
}
/* write a string on screen */
-static void pdp1_draw_string(running_machine &machine, bitmap_ind16 &bitmap, const char *buf, int x, int y, int color)
+void pdp1_state::pdp1_draw_string(bitmap_ind16 &bitmap, const char *buf, int x, int y, int color)
{
while (* buf)
{
- pdp1_draw_char(machine, bitmap, *buf, x, y, color);
+ pdp1_draw_char(bitmap, *buf, x, y, color);
x += 8;
buf++;
@@ -249,98 +240,96 @@ static void pdp1_draw_string(running_machine &machine, bitmap_ind16 &bitmap, con
/*
draw the operator control panel (fixed backdrop)
*/
-static void pdp1_draw_panel_backdrop(running_machine &machine, bitmap_ind16 &bitmap)
+void pdp1_state::pdp1_draw_panel_backdrop(bitmap_ind16 &bitmap)
{
- pdp1_state *state = machine.driver_data<pdp1_state>();
/* fill with black */
const rectangle panel_bitmap_bounds(0, panel_window_width-1, 0, panel_window_height-1);
- state->m_panel_bitmap.fill(pen_panel_bg, panel_bitmap_bounds);
+ m_panel_bitmap.fill(pen_panel_bg, panel_bitmap_bounds);
/* column 1: registers, test word, test address */
- pdp1_draw_string(machine, bitmap, "program counter", x_panel_col1_offset, y_panel_pc_offset, color_panel_caption);
- pdp1_draw_string(machine, bitmap, "memory address", x_panel_col1_offset, y_panel_ma_offset, color_panel_caption);
- pdp1_draw_string(machine, bitmap, "memory buffer", x_panel_col1_offset, y_panel_mb_offset, color_panel_caption);
- pdp1_draw_string(machine, bitmap, "accumulator", x_panel_col1_offset, y_panel_ac_offset, color_panel_caption);
- pdp1_draw_string(machine, bitmap, "in-out", x_panel_col1_offset, y_panel_io_offset, color_panel_caption);
- pdp1_draw_string(machine, bitmap, "extend address", x_panel_col1_offset, y_panel_ta_offset, color_panel_caption);
- pdp1_draw_string(machine, bitmap, "test word", x_panel_col1_offset, y_panel_tw_offset, color_panel_caption);
+ pdp1_draw_string(bitmap, "program counter", x_panel_col1_offset, y_panel_pc_offset, color_panel_caption);
+ pdp1_draw_string(bitmap, "memory address", x_panel_col1_offset, y_panel_ma_offset, color_panel_caption);
+ pdp1_draw_string(bitmap, "memory buffer", x_panel_col1_offset, y_panel_mb_offset, color_panel_caption);
+ pdp1_draw_string(bitmap, "accumulator", x_panel_col1_offset, y_panel_ac_offset, color_panel_caption);
+ pdp1_draw_string(bitmap, "in-out", x_panel_col1_offset, y_panel_io_offset, color_panel_caption);
+ pdp1_draw_string(bitmap, "extend address", x_panel_col1_offset, y_panel_ta_offset, color_panel_caption);
+ pdp1_draw_string(bitmap, "test word", x_panel_col1_offset, y_panel_tw_offset, color_panel_caption);
/* column separator */
bitmap.plot_box(x_panel_col2_offset-4, panel_window_offset_y+8, 1, 96, pen_panel_caption);
/* column 2: 1-bit indicators */
- pdp1_draw_string(machine, bitmap, "run", x_panel_col2_offset+8, y_panel_run_offset, color_panel_caption);
- pdp1_draw_string(machine, bitmap, "cycle", x_panel_col2_offset+8, y_panel_cyc_offset, color_panel_caption);
- pdp1_draw_string(machine, bitmap, "defer", x_panel_col2_offset+8, y_panel_defer_offset, color_panel_caption);
- pdp1_draw_string(machine, bitmap, "h. s. cycle", x_panel_col2_offset+8, y_panel_hs_cyc_offset, color_panel_caption);
- pdp1_draw_string(machine, bitmap, "brk. ctr. 1", x_panel_col2_offset+8, y_panel_brk_ctr_1_offset, color_panel_caption);
- pdp1_draw_string(machine, bitmap, "brk. ctr. 2", x_panel_col2_offset+8, y_panel_brk_ctr_2_offset, color_panel_caption);
- pdp1_draw_string(machine, bitmap, "overflow", x_panel_col2_offset+8, y_panel_ov_offset, color_panel_caption);
- pdp1_draw_string(machine, bitmap, "read in", x_panel_col2_offset+8, y_panel_rim_offset, color_panel_caption);
- pdp1_draw_string(machine, bitmap, "seq. break", x_panel_col2_offset+8, y_panel_sbm_offset, color_panel_caption);
- pdp1_draw_string(machine, bitmap, "extend", x_panel_col2_offset+8, y_panel_exd_offset, color_panel_caption);
- pdp1_draw_string(machine, bitmap, "i-o halt", x_panel_col2_offset+8, y_panel_ioh_offset, color_panel_caption);
- pdp1_draw_string(machine, bitmap, "i-o com'ds", x_panel_col2_offset+8, y_panel_ioc_offset, color_panel_caption);
- pdp1_draw_string(machine, bitmap, "i-o sync", x_panel_col2_offset+8, y_panel_ios_offset, color_panel_caption);
+ pdp1_draw_string(bitmap, "run", x_panel_col2_offset+8, y_panel_run_offset, color_panel_caption);
+ pdp1_draw_string(bitmap, "cycle", x_panel_col2_offset+8, y_panel_cyc_offset, color_panel_caption);
+ pdp1_draw_string(bitmap, "defer", x_panel_col2_offset+8, y_panel_defer_offset, color_panel_caption);
+ pdp1_draw_string(bitmap, "h. s. cycle", x_panel_col2_offset+8, y_panel_hs_cyc_offset, color_panel_caption);
+ pdp1_draw_string(bitmap, "brk. ctr. 1", x_panel_col2_offset+8, y_panel_brk_ctr_1_offset, color_panel_caption);
+ pdp1_draw_string(bitmap, "brk. ctr. 2", x_panel_col2_offset+8, y_panel_brk_ctr_2_offset, color_panel_caption);
+ pdp1_draw_string(bitmap, "overflow", x_panel_col2_offset+8, y_panel_ov_offset, color_panel_caption);
+ pdp1_draw_string(bitmap, "read in", x_panel_col2_offset+8, y_panel_rim_offset, color_panel_caption);
+ pdp1_draw_string(bitmap, "seq. break", x_panel_col2_offset+8, y_panel_sbm_offset, color_panel_caption);
+ pdp1_draw_string(bitmap, "extend", x_panel_col2_offset+8, y_panel_exd_offset, color_panel_caption);
+ pdp1_draw_string(bitmap, "i-o halt", x_panel_col2_offset+8, y_panel_ioh_offset, color_panel_caption);
+ pdp1_draw_string(bitmap, "i-o com'ds", x_panel_col2_offset+8, y_panel_ioc_offset, color_panel_caption);
+ pdp1_draw_string(bitmap, "i-o sync", x_panel_col2_offset+8, y_panel_ios_offset, color_panel_caption);
/* column separator */
bitmap.plot_box(x_panel_col3_offset-4, panel_window_offset_y+8, 1, 96, pen_panel_caption);
/* column 3: power, single step, single inst, sense, flags, instr... */
- pdp1_draw_string(machine, bitmap, "power", x_panel_col3_offset+16, y_panel_power_offset, color_panel_caption);
- pdp1_draw_string(machine, bitmap, "single step", x_panel_col3_offset+16, y_panel_sngl_step_offset, color_panel_caption);
- pdp1_draw_string(machine, bitmap, "single inst.", x_panel_col3_offset+16, y_panel_sngl_inst_offset, color_panel_caption);
+ pdp1_draw_string(bitmap, "power", x_panel_col3_offset+16, y_panel_power_offset, color_panel_caption);
+ pdp1_draw_string(bitmap, "single step", x_panel_col3_offset+16, y_panel_sngl_step_offset, color_panel_caption);
+ pdp1_draw_string(bitmap, "single inst.", x_panel_col3_offset+16, y_panel_sngl_inst_offset, color_panel_caption);
/* separator */
bitmap.plot_box(x_panel_col3_offset+8, y_panel_sep1_offset+4, 96, 1, pen_panel_caption);
- pdp1_draw_string(machine, bitmap, "sense switches", x_panel_col3_offset, y_panel_ss_offset, color_panel_caption);
+ pdp1_draw_string(bitmap, "sense switches", x_panel_col3_offset, y_panel_ss_offset, color_panel_caption);
/* separator */
bitmap.plot_box(x_panel_col3_offset+8, y_panel_sep2_offset+4, 96, 1, pen_panel_caption);
- pdp1_draw_string(machine, bitmap, "program flags", x_panel_col3_offset, y_panel_pf_offset, color_panel_caption);
- pdp1_draw_string(machine, bitmap, "instruction", x_panel_col3_offset, y_panel_ir_offset, color_panel_caption);
+ pdp1_draw_string(bitmap, "program flags", x_panel_col3_offset, y_panel_pf_offset, color_panel_caption);
+ pdp1_draw_string(bitmap, "instruction", x_panel_col3_offset, y_panel_ir_offset, color_panel_caption);
}
/*
draw the operator control panel (dynamic elements)
*/
-static void pdp1_draw_panel(running_machine &machine, bitmap_ind16 &bitmap)
+void pdp1_state::pdp1_draw_panel(bitmap_ind16 &bitmap)
{
- pdp1_state *state = machine.driver_data<pdp1_state>();
/* column 1: registers, test word, test address */
- pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset+16, y_panel_pc_offset+8,state->m_maincpu->state_int(PDP1_PC), 16);
- pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset+16, y_panel_ma_offset+8,state->m_maincpu->state_int(PDP1_MA), 16);
- pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset, y_panel_mb_offset+8,state->m_maincpu->state_int(PDP1_MB), 18);
- pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset, y_panel_ac_offset+8,state->m_maincpu->state_int(PDP1_AC), 18);
- pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset, y_panel_io_offset+8,state->m_maincpu->state_int(PDP1_IO), 18);
- pdp1_draw_switch(machine, bitmap, x_panel_col1_offset, y_panel_ta_offset+8,state->m_maincpu->state_int(PDP1_EXTEND_SW));
- pdp1_draw_multipleswitch(machine, bitmap, x_panel_col1_offset+16, y_panel_ta_offset+8,state->m_maincpu->state_int(PDP1_TA), 16);
- pdp1_draw_multipleswitch(machine, bitmap, x_panel_col1_offset, y_panel_tw_offset+8,state->m_maincpu->state_int(PDP1_TW), 18);
+ pdp1_draw_multipleled(bitmap, x_panel_col1_offset+16, y_panel_pc_offset+8,m_maincpu->state_int(PDP1_PC), 16);
+ pdp1_draw_multipleled(bitmap, x_panel_col1_offset+16, y_panel_ma_offset+8,m_maincpu->state_int(PDP1_MA), 16);
+ pdp1_draw_multipleled(bitmap, x_panel_col1_offset, y_panel_mb_offset+8,m_maincpu->state_int(PDP1_MB), 18);
+ pdp1_draw_multipleled(bitmap, x_panel_col1_offset, y_panel_ac_offset+8,m_maincpu->state_int(PDP1_AC), 18);
+ pdp1_draw_multipleled(bitmap, x_panel_col1_offset, y_panel_io_offset+8,m_maincpu->state_int(PDP1_IO), 18);
+ pdp1_draw_switch(bitmap, x_panel_col1_offset, y_panel_ta_offset+8,m_maincpu->state_int(PDP1_EXTEND_SW));
+ pdp1_draw_multipleswitch(bitmap, x_panel_col1_offset+16, y_panel_ta_offset+8,m_maincpu->state_int(PDP1_TA), 16);
+ pdp1_draw_multipleswitch(bitmap, x_panel_col1_offset, y_panel_tw_offset+8,m_maincpu->state_int(PDP1_TW), 18);
/* column 2: 1-bit indicators */
- pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_run_offset,state->m_maincpu->state_int(PDP1_RUN));
- pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cyc_offset,state->m_maincpu->state_int(PDP1_CYC));
- pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_defer_offset,state->m_maincpu->state_int(PDP1_DEFER));
- pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_hs_cyc_offset, 0); /* not emulated */
- pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_brk_ctr_1_offset,state->m_maincpu->state_int(PDP1_BRK_CTR) & 1);
- pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_brk_ctr_2_offset,state->m_maincpu->state_int(PDP1_BRK_CTR) & 2);
- pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ov_offset,state->m_maincpu->state_int(PDP1_OV));
- pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_rim_offset,state->m_maincpu->state_int(PDP1_RIM));
- pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_sbm_offset,state->m_maincpu->state_int(PDP1_SBM));
- pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_exd_offset,state->m_maincpu->state_int(PDP1_EXD));
- pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioh_offset,state->m_maincpu->state_int(PDP1_IOH));
- pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioc_offset,state->m_maincpu->state_int(PDP1_IOC));
- pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ios_offset,state->m_maincpu->state_int(PDP1_IOS));
+ pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_run_offset,m_maincpu->state_int(PDP1_RUN));
+ pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_cyc_offset,m_maincpu->state_int(PDP1_CYC));
+ pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_defer_offset,m_maincpu->state_int(PDP1_DEFER));
+ pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_hs_cyc_offset, 0); /* not emulated */
+ pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_brk_ctr_1_offset,m_maincpu->state_int(PDP1_BRK_CTR) & 1);
+ pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_brk_ctr_2_offset,m_maincpu->state_int(PDP1_BRK_CTR) & 2);
+ pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_ov_offset,m_maincpu->state_int(PDP1_OV));
+ pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_rim_offset,m_maincpu->state_int(PDP1_RIM));
+ pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_sbm_offset,m_maincpu->state_int(PDP1_SBM));
+ pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_exd_offset,m_maincpu->state_int(PDP1_EXD));
+ pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_ioh_offset,m_maincpu->state_int(PDP1_IOH));
+ pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_ioc_offset,m_maincpu->state_int(PDP1_IOC));
+ pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_ios_offset,m_maincpu->state_int(PDP1_IOS));
/* column 3: power, single step, single inst, sense, flags, instr... */
- pdp1_draw_led(machine, bitmap, x_panel_col3_offset, y_panel_power_offset, 1); /* always on */
- pdp1_draw_switch(machine, bitmap, x_panel_col3_offset+8, y_panel_power_offset, 1); /* always on */
- pdp1_draw_led(machine, bitmap, x_panel_col3_offset, y_panel_sngl_step_offset,state->m_maincpu->state_int(PDP1_SNGL_STEP));
- pdp1_draw_switch(machine, bitmap, x_panel_col3_offset+8, y_panel_sngl_step_offset,state->m_maincpu->state_int(PDP1_SNGL_STEP));
- pdp1_draw_led(machine, bitmap, x_panel_col3_offset, y_panel_sngl_inst_offset,state->m_maincpu->state_int(PDP1_SNGL_INST));
- pdp1_draw_switch(machine, bitmap, x_panel_col3_offset+8, y_panel_sngl_inst_offset,state->m_maincpu->state_int(PDP1_SNGL_INST));
- pdp1_draw_multipleled(machine, bitmap, x_panel_col3_offset, y_panel_ss_offset+8,state->m_maincpu->state_int(PDP1_SS), 6);
- pdp1_draw_multipleswitch(machine, bitmap, x_panel_col3_offset, y_panel_ss_offset+16,state->m_maincpu->state_int(PDP1_SS), 6);
- pdp1_draw_multipleled(machine, bitmap, x_panel_col3_offset, y_panel_pf_offset+8,state->m_maincpu->state_int(PDP1_PF), 6);
- pdp1_draw_multipleled(machine, bitmap, x_panel_col3_offset, y_panel_ir_offset+8,state->m_maincpu->state_int(PDP1_IR), 5);
+ pdp1_draw_led(bitmap, x_panel_col3_offset, y_panel_power_offset, 1); /* always on */
+ pdp1_draw_switch(bitmap, x_panel_col3_offset+8, y_panel_power_offset, 1); /* always on */
+ pdp1_draw_led(bitmap, x_panel_col3_offset, y_panel_sngl_step_offset,m_maincpu->state_int(PDP1_SNGL_STEP));
+ pdp1_draw_switch(bitmap, x_panel_col3_offset+8, y_panel_sngl_step_offset,m_maincpu->state_int(PDP1_SNGL_STEP));
+ pdp1_draw_led(bitmap, x_panel_col3_offset, y_panel_sngl_inst_offset,m_maincpu->state_int(PDP1_SNGL_INST));
+ pdp1_draw_switch(bitmap, x_panel_col3_offset+8, y_panel_sngl_inst_offset,m_maincpu->state_int(PDP1_SNGL_INST));
+ pdp1_draw_multipleled(bitmap, x_panel_col3_offset, y_panel_ss_offset+8,m_maincpu->state_int(PDP1_SS), 6);
+ pdp1_draw_multipleswitch(bitmap, x_panel_col3_offset, y_panel_ss_offset+16,m_maincpu->state_int(PDP1_SS), 6);
+ pdp1_draw_multipleled(bitmap, x_panel_col3_offset, y_panel_pf_offset+8,m_maincpu->state_int(PDP1_PF), 6);
+ pdp1_draw_multipleled(bitmap, x_panel_col3_offset, y_panel_ir_offset+8,m_maincpu->state_int(PDP1_IR), 5);
}
@@ -364,25 +353,23 @@ enum
};
-static void pdp1_typewriter_linefeed(running_machine &machine)
+void pdp1_state::pdp1_typewriter_linefeed()
{
- pdp1_state *state = machine.driver_data<pdp1_state>();
UINT8 buf[typewriter_window_width];
int y;
for (y=0; y<typewriter_window_height-typewriter_scroll_step; y++)
{
- extract_scanline8(state->m_typewriter_bitmap, 0, y+typewriter_scroll_step, typewriter_window_width, buf);
- draw_scanline8(state->m_typewriter_bitmap, 0, y, typewriter_window_width, buf, machine.pens);
+ extract_scanline8(m_typewriter_bitmap, 0, y+typewriter_scroll_step, typewriter_window_width, buf);
+ draw_scanline8(m_typewriter_bitmap, 0, y, typewriter_window_width, buf, machine().pens);
}
const rectangle typewriter_scroll_clear_window(0, typewriter_window_width-1, typewriter_window_height-typewriter_scroll_step, typewriter_window_height-1);
- state->m_typewriter_bitmap.fill(pen_typewriter_bg, typewriter_scroll_clear_window);
+ m_typewriter_bitmap.fill(pen_typewriter_bg, typewriter_scroll_clear_window);
}
-void pdp1_typewriter_drawchar(running_machine &machine, int character)
+void pdp1_state::pdp1_typewriter_drawchar(int character)
{
- pdp1_state *state = machine.driver_data<pdp1_state>();
static const char ascii_table[2][64] =
{ /* n-s = non-spacing */
{ /* lower case */
@@ -431,57 +418,57 @@ void pdp1_typewriter_drawchar(running_machine &machine, int character)
{
case 034:
/* Black */
- state->m_typewriter_color = color_typewriter_black;
+ m_typewriter_color = color_typewriter_black;
break;
case 035:
/* Red */
- state->m_typewriter_color = color_typewriter_red;
+ m_typewriter_color = color_typewriter_red;
break;
case 036:
/* Tab */
- state->m_pos = state->m_pos + tab_step - (state->m_pos % tab_step);
+ m_pos = m_pos + tab_step - (m_pos % tab_step);
break;
case 072:
/* Lower case */
- state->m_case_shift = 0;
+ m_case_shift = 0;
break;
case 074:
/* Upper case */
- state->m_case_shift = 1;
+ m_case_shift = 1;
break;
case 075:
/* Backspace */
- if (state->m_pos)
- state->m_pos--;
+ if (m_pos)
+ m_pos--;
break;
case 077:
/* Carriage Return */
- state->m_pos = 0;
- pdp1_typewriter_linefeed(machine);
+ m_pos = 0;
+ pdp1_typewriter_linefeed();
break;
default:
/* Any printable character... */
- if (state->m_pos >= 80)
+ if (m_pos >= 80)
{ /* if past right border, wrap around. (Right???) */
- pdp1_typewriter_linefeed(machine); /* next line */
- state->m_pos = 0; /* return to start of line */
+ pdp1_typewriter_linefeed(); /* next line */
+ m_pos = 0; /* return to start of line */
}
/* print character (lookup ASCII equivalent in table) */
- pdp1_draw_char(machine, state->m_typewriter_bitmap, ascii_table[state->m_case_shift][character],
- 8*state->m_pos, typewriter_write_offset_y,
- state->m_typewriter_color); /* print char */
+ pdp1_draw_char(m_typewriter_bitmap, ascii_table[m_case_shift][character],
+ 8*m_pos, typewriter_write_offset_y,
+ m_typewriter_color); /* print char */
if ((character!= 040) && (character!= 056)) /* 040 and 056 are non-spacing characters */
- state->m_pos++; /* step carriage forward */
+ m_pos++; /* step carriage forward */
break;
}
@@ -493,14 +480,13 @@ void pdp1_typewriter_drawchar(running_machine &machine, int character)
lightpen code
*/
-void pdp1_update_lightpen_state(running_machine &machine, const lightpen_t *new_state)
+void pdp1_state::pdp1_update_lightpen_state(const lightpen_t *new_state)
{
- pdp1_state *state = machine.driver_data<pdp1_state>();
- state->m_lightpen_state = *new_state;
+ m_lightpen_state = *new_state;
}
#if 1
-static void pdp1_draw_circle(bitmap_ind16 &bitmap, int x, int y, int radius, int color_)
+void pdp1_state::pdp1_draw_circle(bitmap_ind16 &bitmap, int x, int y, int radius, int color_)
{
int interval;
int a;
@@ -535,7 +521,7 @@ static void pdp1_draw_circle(bitmap_ind16 &bitmap, int x, int y, int radius, int
}
}
#else
-static void pdp1_draw_circle(bitmap_ind16 &bitmap, int x, int y, int radius, int color)
+void pdp1_state::pdp1_draw_circle(bitmap_ind16 &bitmap, int x, int y, int radius, int color)
{
float fx, fy;
float interval;
@@ -567,40 +553,40 @@ static void pdp1_draw_circle(bitmap_ind16 &bitmap, int x, int y, int radius, int
}
#endif
-static void pdp1_erase_lightpen(pdp1_state *state, bitmap_ind16 &bitmap)
+void pdp1_state::pdp1_erase_lightpen(bitmap_ind16 &bitmap)
{
- if (state->m_previous_lightpen_state.active)
+ if (m_previous_lightpen_state.active)
{
#if 0
- if (state->m_previous_lightpen_state.x>0)
- pdp1_plot_pixel(bitmap, state->m_previous_lightpen_state.x/2-1, state->m_previous_lightpen_state.y/2, pen_black);
- if (state->m_previous_lightpen_state.x<1023)
- pdp1_plot_pixel(bitmap, state->m_previous_lightpen_state.x/2+1, state->m_previous_lightpen_state.y/2, pen_black);
- if (state->m_previous_lightpen_state.y>0)
- pdp1_plot_pixel(bitmap, state->m_previous_lightpen_state.x/2, state->m_previous_lightpen_state.y/2-1, pen_black);
- if (state->m_previous_lightpen_state.y<1023)
- pdp1_plot_pixel(bitmap, state->m_previous_lightpen_state.x/2, state->m_previous_lightpen_state.y/2+1, pen_black);
+ if (m_previous_lightpen_state.x>0)
+ pdp1_plot_pixel(bitmap, m_previous_lightpen_state.x/2-1, m_previous_lightpen_state.y/2, pen_black);
+ if (m_previous_lightpen_state.x<1023)
+ pdp1_plot_pixel(bitmap, m_previous_lightpen_state.x/2+1, m_previous_lightpen_state.y/2, pen_black);
+ if (m_previous_lightpen_state.y>0)
+ pdp1_plot_pixel(bitmap, m_previous_lightpen_state.x/2, m_previous_lightpen_state.y/2-1, pen_black);
+ if (m_previous_lightpen_state.y<1023)
+ pdp1_plot_pixel(bitmap, m_previous_lightpen_state.x/2, m_previous_lightpen_state.y/2+1, pen_black);
#endif
- pdp1_draw_circle(bitmap, state->m_previous_lightpen_state.x, state->m_previous_lightpen_state.y, state->m_previous_lightpen_state.radius, pen_black);
+ pdp1_draw_circle(bitmap, m_previous_lightpen_state.x, m_previous_lightpen_state.y, m_previous_lightpen_state.radius, pen_black);
}
}
-static void pdp1_draw_lightpen(pdp1_state *state, bitmap_ind16 &bitmap)
+void pdp1_state::pdp1_draw_lightpen(bitmap_ind16 &bitmap)
{
- if (state->m_lightpen_state.active)
+ if (m_lightpen_state.active)
{
- int color_ = state->m_lightpen_state.down ? pen_lightpen_pressed : pen_lightpen_nonpressed;
+ int color_ = m_lightpen_state.down ? pen_lightpen_pressed : pen_lightpen_nonpressed;
#if 0
- if (state->m_lightpen_state.x>0)
- pdp1_plot_pixel(bitmap, state->m_lightpen_state.x/2-1, state->m_lightpen_state.y/2, color);
- if (state->m_lightpen_state.x<1023)
- pdp1_plot_pixel(bitmap, state->m_lightpen_state.x/2+1, state->m_lightpen_state.y/2, color);
- if (state->m_lightpen_state.y>0)
- pdp1_plot_pixel(bitmap, state->m_lightpen_state.x/2, state->m_lightpen_state.y/2-1, color);
- if (state->m_lightpen_state.y<1023)
- pdp1_plot_pixel(bitmap, state->m_lightpen_state.x/2, state->m_lightpen_state.y/2+1, color);
+ if (m_lightpen_state.x>0)
+ pdp1_plot_pixel(bitmap, m_lightpen_state.x/2-1, m_lightpen_state.y/2, color);
+ if (m_lightpen_state.x<1023)
+ pdp1_plot_pixel(bitmap, m_lightpen_state.x/2+1, m_lightpen_state.y/2, color);
+ if (m_lightpen_state.y>0)
+ pdp1_plot_pixel(bitmap, m_lightpen_state.x/2, m_lightpen_state.y/2-1, color);
+ if (m_lightpen_state.y<1023)
+ pdp1_plot_pixel(bitmap, m_lightpen_state.x/2, m_lightpen_state.y/2+1, color);
#endif
- pdp1_draw_circle(bitmap, state->m_lightpen_state.x, state->m_lightpen_state.y, state->m_lightpen_state.radius, color_);
+ pdp1_draw_circle(bitmap, m_lightpen_state.x, m_lightpen_state.y, m_lightpen_state.radius, color_);
}
- state->m_previous_lightpen_state = state->m_lightpen_state;
+ m_previous_lightpen_state = m_lightpen_state;
}
diff --git a/src/mess/video/primo.c b/src/mess/video/primo.c
index 4e03c447253..4fa834f0c7a 100644
--- a/src/mess/video/primo.c
+++ b/src/mess/video/primo.c
@@ -13,9 +13,8 @@
-static void primo_draw_scanline(running_machine &machine,bitmap_ind16 &bitmap, int primo_scanline)
+void primo_state::primo_draw_scanline(bitmap_ind16 &bitmap, int primo_scanline)
{
- primo_state *state = machine.driver_data<primo_state>();
int x, i;
UINT8 data;
@@ -23,7 +22,7 @@ static void primo_draw_scanline(running_machine &machine,bitmap_ind16 &bitmap, i
UINT16 *scanline = &bitmap.pix16(primo_scanline);
/* address of current line in Primo video memory */
- const UINT8* primo_video_ram_line = (const UINT8*)state->m_maincpu->space(AS_PROGRAM).get_read_ptr(state->m_video_memory_base + 32 * primo_scanline);
+ const UINT8* primo_video_ram_line = (const UINT8*)m_maincpu->space(AS_PROGRAM).get_read_ptr(m_video_memory_base + 32 * primo_scanline);
for (x=0; x<256; x+=8)
{
@@ -41,6 +40,6 @@ UINT32 primo_state::screen_update_primo(screen_device &screen, bitmap_ind16 &bit
int primo_scanline;
for (primo_scanline=0; primo_scanline<192; primo_scanline++)
- primo_draw_scanline(machine(), bitmap, primo_scanline);
+ primo_draw_scanline( bitmap, primo_scanline);
return 0;
}
diff --git a/src/mess/video/samcoupe.c b/src/mess/video/samcoupe.c
index 47d3c1e40a0..abb9091274d 100644
--- a/src/mess/video/samcoupe.c
+++ b/src/mess/video/samcoupe.c
@@ -37,10 +37,9 @@ UINT32 samcoupe_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap
return 0;
}
-static void draw_mode4_line(running_machine &machine, int y, int hpos)
+void samcoupe_state::draw_mode4_line(int y, int hpos)
{
- samcoupe_state *state = machine.driver_data<samcoupe_state>();
- UINT8 *videoram = state->m_videoram;
+ UINT8 *videoram = m_videoram;
/* get start address */
UINT8 *vram = videoram + ((y - SAM_BORDER_TOP) * 128) + ((hpos - SAM_BORDER_LEFT) / 4);
@@ -48,24 +47,23 @@ static void draw_mode4_line(running_machine &machine, int y, int hpos)
for (int i = 0; i < (SAM_BLOCK*2)/4; i++)
{
/* draw 2 pixels (doublewidth) */
- state->m_bitmap.pix16(y, hpos + i * 4 + 0) = state->m_clut[(*vram >> 4) & 0x0f];
- state->m_bitmap.pix16(y, hpos + i * 4 + 1) = state->m_clut[(*vram >> 4) & 0x0f];
- state->m_bitmap.pix16(y, hpos + i * 4 + 2) = state->m_clut[(*vram >> 0) & 0x0f];
- state->m_bitmap.pix16(y, hpos + i * 4 + 3) = state->m_clut[(*vram >> 0) & 0x0f];
+ m_bitmap.pix16(y, hpos + i * 4 + 0) = m_clut[(*vram >> 4) & 0x0f];
+ m_bitmap.pix16(y, hpos + i * 4 + 1) = m_clut[(*vram >> 4) & 0x0f];
+ m_bitmap.pix16(y, hpos + i * 4 + 2) = m_clut[(*vram >> 0) & 0x0f];
+ m_bitmap.pix16(y, hpos + i * 4 + 3) = m_clut[(*vram >> 0) & 0x0f];
/* move to next address */
vram++;
/* attribute register contains the third displayed byte */
if (i == 2)
- state->m_attribute = *vram;
+ m_attribute = *vram;
}
}
-static void draw_mode3_line(running_machine &machine, int y, int hpos)
+void samcoupe_state::draw_mode3_line(int y, int hpos)
{
- samcoupe_state *state = machine.driver_data<samcoupe_state>();
- UINT8 *videoram = state->m_videoram;
+ UINT8 *videoram = m_videoram;
/* get start address */
UINT8 *vram = videoram + ((y - SAM_BORDER_TOP) * 128) + ((hpos - SAM_BORDER_LEFT) / 4);
@@ -73,25 +71,25 @@ static void draw_mode3_line(running_machine &machine, int y, int hpos)
for (int i = 0; i < (SAM_BLOCK*2)/4; i++)
{
/* draw 4 pixels */
- state->m_bitmap.pix16(y, hpos + i * 4 + 0) = state->m_clut[(*vram >> 6) & 0x03];
- state->m_bitmap.pix16(y, hpos + i * 4 + 1) = state->m_clut[(*vram >> 4) & 0x03];
- state->m_bitmap.pix16(y, hpos + i * 4 + 2) = state->m_clut[(*vram >> 2) & 0x03];
- state->m_bitmap.pix16(y, hpos + i * 4 + 3) = state->m_clut[(*vram >> 0) & 0x03];
+ m_bitmap.pix16(y, hpos + i * 4 + 0) = m_clut[(*vram >> 6) & 0x03];
+ m_bitmap.pix16(y, hpos + i * 4 + 1) = m_clut[(*vram >> 4) & 0x03];
+ m_bitmap.pix16(y, hpos + i * 4 + 2) = m_clut[(*vram >> 2) & 0x03];
+ m_bitmap.pix16(y, hpos + i * 4 + 3) = m_clut[(*vram >> 0) & 0x03];
/* move to next address */
vram++;
/* attribute register contains the third displayed byte */
if (i == 2)
- state->m_attribute = *vram;
+ m_attribute = *vram;
}
}
-static void draw_mode12_block(samcoupe_state *state, bitmap_ind16 &bitmap, int vpos, int hpos, UINT8 mask)
+void samcoupe_state::draw_mode12_block(bitmap_ind16 &bitmap, int vpos, int hpos, UINT8 mask)
{
/* extract colors from attribute */
- UINT8 ink = state->m_clut[ATTR_FG(state->m_attribute)];
- UINT8 pap = state->m_clut[ATTR_BG(state->m_attribute)];
+ UINT8 ink = m_clut[ATTR_FG(m_attribute)];
+ UINT8 pap = m_clut[ATTR_BG(m_attribute)];
/* draw block of 8 pixels (doubled to 16) */
for (int i = 0; i < SAM_BLOCK; i++)
@@ -101,28 +99,26 @@ static void draw_mode12_block(samcoupe_state *state, bitmap_ind16 &bitmap, int v
}
}
-static void draw_mode2_line(running_machine &machine, int y, int hpos)
+void samcoupe_state::draw_mode2_line(int y, int hpos)
{
- samcoupe_state *state = machine.driver_data<samcoupe_state>();
- UINT8 *videoram = state->m_videoram;
+ UINT8 *videoram = m_videoram;
int cell = (y - SAM_BORDER_TOP) * 32 + (hpos - SAM_BORDER_LEFT) / SAM_BLOCK / 2;
UINT8 mask = videoram[cell];
- state->m_attribute = videoram[cell + 0x2000];
+ m_attribute = videoram[cell + 0x2000];
- draw_mode12_block(state, state->m_bitmap, y, hpos, mask);
+ draw_mode12_block(m_bitmap, y, hpos, mask);
}
-static void draw_mode1_line(running_machine &machine, int y, int hpos)
+void samcoupe_state::draw_mode1_line(int y, int hpos)
{
- samcoupe_state *state = machine.driver_data<samcoupe_state>();
- UINT8 *videoram = state->m_videoram;
+ UINT8 *videoram = m_videoram;
UINT8 mask = videoram[((((y - SAM_BORDER_TOP) & 0xc0) << 5) | (((y - SAM_BORDER_TOP) & 0x07) << 8) | (((y - SAM_BORDER_TOP) & 0x38) << 2)) + (hpos - SAM_BORDER_LEFT) / SAM_BLOCK / 2];
- state->m_attribute = videoram[32*192 + (((y - SAM_BORDER_TOP) & 0xf8) << 2) + (hpos - SAM_BORDER_LEFT) / SAM_BLOCK / 2];
+ m_attribute = videoram[32*192 + (((y - SAM_BORDER_TOP) & 0xf8) << 2) + (hpos - SAM_BORDER_LEFT) / SAM_BLOCK / 2];
- draw_mode12_block(state, state->m_bitmap, y, hpos, mask);
+ draw_mode12_block(m_bitmap, y, hpos, mask);
}
TIMER_CALLBACK_MEMBER(samcoupe_state::sam_video_update_callback)
@@ -158,17 +154,17 @@ TIMER_CALLBACK_MEMBER(samcoupe_state::sam_video_update_callback)
/* main screen area */
switch ((m_vmpr & 0x60) >> 5)
{
- case 0: draw_mode1_line(machine(), vpos, hpos); break;
- case 1: draw_mode2_line(machine(), vpos, hpos); break;
- case 2: draw_mode3_line(machine(), vpos, hpos); break;
- case 3: draw_mode4_line(machine(), vpos, hpos); break;
+ case 0: draw_mode1_line(vpos, hpos); break;
+ case 1: draw_mode2_line(vpos, hpos); break;
+ case 2: draw_mode3_line(vpos, hpos); break;
+ case 3: draw_mode4_line(vpos, hpos); break;
}
}
}
/* do we need to trigger the scanline interrupt (interrupt happens at the start of the right border before the specified line)? */
if (m_line_int < SAM_SCREEN_HEIGHT && hpos == SAM_BORDER_LEFT + SAM_SCREEN_WIDTH && vpos == (m_line_int + SAM_BORDER_TOP - 1))
- samcoupe_irq(machine().firstcpu, SAM_LINE_INT);
+ samcoupe_irq(SAM_LINE_INT);
/* schedule next update */
m_video_update_timer->adjust(machine().primary_screen->time_until_pos(next_vpos, next_hpos));
diff --git a/src/mess/video/spectrum.c b/src/mess/video/spectrum.c
index eda83ca07bb..8524e3a2c7c 100644
--- a/src/mess/video/spectrum.c
+++ b/src/mess/video/spectrum.c
@@ -43,7 +43,7 @@ VIDEO_START_MEMBER(spectrum_state,spectrum_128)
/* return the color to be used inverting FLASHing colors if necessary */
-INLINE unsigned char get_display_color (unsigned char color, int invert)
+inline unsigned char spectrum_state::get_display_color (unsigned char color, int invert)
{
if (invert && (color & 0x80))
return (color & 0xc0) + ((color & 0x38) >> 3) + ((color & 0x07) << 3);
@@ -96,7 +96,7 @@ void spectrum_state::screen_eof_spectrum(screen_device &screen, bool state)
***************************************************************************/
-INLINE void spectrum_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color)
+inline void spectrum_state::spectrum_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color)
{
bitmap.pix16(y, x) = (UINT16)color;
}
diff --git a/src/mess/video/ssystem3.c b/src/mess/video/ssystem3.c
index dec974f6bf4..e0066573f2a 100644
--- a/src/mess/video/ssystem3.c
+++ b/src/mess/video/ssystem3.c
@@ -5,25 +5,23 @@
#include "emu.h"
#include "includes/ssystem3.h"
-void ssystem3_lcd_reset(running_machine &machine)
+void ssystem3_state::ssystem3_lcd_reset()
{
- ssystem3_state *state = machine.driver_data<ssystem3_state>();
- state->m_lcd.count=0; state->m_lcd.clock=1;
+ m_lcd.count=0; m_lcd.clock=1;
}
-void ssystem3_lcd_write(running_machine &machine, int clock, int data)
+void ssystem3_state::ssystem3_lcd_write(int clock, int data)
{
- ssystem3_state *state = machine.driver_data<ssystem3_state>();
- if (clock&&!state->m_lcd.clock) {
- state->m_lcd.data[state->m_lcd.count/8]&=~(1<<(state->m_lcd.count&7));
- if (data) state->m_lcd.data[state->m_lcd.count/8]|=1<<(state->m_lcd.count&7);
- if (state->m_lcd.count+1==40) {
- logerror("%.4x lcd %02x%02x%02x%02x%02x\n",(int)machine.device("maincpu")->safe_pc(),
- state->m_lcd.data[0], state->m_lcd.data[1], state->m_lcd.data[2], state->m_lcd.data[3], state->m_lcd.data[4]);
+ if (clock&&!m_lcd.clock) {
+ m_lcd.data[m_lcd.count/8]&=~(1<<(m_lcd.count&7));
+ if (data) m_lcd.data[m_lcd.count/8]|=1<<(m_lcd.count&7);
+ if (m_lcd.count+1==40) {
+ logerror("%.4x lcd %02x%02x%02x%02x%02x\n",(int)machine().device("maincpu")->safe_pc(),
+ m_lcd.data[0], m_lcd.data[1], m_lcd.data[2], m_lcd.data[3], m_lcd.data[4]);
}
- state->m_lcd.count=(state->m_lcd.count+1)%40;
+ m_lcd.count=(m_lcd.count+1)%40;
}
- state->m_lcd.clock=clock;
+ m_lcd.clock=clock;
}
@@ -82,7 +80,7 @@ static const char led[]={
" dddddddddddd"
};
-static void ssystem3_draw_7segment(bitmap_ind16 &bitmap,int value, int x, int y)
+void ssystem3_state::ssystem3_draw_7segment(bitmap_ind16 &bitmap,int value, int x, int y)
{
int i, xi, yi, mask, color;
@@ -161,7 +159,7 @@ static const char single_led[]=
" 55555555 55555555 000000 000000 00 00 00 00 000000 00 00 00 00 0000000"
;
-static void ssystem3_draw_led(bitmap_ind16 &bitmap,INT16 color, int x, int y, int ch)
+void ssystem3_state::ssystem3_draw_led(bitmap_ind16 &bitmap,INT16 color, int x, int y, int ch)
{
int j, xi=0;
for (j=0; single_led[j]; j++) {
@@ -221,7 +219,7 @@ UINT32 ssystem3_state::screen_update_ssystem3(screen_device &screen, bitmap_ind1
int figure, black;
int xp=263+x*22;
int yp=55+(y^7)*28;
- ssystem3_playfield_getfigure(machine(), x, y, &figure, &black);
+ ssystem3_playfield_getfigure(x, y, &figure, &black);
ssystem3_draw_led(bitmap, lcd_signs_on[figure]&1?1:0, xp, yp, '6');
ssystem3_draw_led(bitmap, lcd_signs_on[figure]&2?1:0, xp, yp, '8');
ssystem3_draw_led(bitmap, lcd_signs_on[figure]&4?1:0, xp, yp, '9');
diff --git a/src/mess/video/super80.c b/src/mess/video/super80.c
index b23e35d0bf9..54aefacf773 100644
--- a/src/mess/video/super80.c
+++ b/src/mess/video/super80.c
@@ -51,20 +51,20 @@ static const UINT8 super80_comp_palette[16*3] =
0x00, 0x00, 0x00, /* 15 Black */
};
-static void palette_set_colors_rgb(running_machine &machine, const UINT8 *colors)
+void super80_state::palette_set_colors_rgb(const UINT8 *colors)
{
UINT8 r, b, g, color_count = 16;
while (color_count--)
{
r = *colors++; g = *colors++; b = *colors++;
- palette_set_color(machine, 15-color_count, MAKE_RGB(r, g, b));
+ palette_set_color(machine(), 15-color_count, MAKE_RGB(r, g, b));
}
}
PALETTE_INIT_MEMBER(super80_state,super80m)
{
- palette_set_colors_rgb(machine(), super80_rgb_palette);
+ palette_set_colors_rgb(super80_rgb_palette);
}
@@ -81,9 +81,9 @@ void super80_state::screen_eof_super80m(screen_device &screen, bool state)
{
m_current_palette = chosen_palette; // save new palette
if (!m_current_palette)
- palette_set_colors_rgb(machine(), super80_comp_palette); // composite colour
+ palette_set_colors_rgb(super80_comp_palette); // composite colour
else
- palette_set_colors_rgb(machine(), super80_rgb_palette); // rgb and b&w
+ palette_set_colors_rgb(super80_rgb_palette); // rgb and b&w
}
}
}
diff --git a/src/mess/video/tx0.c b/src/mess/video/tx0.c
index e8cfe96531b..31b495d8313 100644
--- a/src/mess/video/tx0.c
+++ b/src/mess/video/tx0.c
@@ -13,17 +13,11 @@
-INLINE void tx0_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color)
+inline void tx0_state::tx0_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color)
{
bitmap.pix16(y, x) = color;
}
-
-static void tx0_draw_panel_backdrop(running_machine &machine, bitmap_ind16 &bitmap);
-static void tx0_draw_panel(running_machine &machine, bitmap_ind16 &bitmap);
-
-
-
/*
video init
*/
@@ -36,7 +30,7 @@ void tx0_state::video_start()
m_typewriter_bitmap.allocate(typewriter_window_width, typewriter_window_height, BITMAP_FORMAT_IND16);
/* set up out bitmaps */
- tx0_draw_panel_backdrop(machine(), m_panel_bitmap);
+ tx0_draw_panel_backdrop(m_panel_bitmap);
const rectangle typewriter_bitmap_bounds(0, typewriter_window_width-1, 0, typewriter_window_height-1);
m_typewriter_bitmap.fill(pen_typewriter_bg, typewriter_bitmap_bounds);
@@ -58,14 +52,13 @@ void tx0_state::screen_eof_tx0(screen_device &screen, bool state)
/*
schedule a pixel to be plotted
*/
-void tx0_plot(running_machine &machine, int x, int y)
+void tx0_state::tx0_plot(int x, int y)
{
- tx0_state *state = machine.driver_data<tx0_state>();
/* compute pixel coordinates and plot */
x = x*crt_window_width/0777;
y = y*crt_window_height/0777;
- state->m_crt->plot(x, y);
+ m_crt->plot(x, y);
}
@@ -76,7 +69,7 @@ UINT32 tx0_state::screen_update_tx0(screen_device &screen, bitmap_ind16 &bitmap,
{
m_crt->update(bitmap);
- tx0_draw_panel(machine(), m_panel_bitmap);
+ tx0_draw_panel(m_panel_bitmap);
copybitmap(bitmap, m_panel_bitmap, 0, 0, panel_window_offset_x, panel_window_offset_y, cliprect);
copybitmap(bitmap, m_typewriter_bitmap, 0, 0, typewriter_window_offset_x, typewriter_window_offset_y, cliprect);
@@ -124,7 +117,7 @@ enum
};
/* draw a small 8*8 LED (or is this a lamp? ) */
-static void tx0_draw_led(running_machine &machine, bitmap_ind16 &bitmap, int x, int y, int state)
+void tx0_state::tx0_draw_led(bitmap_ind16 &bitmap, int x, int y, int state)
{
int xx, yy;
@@ -134,13 +127,13 @@ static void tx0_draw_led(running_machine &machine, bitmap_ind16 &bitmap, int x,
}
/* draw nb_bits leds which represent nb_bits bits in value */
-static void tx0_draw_multipleled(running_machine &machine, bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits)
+void tx0_state::tx0_draw_multipleled(bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits)
{
while (nb_bits)
{
nb_bits--;
- tx0_draw_led(machine, bitmap, x, y, (value >> nb_bits) & 1);
+ tx0_draw_led(bitmap, x, y, (value >> nb_bits) & 1);
x += 8;
}
@@ -148,7 +141,7 @@ static void tx0_draw_multipleled(running_machine &machine, bitmap_ind16 &bitmap,
/* draw a small 8*8 switch */
-static void tx0_draw_switch(running_machine &machine, bitmap_ind16 &bitmap, int x, int y, int state)
+void tx0_state::tx0_draw_switch(bitmap_ind16 &bitmap, int x, int y, int state)
{
int xx, yy;
int i;
@@ -189,13 +182,13 @@ static void tx0_draw_switch(running_machine &machine, bitmap_ind16 &bitmap, int
/* draw nb_bits switches which represent nb_bits bits in value */
-static void tx0_draw_multipleswitch(running_machine &machine, bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits)
+void tx0_state::tx0_draw_multipleswitch(bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits)
{
while (nb_bits)
{
nb_bits--;
- tx0_draw_switch(machine, bitmap, x, y, (value >> nb_bits) & 1);
+ tx0_draw_switch(bitmap, x, y, (value >> nb_bits) & 1);
x += 8;
}
@@ -203,18 +196,18 @@ static void tx0_draw_multipleswitch(running_machine &machine, bitmap_ind16 &bitm
/* write a single char on screen */
-static void tx0_draw_char(running_machine &machine, bitmap_ind16 &bitmap, char character, int x, int y, int color)
+void tx0_state::tx0_draw_char(bitmap_ind16 &bitmap, char character, int x, int y, int color)
{
- drawgfx_transpen(bitmap, bitmap.cliprect(), machine.gfx[0], character-32, color, 0, 0,
+ drawgfx_transpen(bitmap, bitmap.cliprect(), machine().gfx[0], character-32, color, 0, 0,
x+1, y, 0);
}
/* write a string on screen */
-static void tx0_draw_string(running_machine &machine, bitmap_ind16 &bitmap, const char *buf, int x, int y, int color)
+void tx0_state::tx0_draw_string(bitmap_ind16 &bitmap, const char *buf, int x, int y, int color)
{
while (* buf)
{
- tx0_draw_char(machine, bitmap, *buf, x, y, color);
+ tx0_draw_char(bitmap, *buf, x, y, color);
x += 8;
buf++;
@@ -223,7 +216,7 @@ static void tx0_draw_string(running_machine &machine, bitmap_ind16 &bitmap, cons
/* draw a vertical line */
-static void tx0_draw_vline(bitmap_ind16 &bitmap, int x, int y, int height, int color)
+void tx0_state::tx0_draw_vline(bitmap_ind16 &bitmap, int x, int y, int height, int color)
{
while (height--)
tx0_plot_pixel(bitmap, x, y++, color);
@@ -231,7 +224,7 @@ static void tx0_draw_vline(bitmap_ind16 &bitmap, int x, int y, int height, int c
#ifdef UNUSED_FUNCTION
/* draw a horizontal line */
-static void tx0_draw_hline(bitmap_ind16 &bitmap, int x, int y, int width, int color)
+void tx0_state::tx0_draw_hline(bitmap_ind16 &bitmap, int x, int y, int width, int color)
{
while (width--)
tx0_plot_pixel(bitmap, x++, y, color);
@@ -241,91 +234,89 @@ static void tx0_draw_hline(bitmap_ind16 &bitmap, int x, int y, int width, int co
/*
draw the operator control panel (fixed backdrop)
*/
-static void tx0_draw_panel_backdrop(running_machine &machine, bitmap_ind16 &bitmap)
+void tx0_state::tx0_draw_panel_backdrop(bitmap_ind16 &bitmap)
{
- tx0_state *state = machine.driver_data<tx0_state>();
int i;
char buf[3];
/* fill with black */
const rectangle panel_bitmap_bounds(0, panel_window_width-1, 0, panel_window_height-1);
- state->m_panel_bitmap.fill(pen_panel_bg, panel_bitmap_bounds);
+ m_panel_bitmap.fill(pen_panel_bg, panel_bitmap_bounds);
/* column 1: registers, test accumulator, test buffer, toggle switch storage */
- tx0_draw_string(machine, bitmap, "program counter", x_panel_col1b_offset, y_panel_pc_offset, color_panel_caption);
- tx0_draw_string(machine, bitmap, "memory address reg.", x_panel_col1b_offset, y_panel_mar_offset, color_panel_caption);
- tx0_draw_string(machine, bitmap, "memory buffer reg.", x_panel_col1b_offset, y_panel_mbr_offset, color_panel_caption);
- tx0_draw_string(machine, bitmap, "accumulator", x_panel_col1b_offset, y_panel_ac_offset, color_panel_caption);
- tx0_draw_string(machine, bitmap, "live register", x_panel_col1b_offset, y_panel_lr_offset, color_panel_caption);
- tx0_draw_string(machine, bitmap, "index register", x_panel_col1b_offset, y_panel_xr_offset, color_panel_caption);
- tx0_draw_string(machine, bitmap, "TBR", x_panel_col1b_offset, y_panel_tbr_offset, color_panel_caption);
- tx0_draw_string(machine, bitmap, "TAC", x_panel_col1b_offset, y_panel_tac_offset, color_panel_caption);
- tx0_draw_string(machine, bitmap, "cm", x_panel_col1a_offset+8, y_panel_tss_offset, color_panel_caption);
- tx0_draw_string(machine, bitmap, "TSS", x_panel_col1a_offset+24, y_panel_tss_offset, color_panel_caption);
- tx0_draw_string(machine, bitmap, "lr", x_panel_col1a_offset+168, y_panel_tss_offset, color_panel_caption);
+ tx0_draw_string(bitmap, "program counter", x_panel_col1b_offset, y_panel_pc_offset, color_panel_caption);
+ tx0_draw_string(bitmap, "memory address reg.", x_panel_col1b_offset, y_panel_mar_offset, color_panel_caption);
+ tx0_draw_string(bitmap, "memory buffer reg.", x_panel_col1b_offset, y_panel_mbr_offset, color_panel_caption);
+ tx0_draw_string(bitmap, "accumulator", x_panel_col1b_offset, y_panel_ac_offset, color_panel_caption);
+ tx0_draw_string(bitmap, "live register", x_panel_col1b_offset, y_panel_lr_offset, color_panel_caption);
+ tx0_draw_string(bitmap, "index register", x_panel_col1b_offset, y_panel_xr_offset, color_panel_caption);
+ tx0_draw_string(bitmap, "TBR", x_panel_col1b_offset, y_panel_tbr_offset, color_panel_caption);
+ tx0_draw_string(bitmap, "TAC", x_panel_col1b_offset, y_panel_tac_offset, color_panel_caption);
+ tx0_draw_string(bitmap, "cm", x_panel_col1a_offset+8, y_panel_tss_offset, color_panel_caption);
+ tx0_draw_string(bitmap, "TSS", x_panel_col1a_offset+24, y_panel_tss_offset, color_panel_caption);
+ tx0_draw_string(bitmap, "lr", x_panel_col1a_offset+168, y_panel_tss_offset, color_panel_caption);
for (i=0; i<16; i++)
{
sprintf(buf, "%2o", i);
- tx0_draw_string(machine, bitmap, buf, x_panel_col1a_offset, y_panel_tss_offset+8+i*8, color_panel_caption);
+ tx0_draw_string(bitmap, buf, x_panel_col1a_offset, y_panel_tss_offset+8+i*8, color_panel_caption);
}
/* column separator */
tx0_draw_vline(bitmap, x_panel_col2_offset-4, 8, 248, pen_panel_caption);
/* column 2: stop c0, stop c1, cm sel, 1-bit indicators, instr, flags */
- tx0_draw_string(machine, bitmap, "stop c0", x_panel_col2_offset+8, y_panel_stop_c0_offset, color_panel_caption);
- tx0_draw_string(machine, bitmap, "stop c1", x_panel_col2_offset+8, y_panel_stop_c1_offset, color_panel_caption);
- tx0_draw_string(machine, bitmap, "cm select", x_panel_col2_offset+8, y_panel_gbl_cm_sel_offset, color_panel_caption);
- tx0_draw_string(machine, bitmap, "run", x_panel_col2_offset+8, y_panel_run_offset, color_panel_caption);
- tx0_draw_string(machine, bitmap, "cycle1", x_panel_col2_offset+8, y_panel_cycle1_offset, color_panel_caption);
- tx0_draw_string(machine, bitmap, "cycle2", x_panel_col2_offset+8, y_panel_cycle2_offset, color_panel_caption);
- tx0_draw_string(machine, bitmap, "read in", x_panel_col2_offset+8, y_panel_rim_offset, color_panel_caption);
- tx0_draw_string(machine, bitmap, "i-o halt", x_panel_col2_offset+8, y_panel_ioh_offset, color_panel_caption);
- tx0_draw_string(machine, bitmap, "i-o sync", x_panel_col2_offset+8, y_panel_ios_offset, color_panel_caption);
- tx0_draw_string(machine, bitmap, "instr", x_panel_col2_offset+8, y_panel_ir_offset, color_panel_caption);
- tx0_draw_string(machine, bitmap, "pgm flags", x_panel_col2_offset+8, y_panel_pf_offset, color_panel_caption);
+ tx0_draw_string(bitmap, "stop c0", x_panel_col2_offset+8, y_panel_stop_c0_offset, color_panel_caption);
+ tx0_draw_string(bitmap, "stop c1", x_panel_col2_offset+8, y_panel_stop_c1_offset, color_panel_caption);
+ tx0_draw_string(bitmap, "cm select", x_panel_col2_offset+8, y_panel_gbl_cm_sel_offset, color_panel_caption);
+ tx0_draw_string(bitmap, "run", x_panel_col2_offset+8, y_panel_run_offset, color_panel_caption);
+ tx0_draw_string(bitmap, "cycle1", x_panel_col2_offset+8, y_panel_cycle1_offset, color_panel_caption);
+ tx0_draw_string(bitmap, "cycle2", x_panel_col2_offset+8, y_panel_cycle2_offset, color_panel_caption);
+ tx0_draw_string(bitmap, "read in", x_panel_col2_offset+8, y_panel_rim_offset, color_panel_caption);
+ tx0_draw_string(bitmap, "i-o halt", x_panel_col2_offset+8, y_panel_ioh_offset, color_panel_caption);
+ tx0_draw_string(bitmap, "i-o sync", x_panel_col2_offset+8, y_panel_ios_offset, color_panel_caption);
+ tx0_draw_string(bitmap, "instr", x_panel_col2_offset+8, y_panel_ir_offset, color_panel_caption);
+ tx0_draw_string(bitmap, "pgm flags", x_panel_col2_offset+8, y_panel_pf_offset, color_panel_caption);
}
/*
draw the operator control panel (dynamic elements)
*/
-static void tx0_draw_panel(running_machine &machine, bitmap_ind16 &bitmap)
+void tx0_state::tx0_draw_panel(bitmap_ind16 &bitmap)
{
int cm_sel, lr_sel;
int i;
- tx0_state *state = machine.driver_data<tx0_state>();
/* column 1: registers, test accumulator, test buffer, toggle switch storage */
- tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+2*8, y_panel_pc_offset+8, state->m_maincpu->state_int(TX0_PC), 16);
- tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+2*8, y_panel_mar_offset+8, state->m_maincpu->state_int(TX0_MAR), 16);
- tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_mbr_offset+8, state->m_maincpu->state_int(TX0_MBR), 18);
- tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_ac_offset+8, state->m_maincpu->state_int(TX0_AC), 18);
- tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_lr_offset+8, state->m_maincpu->state_int(TX0_LR), 18);
- tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+4*8, y_panel_xr_offset+8, state->m_maincpu->state_int(TX0_XR), 14);
- tx0_draw_multipleswitch(machine, bitmap, x_panel_col1b_offset, y_panel_tbr_offset+8, state->m_maincpu->state_int(TX0_TBR), 18);
- tx0_draw_multipleswitch(machine, bitmap, x_panel_col1b_offset, y_panel_tac_offset+8, state->m_maincpu->state_int(TX0_TAC), 18);
- cm_sel = state->m_maincpu->state_int(TX0_CM_SEL);
- lr_sel = state->m_maincpu->state_int(TX0_LR_SEL);
+ tx0_draw_multipleled(bitmap, x_panel_col1b_offset+2*8, y_panel_pc_offset+8, m_maincpu->state_int(TX0_PC), 16);
+ tx0_draw_multipleled(bitmap, x_panel_col1b_offset+2*8, y_panel_mar_offset+8, m_maincpu->state_int(TX0_MAR), 16);
+ tx0_draw_multipleled(bitmap, x_panel_col1b_offset, y_panel_mbr_offset+8, m_maincpu->state_int(TX0_MBR), 18);
+ tx0_draw_multipleled(bitmap, x_panel_col1b_offset, y_panel_ac_offset+8, m_maincpu->state_int(TX0_AC), 18);
+ tx0_draw_multipleled(bitmap, x_panel_col1b_offset, y_panel_lr_offset+8, m_maincpu->state_int(TX0_LR), 18);
+ tx0_draw_multipleled(bitmap, x_panel_col1b_offset+4*8, y_panel_xr_offset+8, m_maincpu->state_int(TX0_XR), 14);
+ tx0_draw_multipleswitch(bitmap, x_panel_col1b_offset, y_panel_tbr_offset+8, m_maincpu->state_int(TX0_TBR), 18);
+ tx0_draw_multipleswitch(bitmap, x_panel_col1b_offset, y_panel_tac_offset+8, m_maincpu->state_int(TX0_TAC), 18);
+ cm_sel = m_maincpu->state_int(TX0_CM_SEL);
+ lr_sel = m_maincpu->state_int(TX0_LR_SEL);
for (i=0; i<16; i++)
{
- tx0_draw_switch(machine, bitmap, x_panel_col1a_offset+16, y_panel_tss_offset+8+i*8, (cm_sel >> i) & 1);
- tx0_draw_multipleswitch(machine, bitmap, x_panel_col1a_offset+24, y_panel_tss_offset+8+i*8, state->m_maincpu->state_int(TX0_TSS00+i), 18);
- tx0_draw_switch(machine, bitmap, x_panel_col1a_offset+168, y_panel_tss_offset+8+i*8, (lr_sel >> i) & 1);
+ tx0_draw_switch(bitmap, x_panel_col1a_offset+16, y_panel_tss_offset+8+i*8, (cm_sel >> i) & 1);
+ tx0_draw_multipleswitch(bitmap, x_panel_col1a_offset+24, y_panel_tss_offset+8+i*8, m_maincpu->state_int(TX0_TSS00+i), 18);
+ tx0_draw_switch(bitmap, x_panel_col1a_offset+168, y_panel_tss_offset+8+i*8, (lr_sel >> i) & 1);
}
/* column 2: stop c0, stop c1, cm sel, 1-bit indicators, instr, flags */
- tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_stop_c0_offset, state->m_maincpu->state_int(TX0_STOP_CYC0));
- tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_stop_c1_offset, state->m_maincpu->state_int(TX0_STOP_CYC1));
- tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_gbl_cm_sel_offset, state->m_maincpu->state_int(TX0_GBL_CM_SEL));
- tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_run_offset, state->m_maincpu->state_int(TX0_RUN));
- tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cycle1_offset, state->m_maincpu->state_int(TX0_CYCLE) & 1);
- tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cycle2_offset, state->m_maincpu->state_int(TX0_CYCLE) & 2);
- tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_rim_offset, state->m_maincpu->state_int(TX0_RIM));
- tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioh_offset, state->m_maincpu->state_int(TX0_IOH));
- tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ios_offset, state->m_maincpu->state_int(TX0_IOS));
- tx0_draw_multipleled(machine, bitmap, x_panel_col2_offset, y_panel_ir_offset+8, state->m_maincpu->state_int(TX0_IR), 5);
- tx0_draw_multipleled(machine, bitmap, x_panel_col2_offset, y_panel_pf_offset+8, state->m_maincpu->state_int(TX0_PF), 6);
+ tx0_draw_switch(bitmap, x_panel_col2_offset, y_panel_stop_c0_offset, m_maincpu->state_int(TX0_STOP_CYC0));
+ tx0_draw_switch(bitmap, x_panel_col2_offset, y_panel_stop_c1_offset, m_maincpu->state_int(TX0_STOP_CYC1));
+ tx0_draw_switch(bitmap, x_panel_col2_offset, y_panel_gbl_cm_sel_offset, m_maincpu->state_int(TX0_GBL_CM_SEL));
+ tx0_draw_led(bitmap, x_panel_col2_offset, y_panel_run_offset, m_maincpu->state_int(TX0_RUN));
+ tx0_draw_led(bitmap, x_panel_col2_offset, y_panel_cycle1_offset, m_maincpu->state_int(TX0_CYCLE) & 1);
+ tx0_draw_led(bitmap, x_panel_col2_offset, y_panel_cycle2_offset, m_maincpu->state_int(TX0_CYCLE) & 2);
+ tx0_draw_led(bitmap, x_panel_col2_offset, y_panel_rim_offset, m_maincpu->state_int(TX0_RIM));
+ tx0_draw_led(bitmap, x_panel_col2_offset, y_panel_ioh_offset, m_maincpu->state_int(TX0_IOH));
+ tx0_draw_led(bitmap, x_panel_col2_offset, y_panel_ios_offset, m_maincpu->state_int(TX0_IOS));
+ tx0_draw_multipleled(bitmap, x_panel_col2_offset, y_panel_ir_offset+8, m_maincpu->state_int(TX0_IR), 5);
+ tx0_draw_multipleled(bitmap, x_panel_col2_offset, y_panel_pf_offset+8, m_maincpu->state_int(TX0_PF), 6);
}
@@ -351,25 +342,23 @@ enum
};
-static void tx0_typewriter_linefeed(running_machine &machine)
+void tx0_state::tx0_typewriter_linefeed()
{
- tx0_state *state = machine.driver_data<tx0_state>();
UINT8 buf[typewriter_window_width];
int y;
for (y=0; y<typewriter_window_height-typewriter_scroll_step; y++)
{
- extract_scanline8(state->m_typewriter_bitmap, 0, y+typewriter_scroll_step, typewriter_window_width, buf);
- draw_scanline8(state->m_typewriter_bitmap, 0, y, typewriter_window_width, buf, machine.pens);
+ extract_scanline8(m_typewriter_bitmap, 0, y+typewriter_scroll_step, typewriter_window_width, buf);
+ draw_scanline8(m_typewriter_bitmap, 0, y, typewriter_window_width, buf, machine().pens);
}
const rectangle typewriter_scroll_clear_window(0, typewriter_window_width-1, typewriter_window_height-typewriter_scroll_step, typewriter_window_height-1);
- state->m_typewriter_bitmap.fill(pen_typewriter_bg, typewriter_scroll_clear_window);
+ m_typewriter_bitmap.fill(pen_typewriter_bg, typewriter_scroll_clear_window);
}
-void tx0_typewriter_drawchar(running_machine &machine, int character)
+void tx0_state::tx0_typewriter_drawchar(int character)
{
- tx0_state *state = machine.driver_data<tx0_state>();
static const char ascii_table[2][64] =
{
{ /* lower case */
@@ -419,26 +408,26 @@ void tx0_typewriter_drawchar(running_machine &machine, int character)
case 020:
#if 0
/* color shift */
- state->m_typewriter_color = color_typewriter_black;
- state->m_typewriter_color = color_typewriter_red;
+ m_typewriter_color = color_typewriter_black;
+ m_typewriter_color = color_typewriter_red;
#endif
break;
case 043:
/* Backspace */
- if (state->m_pos)
- state->m_pos--;
+ if (m_pos)
+ m_pos--;
break;
case 045:
/* Tab */
- state->m_pos = state->m_pos + tab_step - (state->m_pos % tab_step);
+ m_pos = m_pos + tab_step - (m_pos % tab_step);
break;
case 051:
/* Carriage Return */
- state->m_pos = 0;
- tx0_typewriter_linefeed( machine );
+ m_pos = 0;
+ tx0_typewriter_linefeed();
break;
case 061:
@@ -448,12 +437,12 @@ void tx0_typewriter_drawchar(running_machine &machine, int character)
case 071:
/* Upper case */
- state->m_case_shift = 1;
+ m_case_shift = 1;
break;
case 075:
/* Lower case */
- state->m_case_shift = 0;
+ m_case_shift = 0;
break;
case 077:
@@ -464,18 +453,18 @@ void tx0_typewriter_drawchar(running_machine &machine, int character)
default:
/* Any printable character... */
- if (state->m_pos >= 80)
+ if (m_pos >= 80)
{ /* if past right border, wrap around. (Right???) */
- tx0_typewriter_linefeed( machine ); /* next line */
- state->m_pos = 0; /* return to start of line */
+ tx0_typewriter_linefeed(); /* next line */
+ m_pos = 0; /* return to start of line */
}
/* print character (lookup ASCII equivalent in table) */
- tx0_draw_char(machine, state->m_typewriter_bitmap, ascii_table[state->m_case_shift][character],
- 8*state->m_pos, typewriter_write_offset_y,
- state->m_typewriter_color); /* print char */
+ tx0_draw_char(m_typewriter_bitmap, ascii_table[m_case_shift][character],
+ 8*m_pos, typewriter_write_offset_y,
+ m_typewriter_color); /* print char */
- state->m_pos++; /* step carriage forward */
+ m_pos++; /* step carriage forward */
break;
}
}
diff --git a/src/mess/video/vc4000.c b/src/mess/video/vc4000.c
index 165c1fc66b4..9a175e66548 100644
--- a/src/mess/video/vc4000.c
+++ b/src/mess/video/vc4000.c
@@ -60,7 +60,7 @@ void vc4000_state::video_start()
m_bitmap = auto_bitmap_ind16_alloc(machine(), screen->width(), screen->height());
}
-INLINE UINT8 vc4000_joystick_return_to_centre(UINT8 joy)
+inline UINT8 vc4000_state::vc4000_joystick_return_to_centre(UINT8 joy)
{
UINT8 data;
@@ -377,7 +377,7 @@ static const char led[20][12+1] =
};
-static void vc4000_draw_digit(vc4000_state *state, bitmap_ind16 &bitmap, int x, int y, int d, int line)
+void vc4000_state::vc4000_draw_digit(bitmap_ind16 &bitmap, int x, int y, int d, int line)
{
static const int digit_to_segment[0x10]={
0x0fff, 0x007c, 0x17df, 0x15ff, 0x1c7d, 0x1df7, 0x1ff7, 0x007f, 0x1fff, 0x1dff
@@ -388,11 +388,11 @@ static void vc4000_draw_digit(vc4000_state *state, bitmap_ind16 &bitmap, int x,
for (j=0; j<sizeof(led[0])-1; j++)
{
if (led[i][j] != ' ' && digit_to_segment[d]&(1<<(led[i][j]-'a')) )
- bitmap.pix16(y+i, x+j) = ((state->m_video.reg.d.background>>4)&7)^7;
+ bitmap.pix16(y+i, x+j) = ((m_video.reg.d.background>>4)&7)^7;
}
}
-INLINE void vc4000_collision_plot(UINT8 *collision, UINT8 data, UINT8 color, int scale)
+inline void vc4000_state::vc4000_collision_plot(UINT8 *collision, UINT8 data, UINT8 color, int scale)
{
int i,j,m;
@@ -406,11 +406,11 @@ INLINE void vc4000_collision_plot(UINT8 *collision, UINT8 data, UINT8 color, int
}
-static void vc4000_sprite_update(vc4000_state *state, bitmap_ind16 &bitmap, UINT8 *collision, SPRITE *This)
+void vc4000_state::vc4000_sprite_update(bitmap_ind16 &bitmap, UINT8 *collision, SPRITE *This)
{
int i,j,m;
- if (state->m_video.line==0)
+ if (m_video.line==0)
{
This->y=This->data->y1;
This->state=0;
@@ -420,12 +420,12 @@ static void vc4000_sprite_update(vc4000_state *state, bitmap_ind16 &bitmap, UINT
This->finished_now=FALSE;
- if (state->m_video.line>VC4000_END_LINE) return;
+ if (m_video.line>VC4000_END_LINE) return;
switch (This->state)
{
case 0:
- if (state->m_video.line != This->y + 2) break;
+ if (m_video.line != This->y + 2) break;
This->state++;
case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8:case 9:case 10:
@@ -438,8 +438,8 @@ static void vc4000_sprite_update(vc4000_state *state, bitmap_ind16 &bitmap, UINT
{
for (i=0; i<This->size; i++)
{
- state->m_objects[This->data->x1 + i + j*This->size] |= This->scolor;
- state->m_objects[This->data->x1 + i + j*This->size] &= 7;
+ m_objects[This->data->x1 + i + j*This->size] |= This->scolor;
+ m_objects[This->data->x1 + i + j*This->size] &= 7;
}
}
}
@@ -497,8 +497,8 @@ static void vc4000_sprite_update(vc4000_state *state, bitmap_ind16 &bitmap, UINT
// it properly.
if (offset < 256)
{
- state->m_objects[offset] |= This->scolor;
- state->m_objects[offset] &= 7;
+ m_objects[offset] |= This->scolor;
+ m_objects[offset] &= 7;
}
}
}
@@ -515,26 +515,25 @@ static void vc4000_sprite_update(vc4000_state *state, bitmap_ind16 &bitmap, UINT
}
}
-INLINE void vc4000_draw_grid(running_machine &machine, UINT8 *collision)
+inline void vc4000_state::vc4000_draw_grid(UINT8 *collision)
{
- vc4000_state *state = machine.driver_data<vc4000_state>();
- screen_device *screen = machine.first_screen();
+ screen_device *screen = machine().first_screen();
int width = screen->width();
int height = screen->height();
- int i, j, m, x, line=state->m_video.line-20;
+ int i, j, m, x, line=m_video.line-20;
int w, k;
- if (state->m_video.line>=height) return;
+ if (m_video.line>=height) return;
- state->m_bitmap->plot_box(0, state->m_video.line, width, 1, (state->m_video.reg.d.background)&7);
+ m_bitmap->plot_box(0, m_video.line, width, 1, (m_video.reg.d.background)&7);
if (line<0 || line>=200) return;
- if (~state->m_video.reg.d.background & 8) return;
+ if (~m_video.reg.d.background & 8) return;
i=(line/20)*2;
if (line%20>=2) i++;
- k=state->m_video.reg.d.grid_control[i>>2];
+ k=m_video.reg.d.grid_control[i>>2];
switch (k>>6) {
default:
case 0:case 2: w=1;break;
@@ -562,11 +561,11 @@ INLINE void vc4000_draw_grid(running_machine &machine, UINT8 *collision)
}
for (x=30, j=0, m=0x80; j<16; j++, x+=8, m>>=1)
{
- if (state->m_video.reg.d.grid[i][j>>3]&m)
+ if (m_video.reg.d.grid[i][j>>3]&m)
{
int l;
for (l=0; l<w; l++) collision[x+l]|=0x10;
- state->m_bitmap->plot_box(x, state->m_video.line, w, 1, (state->m_video.reg.d.background>>4)&7);
+ m_bitmap->plot_box(x, m_video.line, w, 1, (m_video.reg.d.background>>4)&7);
}
if (j==7) m=0x100;
}
@@ -599,16 +598,16 @@ INTERRUPT_GEN_MEMBER(vc4000_state::vc4000_video_line)
if (m_video.line <= VC4000_END_LINE)
{
- vc4000_draw_grid(machine(), collision);
+ vc4000_draw_grid(collision);
/* init object colours */
for (i=visarea.min_x; i<visarea.max_x; i++) m_objects[i]=8;
/* calculate object colours and OR overlapping object colours */
- vc4000_sprite_update(this, *m_bitmap, collision, &m_video.sprites[0]);
- vc4000_sprite_update(this, *m_bitmap, collision, &m_video.sprites[1]);
- vc4000_sprite_update(this, *m_bitmap, collision, &m_video.sprites[2]);
- vc4000_sprite_update(this, *m_bitmap, collision, &m_video.sprites[3]);
+ vc4000_sprite_update(*m_bitmap, collision, &m_video.sprites[0]);
+ vc4000_sprite_update(*m_bitmap, collision, &m_video.sprites[1]);
+ vc4000_sprite_update(*m_bitmap, collision, &m_video.sprites[2]);
+ vc4000_sprite_update(*m_bitmap, collision, &m_video.sprites[3]);
for (i=visarea.min_x; i<visarea.max_x; i++)
{
@@ -624,11 +623,11 @@ INTERRUPT_GEN_MEMBER(vc4000_state::vc4000_video_line)
if ((m_video.line>=y)&&(m_video.line<y+20))
{
x = 60;
- vc4000_draw_digit(this, *m_bitmap, x, y, m_video.reg.d.bcd[0]>>4, m_video.line-y);
- vc4000_draw_digit(this, *m_bitmap, x+16, y, m_video.reg.d.bcd[0]&0xf, m_video.line-y);
+ vc4000_draw_digit(*m_bitmap, x, y, m_video.reg.d.bcd[0]>>4, m_video.line-y);
+ vc4000_draw_digit(*m_bitmap, x+16, y, m_video.reg.d.bcd[0]&0xf, m_video.line-y);
if (m_video.reg.d.score_control&2) x -= 16;
- vc4000_draw_digit(this, *m_bitmap, x+48, y, m_video.reg.d.bcd[1]>>4, m_video.line-y);
- vc4000_draw_digit(this, *m_bitmap, x+64, y, m_video.reg.d.bcd[1]&0xf, m_video.line-y);
+ vc4000_draw_digit(*m_bitmap, x+48, y, m_video.reg.d.bcd[1]>>4, m_video.line-y);
+ vc4000_draw_digit(*m_bitmap, x+64, y, m_video.reg.d.bcd[1]&0xf, m_video.line-y);
}
}
if (m_video.line==VC4000_END_LINE) m_video.reg.d.sprite_collision |=0x40;
diff --git a/src/mess/video/wswan.c b/src/mess/video/wswan.c
index 12897c6cbfa..21fad625b06 100644
--- a/src/mess/video/wswan.c
+++ b/src/mess/video/wswan.c
@@ -11,65 +11,66 @@
#include "includes/wswan.h"
-static void wswan_setup_palettes(wswan_state *state) {
+void wswan_state::wswan_setup_palettes()
+{
int i,j;
- if ( state->m_vdp.color_mode ) {
+ if ( m_vdp.color_mode ) {
for( i = 0; i < 16; i++ ) {
for( j = 0; j < 16; j++ ) {
- state->m_pal[i][j] = ( ( state->m_vdp.palette_vram[ ( i << 5 ) + j*2 + 1 ] << 8 ) | state->m_vdp.palette_vram[ ( i << 5 ) + j*2 ] ) & 0x0FFF;
+ m_pal[i][j] = ( ( m_vdp.palette_vram[ ( i << 5 ) + j*2 + 1 ] << 8 ) | m_vdp.palette_vram[ ( i << 5 ) + j*2 ] ) & 0x0FFF;
}
}
} else {
for( i = 0; i < 16; i++ ) {
- state->m_pal[i][0] = state->m_ws_portram[ 0x20 + ( i << 1 ) ] & 0x07;
- state->m_pal[i][1] = ( state->m_ws_portram[ 0x20 + ( i << 1 ) ] >> 4 ) & 0x07;
- state->m_pal[i][2] = state->m_ws_portram[ 0x21 + ( i << 1 ) ] & 0x07;
- state->m_pal[i][3] = ( state->m_ws_portram[ 0x21 + ( i << 1 ) ] >> 4 ) & 0x07;
+ m_pal[i][0] = m_ws_portram[ 0x20 + ( i << 1 ) ] & 0x07;
+ m_pal[i][1] = ( m_ws_portram[ 0x20 + ( i << 1 ) ] >> 4 ) & 0x07;
+ m_pal[i][2] = m_ws_portram[ 0x21 + ( i << 1 ) ] & 0x07;
+ m_pal[i][3] = ( m_ws_portram[ 0x21 + ( i << 1 ) ] >> 4 ) & 0x07;
}
}
}
-static void wswan_draw_background( running_machine &machine ) {
- wswan_state *state = machine.driver_data<wswan_state>();
+void wswan_state::wswan_draw_background()
+{
UINT16 map_addr;
UINT8 start_column;
int column;
- map_addr = state->m_vdp.layer_bg_address + ( ( ( state->m_vdp.current_line + state->m_vdp.layer_bg_scroll_y ) & 0xF8 ) << 3 );
- start_column = ( state->m_vdp.layer_bg_scroll_x >> 3 );
+ map_addr = m_vdp.layer_bg_address + ( ( ( m_vdp.current_line + m_vdp.layer_bg_scroll_y ) & 0xF8 ) << 3 );
+ start_column = ( m_vdp.layer_bg_scroll_x >> 3 );
for( column = 0; column < 29; column++ ) {
int tile_data, tile_number, tile_palette, tile_line, tile_address;
UINT32 plane0=0, plane1=0, plane2=0, plane3=0;
int x, x_offset;
- tile_data = ( state->m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) + 1 ] << 8 )
- | state->m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) ];
+ tile_data = ( m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) + 1 ] << 8 )
+ | m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) ];
tile_number = tile_data & 0x01FF;
tile_palette = ( tile_data >> 9 ) & 0x0F;
- tile_line = ( state->m_vdp.current_line + state->m_vdp.layer_bg_scroll_y ) & 0x07;
+ tile_line = ( m_vdp.current_line + m_vdp.layer_bg_scroll_y ) & 0x07;
if ( tile_data & 0x8000 ) {
tile_line = 7 - tile_line;
}
- if ( state->m_vdp.colors_16 ) {
+ if ( m_vdp.colors_16 ) {
tile_address = ( ( tile_data & 0x2000 ) ? 0x8000 : 0x4000 ) + ( tile_number * 32 ) + ( tile_line << 2 );
- if ( state->m_vdp.tile_packed ) {
- plane0 = ( state->m_vdp.vram[ tile_address + 0 ] << 24 ) | ( state->m_vdp.vram[ tile_address + 1 ] << 16 ) | ( state->m_vdp.vram[ tile_address + 2 ] << 8 ) | state->m_vdp.vram[ tile_address + 3 ];
+ if ( m_vdp.tile_packed ) {
+ plane0 = ( m_vdp.vram[ tile_address + 0 ] << 24 ) | ( m_vdp.vram[ tile_address + 1 ] << 16 ) | ( m_vdp.vram[ tile_address + 2 ] << 8 ) | m_vdp.vram[ tile_address + 3 ];
} else {
- plane0 = state->m_vdp.vram[ tile_address + 0 ];
- plane1 = state->m_vdp.vram[ tile_address + 1 ] << 1;
- plane2 = state->m_vdp.vram[ tile_address + 2 ] << 2;
- plane3 = state->m_vdp.vram[ tile_address + 3 ] << 3;
+ plane0 = m_vdp.vram[ tile_address + 0 ];
+ plane1 = m_vdp.vram[ tile_address + 1 ] << 1;
+ plane2 = m_vdp.vram[ tile_address + 2 ] << 2;
+ plane3 = m_vdp.vram[ tile_address + 3 ] << 3;
}
} else {
tile_address = 0x2000 + ( tile_number * 16 ) + ( tile_line << 1 );
- if ( state->m_vdp.tile_packed ) {
- plane0 = ( state->m_vdp.vram[ tile_address + 0 ] << 8 ) | state->m_vdp.vram[ tile_address + 1 ];
+ if ( m_vdp.tile_packed ) {
+ plane0 = ( m_vdp.vram[ tile_address + 0 ] << 8 ) | m_vdp.vram[ tile_address + 1 ];
} else {
- plane0 = state->m_vdp.vram[ tile_address + 0 ];
- plane1 = state->m_vdp.vram[ tile_address + 1 ] << 1;
+ plane0 = m_vdp.vram[ tile_address + 0 ];
+ plane1 = m_vdp.vram[ tile_address + 1 ] << 1;
plane2 = 0;
plane3 = 0;
}
@@ -77,8 +78,8 @@ static void wswan_draw_background( running_machine &machine ) {
for( x = 0; x < 8; x++ ) {
int col;
- if ( state->m_vdp.tile_packed ) {
- if ( state->m_vdp.colors_16 ) {
+ if ( m_vdp.tile_packed ) {
+ if ( m_vdp.colors_16 ) {
col = plane0 & 0x0F;
plane0 = plane0 >> 4;
} else {
@@ -93,26 +94,26 @@ static void wswan_draw_background( running_machine &machine ) {
plane0 = plane0 >> 1;
}
if ( tile_data & 0x4000 ) {
- x_offset = x + ( column << 3 ) - ( state->m_vdp.layer_bg_scroll_x & 0x07 );
+ x_offset = x + ( column << 3 ) - ( m_vdp.layer_bg_scroll_x & 0x07 );
} else {
- x_offset = 7 - x + ( column << 3 ) - ( state->m_vdp.layer_bg_scroll_x & 0x07 );
+ x_offset = 7 - x + ( column << 3 ) - ( m_vdp.layer_bg_scroll_x & 0x07 );
}
if ( x_offset >= 0 && x_offset < WSWAN_X_PIXELS ) {
- if ( state->m_vdp.colors_16 ) {
+ if ( m_vdp.colors_16 ) {
if ( col ) {
- if ( state->m_vdp.color_mode ) {
- state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_pal[tile_palette][col];
+ if ( m_vdp.color_mode ) {
+ m_bitmap.pix16(m_vdp.current_line, x_offset) = m_pal[tile_palette][col];
} else {
/* Hmmmm, what should we do here... Is this correct?? */
- state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_pal[tile_palette][col];
+ m_bitmap.pix16(m_vdp.current_line, x_offset) = m_pal[tile_palette][col];
}
}
} else {
if ( col || !(tile_palette & 4 ) ) {
- if ( state->m_vdp.color_mode ) {
- state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_pal[tile_palette][col];
+ if ( m_vdp.color_mode ) {
+ m_bitmap.pix16(m_vdp.current_line, x_offset) = m_pal[tile_palette][col];
} else {
- state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_vdp.main_palette[state->m_pal[tile_palette][col]];
+ m_bitmap.pix16(m_vdp.current_line, x_offset) = m_vdp.main_palette[m_pal[tile_palette][col]];
}
}
}
@@ -121,43 +122,43 @@ static void wswan_draw_background( running_machine &machine ) {
}
}
-static void wswan_draw_foreground_0( running_machine &machine ) {
- wswan_state *state = machine.driver_data<wswan_state>();
+void wswan_state::wswan_draw_foreground_0()
+{
UINT16 map_addr;
UINT8 start_column;
int column;
- map_addr = state->m_vdp.layer_fg_address + ( ( ( state->m_vdp.current_line + state->m_vdp.layer_fg_scroll_y ) & 0xF8 ) << 3 );
- start_column = ( state->m_vdp.layer_fg_scroll_x >> 3 );
+ map_addr = m_vdp.layer_fg_address + ( ( ( m_vdp.current_line + m_vdp.layer_fg_scroll_y ) & 0xF8 ) << 3 );
+ start_column = ( m_vdp.layer_fg_scroll_x >> 3 );
for( column = 0; column < 29; column++ ) {
UINT32 plane0 = 0, plane1 = 0, plane2 = 0, plane3 = 0;
int x, x_offset, tile_line, tile_address;
- int tile_data = ( state->m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) + 1 ] << 8 )
- | state->m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) ];
+ int tile_data = ( m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) + 1 ] << 8 )
+ | m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) ];
int tile_number = tile_data & 0x01FF;
int tile_palette = ( tile_data >> 9 ) & 0x0F;
- tile_line = ( state->m_vdp.current_line + state->m_vdp.layer_fg_scroll_y ) & 0x07;
+ tile_line = ( m_vdp.current_line + m_vdp.layer_fg_scroll_y ) & 0x07;
if ( tile_data & 0x8000 ) {
tile_line = 7 - tile_line;
}
- if ( state->m_vdp.colors_16 ) {
+ if ( m_vdp.colors_16 ) {
tile_address = ( ( tile_data & 0x2000 ) ? 0x8000 : 0x4000 ) + ( tile_number * 32 ) + ( tile_line << 2 );
- if ( state->m_vdp.tile_packed ) {
- plane0 = ( state->m_vdp.vram[ tile_address + 0 ] << 24 ) | ( state->m_vdp.vram[ tile_address + 1 ] << 16 ) | ( state->m_vdp.vram[ tile_address + 2 ] << 8 ) | state->m_vdp.vram[ tile_address + 3 ];
+ if ( m_vdp.tile_packed ) {
+ plane0 = ( m_vdp.vram[ tile_address + 0 ] << 24 ) | ( m_vdp.vram[ tile_address + 1 ] << 16 ) | ( m_vdp.vram[ tile_address + 2 ] << 8 ) | m_vdp.vram[ tile_address + 3 ];
} else {
- plane0 = state->m_vdp.vram[ tile_address + 0 ];
- plane1 = state->m_vdp.vram[ tile_address + 1 ] << 1;
- plane2 = state->m_vdp.vram[ tile_address + 2 ] << 2;
- plane3 = state->m_vdp.vram[ tile_address + 3 ] << 3;
+ plane0 = m_vdp.vram[ tile_address + 0 ];
+ plane1 = m_vdp.vram[ tile_address + 1 ] << 1;
+ plane2 = m_vdp.vram[ tile_address + 2 ] << 2;
+ plane3 = m_vdp.vram[ tile_address + 3 ] << 3;
}
} else {
tile_address = 0x2000 + ( tile_number * 16 ) + ( tile_line << 1 );
- if ( state->m_vdp.tile_packed ) {
- plane0 = ( state->m_vdp.vram[ tile_address + 0 ] << 8 ) | state->m_vdp.vram[ tile_address + 1 ];
+ if ( m_vdp.tile_packed ) {
+ plane0 = ( m_vdp.vram[ tile_address + 0 ] << 8 ) | m_vdp.vram[ tile_address + 1 ];
} else {
- plane0 = state->m_vdp.vram[ tile_address + 0 ];
- plane1 = state->m_vdp.vram[ tile_address + 1 ] << 1;
+ plane0 = m_vdp.vram[ tile_address + 0 ];
+ plane1 = m_vdp.vram[ tile_address + 1 ] << 1;
plane2 = 0;
plane3 = 0;
}
@@ -165,8 +166,8 @@ static void wswan_draw_foreground_0( running_machine &machine ) {
for( x = 0; x < 8; x++ ) {
int col;
- if ( state->m_vdp.tile_packed ) {
- if ( state->m_vdp.colors_16 ) {
+ if ( m_vdp.tile_packed ) {
+ if ( m_vdp.colors_16 ) {
col = plane0 & 0x0F;
plane0 = plane0 >> 4;
} else {
@@ -181,26 +182,26 @@ static void wswan_draw_foreground_0( running_machine &machine ) {
plane0 = plane0 >> 1;
}
if ( tile_data & 0x4000 ) {
- x_offset = x + ( column << 3 ) - ( state->m_vdp.layer_fg_scroll_x & 0x07 );
+ x_offset = x + ( column << 3 ) - ( m_vdp.layer_fg_scroll_x & 0x07 );
} else {
- x_offset = 7 - x + ( column << 3 ) - ( state->m_vdp.layer_fg_scroll_x & 0x07 );
+ x_offset = 7 - x + ( column << 3 ) - ( m_vdp.layer_fg_scroll_x & 0x07 );
}
if ( x_offset >= 0 && x_offset < WSWAN_X_PIXELS ) {
- if ( state->m_vdp.colors_16 ) {
+ if ( m_vdp.colors_16 ) {
if ( col ) {
-// if ( state->m_vdp.color_mode ) {
- state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_pal[tile_palette][col];
+// if ( m_vdp.color_mode ) {
+ m_bitmap.pix16(m_vdp.current_line, x_offset) = m_pal[tile_palette][col];
// } else {
// /* Hmmmm, what should we do here... Is this correct?? */
-// state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_pal[tile_palette][col];
+// m_bitmap.pix16(m_vdp.current_line, x_offset) = m_pal[tile_palette][col];
// }
}
} else {
if ( col || !(tile_palette & 4 ) ) {
- if ( state->m_vdp.color_mode ) {
- state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_pal[tile_palette][col];
+ if ( m_vdp.color_mode ) {
+ m_bitmap.pix16(m_vdp.current_line, x_offset) = m_pal[tile_palette][col];
} else {
- state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_vdp.main_palette[state->m_pal[tile_palette][col]];
+ m_bitmap.pix16(m_vdp.current_line, x_offset) = m_vdp.main_palette[m_pal[tile_palette][col]];
}
}
}
@@ -209,43 +210,43 @@ static void wswan_draw_foreground_0( running_machine &machine ) {
}
}
-static void wswan_draw_foreground_2( running_machine &machine ) {
- wswan_state *state = machine.driver_data<wswan_state>();
+void wswan_state::wswan_draw_foreground_2()
+{
UINT16 map_addr;
UINT8 start_column;
int column;
- map_addr = state->m_vdp.layer_fg_address + ( ( ( state->m_vdp.current_line + state->m_vdp.layer_fg_scroll_y ) & 0xF8 ) << 3 );
- start_column = ( state->m_vdp.layer_fg_scroll_x >> 3 );
+ map_addr = m_vdp.layer_fg_address + ( ( ( m_vdp.current_line + m_vdp.layer_fg_scroll_y ) & 0xF8 ) << 3 );
+ start_column = ( m_vdp.layer_fg_scroll_x >> 3 );
for( column = 0; column < 29; column++ ) {
UINT32 plane0 = 0, plane1 = 0, plane2 = 0, plane3 = 0;
int x, x_offset, tile_line, tile_address;
- int tile_data = ( state->m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) + 1 ] << 8 )
- | state->m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) ];
+ int tile_data = ( m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) + 1 ] << 8 )
+ | m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) ];
int tile_number = tile_data & 0x01FF;
int tile_palette = ( tile_data >> 9 ) & 0x0F;
- tile_line = ( state->m_vdp.current_line + state->m_vdp.layer_fg_scroll_y ) & 0x07;
+ tile_line = ( m_vdp.current_line + m_vdp.layer_fg_scroll_y ) & 0x07;
if ( tile_data & 0x8000 ) {
tile_line = 7 - tile_line;
}
- if ( state->m_vdp.colors_16 ) {
+ if ( m_vdp.colors_16 ) {
tile_address = ( ( tile_data & 0x2000 ) ? 0x8000 : 0x4000 ) + ( tile_number * 32 ) + ( tile_line << 2 );
- if ( state->m_vdp.tile_packed ) {
- plane0 = ( state->m_vdp.vram[ tile_address + 0 ] << 24 ) | ( state->m_vdp.vram[ tile_address + 1 ] << 16 ) | ( state->m_vdp.vram[ tile_address + 2 ] << 8 ) | state->m_vdp.vram[ tile_address + 3 ];
+ if ( m_vdp.tile_packed ) {
+ plane0 = ( m_vdp.vram[ tile_address + 0 ] << 24 ) | ( m_vdp.vram[ tile_address + 1 ] << 16 ) | ( m_vdp.vram[ tile_address + 2 ] << 8 ) | m_vdp.vram[ tile_address + 3 ];
} else {
- plane0 = state->m_vdp.vram[ tile_address + 0 ];
- plane1 = state->m_vdp.vram[ tile_address + 1 ] << 1;
- plane2 = state->m_vdp.vram[ tile_address + 2 ] << 2;
- plane3 = state->m_vdp.vram[ tile_address + 3 ] << 3;
+ plane0 = m_vdp.vram[ tile_address + 0 ];
+ plane1 = m_vdp.vram[ tile_address + 1 ] << 1;
+ plane2 = m_vdp.vram[ tile_address + 2 ] << 2;
+ plane3 = m_vdp.vram[ tile_address + 3 ] << 3;
}
} else {
tile_address = 0x2000 + ( tile_number * 16 ) + ( tile_line << 1 );
- if ( state->m_vdp.tile_packed ) {
- plane0 = ( state->m_vdp.vram[ tile_address + 0 ] << 8 ) | state->m_vdp.vram[ tile_address + 1 ];
+ if ( m_vdp.tile_packed ) {
+ plane0 = ( m_vdp.vram[ tile_address + 0 ] << 8 ) | m_vdp.vram[ tile_address + 1 ];
} else {
- plane0 = state->m_vdp.vram[ tile_address + 0 ];
- plane1 = state->m_vdp.vram[ tile_address + 1 ] << 1;
+ plane0 = m_vdp.vram[ tile_address + 0 ];
+ plane1 = m_vdp.vram[ tile_address + 1 ] << 1;
plane2 = 0;
plane3 = 0;
}
@@ -253,8 +254,8 @@ static void wswan_draw_foreground_2( running_machine &machine ) {
for( x = 0; x < 8; x++ ) {
int col;
- if ( state->m_vdp.tile_packed ) {
- if ( state->m_vdp.colors_16 ) {
+ if ( m_vdp.tile_packed ) {
+ if ( m_vdp.colors_16 ) {
col = plane0 & 0x0F;
plane0 = plane0 >> 4;
} else {
@@ -269,26 +270,26 @@ static void wswan_draw_foreground_2( running_machine &machine ) {
plane0 = plane0 >> 1;
}
if ( tile_data & 0x4000 ) {
- x_offset = x + ( column << 3 ) - ( state->m_vdp.layer_fg_scroll_x & 0x07 );
+ x_offset = x + ( column << 3 ) - ( m_vdp.layer_fg_scroll_x & 0x07 );
} else {
- x_offset = 7 - x + ( column << 3 ) - ( state->m_vdp.layer_fg_scroll_x & 0x07 );
+ x_offset = 7 - x + ( column << 3 ) - ( m_vdp.layer_fg_scroll_x & 0x07 );
}
- if ( x_offset >= 0 && x_offset >= state->m_vdp.window_fg_left && x_offset < state->m_vdp.window_fg_right && x_offset < WSWAN_X_PIXELS ) {
- if ( state->m_vdp.colors_16 ) {
+ if ( x_offset >= 0 && x_offset >= m_vdp.window_fg_left && x_offset < m_vdp.window_fg_right && x_offset < WSWAN_X_PIXELS ) {
+ if ( m_vdp.colors_16 ) {
if ( col ) {
- if ( state->m_vdp.color_mode ) {
- state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_pal[tile_palette][col];
+ if ( m_vdp.color_mode ) {
+ m_bitmap.pix16(m_vdp.current_line, x_offset) = m_pal[tile_palette][col];
} else {
/* Hmmmm, what should we do here... Is this correct?? */
- state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_pal[tile_palette][col];
+ m_bitmap.pix16(m_vdp.current_line, x_offset) = m_pal[tile_palette][col];
}
}
} else {
if ( col || !(tile_palette & 4 ) ) {
- if ( state->m_vdp.color_mode ) {
- state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_pal[tile_palette][col];
+ if ( m_vdp.color_mode ) {
+ m_bitmap.pix16(m_vdp.current_line, x_offset) = m_pal[tile_palette][col];
} else {
- state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_vdp.main_palette[state->m_pal[tile_palette][col]];
+ m_bitmap.pix16(m_vdp.current_line, x_offset) = m_vdp.main_palette[m_pal[tile_palette][col]];
}
}
}
@@ -297,43 +298,43 @@ static void wswan_draw_foreground_2( running_machine &machine ) {
}
}
-static void wswan_draw_foreground_3( running_machine &machine ) {
- wswan_state *state = machine.driver_data<wswan_state>();
+void wswan_state::wswan_draw_foreground_3()
+{
UINT16 map_addr;
UINT8 start_column;
int column;
- map_addr = state->m_vdp.layer_fg_address + ( ( ( state->m_vdp.current_line + state->m_vdp.layer_fg_scroll_y ) & 0xF8 ) << 3 );
- start_column = ( state->m_vdp.layer_fg_scroll_x >> 3 );
+ map_addr = m_vdp.layer_fg_address + ( ( ( m_vdp.current_line + m_vdp.layer_fg_scroll_y ) & 0xF8 ) << 3 );
+ start_column = ( m_vdp.layer_fg_scroll_x >> 3 );
for( column = 0; column < 29; column++ ) {
UINT32 plane0 = 0, plane1 = 0, plane2 = 0, plane3 = 0;
int x, x_offset, tile_line, tile_address;
- int tile_data = ( state->m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) + 1 ] << 8 )
- | state->m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) ];
+ int tile_data = ( m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) + 1 ] << 8 )
+ | m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) ];
int tile_number = tile_data & 0x01FF;
int tile_palette = ( tile_data >> 9 ) & 0x0F;
- tile_line = ( state->m_vdp.current_line + state->m_vdp.layer_fg_scroll_y ) & 0x07;
+ tile_line = ( m_vdp.current_line + m_vdp.layer_fg_scroll_y ) & 0x07;
if ( tile_data & 0x8000 ) { // vflip
tile_line = 7 - tile_line;
}
- if ( state->m_vdp.colors_16 ) {
+ if ( m_vdp.colors_16 ) {
tile_address = ( ( tile_data & 0x2000 ) ? 0x8000 : 0x4000 ) + ( tile_number * 32 ) + ( tile_line << 2 );
- if ( state->m_vdp.tile_packed ) {
- plane0 = ( state->m_vdp.vram[ tile_address + 0 ] << 24 ) | ( state->m_vdp.vram[ tile_address + 1 ] << 16 ) | ( state->m_vdp.vram[ tile_address + 2 ] << 8 ) | state->m_vdp.vram[ tile_address + 3 ];
+ if ( m_vdp.tile_packed ) {
+ plane0 = ( m_vdp.vram[ tile_address + 0 ] << 24 ) | ( m_vdp.vram[ tile_address + 1 ] << 16 ) | ( m_vdp.vram[ tile_address + 2 ] << 8 ) | m_vdp.vram[ tile_address + 3 ];
} else {
- plane0 = state->m_vdp.vram[ tile_address + 0 ];
- plane1 = state->m_vdp.vram[ tile_address + 1 ] << 1;
- plane2 = state->m_vdp.vram[ tile_address + 2 ] << 2;
- plane3 = state->m_vdp.vram[ tile_address + 3 ] << 3;
+ plane0 = m_vdp.vram[ tile_address + 0 ];
+ plane1 = m_vdp.vram[ tile_address + 1 ] << 1;
+ plane2 = m_vdp.vram[ tile_address + 2 ] << 2;
+ plane3 = m_vdp.vram[ tile_address + 3 ] << 3;
}
} else {
tile_address = 0x2000 + ( tile_number * 16 ) + ( tile_line << 1 );
- if ( state->m_vdp.tile_packed ) {
- plane0 = ( state->m_vdp.vram[ tile_address + 0 ] << 8 ) | state->m_vdp.vram[ tile_address + 1 ];
+ if ( m_vdp.tile_packed ) {
+ plane0 = ( m_vdp.vram[ tile_address + 0 ] << 8 ) | m_vdp.vram[ tile_address + 1 ];
} else {
- plane0 = state->m_vdp.vram[ tile_address + 0 ];
- plane1 = state->m_vdp.vram[ tile_address + 1 ] << 1;
+ plane0 = m_vdp.vram[ tile_address + 0 ];
+ plane1 = m_vdp.vram[ tile_address + 1 ] << 1;
plane2 = 0;
plane3 = 0;
}
@@ -341,8 +342,8 @@ static void wswan_draw_foreground_3( running_machine &machine ) {
for( x = 0; x < 8; x++ ) {
int col;
- if ( state->m_vdp.tile_packed ) {
- if ( state->m_vdp.colors_16 ) {
+ if ( m_vdp.tile_packed ) {
+ if ( m_vdp.colors_16 ) {
col = plane0 & 0x0F;
plane0 = plane0 >> 4;
} else {
@@ -357,26 +358,26 @@ static void wswan_draw_foreground_3( running_machine &machine ) {
plane0 = plane0 >> 1;
}
if ( tile_data & 0x4000 ) {
- x_offset = x + ( column << 3 ) - ( state->m_vdp.layer_fg_scroll_x & 0x07 );
+ x_offset = x + ( column << 3 ) - ( m_vdp.layer_fg_scroll_x & 0x07 );
} else {
- x_offset = 7 - x + ( column << 3 ) - ( state->m_vdp.layer_fg_scroll_x & 0x07 );
+ x_offset = 7 - x + ( column << 3 ) - ( m_vdp.layer_fg_scroll_x & 0x07 );
}
- if ( ( x_offset >= 0 && x_offset < state->m_vdp.window_fg_left ) || ( x_offset >= state->m_vdp.window_fg_right && x_offset < WSWAN_X_PIXELS ) ) {
- if ( state->m_vdp.colors_16 ) {
+ if ( ( x_offset >= 0 && x_offset < m_vdp.window_fg_left ) || ( x_offset >= m_vdp.window_fg_right && x_offset < WSWAN_X_PIXELS ) ) {
+ if ( m_vdp.colors_16 ) {
if ( col ) {
- if ( state->m_vdp.color_mode ) {
- state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_pal[tile_palette][col];
+ if ( m_vdp.color_mode ) {
+ m_bitmap.pix16(m_vdp.current_line, x_offset) = m_pal[tile_palette][col];
} else {
/* Hmmmm, what should we do here... Is this correct?? */
- state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_pal[tile_palette][col];
+ m_bitmap.pix16(m_vdp.current_line, x_offset) = m_pal[tile_palette][col];
}
}
} else {
if ( col || !(tile_palette & 4 ) ) {
- if ( state->m_vdp.color_mode ) {
- state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_pal[tile_palette][col];
+ if ( m_vdp.color_mode ) {
+ m_bitmap.pix16(m_vdp.current_line, x_offset) = m_pal[tile_palette][col];
} else {
- state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_vdp.main_palette[state->m_pal[tile_palette][col]];
+ m_bitmap.pix16(m_vdp.current_line, x_offset) = m_vdp.main_palette[m_pal[tile_palette][col]];
}
}
}
@@ -385,20 +386,20 @@ static void wswan_draw_foreground_3( running_machine &machine ) {
}
}
-static void wswan_handle_sprites( running_machine &machine, int mask ) {
- wswan_state *state = machine.driver_data<wswan_state>();
+void wswan_state::wswan_handle_sprites(int mask )
+{
int i;
- if ( state->m_vdp.sprite_count == 0 )
+ if ( m_vdp.sprite_count == 0 )
return;
- for( i = state->m_vdp.sprite_first + state->m_vdp.sprite_count - 1; i >= state->m_vdp.sprite_first; i-- ) {
+ for( i = m_vdp.sprite_first + m_vdp.sprite_count - 1; i >= m_vdp.sprite_first; i-- ) {
UINT8 x, y;
UINT16 tile_data;
int tile_line;
- tile_data = ( state->m_vdp.sprite_table_buffer[ i * 4 + 1 ] << 8 ) | state->m_vdp.sprite_table_buffer[ i * 4 ];
- y = state->m_vdp.sprite_table_buffer[ i * 4 + 2 ];
- x = state->m_vdp.sprite_table_buffer[ i * 4 + 3 ];
- tile_line = state->m_vdp.current_line - y;
+ tile_data = ( m_vdp.sprite_table_buffer[ i * 4 + 1 ] << 8 ) | m_vdp.sprite_table_buffer[ i * 4 ];
+ y = m_vdp.sprite_table_buffer[ i * 4 + 2 ];
+ x = m_vdp.sprite_table_buffer[ i * 4 + 3 ];
+ tile_line = m_vdp.current_line - y;
tile_line = tile_line & 0xFF;
if ( ( tile_line >= 0 ) && ( tile_line < 8 ) && ( ( tile_data & 0x2000 ) == mask ) ) {
UINT32 plane0 = 0, plane1 = 0, plane2 = 0, plane3 = 0;
@@ -410,35 +411,35 @@ static void wswan_handle_sprites( running_machine &machine, int mask ) {
tile_line = 7 - tile_line;
}
- if ( state->m_vdp.colors_16 ) {
+ if ( m_vdp.colors_16 ) {
tile_address = 0x4000 + ( tile_number * 32 ) + ( tile_line << 2 );
- if ( state->m_vdp.tile_packed ) {
- plane0 = ( state->m_vdp.vram[ tile_address + 0 ] << 24 ) | ( state->m_vdp.vram[ tile_address + 1 ] << 16 ) | ( state->m_vdp.vram[ tile_address + 2 ] << 8 ) | state->m_vdp.vram[ tile_address + 3 ];
+ if ( m_vdp.tile_packed ) {
+ plane0 = ( m_vdp.vram[ tile_address + 0 ] << 24 ) | ( m_vdp.vram[ tile_address + 1 ] << 16 ) | ( m_vdp.vram[ tile_address + 2 ] << 8 ) | m_vdp.vram[ tile_address + 3 ];
} else {
- plane0 = state->m_vdp.vram[ tile_address + 0 ];
- plane1 = state->m_vdp.vram[ tile_address + 1 ] << 1;
- plane2 = state->m_vdp.vram[ tile_address + 2 ] << 2;
- plane3 = state->m_vdp.vram[ tile_address + 3 ] << 3;
+ plane0 = m_vdp.vram[ tile_address + 0 ];
+ plane1 = m_vdp.vram[ tile_address + 1 ] << 1;
+ plane2 = m_vdp.vram[ tile_address + 2 ] << 2;
+ plane3 = m_vdp.vram[ tile_address + 3 ] << 3;
}
} else {
tile_address = 0x2000 + ( tile_number * 16 ) + ( tile_line << 1 );
- if ( state->m_vdp.tile_packed ) {
- plane0 = ( state->m_vdp.vram[ tile_address + 0 ] << 8 ) | state->m_vdp.vram[ tile_address + 1 ];
+ if ( m_vdp.tile_packed ) {
+ plane0 = ( m_vdp.vram[ tile_address + 0 ] << 8 ) | m_vdp.vram[ tile_address + 1 ];
} else {
- plane0 = state->m_vdp.vram[ tile_address + 0 ];
- plane1 = state->m_vdp.vram[ tile_address + 1 ] << 1;
+ plane0 = m_vdp.vram[ tile_address + 0 ];
+ plane1 = m_vdp.vram[ tile_address + 1 ] << 1;
plane2 = 0;
plane3 = 0;
}
}
- if ( state->m_vdp.window_sprites_enable ) {
+ if ( m_vdp.window_sprites_enable ) {
if ( tile_data & 0x1000 ) {
- if ( state->m_vdp.current_line >= state->m_vdp.window_sprites_top && state->m_vdp.current_line <= state->m_vdp.window_sprites_bottom ) {
+ if ( m_vdp.current_line >= m_vdp.window_sprites_top && m_vdp.current_line <= m_vdp.window_sprites_bottom ) {
check_clip = 1;
}
} else {
- if ( state->m_vdp.current_line < state->m_vdp.window_sprites_top || state->m_vdp.current_line > state->m_vdp.window_sprites_bottom ) {
+ if ( m_vdp.current_line < m_vdp.window_sprites_top || m_vdp.current_line > m_vdp.window_sprites_bottom ) {
continue;
}
}
@@ -446,8 +447,8 @@ static void wswan_handle_sprites( running_machine &machine, int mask ) {
for ( j = 0; j < 8; j++ ) {
int col;
- if ( state->m_vdp.tile_packed ) {
- if ( state->m_vdp.colors_16 ) {
+ if ( m_vdp.tile_packed ) {
+ if ( m_vdp.colors_16 ) {
col = plane0 & 0x0F;
plane0 = plane0 >> 4;
} else {
@@ -467,33 +468,33 @@ static void wswan_handle_sprites( running_machine &machine, int mask ) {
x_offset = x + 7 - j;
}
x_offset = x_offset & 0xFF;
- if ( state->m_vdp.window_sprites_enable ) {
+ if ( m_vdp.window_sprites_enable ) {
if ( tile_data & 0x1000 && check_clip ) {
- if ( x_offset >= state->m_vdp.window_sprites_left && x_offset <= state->m_vdp.window_sprites_right ) {
+ if ( x_offset >= m_vdp.window_sprites_left && x_offset <= m_vdp.window_sprites_right ) {
continue;
}
} else {
- if ( x_offset < state->m_vdp.window_sprites_left || x_offset > state->m_vdp.window_sprites_right ) {
+ if ( x_offset < m_vdp.window_sprites_left || x_offset > m_vdp.window_sprites_right ) {
// continue;
}
}
}
if ( x_offset >= 0 && x_offset < WSWAN_X_PIXELS ) {
- if ( state->m_vdp.colors_16 ) {
+ if ( m_vdp.colors_16 ) {
if ( col ) {
- if ( state->m_vdp.color_mode ) {
- state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_pal[tile_palette][col];
+ if ( m_vdp.color_mode ) {
+ m_bitmap.pix16(m_vdp.current_line, x_offset) = m_pal[tile_palette][col];
} else {
/* Hmmmm, what should we do here... Is this correct?? */
- state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_pal[tile_palette][col];
+ m_bitmap.pix16(m_vdp.current_line, x_offset) = m_pal[tile_palette][col];
}
}
} else {
if ( col || !(tile_palette & 4 ) ) {
- if ( state->m_vdp.color_mode ) {
- state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_pal[tile_palette][col];
+ if ( m_vdp.color_mode ) {
+ m_bitmap.pix16(m_vdp.current_line, x_offset) = m_pal[tile_palette][col];
} else {
- state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_vdp.main_palette[state->m_pal[tile_palette][col]];
+ m_bitmap.pix16(m_vdp.current_line, x_offset) = m_vdp.main_palette[m_pal[tile_palette][col]];
}
}
}
@@ -503,60 +504,58 @@ static void wswan_handle_sprites( running_machine &machine, int mask ) {
}
}
-void wswan_refresh_scanline( running_machine &machine )
+void wswan_state::wswan_refresh_scanline()
{
- wswan_state *state = machine.driver_data<wswan_state>();
-
- wswan_setup_palettes(state);
+ wswan_setup_palettes();
- rectangle rec(0, WSWAN_X_PIXELS, state->m_vdp.current_line, state->m_vdp.current_line);
- if ( state->m_ws_portram[0x14] ) {
+ rectangle rec(0, WSWAN_X_PIXELS, m_vdp.current_line, m_vdp.current_line);
+ if ( m_ws_portram[0x14] ) {
/* Not sure if these background color checks and settings are correct */
- if ( state->m_vdp.color_mode && state->m_vdp.colors_16 ) {
- state->m_bitmap.fill( state->m_pal[state->m_ws_portram[0x01]>>4][state->m_ws_portram[0x01]&0x0F], rec );
+ if ( m_vdp.color_mode && m_vdp.colors_16 ) {
+ m_bitmap.fill( m_pal[m_ws_portram[0x01]>>4][m_ws_portram[0x01]&0x0F], rec );
} else {
- state->m_bitmap.fill( state->m_vdp.main_palette[state->m_ws_portram[0x01]&0x07], rec );
+ m_bitmap.fill( m_vdp.main_palette[m_ws_portram[0x01]&0x07], rec );
}
} else {
- state->m_bitmap.fill( 0, rec );
+ m_bitmap.fill( 0, rec );
return;
}
/*
* Draw background layer
*/
- if ( state->m_vdp.layer_bg_enable ) {
- wswan_draw_background(machine);
+ if ( m_vdp.layer_bg_enable ) {
+ wswan_draw_background();
}
/*
* Draw sprites between background and foreground layers
*/
- if ( state->m_vdp.sprites_enable ) {
- wswan_handle_sprites( machine, 0 );
+ if ( m_vdp.sprites_enable ) {
+ wswan_handle_sprites(0);
}
/*
* Draw foreground layer, taking window settings into account
*/
- if ( state->m_vdp.layer_fg_enable ) {
- switch( state->m_vdp.window_fg_mode ) {
+ if ( m_vdp.layer_fg_enable ) {
+ switch( m_vdp.window_fg_mode ) {
case 0: /* FG inside & outside window area */
- wswan_draw_foreground_0(machine);
+ wswan_draw_foreground_0();
break;
case 1: /* ??? */
logerror( "Unknown foreground mode 1 set\n" );
break;
case 2: /* FG only inside window area */
- if ( state->m_vdp.current_line >= state->m_vdp.window_fg_top && state->m_vdp.current_line <= state->m_vdp.window_fg_bottom ) {
- wswan_draw_foreground_2(machine);
+ if ( m_vdp.current_line >= m_vdp.window_fg_top && m_vdp.current_line <= m_vdp.window_fg_bottom ) {
+ wswan_draw_foreground_2();
}
break;
case 3: /* FG only outside window area */
- if ( state->m_vdp.current_line < state->m_vdp.window_fg_top || state->m_vdp.current_line > state->m_vdp.window_fg_bottom ) {
- wswan_draw_foreground_0(machine);
+ if ( m_vdp.current_line < m_vdp.window_fg_top || m_vdp.current_line > m_vdp.window_fg_bottom ) {
+ wswan_draw_foreground_0();
} else {
- wswan_draw_foreground_3(machine);
+ wswan_draw_foreground_3();
}
break;
}
@@ -565,8 +564,8 @@ void wswan_refresh_scanline( running_machine &machine )
/*
* Draw sprites in front of foreground layer
*/
- if ( state->m_vdp.sprites_enable ) {
- wswan_handle_sprites( machine, 0x2000 );
+ if ( m_vdp.sprites_enable ) {
+ wswan_handle_sprites(0x2000 );
}
}
diff --git a/src/mess/video/x68k.c b/src/mess/video/x68k.c
index 31e8eba2217..ce78f4c9252 100644
--- a/src/mess/video/x68k.c
+++ b/src/mess/video/x68k.c
@@ -38,7 +38,7 @@ inline void x68k_state::x68k_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT
bitmap.pix16(y, x) = (UINT16)color;
}
/*
-static bitmap_ind16* x68k_get_gfx_page(int pri,int type)
+bitmap_ind16* ::x68k_get_gfx_page(int pri,int type)
{
if(type == GFX16)
{