diff options
author | hap <happppp@users.noreply.github.com> | 2020-08-16 20:55:10 +0200 |
---|---|---|
committer | hap <happppp@users.noreply.github.com> | 2020-08-16 20:55:27 +0200 |
commit | 9ee3de7b1f5d8d68d06650ef1d77697000ad494e (patch) | |
tree | 93d7311186025a8d05b561d3394d0217585f8e61 /src/devices/video | |
parent | 6c5e9d3eff7435546faf844384a1f6c86cf3a025 (diff) |
ef9340: add character blink/underline modes
Diffstat (limited to 'src/devices/video')
-rw-r--r-- | src/devices/video/ef9340_1.cpp | 158 | ||||
-rw-r--r-- | src/devices/video/ef9340_1.h | 36 | ||||
-rw-r--r-- | src/devices/video/i8244.cpp | 128 | ||||
-rw-r--r-- | src/devices/video/i8244.h | 2 |
4 files changed, 179 insertions, 145 deletions
diff --git a/src/devices/video/ef9340_1.cpp b/src/devices/video/ef9340_1.cpp index 65e140666f0..0fd895ed148 100644 --- a/src/devices/video/ef9340_1.cpp +++ b/src/devices/video/ef9340_1.cpp @@ -1,15 +1,13 @@ // license:BSD-3-Clause -// copyright-holders:Wilbert Pol +// copyright-holders:Wilbert Pol, hap /*************************************************************************** Thomson EF9340 + EF9341 teletext graphics chips with 1KB external character ram. TODO: - busy state (right now it is immediate) -- character blinking mode -- character underline mode - character width/height doubling -- window boxing/conceal +- window boxing - Y zoom ***************************************************************************/ @@ -30,7 +28,6 @@ DEFINE_DEVICE_TYPE(EF9340_1, ef9340_1_device, "ef9340_1", "Thomson EF9340+EF9341 ef9340_1_device::ef9340_1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, EF9340_1, tag, owner, clock) , device_video_interface(mconfig, *this) - , m_line_timer(nullptr) , m_charset(*this, "ef9340_1") { } @@ -54,7 +51,10 @@ void ef9340_1_device::device_start() screen().register_screen_bitmap(m_tmp_bitmap); m_line_timer = timer_alloc(TIMER_LINE); - m_line_timer->adjust( screen().time_until_pos(0, 0), 0, screen().scan_period() ); + m_line_timer->adjust( screen().time_until_pos(0, 0), 0, screen().scan_period() ); + + m_blink_timer = timer_alloc(TIMER_BLINK); + m_blink_timer->adjust( screen().time_until_pos(0, 0), 0, screen().frame_period() ); // zerofill m_ef9341.TA = 0; @@ -66,10 +66,12 @@ void ef9340_1_device::device_start() m_ef9340.Y0 = 0; m_ef9340.R = 0; m_ef9340.M = 0; + m_ef9340.blink = false; + m_ef9340.blink_prescaler = 0; - memset(m_ef934x_ram_a, 0, sizeof(m_ef934x_ram_a)); - memset(m_ef934x_ram_b, 0, sizeof(m_ef934x_ram_b)); - memset(m_ef934x_ram_b, 0, sizeof(m_ef934x_ext_char_ram)); + memset(m_ram_a, 0, sizeof(m_ram_a)); + memset(m_ram_b, 0, sizeof(m_ram_b)); + memset(m_ram_b, 0, sizeof(m_ef934x_ext_char_ram)); // register our state save_item(NAME(m_ef9341.TA)); @@ -81,9 +83,11 @@ void ef9340_1_device::device_start() save_item(NAME(m_ef9340.Y0)); save_item(NAME(m_ef9340.R)); save_item(NAME(m_ef9340.M)); + save_item(NAME(m_ef9340.blink)); + save_item(NAME(m_ef9340.blink_prescaler)); - save_item(NAME(m_ef934x_ram_a)); - save_item(NAME(m_ef934x_ram_b)); + save_item(NAME(m_ram_a)); + save_item(NAME(m_ram_b)); save_item(NAME(m_ef934x_ext_char_ram)); } @@ -95,6 +99,17 @@ void ef9340_1_device::device_timer(emu_timer &timer, device_timer_id id, int par case TIMER_LINE: ef9340_scanline(screen().vpos()); break; + + case TIMER_BLINK: + // blink rate is approximately 0.5s + m_ef9340.blink_prescaler = (m_ef9340.blink_prescaler + 1) & 0x1f; + if (m_ef9340.R & 0x40 && m_ef9340.blink_prescaler == 24) + m_ef9340.blink_prescaler = 0; + + if (m_ef9340.blink_prescaler == 0) + m_ef9340.blink = !m_ef9340.blink; + + break; } } @@ -197,20 +212,20 @@ void ef9340_1_device::ef9341_write( uint8_t command, uint8_t b, uint8_t data ) switch ( m_ef9340.M & 0xE0 ) { case 0x00: /* Write */ - m_ef934x_ram_a[addr] = m_ef9341.TA; - m_ef934x_ram_b[addr] = m_ef9341.TB; + m_ram_a[addr] = m_ef9341.TA; + m_ram_b[addr] = m_ef9341.TB; ef9340_inc_c(); break; case 0x40: /* Write without increment */ - m_ef934x_ram_a[addr] = m_ef9341.TA; - m_ef934x_ram_b[addr] = m_ef9341.TB; + m_ram_a[addr] = m_ef9341.TA; + m_ram_b[addr] = m_ef9341.TB; break; case 0x80: /* Write slice */ { - uint8_t a = m_ef934x_ram_a[addr]; - uint8_t b = m_ef934x_ram_b[addr]; + uint8_t a = m_ram_a[addr]; + uint8_t b = m_ram_b[addr]; uint8_t slice = ( m_ef9340.M & 0x0f ) % 10; if ( b >= 0xa0 ) @@ -264,20 +279,20 @@ uint8_t ef9340_1_device::ef9341_read( uint8_t command, uint8_t b ) switch ( m_ef9340.M & 0xE0 ) { case 0x20: /* Read */ - m_ef9341.TA = m_ef934x_ram_a[addr]; - m_ef9341.TB = m_ef934x_ram_b[addr]; + m_ef9341.TA = m_ram_a[addr]; + m_ef9341.TB = m_ram_b[addr]; ef9340_inc_c(); break; case 0x60: /* Read without increment */ - m_ef9341.TA = m_ef934x_ram_a[addr]; - m_ef9341.TB = m_ef934x_ram_b[addr]; + m_ef9341.TA = m_ram_a[addr]; + m_ef9341.TB = m_ram_b[addr]; break; case 0xA0: /* Read slice */ { - uint8_t a = m_ef934x_ram_a[addr]; - uint8_t b = m_ef934x_ram_b[addr]; + uint8_t a = m_ram_a[addr]; + uint8_t b = m_ram_b[addr]; uint8_t slice = ( m_ef9340.M & 0x0f ) % 10; if ( b >= 0xa0 ) @@ -307,14 +322,13 @@ uint8_t ef9340_1_device::ef9341_read( uint8_t command, uint8_t b ) void ef9340_1_device::ef9340_scanline(int vpos) { - static const uint8_t bgr2rgb[8] = - { - 0x00, 0x04, 0x02, 0x06, 0x01, 0x05, 0x03, 0x07 - }; - - for ( int i = 0; i < 40 * 8; i++ ) + for (int i = 0; i < m_tmp_bitmap.width(); i++) m_tmp_bitmap.pix16(vpos, i) = 0; + vpos -= m_offset_y; + if (vpos < 0) + return; + // display automaton active at 40-290, or 32-242 int max_vpos = ( m_ef9340.R & 0x40 ) ? 250 : 210; @@ -324,6 +338,8 @@ void ef9340_1_device::ef9340_scanline(int vpos) int y_row, slice; uint8_t fg = 0; uint8_t bg = 0; + bool underline = false; + bool blank = false; if ( y < 10 ) { @@ -337,6 +353,8 @@ void ef9340_1_device::ef9340_scanline(int vpos) else { // Service row is disabled + for (int i = 0; i < 40 * 8; i++) + m_tmp_bitmap.pix16(vpos, i) = 8; return; } } @@ -350,75 +368,103 @@ void ef9340_1_device::ef9340_scanline(int vpos) for ( int x = 0; x < 40; x++ ) { uint16_t addr = ef9340_get_c_addr( x, y_row ); - uint8_t a = m_ef934x_ram_a[addr]; - uint8_t b = m_ef934x_ram_b[addr]; + uint8_t a = m_ram_a[addr]; + uint8_t b = m_ram_b[addr]; uint8_t char_data = 0x00; + bool blink = m_ef9340.R & 0x80 && m_ef9340.blink; + bool cursor = m_ef9340.R & 0x10 && x == m_ef9340.X && y_row == m_ef9340.Y; + bool invert = cursor && !blink; + bool alpha = !bool(a & 0x80); - if ( a & 0x80 ) + if (alpha) { - // Graphics + // Alphanumeric if ( b & 0x80 ) { if ( b & 0x60 ) { // Extension - char_data = m_ef934x_ext_char_ram[ 0x400 | external_chargen_address( b & 0x7f, slice ) ]; - fg = bgr2rgb[ a & 0x07 ]; - bg = bgr2rgb[ ( a >> 4 ) & 0x07 ]; + char_data = m_ef934x_ext_char_ram[ external_chargen_address( b & 0x7f, slice ) ]; + fg = a & 0x07; } else { - // Illegal + // Deliminator + alpha = false; + blank = m_ef9340.R & 0x04 && b & 0x01; + underline = bool(b & 0x04); + char_data = 0xff; + fg = a & 0x07; + bg = a >> 4 & 0x07; } } else { // Normal - char_data = m_charset[((b | 0x80) * 10) + slice]; - fg = bgr2rgb[ a & 0x07 ]; - bg = bgr2rgb[ ( a >> 4 ) & 0x07 ]; + if (slice == 9 && underline) + char_data = 0xff; + else + char_data = m_charset[((b & 0x7f) * 10) + slice]; + fg = a & 0x07; + } + + // Inverted + if (alpha && a & 0x40) + { + invert = !invert; + blink = m_ef9340.R & 0x80 && !m_ef9340.blink; } } else { - // Alphanumeric + // Graphics if ( b & 0x80 ) { if ( b & 0x60 ) { // Extension - char_data = m_ef934x_ext_char_ram[ external_chargen_address( b & 0x7f, slice ) ]; - if ( a & 0x40 ) - char_data ^= 0xff; - fg = bgr2rgb[ a & 0x07 ]; + char_data = m_ef934x_ext_char_ram[ 0x400 | external_chargen_address( b & 0x7f, slice ) ]; + fg = a & 0x07; + bg = a >> 4 & 0x07; } else { - // DEL - char_data = 0xff; - fg = bgr2rgb[ a & 0x07 ]; - bg = bgr2rgb[ ( a >> 4 ) & 0x07 ]; + // Illegal } } else { // Normal - char_data = m_charset[((b & 0x7f) * 10) + slice]; - if ( a & 0x40 ) - char_data ^= 0xff; - fg = bgr2rgb[ a & 0x07 ]; + char_data = m_charset[((b | 0x80) * 10) + slice]; + fg = a & 0x07; + bg = a >> 4 & 0x07; } } - // Cursor is enabled - if ( m_ef9340.R & 0x10 && x == m_ef9340.X && y_row == m_ef9340.Y ) + // blink character + if (blink && !cursor && (b & 0xe0) != 0x80 && ~a & 0x08) + char_data = 0; + + if (invert) char_data ^= 0xff; for ( int i = 0; i < 8; i++ ) { - m_tmp_bitmap.pix16(vpos, 0 + x*8 + i ) = (char_data & 0x80) ? fg : bg; + uint16_t d = blank ? 0 : (char_data & 0x80) ? fg : bg; + m_tmp_bitmap.pix16(m_offset_y + vpos, m_offset_x + x*8 + i ) = d | 8; char_data <<= 1; } } } } + + +uint32_t ef9340_1_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + // note: palette d3 is transparency (datasheet calls it "I"), this handler masks it off + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) + bitmap.pix16(y, x) = m_tmp_bitmap.pix16(y, x) & 7; + + return 0; +} diff --git a/src/devices/video/ef9340_1.h b/src/devices/video/ef9340_1.h index f2d9d906731..115ce51d25b 100644 --- a/src/devices/video/ef9340_1.h +++ b/src/devices/video/ef9340_1.h @@ -1,9 +1,8 @@ // license:BSD-3-Clause -// copyright-holders:Wilbert Pol +// copyright-holders:Wilbert Pol, hap /*************************************************************************** - Thomson EF9340 + EF9341 teletext graphics chips with 1KB external - character ram. + Thomson EF9340 + EF9341 teletext graphics chips ***************************************************************************/ @@ -25,9 +24,13 @@ public: set_screen(std::forward<T>(screen_tag)); } + // configuration helpers + ef9340_1_device &set_offsets(int x, int y) { m_offset_x = x; m_offset_y = y; return *this; } // when used with overlay chip + ef9340_1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); inline bitmap_ind16 *get_bitmap() { return &m_tmp_bitmap; } + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void ef9341_write( uint8_t command, uint8_t b, uint8_t data ); uint8_t ef9341_read( uint8_t command, uint8_t b ); @@ -48,31 +51,38 @@ protected: /* timers */ static constexpr device_timer_id TIMER_LINE = 0; + static constexpr device_timer_id TIMER_BLINK = 1; emu_timer *m_line_timer; + emu_timer *m_blink_timer; required_region_ptr<uint8_t> m_charset; bitmap_ind16 m_tmp_bitmap; + int m_offset_x = 0; + int m_offset_y = 0; + struct { - uint8_t TA; - uint8_t TB; - bool busy; + uint8_t TA; + uint8_t TB; + bool busy; } m_ef9341; struct { - uint8_t X; - uint8_t Y; - uint8_t Y0; - uint8_t R; - uint8_t M; + uint8_t X; + uint8_t Y; + uint8_t Y0; + uint8_t R; + uint8_t M; + bool blink; + int blink_prescaler; } m_ef9340; - uint8_t m_ef934x_ram_a[0x400]; // A10 to GND - uint8_t m_ef934x_ram_b[0x400]; // A10 to GND + uint8_t m_ram_a[0x400]; + uint8_t m_ram_b[0x400]; uint8_t m_ef934x_ext_char_ram[0x800]; // The G7400 has 2KB of external ram hooked up. The datasheet only describes how to hookup 1KB. }; diff --git a/src/devices/video/i8244.cpp b/src/devices/video/i8244.cpp index 184536257e3..3085508e7aa 100644 --- a/src/devices/video/i8244.cpp +++ b/src/devices/video/i8244.cpp @@ -159,20 +159,20 @@ void i8244_device::i8244_palette(palette_device &palette) const static constexpr rgb_t i8244_colors[16] = { { 0x00, 0x00, 0x00 }, // i r g b - { 0x00, 0x00, 0xb6 }, // i r g B - { 0x00, 0xb6, 0x00 }, // i r G b - { 0x00, 0xb6, 0xb6 }, // i r G B { 0xb6, 0x00, 0x00 }, // i R g b - { 0xb6, 0x00, 0xb6 }, // i R g B + { 0x00, 0xb6, 0x00 }, // i r G b { 0xb6, 0xb6, 0x00 }, // i R G b + { 0x00, 0x00, 0xb6 }, // i r g B + { 0xb6, 0x00, 0xb6 }, // i R g B + { 0x00, 0xb6, 0xb6 }, // i r G B { 0xb6, 0xb6, 0xb6 }, // i R G B { 0x49, 0x49, 0x49 }, // I r g b - { 0x49, 0x49, 0xff }, // I r g B - { 0x49, 0xff, 0x49 }, // I r G b - { 0x49, 0xff, 0xff }, // I r G B { 0xff, 0x49, 0x49 }, // I R g b - { 0xff, 0x49, 0xff }, // I R g B + { 0x49, 0xff, 0x49 }, // I r G b { 0xff, 0xff, 0x49 }, // I R G b + { 0x49, 0x49, 0xff }, // I r g B + { 0xff, 0x49, 0xff }, // I R g B + { 0x49, 0xff, 0xff }, // I r G B { 0xff, 0xff, 0xff } // I R G B }; @@ -473,7 +473,7 @@ void i8244_device::write_cx(int x, bool cx) { if (cx) { - u8 colx = m_collision_map[x]; + u8 colx = m_collision_map[x] & 0x3f; // Check if we collide with an already drawn source object if (colx) @@ -499,26 +499,8 @@ void i8244_device::write_cx(int x, bool cx) uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - // Some local constants for this method - //static const uint8_t COLLISION_SPRITE_0 = 0x01; - //static const uint8_t COLLISION_SPRITE_1 = 0x02; - //static const uint8_t COLLISION_SPRITE_2 = 0x04; - //static const uint8_t COLLISION_SPRITE_3 = 0x08; - static const uint8_t COLLISION_VERTICAL_GRID = 0x10; - static const uint8_t COLLISION_HORIZ_GRID_DOTS = 0x20; - static const uint8_t COLLISION_EXTERNAL = 0x40; - static const uint8_t COLLISION_CHARACTERS = 0x80; - - // Background and grid information is stored in RGB format - // while the character and sprite colors are stored in BGR - // format. - static const uint8_t bgr2rgb[8] = - { - 0x00, 0x04, 0x02, 0x06, 0x01, 0x05, 0x03, 0x07 - }; - /* Draw background color */ - bitmap.fill( (m_vdc.s.color >> 3) & 0x7, cliprect ); + bitmap.fill(bitswap<3>(m_vdc.s.color,3,4,5), cliprect); for (int scanline = cliprect.min_y; scanline <= cliprect.max_y; scanline++) { @@ -528,7 +510,7 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap /* Display grid if enabled */ if ( m_vdc.s.control & 0x08 ) { - uint16_t color = ( m_vdc.s.color & 7 ) | ( ( m_vdc.s.color >> 3 ) & 0x08 ); + uint16_t color = bitswap<4>(m_vdc.s.color,6,0,1,2); int x_grid_offset = 13; int y_grid_offset = 24; int width = 16; @@ -552,7 +534,7 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap { if (cliprect.contains(px, scanline)) { - m_collision_map[ px ] |= COLLISION_HORIZ_GRID_DOTS; + m_collision_map[ px ] |= 0x20; bitmap.pix16( scanline, px ) = color; } } @@ -579,7 +561,7 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap { if (cliprect.contains(px, scanline)) { - m_collision_map[ px ] |= COLLISION_HORIZ_GRID_DOTS; + m_collision_map[ px ] |= 0x20; bitmap.pix16( scanline, px ) = color; } } @@ -606,7 +588,7 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap { if (cliprect.contains(px, scanline)) { - m_collision_map[ px ] |= COLLISION_VERTICAL_GRID; + m_collision_map[ px ] |= 0x10; bitmap.pix16( scanline, px ) = color; } } @@ -629,7 +611,7 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap if ( y <= scanline && scanline < y + height * 2 ) { - uint16_t color = 8 + bgr2rgb[ ( ( m_vdc.s.foreground[i].color >> 1 ) & 0x07 ) ]; + uint16_t color = 8 + ( ( m_vdc.s.foreground[i].color >> 1 ) & 0x07 ); int offset = ( m_vdc.s.foreground[i].ptr | ( ( m_vdc.s.foreground[i].color & 0x01 ) << 8 ) ) + ( y >> 1 ) + ( ( scanline - y ) >> 1 ); uint8_t chr = m_charset[ offset & 0x1FF ]; int x = (m_vdc.s.foreground[i].x + 5) * 2; @@ -642,25 +624,23 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap { if (cliprect.contains(px, scanline)) { - /* Check collision with self */ - u8 colx = m_collision_map[ px ] & ~COLLISION_EXTERNAL; - if (colx & COLLISION_CHARACTERS) + // Check collision with self + u8 colx = m_collision_map[ px ]; + if (colx & 0x80) { - colx &= ~COLLISION_CHARACTERS; - m_control_status |= COLLISION_CHARACTERS; + colx &= ~0x80; + m_control_status |= 0x80; } - /* Check if we collide with an already drawn source object */ - if ( colx & m_vdc.s.collision ) - { - m_collision_status |= COLLISION_CHARACTERS; - } - /* Check if an already drawn object would collide with us */ - if ( COLLISION_CHARACTERS & m_vdc.s.collision ) - { + // Check if we collide with an already drawn source object + if (m_vdc.s.collision & colx) + m_collision_status |= 0x80; + + // Check if an already drawn object would collide with us + if (m_vdc.s.collision & 0x80) m_collision_status |= colx; - } - m_collision_map[ px ] |= COLLISION_CHARACTERS; + + m_collision_map[ px ] |= 0x80; bitmap.pix16( scanline, px ) = color; } } @@ -684,7 +664,7 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap for ( int j = 0; j < ARRAY_LENGTH( m_vdc.s.quad[0].single ); j++, x += 16 ) { - uint16_t color = 8 + bgr2rgb[ ( ( m_vdc.s.quad[i].single[j].color >> 1 ) & 0x07 ) ]; + uint16_t color = 8 + ( ( m_vdc.s.quad[i].single[j].color >> 1 ) & 0x07 ); int offset = ( m_vdc.s.quad[i].single[j].ptr | ( ( m_vdc.s.quad[i].single[j].color & 0x01 ) << 8 ) ) + ( y >> 1 ) + ( ( scanline - y ) >> 1 ); uint8_t chr = m_charset[ offset & 0x1FF ]; @@ -696,25 +676,23 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap { if (cliprect.contains(px, scanline)) { - /* Check collision with self */ - u8 colx = m_collision_map[ px ] & ~COLLISION_EXTERNAL; - if (colx & COLLISION_CHARACTERS) + // Check collision with self + u8 colx = m_collision_map[ px ]; + if (colx & 0x80) { - colx &= ~COLLISION_CHARACTERS; - m_control_status |= COLLISION_CHARACTERS; + colx &= ~0x80; + m_control_status |= 0x80; } - /* Check if we collide with an already drawn source object */ - if ( colx & m_vdc.s.collision ) - { - m_collision_status |= COLLISION_CHARACTERS; - } - /* Check if an already drawn object would collide with us */ - if ( COLLISION_CHARACTERS & m_vdc.s.collision ) - { + // Check if we collide with an already drawn source object + if (m_vdc.s.collision & colx) + m_collision_status |= 0x80; + + // Check if an already drawn object would collide with us + if (m_vdc.s.collision & 0x80) m_collision_status |= colx; - } - m_collision_map[ px ] |= COLLISION_CHARACTERS; + + m_collision_map[ px ] |= 0x80; bitmap.pix16( scanline, px ) = color; } } @@ -734,7 +712,7 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap if ( y <= scanline && scanline < y + height * zoom_px ) { - uint16_t color = 8 + bgr2rgb[ ( ( m_vdc.s.sprites[i].color >> 3 ) & 0x07 ) ]; + uint16_t color = 8 + ( ( m_vdc.s.sprites[i].color >> 3 ) & 0x07 ); uint8_t chr = m_vdc.s.shape[i][ ( ( scanline - y ) / zoom_px ) ]; int x = (m_vdc.s.sprites[i].x + 5) * 2; int x_shift = 0; @@ -764,17 +742,17 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap { if (cliprect.contains(px, scanline)) { - /* Check if we collide with an already drawn source object */ - if ( m_collision_map[ px ] & m_vdc.s.collision ) - { - m_collision_status |= ( 1 << i ); - } - /* Check if an already drawn object would collide with us */ - if ( ( 1 << i ) & m_vdc.s.collision ) - { + u8 mask = 1 << i; + + // Check if we collide with an already drawn source object + if (m_vdc.s.collision & m_collision_map[ px ]) + m_collision_status |= mask; + + // Check if an already drawn object would collide with us + if (m_vdc.s.collision & mask) m_collision_status |= m_collision_map[ px ]; - } - m_collision_map[ px ] |= ( 1 << i ); + + m_collision_map[ px ] |= mask; bitmap.pix16( scanline, px ) = color; } } diff --git a/src/devices/video/i8244.h b/src/devices/video/i8244.h index d27ae19ea52..6ddff5806aa 100644 --- a/src/devices/video/i8244.h +++ b/src/devices/video/i8244.h @@ -31,7 +31,7 @@ public: // configuration helpers auto irq_cb() { return m_irq_func.bind(); } - i8244_device &set_screen_size(int width, int height, int cropx, int cropy); + i8244_device &set_screen_size(int width, int height, int cropx = 0, int cropy = 0); uint8_t read(offs_t offset); void write(offs_t offset, uint8_t data); |