From e0c2dfd1b93c49607918a4569c950f58396393d0 Mon Sep 17 00:00:00 2001 From: Curt Coder Date: Fri, 28 Dec 2012 22:47:39 +0000 Subject: [PATCH] i8275: Modernized. [Curt Coder] --- src/emu/video/i8275.c | 570 +++++++++++++++-------------------- src/emu/video/i8275.h | 197 ++++++++---- src/mess/drivers/apogee.c | 4 +- src/mess/drivers/ipds.c | 22 +- src/mess/drivers/mikromik.c | 6 +- src/mess/drivers/mikrosha.c | 4 +- src/mess/drivers/partner.c | 4 +- src/mess/drivers/radio86.c | 14 +- src/mess/drivers/rt1715.c | 11 +- src/mess/drivers/sm1800.c | 24 +- src/mess/drivers/tim100.c | 19 +- src/mess/includes/mikromik.h | 1 - src/mess/includes/radio86.h | 7 - src/mess/machine/partner.c | 2 +- src/mess/machine/radio86.c | 10 +- src/mess/video/mikromik.c | 9 +- src/mess/video/radio86.c | 23 -- 17 files changed, 421 insertions(+), 506 deletions(-) diff --git a/src/emu/video/i8275.c b/src/emu/video/i8275.c index 1d98b765351..5df3167ab75 100644 --- a/src/emu/video/i8275.c +++ b/src/emu/video/i8275.c @@ -59,240 +59,160 @@ struct i8275_t { - devcb_resolved_write_line out_drq_func; - devcb_resolved_write_line out_irq_func; - - screen_device *screen; - - const i8275_interface *intf; - - UINT8 status_reg; /* value of status reggister */ - UINT8 num_of_params; /* expected number of parameters */ - UINT8 current_command; /* command currently executing */ - UINT8 param_type; /* parameter type */ - - UINT8 cursor_col; /* current cursor column */ - UINT8 cursor_row; /* current cursor row */ - - UINT8 light_pen_col; /* current light pen column */ - UINT8 light_pen_row; /* current light pen row */ - - /* reset command parameter values*/ - /* parameter 0 */ - UINT8 rows_type; - UINT8 chars_per_row; - /* parameter 1 */ - UINT8 vert_retrace_rows; - UINT8 rows_per_frame; - /* parameter 2 */ - UINT8 undeline_line_num; - UINT8 lines_per_row; - /* parameter 3 */ - UINT8 line_counter_mode; - UINT8 field_attribute_mode; - UINT8 cursor_format; - UINT8 hor_retrace_count; - - /* values for start display command */ - UINT8 burst_space_code; - UINT8 burst_count_code; - - /* buffers */ - UINT8 row_buffer_1[80]; - UINT8 row_buffer_2[80]; - UINT8 row_pos; - UINT8 buffer_used; - - UINT8 fifo_buffer_1[16]; - UINT8 fifo_buffer_2[16]; - UINT8 fifo_write; - - int ypos; - int current_row; - - UINT8 cursor_blink_cnt; - UINT8 char_blink_cnt; - - UINT8 next_in_fifo; - - UINT8 lineattr; - UINT8 rvv; - UINT8 gpa; - UINT8 hlgt; - UINT8 underline; - UINT8 blink; - - UINT8 last_data; }; -INLINE i8275_t *get_safe_token(device_t *device) -{ - assert(device != NULL); - assert(device->type() == I8275); - - return (i8275_t *)downcast(device)->token(); -} - - /* Register Access */ -static UINT8 i8275_get_parameter_light_pen(device_t *device, offs_t offset) +UINT8 i8275_device::get_parameter_light_pen(offs_t offset) { - i8275_t *i8275 = get_safe_token(device); UINT8 val = 0; switch(offset) { case 0 : - val = i8275->light_pen_col; + val = m_light_pen_col; break; case 1 : - val = i8275->light_pen_row; + val = m_light_pen_row; break; } return val; } -READ8_DEVICE_HANDLER( i8275_r ) +READ8_MEMBER( i8275_device::read ) { UINT8 val; - i8275_t *i8275 = get_safe_token(device); if (offset & 0x01) { /* Status register */ - val = i8275->status_reg; + val = m_status_reg; /* status reset after read */ - i8275->status_reg &= ~I8275_STATUS_FIFO_OVERRUN; - i8275->status_reg &= ~I8275_STATUS_DMA_UNDERRUN; - i8275->status_reg &= ~I8275_STATUS_IMPROPER_COMMAND; - i8275->status_reg &= ~I8275_STATUS_LIGHT_PEN; - i8275->status_reg &= ~I8275_STATUS_INTERRUPT_REQUEST; + m_status_reg &= ~I8275_STATUS_FIFO_OVERRUN; + m_status_reg &= ~I8275_STATUS_DMA_UNDERRUN; + m_status_reg &= ~I8275_STATUS_IMPROPER_COMMAND; + m_status_reg &= ~I8275_STATUS_LIGHT_PEN; + m_status_reg &= ~I8275_STATUS_INTERRUPT_REQUEST; } else { /* Parameter register */ val = 0x00; - if (i8275->param_type==I8275_PARAM_READ) { - if (i8275->num_of_params > 0) { - val = i8275_get_parameter_light_pen(device, 2 - i8275->num_of_params); - i8275->num_of_params--; + if (m_param_type==I8275_PARAM_READ) { + if (m_num_of_params > 0) { + val = get_parameter_light_pen(2 - m_num_of_params); + m_num_of_params--; } else { - i8275->status_reg |= I8275_STATUS_IMPROPER_COMMAND; + m_status_reg |= I8275_STATUS_IMPROPER_COMMAND; } } else { LOG(("i8275 : ERROR reading parameter\n")); - i8275->status_reg |= I8275_STATUS_IMPROPER_COMMAND; + m_status_reg |= I8275_STATUS_IMPROPER_COMMAND; } } return val; } -static void i8275_recompute_parameters(device_t *device) +void i8275_device::recompute_parameters() { - i8275_t *i8275 = get_safe_token(device); int horiz_pix_total = 0; int vert_pix_total = 0; rectangle visarea; - horiz_pix_total = (i8275->chars_per_row + 1) * i8275->intf->width; - vert_pix_total = (i8275->lines_per_row + 1) * (i8275->rows_per_frame + 1); - if (i8275->rows_type==1) { + horiz_pix_total = (m_chars_per_row + 1) * m_width; + vert_pix_total = (m_lines_per_row + 1) * (m_rows_per_frame + 1); + if (m_rows_type==1) { vert_pix_total *= 2; // Use of spaced rows } visarea.set(0, horiz_pix_total - 1, 0, vert_pix_total - 1); - i8275->screen->configure(horiz_pix_total, vert_pix_total, visarea, - i8275->screen->frame_period().attoseconds); + m_screen->configure(horiz_pix_total, vert_pix_total, visarea, + m_screen->frame_period().attoseconds); } -static void i8275_set_parameter_reset(device_t *device, offs_t offset, UINT8 data) +void i8275_device::set_parameter_reset(offs_t offset, UINT8 data) { - i8275_t *i8275 = get_safe_token(device); switch(offset) { case 0 : - i8275->rows_type = (data >> 7) & 1; - i8275->chars_per_row = data & 0x7f; + m_rows_type = (data >> 7) & 1; + m_chars_per_row = data & 0x7f; break; case 1 : - i8275->vert_retrace_rows = (data >> 6) & 3; - i8275->rows_per_frame = data & 0x3f; + m_vert_retrace_rows = (data >> 6) & 3; + m_rows_per_frame = data & 0x3f; break; case 2 : - i8275->undeline_line_num = (data >> 4) & 0x0f; - i8275->lines_per_row = data & 0x0f; + m_undeline_line_num = (data >> 4) & 0x0f; + m_lines_per_row = data & 0x0f; break; case 3 : - i8275->line_counter_mode = (data >> 7) & 1; - i8275->field_attribute_mode = (data >> 6) & 1; - i8275->cursor_format = (data >> 4) & 3; - i8275->hor_retrace_count = data & 0x0f; + m_line_counter_mode = (data >> 7) & 1; + m_field_attribute_mode = (data >> 6) & 1; + m_cursor_format = (data >> 4) & 3; + m_hor_retrace_count = data & 0x0f; break; } } -static void i8275_set_parameter_cursor(device_t *device, offs_t offset, UINT8 data) +void i8275_device::set_parameter_cursor(offs_t offset, UINT8 data) { - i8275_t *i8275 = get_safe_token(device); switch(offset) { case 0 : - i8275->cursor_col = data; + m_cursor_col = data; break; case 1 : - i8275->cursor_row = data; + m_cursor_row = data; break; } } -WRITE8_DEVICE_HANDLER( i8275_w ) +WRITE8_MEMBER( i8275_device::write ) { - i8275_t *i8275 = get_safe_token(device); - if (offset & 0x01) { /* Command register */ - if (i8275->num_of_params != 0) { - i8275->status_reg |= I8275_STATUS_IMPROPER_COMMAND; + if (m_num_of_params != 0) { + m_status_reg |= I8275_STATUS_IMPROPER_COMMAND; return; } - i8275->current_command = (data >> 5) & 7; - i8275->num_of_params = I8275_PARAM_NONE; - i8275->param_type = I8275_PARAM_NONE; - switch(i8275->current_command) { + m_current_command = (data >> 5) & 7; + m_num_of_params = I8275_PARAM_NONE; + m_param_type = I8275_PARAM_NONE; + switch(m_current_command) { case I8275_COMMAND_RESET : - i8275->num_of_params = I8275_PARAM_RESET; - i8275->param_type = I8275_PARAM_WRITE; + m_num_of_params = I8275_PARAM_RESET; + m_param_type = I8275_PARAM_WRITE; /* set status register */ - i8275->status_reg &= ~I8275_STATUS_INTERRUPT_ENABLE; - i8275->status_reg &= ~I8275_STATUS_VIDEO_ENABLE; + m_status_reg &= ~I8275_STATUS_INTERRUPT_ENABLE; + m_status_reg &= ~I8275_STATUS_VIDEO_ENABLE; break; case I8275_COMMAND_START_DISPLAY: - i8275->burst_space_code = (data >> 2) & 7; - i8275->burst_count_code = data & 3; + m_burst_space_code = (data >> 2) & 7; + m_burst_count_code = data & 3; /* set status register */ - i8275->status_reg |= I8275_STATUS_VIDEO_ENABLE; - i8275->status_reg |= I8275_STATUS_INTERRUPT_ENABLE; - i8275_recompute_parameters(device); + m_status_reg |= I8275_STATUS_VIDEO_ENABLE; + m_status_reg |= I8275_STATUS_INTERRUPT_ENABLE; + recompute_parameters(); break; case I8275_COMMAND_STOP_DISPLAY : /* set status register */ - i8275->status_reg &= ~I8275_STATUS_VIDEO_ENABLE; + m_status_reg &= ~I8275_STATUS_VIDEO_ENABLE; break; case I8275_COMMAND_READ_LIGHT_PEN: - i8275->num_of_params = I8275_PARAM_READ_LIGHT_PEN; - i8275->param_type = I8275_PARAM_READ; + m_num_of_params = I8275_PARAM_READ_LIGHT_PEN; + m_param_type = I8275_PARAM_READ; break; case I8275_COMMAND_LOAD_CURSOR : - i8275->num_of_params = I8275_PARAM_LOAD_CURSOR; - i8275->param_type = I8275_PARAM_WRITE; + m_num_of_params = I8275_PARAM_LOAD_CURSOR; + m_param_type = I8275_PARAM_WRITE; break; case I8275_COMMAND_ENABLE_INTERRUPT : /* set status register */ - i8275->status_reg |= I8275_STATUS_INTERRUPT_ENABLE; + m_status_reg |= I8275_STATUS_INTERRUPT_ENABLE; break; case I8275_COMMAND_DISABLE_INTERRUPT: /* set status register */ - i8275->status_reg &= ~I8275_STATUS_INTERRUPT_ENABLE; + m_status_reg &= ~I8275_STATUS_INTERRUPT_ENABLE; break; case I8275_COMMAND_PRESET_COUNTERS : break; @@ -301,28 +221,27 @@ WRITE8_DEVICE_HANDLER( i8275_w ) else { /* Parameter register */ - if (i8275->param_type==I8275_PARAM_WRITE) { - if (i8275->num_of_params > 0) { - if (i8275->current_command == I8275_COMMAND_RESET) { - i8275_set_parameter_reset(device, 4 - i8275->num_of_params ,data); + if (m_param_type==I8275_PARAM_WRITE) { + if (m_num_of_params > 0) { + if (m_current_command == I8275_COMMAND_RESET) { + set_parameter_reset(4 - m_num_of_params ,data); } else { - i8275_set_parameter_cursor(device, 2 - i8275->num_of_params, data); + set_parameter_cursor(2 - m_num_of_params, data); } - i8275->num_of_params--; + m_num_of_params--; } else { - i8275->status_reg |= I8275_STATUS_IMPROPER_COMMAND; + m_status_reg |= I8275_STATUS_IMPROPER_COMMAND; } } else { LOG(("i8275 : ERROR writing parameter\n")); - i8275->status_reg |= I8275_STATUS_IMPROPER_COMMAND; + m_status_reg |= I8275_STATUS_IMPROPER_COMMAND; } } } -static void i8275_draw_char_line(device_t *device) +void i8275_device::draw_char_line() { - i8275_t *i8275 = get_safe_token(device); int xpos = 0; int line = 0; UINT8 lc = 0; @@ -330,46 +249,46 @@ static void i8275_draw_char_line(device_t *device) UINT8 lten = 0; UINT8 fifo_read = 0; - for(line=0;line<=i8275->lines_per_row;line++) { + for(line=0;line<=m_lines_per_row;line++) { // If line counter is 1 then select right values - lc = (i8275->line_counter_mode==1) ? (line - 1) % i8275->lines_per_row : line; + lc = (m_line_counter_mode==1) ? (line - 1) % m_lines_per_row : line; fifo_read = 0; - for(xpos=0;xpos<=i8275->chars_per_row;xpos++) { - UINT8 chr = (i8275->buffer_used==0) ? i8275->row_buffer_2[xpos] : i8275->row_buffer_1[xpos]; - if (i8275->undeline_line_num & 0x08) { - vsp = (line==0 || line==i8275->lines_per_row) ? 1 : 0; + for(xpos=0;xpos<=m_chars_per_row;xpos++) { + UINT8 chr = (m_buffer_used==0) ? m_row_buffer_2[xpos] : m_row_buffer_1[xpos]; + if (m_undeline_line_num & 0x08) { + vsp = (line==0 || line==m_lines_per_row) ? 1 : 0; } if ((chr & 0x80)==0x80) { if ((chr & 0xc0)==0xc0) { // character attribute code - i8275->lineattr = 0; + m_lineattr = 0; } else { // field attribute code - i8275->hlgt = chr & 1; - i8275->blink = (chr >> 1) & 1; - i8275->gpa = (chr >> 2) & 3; - i8275->rvv = (chr >> 4) & 1; - i8275->underline = (chr >> 5) & 1; + m_hlgt = chr & 1; + m_blink = (chr >> 1) & 1; + m_gpa = (chr >> 2) & 3; + m_rvv = (chr >> 4) & 1; + m_underline = (chr >> 5) & 1; } - if (i8275->field_attribute_mode==0) { - chr = (i8275->buffer_used==0) ? i8275->fifo_buffer_2[fifo_read] : i8275->fifo_buffer_1[fifo_read]; + if (m_field_attribute_mode==0) { + chr = (m_buffer_used==0) ? m_fifo_buffer_2[fifo_read] : m_fifo_buffer_1[fifo_read]; fifo_read = (fifo_read + 1 ) % 16; } else { vsp = 1; } } - if (vsp==0 && i8275->blink) { - vsp = (i8275->char_blink_cnt < 32) ? 1: 0; + if (vsp==0 && m_blink) { + vsp = (m_char_blink_cnt < 32) ? 1: 0; } - if ((i8275->current_row == i8275->cursor_row) && (xpos == i8275->cursor_col - i8275->intf->char_delay)) { + if ((m_current_row == m_cursor_row) && (xpos == m_cursor_col - m_char_delay)) { int vis = 1; - if ((i8275->cursor_format & 2)==0) { - vis = (i8275->cursor_blink_cnt<16) ? 1 : 0; + if ((m_cursor_format & 2)==0) { + vis = (m_cursor_blink_cnt<16) ? 1 : 0; } - if ((i8275->cursor_format & 1)==1) { - lten = (line == i8275->undeline_line_num) ? vis : 0; //underline + if ((m_cursor_format & 1)==1) { + lten = (line == m_undeline_line_num) ? vis : 0; //underline } else { lten = vis; // block cursor } @@ -377,223 +296,125 @@ static void i8275_draw_char_line(device_t *device) lten = 0; } - i8275->intf->display_pixels(device, - xpos * i8275->intf->width, // x position on screen of starting point - i8275->ypos, // y position on screen + m_display_pixels_func(this, m_bitmap, + xpos * m_width, // x position on screen of starting point + m_ypos, // y position on screen lc, // current line of char (chr & 0x7f), // char code to be displayed - i8275->lineattr, // line attribute code - lten | i8275->underline, // light enable signal - i8275->rvv, // reverse video signal + m_lineattr, // line attribute code + lten | m_underline, // light enable signal + m_rvv, // reverse video signal vsp, // video suppression - i8275->gpa, // general purpose attribute code - i8275->hlgt // highlight + m_gpa, // general purpose attribute code + m_hlgt // highlight ); vsp = 0; } - i8275->ypos++; + m_ypos++; } - i8275->current_row++; + m_current_row++; } -WRITE8_DEVICE_HANDLER( i8275_dack_w ) +WRITE8_MEMBER( i8275_device::dack_w ) { - i8275_t *i8275 = get_safe_token(device); - - if (i8275->next_in_fifo == 1) + if (m_next_in_fifo == 1) { - i8275->next_in_fifo = 0; + m_next_in_fifo = 0; - if(i8275->buffer_used == 0) + if(m_buffer_used == 0) { - i8275->fifo_buffer_1[i8275->fifo_write] = data & 0x7f; + m_fifo_buffer_1[m_fifo_write] = data & 0x7f; } else { - i8275->fifo_buffer_2[i8275->fifo_write] = data & 0x7f; + m_fifo_buffer_2[m_fifo_write] = data & 0x7f; } - i8275->fifo_write = (i8275->fifo_write + 1) % 16; + m_fifo_write = (m_fifo_write + 1) % 16; - if (i8275->last_data == 0xf1) { - i8275->row_pos = i8275->chars_per_row + 1; + if (m_last_data == 0xf1) { + m_row_pos = m_chars_per_row + 1; } } else { - if(i8275->buffer_used == 0) + if(m_buffer_used == 0) { - i8275->row_buffer_1[i8275->row_pos++] = data; + m_row_buffer_1[m_row_pos++] = data; } else { - i8275->row_buffer_2[i8275->row_pos++] = data; + m_row_buffer_2[m_row_pos++] = data; } - if (i8275->field_attribute_mode==0) + if (m_field_attribute_mode==0) { if ((data & 0x80)==0x80) { - i8275->last_data = data; - i8275->next_in_fifo = 1; + m_last_data = data; + m_next_in_fifo = 1; } } } - if ((i8275->row_pos - 1)==i8275->chars_per_row ) + if ((m_row_pos - 1)==m_chars_per_row ) { - i8275->buffer_used = (i8275->buffer_used==0) ? 1 : 0; - i8275->row_pos = 0; - i8275->fifo_write = 0; - i8275_draw_char_line(device); + m_buffer_used = (m_buffer_used==0) ? 1 : 0; + m_row_pos = 0; + m_fifo_write = 0; + draw_char_line(); } - if (i8275->current_row == (i8275->rows_per_frame + 1)) + if (m_current_row == (m_rows_per_frame + 1)) { - i8275->ypos = 0; - i8275->current_row = 0; + m_ypos = 0; + m_current_row = 0; - i8275->out_drq_func(0); + m_out_drq_func(0); } } /* Screen Update */ -void i8275_update(device_t *device, bitmap_rgb32 &bitmap, const rectangle &cliprect) +UINT32 i8275_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - i8275_t *i8275 = get_safe_token(device); - i8275->ypos = 0; - i8275->lineattr = 0; - i8275->rvv = 0; - i8275->gpa = 0; - i8275->hlgt = 0; - i8275->underline = 0; - i8275->blink = 0; - i8275->row_pos = 0; - i8275->fifo_write = 0; + m_ypos = 0; + m_lineattr = 0; + m_rvv = 0; + m_gpa = 0; + m_hlgt = 0; + m_underline = 0; + m_blink = 0; + m_row_pos = 0; + m_fifo_write = 0; - if ((i8275->status_reg & I8275_STATUS_VIDEO_ENABLE)==0) { - bitmap.fill(get_black_pen(device->machine()), cliprect); + if ((m_status_reg & I8275_STATUS_VIDEO_ENABLE)==0) { + bitmap.fill(get_black_pen(machine()), cliprect); } else { // if value < 16 it is visible otherwise not - i8275->cursor_blink_cnt++; - if(i8275->cursor_blink_cnt==32) i8275->cursor_blink_cnt = 0; + m_cursor_blink_cnt++; + if(m_cursor_blink_cnt==32) m_cursor_blink_cnt = 0; // if value < 32 it is visible otherwise not - i8275->char_blink_cnt++; - if(i8275->char_blink_cnt==64) i8275->char_blink_cnt = 0; + m_char_blink_cnt++; + if(m_char_blink_cnt==64) m_char_blink_cnt = 0; - i8275->out_drq_func(1); + m_out_drq_func(1); } - if (i8275->status_reg & I8275_STATUS_INTERRUPT_ENABLE) { - i8275->status_reg |= I8275_STATUS_INTERRUPT_REQUEST; + if (m_status_reg & I8275_STATUS_INTERRUPT_ENABLE) { + m_status_reg |= I8275_STATUS_INTERRUPT_REQUEST; } + + copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); + + return 0; } /* Device Interface */ -static DEVICE_START( i8275 ) -{ - i8275_t *i8275 = get_safe_token(device); - - /* validate arguments */ - assert(device != NULL); - assert(device->tag() != NULL); - assert(device->static_config() != NULL); - - i8275->intf = (const i8275_interface*)device->static_config(); - - assert(i8275->intf->display_pixels != NULL); - - /* get the screen device */ - i8275->screen = device->machine().device(i8275->intf->screen_tag); - - - assert(i8275->screen != NULL); - - /* resolve callbacks */ - i8275->out_drq_func.resolve(i8275->intf->out_drq_func, *device); - i8275->out_irq_func.resolve(i8275->intf->out_irq_func, *device); - - /* register for state saving */ - device->save_item(NAME(i8275->status_reg)); - device->save_item(NAME(i8275->num_of_params)); - device->save_item(NAME(i8275->current_command)); - device->save_item(NAME(i8275->param_type)); - - device->save_item(NAME(i8275->cursor_col)); - device->save_item(NAME(i8275->cursor_row)); - - device->save_item(NAME(i8275->light_pen_col)); - device->save_item(NAME(i8275->light_pen_row)); - - device->save_item(NAME(i8275->rows_type)); - device->save_item(NAME(i8275->chars_per_row)); - device->save_item(NAME(i8275->vert_retrace_rows)); - device->save_item(NAME(i8275->rows_per_frame)); - device->save_item(NAME(i8275->undeline_line_num)); - device->save_item(NAME(i8275->lines_per_row)); - device->save_item(NAME(i8275->line_counter_mode)); - device->save_item(NAME(i8275->field_attribute_mode)); - device->save_item(NAME(i8275->cursor_format)); - device->save_item(NAME(i8275->hor_retrace_count)); - - device->save_item(NAME(i8275->burst_space_code)); - device->save_item(NAME(i8275->burst_count_code)); -} - -static DEVICE_RESET( i8275 ) -{ - i8275_t *i8275 = get_safe_token(device); - - i8275->status_reg = 0; - i8275->num_of_params = 0; - i8275->current_command = 0; - i8275->param_type = 0; - - i8275->cursor_col = 0; - i8275->cursor_row = 0; - - i8275->light_pen_col = 0; - i8275->light_pen_row = 0; - - i8275->rows_type = 0; - i8275->chars_per_row = 0; - i8275->vert_retrace_rows = 0; - i8275->rows_per_frame = 0; - i8275->undeline_line_num = 0; - i8275->lines_per_row = 0; - i8275->line_counter_mode = 0; - i8275->field_attribute_mode = 0; - i8275->cursor_format = 0; - i8275->hor_retrace_count = 0; - - i8275->burst_space_code = 0; - i8275->burst_count_code = 0; - - i8275->row_pos = 0; - i8275->buffer_used = 0; - - i8275->fifo_write = 0; - - i8275->ypos = 0; - i8275->current_row = 0; - - i8275->cursor_blink_cnt = 0; - i8275->char_blink_cnt = 0; - i8275->next_in_fifo = 0; - - i8275->lineattr = 0; - i8275->rvv = 0; - i8275->gpa = 0; - i8275->hlgt = 0; - i8275->underline = 0; - i8275->blink = 0; -} - const device_type I8275 = &device_creator; i8275_device::i8275_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, I8275, "Intel 8275", tag, owner, clock) { - m_token = global_alloc_clear(i8275_t); } + //------------------------------------------------- // device_config_complete - perform any // operations now that the configuration is @@ -602,15 +423,64 @@ i8275_device::i8275_device(const machine_config &mconfig, const char *tag, devic void i8275_device::device_config_complete() { + // inherit a copy of the static data + const i8275_interface *intf = reinterpret_cast(static_config()); + if (intf != NULL) + *static_cast(this) = *intf; + + // or initialize to defaults if none provided + else + { + memset(&m_out_drq_cb, 0, sizeof(m_out_drq_cb)); + memset(&m_out_irq_cb, 0, sizeof(m_out_irq_cb)); + memset(&m_out_hrtc_cb, 0, sizeof(m_out_hrtc_cb)); + memset(&m_out_vrtc_cb, 0, sizeof(m_out_vrtc_cb)); + } } + //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- void i8275_device::device_start() { - DEVICE_START_NAME( i8275 )(this); + /* get the screen device */ + m_screen = machine().device(m_screen_tag); + assert(m_screen != NULL); + m_screen->register_screen_bitmap(m_bitmap); + + /* resolve callbacks */ + m_out_drq_func.resolve(m_out_drq_cb, *this); + m_out_irq_func.resolve(m_out_irq_cb, *this); + m_out_hrtc_func.resolve(m_out_hrtc_cb, *this); + m_out_vrtc_func.resolve(m_out_vrtc_cb, *this); + + /* register for state saving */ + save_item(NAME(m_status_reg)); + save_item(NAME(m_num_of_params)); + save_item(NAME(m_current_command)); + save_item(NAME(m_param_type)); + + save_item(NAME(m_cursor_col)); + save_item(NAME(m_cursor_row)); + + save_item(NAME(m_light_pen_col)); + save_item(NAME(m_light_pen_row)); + + save_item(NAME(m_rows_type)); + save_item(NAME(m_chars_per_row)); + save_item(NAME(m_vert_retrace_rows)); + save_item(NAME(m_rows_per_frame)); + save_item(NAME(m_undeline_line_num)); + save_item(NAME(m_lines_per_row)); + save_item(NAME(m_line_counter_mode)); + save_item(NAME(m_field_attribute_mode)); + save_item(NAME(m_cursor_format)); + save_item(NAME(m_hor_retrace_count)); + + save_item(NAME(m_burst_space_code)); + save_item(NAME(m_burst_count_code)); } //------------------------------------------------- @@ -619,7 +489,47 @@ void i8275_device::device_start() void i8275_device::device_reset() { - DEVICE_RESET_NAME( i8275 )(this); + m_status_reg = 0; + m_num_of_params = 0; + m_current_command = 0; + m_param_type = 0; + + m_cursor_col = 0; + m_cursor_row = 0; + + m_light_pen_col = 0; + m_light_pen_row = 0; + + m_rows_type = 0; + m_chars_per_row = 0; + m_vert_retrace_rows = 0; + m_rows_per_frame = 0; + m_undeline_line_num = 0; + m_lines_per_row = 0; + m_line_counter_mode = 0; + m_field_attribute_mode = 0; + m_cursor_format = 0; + m_hor_retrace_count = 0; + + m_burst_space_code = 0; + m_burst_count_code = 0; + + m_row_pos = 0; + m_buffer_used = 0; + + m_fifo_write = 0; + + m_ypos = 0; + m_current_row = 0; + + m_cursor_blink_cnt = 0; + m_char_blink_cnt = 0; + m_next_in_fifo = 0; + + m_lineattr = 0; + m_rvv = 0; + m_gpa = 0; + m_hlgt = 0; + m_underline = 0; + m_blink = 0; } - - diff --git a/src/emu/video/i8275.h b/src/emu/video/i8275.h index 8e8bbf35a28..846e63b67a0 100644 --- a/src/emu/video/i8275.h +++ b/src/emu/video/i8275.h @@ -12,73 +12,148 @@ #ifndef __I8275_VIDEO__ #define __I8275_VIDEO__ -#include "devcb.h" - -/*************************************************************************** - MACROS -***************************************************************************/ - -class i8275_device : public device_t -{ -public: - i8275_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - ~i8275_device() { global_free(m_token); } - - // access to legacy token - void *token() const { assert(m_token != NULL); return m_token; } -protected: - // device-level overrides - virtual void device_config_complete(); - virtual void device_start(); - virtual void device_reset(); -private: - // internal state - void *m_token; -}; - -extern const device_type I8275; +#include "emu.h" -/*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ -typedef void (*i8275_display_pixels_func)(device_t *device, int x, int y, UINT8 linecount, UINT8 charcode, UINT8 lineattr, UINT8 lten, UINT8 rvv, UINT8 vsp, UINT8 gpa, UINT8 hlgt); -#define I8275_DISPLAY_PIXELS(name) void name(device_t *device, int x, int y, UINT8 linecount, UINT8 charcode, UINT8 lineattr, UINT8 lten, UINT8 rvv, UINT8 vsp, UINT8 gpa, UINT8 hlgt) - -/* interface */ -struct i8275_interface -{ - const char *screen_tag; /* screen we are acting on */ - int width; /* char width in pixels */ - int char_delay; /* delay of display char */ - - devcb_write_line out_drq_func; - - devcb_write_line out_irq_func; - - i8275_display_pixels_func display_pixels; -}; - -/*************************************************************************** - FUNCTION PROTOTYPES -***************************************************************************/ - -/* register access */ -DECLARE_READ8_DEVICE_HANDLER ( i8275_r ); -DECLARE_WRITE8_DEVICE_HANDLER ( i8275_w ); - -/* updates the screen */ -void i8275_update(device_t *device, bitmap_rgb32 &bitmap, const rectangle &cliprect); - -DECLARE_WRITE8_DEVICE_HANDLER( i8275_dack_w ); - -/*************************************************************************** - DEVICE CONFIGURATION MACROS -***************************************************************************/ +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** #define MCFG_I8275_ADD(_tag, _intrf) \ MCFG_DEVICE_ADD(_tag, I8275, 0) \ MCFG_DEVICE_CONFIG(_intrf) + +#define I8275_INTERFACE(name) \ + const i8275_interface (name) = + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class i8275_device; + +// ======================> i8275_display_pixels_func + +typedef void (*i8275_display_pixels_func)(i8275_device *device, bitmap_rgb32 &bitmap, int x, int y, UINT8 linecount, UINT8 charcode, UINT8 lineattr, UINT8 lten, UINT8 rvv, UINT8 vsp, UINT8 gpa, UINT8 hlgt); +#define I8275_DISPLAY_PIXELS(name) void name(i8275_device *device, bitmap_rgb32 &bitmap, int x, int y, UINT8 linecount, UINT8 charcode, UINT8 lineattr, UINT8 lten, UINT8 rvv, UINT8 vsp, UINT8 gpa, UINT8 hlgt) + + +// ======================> i8275_interface + +struct i8275_interface +{ + const char *m_screen_tag; /* screen we are acting on */ + int m_width; /* char width in pixels */ + int m_char_delay; /* delay of display char */ + + devcb_write_line m_out_drq_cb; + devcb_write_line m_out_irq_cb; + + devcb_write_line m_out_hrtc_cb; + devcb_write_line m_out_vrtc_cb; + + i8275_display_pixels_func m_display_pixels_func; +}; + + +class i8275_device : public device_t, + public i8275_interface +{ +public: + i8275_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + + DECLARE_WRITE8_MEMBER( dack_w ); + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + UINT8 get_parameter_light_pen(offs_t offset); + void recompute_parameters(); + void set_parameter_reset(offs_t offset, UINT8 data); + void set_parameter_cursor(offs_t offset, UINT8 data); + void draw_char_line(); + + devcb_resolved_write_line m_out_drq_func; + devcb_resolved_write_line m_out_irq_func; + devcb_resolved_write_line m_out_hrtc_func; + devcb_resolved_write_line m_out_vrtc_func; + + screen_device *m_screen; + bitmap_rgb32 m_bitmap; + + UINT8 m_status_reg; /* value of status reggister */ + UINT8 m_num_of_params; /* expected number of parameters */ + UINT8 m_current_command; /* command currently executing */ + UINT8 m_param_type; /* parameter type */ + + UINT8 m_cursor_col; /* current cursor column */ + UINT8 m_cursor_row; /* current cursor row */ + + UINT8 m_light_pen_col; /* current light pen column */ + UINT8 m_light_pen_row; /* current light pen row */ + + /* reset command parameter values*/ + /* parameter 0 */ + UINT8 m_rows_type; + UINT8 m_chars_per_row; + /* parameter 1 */ + UINT8 m_vert_retrace_rows; + UINT8 m_rows_per_frame; + /* parameter 2 */ + UINT8 m_undeline_line_num; + UINT8 m_lines_per_row; + /* parameter 3 */ + UINT8 m_line_counter_mode; + UINT8 m_field_attribute_mode; + UINT8 m_cursor_format; + UINT8 m_hor_retrace_count; + + /* values for start display command */ + UINT8 m_burst_space_code; + UINT8 m_burst_count_code; + + /* buffers */ + UINT8 m_row_buffer_1[80]; + UINT8 m_row_buffer_2[80]; + UINT8 m_row_pos; + UINT8 m_buffer_used; + + UINT8 m_fifo_buffer_1[16]; + UINT8 m_fifo_buffer_2[16]; + UINT8 m_fifo_write; + + int m_ypos; + int m_current_row; + + UINT8 m_cursor_blink_cnt; + UINT8 m_char_blink_cnt; + + UINT8 m_next_in_fifo; + + UINT8 m_lineattr; + UINT8 m_rvv; + UINT8 m_gpa; + UINT8 m_hlgt; + UINT8 m_underline; + UINT8 m_blink; + + UINT8 m_last_data; +}; + +// device type definition +extern const device_type I8275; + + #endif diff --git a/src/mess/drivers/apogee.c b/src/mess/drivers/apogee.c index 17fe0d78a6f..c470a7e04cb 100644 --- a/src/mess/drivers/apogee.c +++ b/src/mess/drivers/apogee.c @@ -33,7 +33,7 @@ static ADDRESS_MAP_START(apogee_mem, AS_PROGRAM, 8, apogee_state ) //AM_RANGE( 0xec00, 0xecff ) AM_RAM // Timer AM_RANGE( 0xed00, 0xed03 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_MIRROR(0x00fc) //AM_RANGE( 0xee00, 0xee03 ) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write) AM_MIRROR(0x00fc) - AM_RANGE( 0xef00, 0xef01 ) AM_DEVREADWRITE_LEGACY("i8275", i8275_r, i8275_w) AM_MIRROR(0x00fe) // video + AM_RANGE( 0xef00, 0xef01 ) AM_DEVREADWRITE("i8275", i8275_device, read, write) AM_MIRROR(0x00fe) // video AM_RANGE( 0xf000, 0xf0ff ) AM_DEVWRITE_LEGACY("dma8257", i8257_w) // DMA AM_RANGE( 0xf000, 0xffff ) AM_ROM // System ROM ADDRESS_MAP_END @@ -174,11 +174,11 @@ static MACHINE_CONFIG_START( apogee, apogee_state ) MCFG_I8275_ADD ( "i8275", apogee_i8275_interface) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_UPDATE_DEVICE("i8275", i8275_device, screen_update) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ MCFG_SCREEN_SIZE(78*6, 30*10) MCFG_SCREEN_VISIBLE_AREA(0, 78*6-1, 0, 30*10-1) - MCFG_SCREEN_UPDATE_DRIVER(radio86_state, screen_update_radio86) MCFG_GFXDECODE(apogee) MCFG_PALETTE_LENGTH(3) diff --git a/src/mess/drivers/ipds.c b/src/mess/drivers/ipds.c index 6acaca58f10..a94ad9977c4 100644 --- a/src/mess/drivers/ipds.c +++ b/src/mess/drivers/ipds.c @@ -29,10 +29,7 @@ public: DECLARE_WRITE8_MEMBER(ipds_b1_w); DECLARE_WRITE8_MEMBER(kbd_put); UINT8 m_term_data; - bitmap_rgb32 m_bitmap; - virtual void video_start(); virtual void machine_reset(); - UINT32 screen_update_ipds(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); }; READ8_MEMBER( ipds_state::ipds_b0_r ) @@ -78,17 +75,10 @@ void ipds_state::machine_reset() { } - -void ipds_state::video_start() -{ - machine().primary_screen->register_screen_bitmap(m_bitmap); -} - static I8275_DISPLAY_PIXELS(ipds_display_pixels) { int i; ipds_state *state = device->machine().driver_data(); - bitmap_rgb32 &bitmap = state->m_bitmap; const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); UINT8 *charmap = state->memregion("chargen")->base(); UINT8 pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff; @@ -113,17 +103,11 @@ const i8275_interface ipds_i8275_interface = 0, DEVCB_NULL, DEVCB_NULL, + DEVCB_NULL, + DEVCB_NULL, ipds_display_pixels }; -UINT32 ipds_state::screen_update_ipds(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - device_t *devconf = machine().device("i8275"); - i8275_update( devconf, bitmap, cliprect); - copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); - return 0; -} - /* F4 Character Displayer */ static const gfx_layout ipds_charlayout = { @@ -162,11 +146,11 @@ static MACHINE_CONFIG_START( ipds, ipds_state ) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_UPDATE_DEVICE("i8275", i8275_device, screen_update) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ MCFG_SCREEN_SIZE(640, 480) MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(ipds_state, screen_update_ipds) MCFG_GFXDECODE(ipds) MCFG_PALETTE_LENGTH(2) MCFG_PALETTE_INIT(monochrome_green) diff --git a/src/mess/drivers/mikromik.c b/src/mess/drivers/mikromik.c index 2f50a28d679..0797334051a 100644 --- a/src/mess/drivers/mikromik.c +++ b/src/mess/drivers/mikromik.c @@ -97,7 +97,7 @@ READ8_MEMBER( mm1_state::read ) break; case 2: - data = i8275_r(m_crtc, space, offset & 0x01); + data = m_crtc->read(space, offset & 0x01); break; case 3: @@ -166,7 +166,7 @@ WRITE8_MEMBER( mm1_state::write ) break; case 2: - i8275_w(m_crtc, space, offset & 0x01, data); + m_crtc->write(space, offset & 0x01, data); break; case 3: @@ -540,7 +540,7 @@ static I8237_INTERFACE( dmac_intf ) DEVCB_DRIVER_MEMBER(mm1_state, read), DEVCB_DRIVER_MEMBER(mm1_state, write), { DEVCB_NULL, DEVCB_NULL, DEVCB_DRIVER_MEMBER(mm1_state, mpsc_dack_r), DEVCB_DEVICE_MEMBER(UPD765_TAG, upd765_family_device, mdma_r) }, - { DEVCB_DEVICE_HANDLER(I8275_TAG, i8275_dack_w), DEVCB_DRIVER_MEMBER(mm1_state, mpsc_dack_w), DEVCB_NULL, DEVCB_DEVICE_MEMBER(UPD765_TAG, upd765_family_device, mdma_w) }, + { DEVCB_DEVICE_MEMBER(I8275_TAG, i8275_device, dack_w), DEVCB_DRIVER_MEMBER(mm1_state, mpsc_dack_w), DEVCB_NULL, DEVCB_DEVICE_MEMBER(UPD765_TAG, upd765_family_device, mdma_w) }, { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_DRIVER_LINE_MEMBER(mm1_state, dack3_w) } }; diff --git a/src/mess/drivers/mikrosha.c b/src/mess/drivers/mikrosha.c index 99c20c731c3..4db510981d3 100644 --- a/src/mess/drivers/mikrosha.c +++ b/src/mess/drivers/mikrosha.c @@ -35,7 +35,7 @@ static ADDRESS_MAP_START(mikrosha_mem, AS_PROGRAM, 8, mikrosha_state ) AM_RANGE( 0x8000, 0xbfff ) AM_READ(radio_cpu_state_r) // Not connected AM_RANGE( 0xc000, 0xc003 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_MIRROR(0x07fc) AM_RANGE( 0xc800, 0xc803 ) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write) AM_MIRROR(0x07fc) - AM_RANGE( 0xd000, 0xd001 ) AM_DEVREADWRITE_LEGACY("i8275", i8275_r, i8275_w) AM_MIRROR(0x07fe) // video + AM_RANGE( 0xd000, 0xd001 ) AM_DEVREADWRITE("i8275", i8275_device, read, write) AM_MIRROR(0x07fe) // video AM_RANGE( 0xd800, 0xd803 ) AM_DEVREADWRITE_LEGACY("pit8253", pit8253_r,pit8253_w) AM_MIRROR(0x07fc) // Timer AM_RANGE( 0xe000, 0xf7ff ) AM_READ(radio_cpu_state_r) // Not connected AM_RANGE( 0xf800, 0xffff ) AM_DEVWRITE_LEGACY("dma8257", i8257_w) // DMA @@ -213,11 +213,11 @@ static MACHINE_CONFIG_START( mikrosha, mikrosha_state ) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_UPDATE_DEVICE("i8275", i8275_device, screen_update) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ MCFG_SCREEN_SIZE(78*6, 30*10) MCFG_SCREEN_VISIBLE_AREA(0, 78*6-1, 0, 30*10-1) - MCFG_SCREEN_UPDATE_DRIVER(radio86_state, screen_update_radio86) MCFG_GFXDECODE(mikrosha) MCFG_PALETTE_LENGTH(3) diff --git a/src/mess/drivers/partner.c b/src/mess/drivers/partner.c index e82e5109af9..8bd3ea0b41f 100644 --- a/src/mess/drivers/partner.c +++ b/src/mess/drivers/partner.c @@ -34,7 +34,7 @@ static ADDRESS_MAP_START(partner_mem, AS_PROGRAM, 8, partner_state ) AM_RANGE( 0xc000, 0xc7ff ) AM_RAMBANK("bank8") AM_RANGE( 0xc800, 0xcfff ) AM_RAMBANK("bank9") AM_RANGE( 0xd000, 0xd7ff ) AM_RAMBANK("bank10") - AM_RANGE( 0xd800, 0xd8ff ) AM_DEVREADWRITE_LEGACY("i8275", i8275_r, i8275_w) // video + AM_RANGE( 0xd800, 0xd8ff ) AM_DEVREADWRITE("i8275", i8275_device, read, write) // video AM_RANGE( 0xd900, 0xd9ff ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_RANGE( 0xda00, 0xdaff ) AM_WRITE(partner_mem_page_w) AM_RANGE( 0xdb00, 0xdbff ) AM_DEVWRITE_LEGACY("dma8257", i8257_w) // DMA @@ -201,11 +201,11 @@ static MACHINE_CONFIG_START( partner, partner_state ) MCFG_I8275_ADD ( "i8275", partner_i8275_interface) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_UPDATE_DEVICE("i8275", i8275_device, screen_update) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ MCFG_SCREEN_SIZE(78*6, 30*10) MCFG_SCREEN_VISIBLE_AREA(0, 78*6-1, 0, 30*10-1) - MCFG_SCREEN_UPDATE_DRIVER(radio86_state, screen_update_radio86) MCFG_GFXDECODE(partner) MCFG_PALETTE_LENGTH(3) diff --git a/src/mess/drivers/radio86.c b/src/mess/drivers/radio86.c index e494e4edcc3..536e403d8d0 100644 --- a/src/mess/drivers/radio86.c +++ b/src/mess/drivers/radio86.c @@ -24,7 +24,7 @@ static ADDRESS_MAP_START(radio86_mem, AS_PROGRAM, 8, radio86_state ) AM_RANGE( 0x1000, 0x7fff ) AM_RAM // RAM AM_RANGE( 0x8000, 0x8003 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_MIRROR(0x1ffc) //AM_RANGE( 0xa000, 0xa003 ) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write) AM_MIRROR(0x1ffc) - AM_RANGE( 0xc000, 0xc001 ) AM_DEVREADWRITE_LEGACY("i8275", i8275_r, i8275_w) AM_MIRROR(0x1ffe) // video + AM_RANGE( 0xc000, 0xc001 ) AM_DEVREADWRITE("i8275", i8275_device, read, write) AM_MIRROR(0x1ffe) // video AM_RANGE( 0xe000, 0xffff ) AM_DEVWRITE_LEGACY("dma8257", i8257_w) // DMA AM_RANGE( 0xf000, 0xffff ) AM_ROM // System ROM ADDRESS_MAP_END @@ -44,7 +44,7 @@ static ADDRESS_MAP_START(radio86rom_mem, AS_PROGRAM, 8, radio86_state ) AM_RANGE( 0x1000, 0x7fff ) AM_RAM // RAM AM_RANGE( 0x8000, 0x8003 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_MIRROR(0x1ffc) AM_RANGE( 0xa000, 0xa003 ) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write) AM_MIRROR(0x1ffc) - AM_RANGE( 0xc000, 0xc001 ) AM_DEVREADWRITE_LEGACY("i8275", i8275_r, i8275_w) AM_MIRROR(0x1ffe) // video + AM_RANGE( 0xc000, 0xc001 ) AM_DEVREADWRITE("i8275", i8275_device, read, write) AM_MIRROR(0x1ffe) // video AM_RANGE( 0xe000, 0xffff ) AM_DEVWRITE_LEGACY("dma8257", i8257_w) // DMA AM_RANGE( 0xf000, 0xffff ) AM_ROM // System ROM ADDRESS_MAP_END @@ -55,7 +55,7 @@ static ADDRESS_MAP_START(radio86ram_mem, AS_PROGRAM, 8, radio86_state ) AM_RANGE( 0xe000, 0xe7ff ) AM_ROM // System ROM page 2 AM_RANGE( 0xe800, 0xf5ff ) AM_RAM // RAM AM_RANGE( 0xf700, 0xf703 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) - AM_RANGE( 0xf780, 0xf7bf ) AM_DEVREADWRITE_LEGACY("i8275", i8275_r, i8275_w) // video + AM_RANGE( 0xf780, 0xf7bf ) AM_DEVREADWRITE("i8275", i8275_device, read, write) // video AM_RANGE( 0xf684, 0xf687 ) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write) AM_RANGE( 0xf688, 0xf688 ) AM_WRITE(radio86_pagesel ) AM_RANGE( 0xf800, 0xffff ) AM_DEVWRITE_LEGACY("dma8257", i8257_w) // DMA @@ -69,7 +69,7 @@ static ADDRESS_MAP_START(radio86_16_mem, AS_PROGRAM, 8, radio86_state ) AM_RANGE( 0x4000, 0x7fff ) AM_READ(radio_cpu_state_r) AM_RANGE( 0x8000, 0x8003 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_MIRROR(0x1ffc) //AM_RANGE( 0xa000, 0xa003 ) AM_DEVREADWRITE_LEGACY("ppi8255_2", i8255a_r, i8255a_w) AM_MIRROR(0x1ffc) - AM_RANGE( 0xc000, 0xc001 ) AM_DEVREADWRITE_LEGACY("i8275", i8275_r, i8275_w) AM_MIRROR(0x1ffe) // video + AM_RANGE( 0xc000, 0xc001 ) AM_DEVREADWRITE("i8275", i8275_device, read, write) AM_MIRROR(0x1ffe) // video AM_RANGE( 0xe000, 0xffff ) AM_DEVWRITE_LEGACY("dma8257", i8257_w) // DMA AM_RANGE( 0xf000, 0xffff ) AM_ROM // System ROM ADDRESS_MAP_END @@ -80,7 +80,7 @@ static ADDRESS_MAP_START(mikron2_mem, AS_PROGRAM, 8, radio86_state ) AM_RANGE( 0x1000, 0x7fff ) AM_RAM // RAM AM_RANGE( 0xc000, 0xc003 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_MIRROR(0x00fc) //AM_RANGE( 0xc100, 0xc103 ) AM_DEVREADWRITE_LEGACY("ppi8255_2", i8255a_r, i8255a_w) AM_MIRROR(0x00fc) - AM_RANGE( 0xc200, 0xc201 ) AM_DEVREADWRITE_LEGACY("i8275", i8275_r, i8275_w) AM_MIRROR(0x00fe) // video + AM_RANGE( 0xc200, 0xc201 ) AM_DEVREADWRITE("i8275", i8275_device, read, write) AM_MIRROR(0x00fe) // video AM_RANGE( 0xc300, 0xc3ff ) AM_DEVWRITE_LEGACY("dma8257", i8257_w) // DMA AM_RANGE( 0xf000, 0xffff ) AM_ROM // System ROM ADDRESS_MAP_END @@ -90,7 +90,7 @@ static ADDRESS_MAP_START(impuls03_mem, AS_PROGRAM, 8, radio86_state ) AM_RANGE( 0x1000, 0x7fff ) AM_RAM // RAM AM_RANGE( 0x8000, 0x8003 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_MIRROR(0x1ffc) AM_RANGE( 0xa000, 0xbfff ) AM_ROM // Basic ROM - AM_RANGE( 0xc000, 0xc001 ) AM_DEVREADWRITE_LEGACY("i8275", i8275_r, i8275_w) AM_MIRROR(0x1ffe) // video + AM_RANGE( 0xc000, 0xc001 ) AM_DEVREADWRITE("i8275", i8275_device, read, write) AM_MIRROR(0x1ffe) // video AM_RANGE( 0xe000, 0xffff ) AM_DEVWRITE_LEGACY("dma8257", i8257_w) // DMA AM_RANGE( 0xf000, 0xffff ) AM_ROM // System ROM ADDRESS_MAP_END @@ -359,11 +359,11 @@ static MACHINE_CONFIG_START( radio86, radio86_state ) MCFG_I8275_ADD ( "i8275", radio86_i8275_interface) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_UPDATE_DEVICE("i8275", i8275_device, screen_update) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ MCFG_SCREEN_SIZE(78*6, 30*10) MCFG_SCREEN_VISIBLE_AREA(0, 78*6-1, 0, 30*10-1) - MCFG_SCREEN_UPDATE_DRIVER(radio86_state, screen_update_radio86) MCFG_GFXDECODE(radio86) MCFG_PALETTE_LENGTH(3) MCFG_PALETTE_INIT_OVERRIDE(radio86_state,radio86) diff --git a/src/mess/drivers/rt1715.c b/src/mess/drivers/rt1715.c index cb68e5e5bcf..66961762115 100644 --- a/src/mess/drivers/rt1715.c +++ b/src/mess/drivers/rt1715.c @@ -28,11 +28,6 @@ public: rt1715_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) { } - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) - { - return 0; - } - int m_led1_val; int m_led2_val; DECLARE_WRITE8_MEMBER(rt1715_floppy_enable); @@ -165,6 +160,8 @@ static const i8275_interface rt1715_i8275_intf = 0, DEVCB_NULL, DEVCB_NULL, + DEVCB_NULL, + DEVCB_NULL, rt1715_display_pixels }; @@ -197,7 +194,7 @@ static ADDRESS_MAP_START( rt1715_io, AS_IO, 8, rt1715_state ) AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("a72", z80pio_device, read_alt, write_alt) AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("a30", z80ctc_device, read, write) AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE("a29", z80sio_device, read_alt, write_alt) - AM_RANGE(0x18, 0x19) AM_DEVREADWRITE_LEGACY("a26", i8275_r, i8275_w) + AM_RANGE(0x18, 0x19) AM_DEVREADWRITE("a26", i8275_device, read, write) AM_RANGE(0x20, 0x20) AM_WRITE(rt1715_floppy_enable) AM_RANGE(0x28, 0x28) AM_WRITE(rt1715_rom_disable) ADDRESS_MAP_END @@ -329,9 +326,9 @@ static MACHINE_CONFIG_START( rt1715, rt1715_state ) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_UPDATE_DEVICE("a26", i8275_device, screen_update) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(rt1715_state, screen_update) MCFG_SCREEN_SIZE(78*6, 30*10) MCFG_SCREEN_VISIBLE_AREA(0, 78*6-1, 0, 30*10-1) diff --git a/src/mess/drivers/sm1800.c b/src/mess/drivers/sm1800.c index 08c98a1434e..ce592f7be32 100644 --- a/src/mess/drivers/sm1800.c +++ b/src/mess/drivers/sm1800.c @@ -39,12 +39,9 @@ public: DECLARE_WRITE8_MEMBER(sm1800_8255_portc_w); DECLARE_READ8_MEMBER(sm1800_8255_porta_r); DECLARE_READ8_MEMBER(sm1800_8255_portc_r); - bitmap_rgb32 m_bitmap; UINT8 m_irq_state; virtual void machine_reset(); - virtual void video_start(); virtual void palette_init(); - UINT32 screen_update_sm1800(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(sm1800_vblank_interrupt); }; @@ -58,7 +55,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sm1800_io, AS_IO, 8, sm1800_state) ADDRESS_MAP_GLOBAL_MASK(0xff) ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x3c, 0x3d ) AM_DEVREADWRITE_LEGACY("i8275", i8275_r, i8275_w) + AM_RANGE( 0x3c, 0x3d ) AM_DEVREADWRITE("i8275", i8275_device, read, write) AM_RANGE( 0x5c, 0x5c) AM_DEVREADWRITE("i8251", i8251_device, data_r, data_w) AM_RANGE( 0x5d, 0x5d) AM_DEVREADWRITE("i8251", i8251_device, status_r, control_w) AM_RANGE( 0x6c, 0x6f ) AM_DEVREADWRITE("i8255", i8255_device, read, write) @@ -79,20 +76,6 @@ void sm1800_state::machine_reset() m_maincpu->set_irq_acknowledge_callback(sm1800_irq_callback); } -void sm1800_state::video_start() -{ - machine().primary_screen->register_screen_bitmap(m_bitmap); - -} - -UINT32 sm1800_state::screen_update_sm1800(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - device_t *devconf = machine().device("i8275"); - i8275_update( devconf, bitmap, cliprect); - copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); - return 0; -} - INTERRUPT_GEN_MEMBER(sm1800_state::sm1800_vblank_interrupt) { machine().device("maincpu")->execute().set_input_line(0, m_irq_state ? HOLD_LINE : CLEAR_LINE); @@ -103,7 +86,6 @@ static I8275_DISPLAY_PIXELS(sm1800_display_pixels) { int i; sm1800_state *state = device->machine().driver_data(); - bitmap_rgb32 &bitmap = state->m_bitmap; const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); UINT8 *charmap = state->memregion("chargen")->base(); UINT8 pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff; @@ -126,6 +108,8 @@ const i8275_interface sm1800_i8275_interface = { 0, DEVCB_NULL, DEVCB_NULL, + DEVCB_NULL, + DEVCB_NULL, sm1800_display_pixels }; @@ -194,12 +178,12 @@ static MACHINE_CONFIG_START( sm1800, sm1800_state ) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_UPDATE_DEVICE("i8275", i8275_device, screen_update) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ MCFG_SCREEN_SIZE(640, 480) MCFG_GFXDECODE(sm1800) MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(sm1800_state, screen_update_sm1800) MCFG_PALETTE_LENGTH(3) /* Devices */ diff --git a/src/mess/drivers/tim100.c b/src/mess/drivers/tim100.c index 5280c52cb04..89ce7a8a0d2 100644 --- a/src/mess/drivers/tim100.c +++ b/src/mess/drivers/tim100.c @@ -21,8 +21,6 @@ public: { } required_device m_maincpu; - UINT32 screen_update_tim100(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - bitmap_rgb32 m_bitmap; virtual void machine_reset(); }; @@ -31,7 +29,7 @@ static ADDRESS_MAP_START(tim100_mem, AS_PROGRAM, 8, tim100_state) AM_RANGE(0x0000, 0x1fff) AM_ROM // 2764 at U16 AM_RANGE(0x2000, 0x27ff) AM_RAM // 2KB static ram CDM6116A at U15 - AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE_LEGACY("i8276", i8275_r, i8275_w) + AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE("i8276", i8275_device, read, write) AM_RANGE(0x6000, 0x6000) AM_DEVREADWRITE("uart_u17", i8251_device, status_r, control_w) AM_RANGE(0x6001, 0x6001) AM_DEVREADWRITE("uart_u17", i8251_device, data_r, data_w) @@ -78,23 +76,12 @@ static GFXDECODE_START( tim100 ) GFXDECODE_END - -UINT32 tim100_state::screen_update_tim100(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - device_t *devconf = machine().device("i8276"); - i8275_update( devconf, bitmap, cliprect); - copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); - return 0; -} - - // this gets called via a (i8275_dack_w), so does nothing currently // once fixed, pixel count needs adjusting static I8275_DISPLAY_PIXELS(tim100_display_pixels) { tim100_state *state = device->machine().driver_data(); int i; - bitmap_rgb32 &bitmap = state->m_bitmap; const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); UINT8 *charmap = state->memregion("chargen")->base(); UINT8 pixels = charmap[(linecount & 15) + (charcode << 4)]; @@ -125,6 +112,8 @@ static const i8275_interface tim100_i8276_interface = { 0, DEVCB_CPU_INPUT_LINE("maincpu", I8085_RST65_LINE), DEVCB_NULL, + DEVCB_NULL, + DEVCB_NULL, tim100_display_pixels }; @@ -136,11 +125,11 @@ static MACHINE_CONFIG_START( tim100, tim100_state ) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_UPDATE_DEVICE("i8276", i8275_device, screen_update) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ MCFG_SCREEN_SIZE(40*16, 16*16) MCFG_SCREEN_VISIBLE_AREA(0, 40*16-1, 0, 16*16-1) - MCFG_SCREEN_UPDATE_DRIVER(tim100_state, screen_update_tim100) MCFG_GFXDECODE( tim100 ) diff --git a/src/mess/includes/mikromik.h b/src/mess/includes/mikromik.h index 07c4c0841b0..c76b6419068 100644 --- a/src/mess/includes/mikromik.h +++ b/src/mess/includes/mikromik.h @@ -103,7 +103,6 @@ public: const UINT8 *m_key_rom; // video state - bitmap_rgb32 m_bitmap; const UINT8 *m_char_rom; int m_llen; diff --git a/src/mess/includes/radio86.h b/src/mess/includes/radio86.h index 8504e1395c5..d5c3e7b061f 100644 --- a/src/mess/includes/radio86.h +++ b/src/mess/includes/radio86.h @@ -17,12 +17,6 @@ public: radio86_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) { } - virtual void video_start(); - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - bitmap_rgb32 m_bitmap; - UINT8 m_tape_value; UINT8 m_mikrosha_font_page; int m_keyboard_mask; @@ -38,7 +32,6 @@ public: DECLARE_DRIVER_INIT(radio86); DECLARE_MACHINE_RESET(radio86); DECLARE_PALETTE_INIT(radio86); - UINT32 screen_update_radio86(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); TIMER_CALLBACK_MEMBER(radio86_reset); DECLARE_READ8_MEMBER(radio86_8255_portb_r2); DECLARE_READ8_MEMBER(radio86_8255_portc_r2); diff --git a/src/mess/machine/partner.c b/src/mess/machine/partner.c index 52444d99b33..a00346786e9 100644 --- a/src/mess/machine/partner.c +++ b/src/mess/machine/partner.c @@ -378,7 +378,7 @@ I8257_INTERFACE( partner_dma ) DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, memory_read_byte), DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, memory_write_byte), { DEVCB_DEVICE_HANDLER("wd1793", wd17xx_data_r), DEVCB_NULL, DEVCB_NULL, DEVCB_NULL }, - { DEVCB_DEVICE_HANDLER("wd1793", wd17xx_data_w), DEVCB_NULL, DEVCB_DEVICE_HANDLER("i8275", i8275_dack_w), DEVCB_NULL } + { DEVCB_DEVICE_HANDLER("wd1793", wd17xx_data_w), DEVCB_NULL, DEVCB_DEVICE_MEMBER("i8275", i8275_device, dack_w), DEVCB_NULL } }; diff --git a/src/mess/machine/radio86.c b/src/mess/machine/radio86.c index dedf8d7a3ae..a21fd7ea7a7 100644 --- a/src/mess/machine/radio86.c +++ b/src/mess/machine/radio86.c @@ -147,7 +147,7 @@ I8257_INTERFACE( radio86_dma ) DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, memory_read_byte), DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, memory_write_byte), { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL }, - { DEVCB_NULL, DEVCB_NULL, DEVCB_DEVICE_HANDLER("i8275", i8275_dack_w), DEVCB_NULL } + { DEVCB_NULL, DEVCB_NULL, DEVCB_DEVICE_MEMBER("i8275", i8275_device, dack_w), DEVCB_NULL } }; TIMER_CALLBACK_MEMBER(radio86_state::radio86_reset) @@ -241,6 +241,8 @@ const i8275_interface radio86_i8275_interface = { 0, DEVCB_DEVICE_LINE("dma8257", i8257_drq2_w), DEVCB_NULL, + DEVCB_NULL, + DEVCB_NULL, radio86_display_pixels }; @@ -250,6 +252,8 @@ const i8275_interface mikrosha_i8275_interface = { 0, DEVCB_DEVICE_LINE("dma8257", i8257_drq2_w), DEVCB_NULL, + DEVCB_NULL, + DEVCB_NULL, mikrosha_display_pixels }; @@ -259,6 +263,8 @@ const i8275_interface apogee_i8275_interface = { 0, DEVCB_DEVICE_LINE("dma8257", i8257_drq2_w), DEVCB_NULL, + DEVCB_NULL, + DEVCB_NULL, apogee_display_pixels }; @@ -268,5 +274,7 @@ const i8275_interface partner_i8275_interface = { 1, DEVCB_DEVICE_LINE("dma8257", i8257_drq2_w), DEVCB_NULL, + DEVCB_NULL, + DEVCB_NULL, partner_display_pixels }; diff --git a/src/mess/video/mikromik.c b/src/mess/video/mikromik.c index 10f413de5e1..08c4e09fe73 100644 --- a/src/mess/video/mikromik.c +++ b/src/mess/video/mikromik.c @@ -29,7 +29,7 @@ static I8275_DISPLAY_PIXELS( crtc_display_pixels ) int color = hlt_in ? 2 : (video_in ^ compl_in); - state->m_bitmap.pix32(y, x + i) = RGB_MONOCHROME_GREEN_HIGHLIGHT[color]; + bitmap.pix32(y, x + i) = RGB_MONOCHROME_GREEN_HIGHLIGHT[color]; } } @@ -40,6 +40,8 @@ static const i8275_interface crtc_intf = 0, DEVCB_DEVICE_LINE_MEMBER(I8237_TAG, am9517a_device, dreq0_w), DEVCB_NULL, + DEVCB_NULL, + DEVCB_NULL, crtc_display_pixels }; @@ -89,8 +91,6 @@ void mm1_state::video_start() { // find memory regions m_char_rom = memregion("chargen")->base(); - - machine().primary_screen->register_screen_bitmap(m_bitmap); } @@ -101,8 +101,7 @@ void mm1_state::video_start() UINT32 mm1_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { /* text */ - i8275_update(m_crtc, bitmap, cliprect); - copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); + m_crtc->screen_update(screen, bitmap, cliprect); /* graphics */ m_hgdc->screen_update(screen, bitmap, cliprect); diff --git a/src/mess/video/radio86.c b/src/mess/video/radio86.c index 9104fa58ca6..fa54c5c5760 100644 --- a/src/mess/video/radio86.c +++ b/src/mess/video/radio86.c @@ -11,22 +11,10 @@ #include "video/i8275.h" #include "includes/radio86.h" -void radio86_state::video_start() -{ - machine().primary_screen->register_screen_bitmap(m_bitmap); -} - -UINT32 radio86_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); - return 0; -} - I8275_DISPLAY_PIXELS(radio86_display_pixels) { radio86_state *state = device->machine().driver_data(); int i; - bitmap_rgb32 &bitmap = state->m_bitmap; const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); UINT8 *charmap = state->memregion("gfx1")->base(); UINT8 pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff; @@ -49,7 +37,6 @@ I8275_DISPLAY_PIXELS(mikrosha_display_pixels) { radio86_state *state = device->machine().driver_data(); int i; - bitmap_rgb32 &bitmap = state->m_bitmap; const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); UINT8 *charmap = state->memregion("gfx1")->base() + (state->m_mikrosha_font_page & 1) * 0x400; UINT8 pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff; @@ -71,7 +58,6 @@ I8275_DISPLAY_PIXELS(apogee_display_pixels) { radio86_state *state = device->machine().driver_data(); int i; - bitmap_rgb32 &bitmap = state->m_bitmap; const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); UINT8 *charmap = state->memregion("gfx1")->base() + (gpa & 1) * 0x400; UINT8 pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff; @@ -93,7 +79,6 @@ I8275_DISPLAY_PIXELS(partner_display_pixels) { radio86_state *state = device->machine().driver_data(); int i; - bitmap_rgb32 &bitmap = state->m_bitmap; const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); UINT8 *charmap = state->memregion("gfx1")->base() + 0x400 * (gpa * 2 + hlgt); UINT8 pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff; @@ -111,14 +96,6 @@ I8275_DISPLAY_PIXELS(partner_display_pixels) } } -UINT32 radio86_state::screen_update_radio86(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - device_t *devconf = machine().device("i8275"); - i8275_update( devconf, bitmap, cliprect); - copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); - return 0; -} - static const rgb_t radio86_palette[3] = { MAKE_RGB(0x00, 0x00, 0x00), // black MAKE_RGB(0xa0, 0xa0, 0xa0), // white