summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/video/ef9364.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/video/ef9364.cpp')
-rw-r--r--src/devices/video/ef9364.cpp79
1 files changed, 36 insertions, 43 deletions
diff --git a/src/devices/video/ef9364.cpp b/src/devices/video/ef9364.cpp
index 858b7309ca6..1b6ad09bab2 100644
--- a/src/devices/video/ef9364.cpp
+++ b/src/devices/video/ef9364.cpp
@@ -72,6 +72,8 @@ ef9364_device::ef9364_device(const machine_config &mconfig, const char *tag, dev
m_palette(*this, finder_base::DUMMY_TAG)
{
clock_freq = clock;
+
+ erase_char = 0x00;
}
//-------------------------------------------------
@@ -97,6 +99,9 @@ void ef9364_device::set_color_entry( int index, uint8_t r, uint8_t g, uint8_t b
void ef9364_device::device_start()
{
+ // assumes it can make an address mask with m_charset.length() - 1
+ assert(!(m_charset.length() & (m_charset.length() - 1)));
+
m_textram = &space(0);
bitplane_xres = NB_OF_COLUMNS*8;
@@ -108,14 +113,10 @@ void ef9364_device::device_start()
palette[0] = rgb_t(0, 0, 0);
palette[1] = rgb_t(255, 255, 255);
- m_screen_out.allocate( bitplane_xres, screen().height() );
-
cursor_cnt = 0;
cursor_state = 0;
save_item(NAME(m_border));
-
- save_item(NAME(m_screen_out));
}
//-------------------------------------------------
@@ -133,13 +134,11 @@ void ef9364_device::device_reset()
for(i = 0; i < NB_OF_COLUMNS * NB_OF_ROWS * nb_of_pages; i++)
{
- m_textram->write_byte ( i , 0x7F );
+ m_textram->write_byte ( i , erase_char );
}
memset(m_border, 0, sizeof(m_border));
- m_screen_out.fill(0);
-
set_video_mode();
}
@@ -173,35 +172,32 @@ void ef9364_device::draw_border(uint16_t line)
}
//-------------------------------------------------
-// screen_update: Framebuffer video ouput
+// screen_update: Framebuffer video output
//-------------------------------------------------
uint32_t ef9364_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- int x,y,r;
- unsigned char c;
-
- for( r = 0 ; r < NB_OF_ROWS ; r++ )
+ for( int r = 0 ; r < NB_OF_ROWS ; r++ )
{
- for( y = 0 ; y < 8 ; y++ )
+ for( int y = 0 ; y < 12 ; y++ )
{
- for( x = 0 ; x < NB_OF_COLUMNS * 8 ; x++ )
+ for( int x = 0 ; x < NB_OF_COLUMNS * 8 ; x++ )
{
- if( ( ( x >> 3 ) != x_curs_pos ) || ( r != y_curs_pos ) || !cursor_state)
+ if( ( ( x >> 3 ) != x_curs_pos ) || ( r != y_curs_pos ) || !cursor_state)
{
- c = m_textram->read_byte( ( r * NB_OF_COLUMNS ) + ( x>>3 ) );
-
- if( m_charset[((c&0x7F)<<3) + y] & (0x80>>(x&7)) )
- m_screen_out.pix32((r*12)+y, x) = palette[1];
+ unsigned char c = m_textram->read_byte( ( r * NB_OF_COLUMNS ) + ( x>>3 ) );
+ int ra = (y & 8) ? 0 : y;
+ if( BIT(m_charset[((c<<3) + ra) & (m_charset.length() - 1)], 7 - (x & 7)) )
+ bitmap.pix((r*12)+y, x) = palette[1];
else
- m_screen_out.pix32((r*12)+y, x) = palette[0];
+ bitmap.pix((r*12)+y, x) = palette[0];
}
else
{
if(y != 7)
- m_screen_out.pix32((r*12)+y, x) = palette[0];
+ bitmap.pix((r*12)+y, x) = palette[0];
else
- m_screen_out.pix32((r*12)+y, x) = palette[1];
+ bitmap.pix((r*12)+y, x) = palette[1];
}
}
}
@@ -211,7 +207,6 @@ uint32_t ef9364_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma
if(!cursor_cnt)
cursor_state ^= 1;
- copybitmap(bitmap, m_screen_out, 0, 0, 0, 0, cliprect);
return 0;
}
@@ -242,25 +237,25 @@ void ef9364_device::command_w(uint8_t cmd)
switch( cmd&7 )
{
- case 0x0: // Page Erase & Cursor home
+ case 0x0: // Page erase and cursor home
for( y=0 ; y < NB_OF_ROWS ; y++ )
{
for( x=0 ; x < NB_OF_COLUMNS ; x++ )
{
- m_textram->write_byte ( y * NB_OF_COLUMNS + x , 0x7F );
+ m_textram->write_byte ( y * NB_OF_COLUMNS + x , erase_char );
}
}
x_curs_pos = 0;
y_curs_pos = 0;
- break;
+ break;
- case 0x1: // Erase to end of the line and return cursor
+ case 0x1: // Erase to end of line and return cursor
for( ; x_curs_pos < NB_OF_COLUMNS ; x_curs_pos++ )
{
- m_textram->write_byte ( y_curs_pos * NB_OF_COLUMNS + x_curs_pos , 0x7F );
+ m_textram->write_byte ( y_curs_pos * NB_OF_COLUMNS + x_curs_pos , erase_char );
}
x_curs_pos = 0;
- break;
+ break;
case 0x2: // Line feed
y_curs_pos++;
@@ -277,35 +272,34 @@ void ef9364_device::command_w(uint8_t cmd)
// Erase last line
for( i = 0 ; i < NB_OF_COLUMNS ; i++ )
{
- m_textram->write_byte ( ( NB_OF_ROWS - 1 ) * NB_OF_COLUMNS + i , 0x7F );
+ m_textram->write_byte ( ( NB_OF_ROWS - 1 ) * NB_OF_COLUMNS + i , erase_char );
}
y_curs_pos = NB_OF_ROWS - 1;
}
- break;
+ break;
- case 0x3: // Nop
-
- break;
+ case 0x3: // No operation
+ break;
case 0x4: // Cursor left
if(x_curs_pos)
x_curs_pos--;
- break;
+ break;
- case 0x5: // Erasure of cursor Line.
+ case 0x5: // Erasure of cursor line
for( x = 0 ; x < NB_OF_COLUMNS ; x++ )
{
- m_textram->write_byte ( y_curs_pos * NB_OF_COLUMNS + x , 0x7F );
+ m_textram->write_byte ( y_curs_pos * NB_OF_COLUMNS + x , erase_char );
}
- break;
+ break;
case 0x6: // Cursor up
if(y_curs_pos)
y_curs_pos--;
- break;
+ break;
- case 0x7: // Write char
+ case 0x7: // Normal character
if(cmd&0x8)
m_textram->write_byte ( y_curs_pos * NB_OF_COLUMNS + x_curs_pos , char_latch );
@@ -327,14 +321,13 @@ void ef9364_device::command_w(uint8_t cmd)
// Erase last line
for( i = 0 ; i < NB_OF_COLUMNS ; i++ )
{
- m_textram->write_byte ( ( NB_OF_ROWS - 1 ) * NB_OF_COLUMNS + i , 0x7F );
+ m_textram->write_byte ( ( NB_OF_ROWS - 1 ) * NB_OF_COLUMNS + i , erase_char );
}
y_curs_pos = NB_OF_ROWS - 1;
}
}
- break;
-
+ break;
}
}