diff options
Diffstat (limited to 'src/mame/drivers/laser3k.cpp')
-rw-r--r-- | src/mame/drivers/laser3k.cpp | 85 |
1 files changed, 33 insertions, 52 deletions
diff --git a/src/mame/drivers/laser3k.cpp b/src/mame/drivers/laser3k.cpp index 3e514ee9e0f..f17caa47a11 100644 --- a/src/mame/drivers/laser3k.cpp +++ b/src/mame/drivers/laser3k.cpp @@ -496,32 +496,28 @@ uint8_t laser3k_state::io2_r(offs_t offset) void laser3k_state::plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen) { - int x, y, i; int fg = m_fg_color; int bg = m_bg_color; - const uint8_t *chardata; - uint16_t color; /* look up the character data */ - chardata = &textgfx_data[(code * 8) % textgfx_datalen]; + uint8_t const *const chardata = &textgfx_data[(code * 8) % textgfx_datalen]; if (m_flash && (code >= 0x40) && (code <= 0x7f)) { /* we're flashing; swap */ - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { - color = (chardata[y] & (1 << (6-x))) ? fg : bg; + uint16_t color = (chardata[y] & (1 << (6-x))) ? fg : bg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } @@ -578,15 +574,6 @@ void laser3k_state::text_update(screen_device &screen, bitmap_ind16 &bitmap, con void laser3k_state::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - const uint8_t *vram; - int row, col, b; - int offset; - uint8_t vram_row[42] ; - uint16_t v; - uint16_t *p; - uint32_t w; - uint16_t *artifact_map_ptr; - /* sanity checks */ if (beginrow < cliprect.min_y) beginrow = cliprect.min_y; @@ -595,31 +582,32 @@ void laser3k_state::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, cons if (endrow < beginrow) return; - vram = m_ram->pointer() + (m_disp_page ? 0x4000 : 0x2000); + uint8_t const *const vram = m_ram->pointer() + (m_disp_page ? 0x4000 : 0x2000); + uint8_t vram_row[42]; vram_row[0] = 0; vram_row[41] = 0; - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { - offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); + int offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); vram_row[1+col] = vram[offset]; } - p = &bitmap.pix16(row); + uint16_t *p = &bitmap.pix(row); - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { - w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) - | (((uint32_t) vram_row[col+1] & 0x7f) << 7) - | (((uint32_t) vram_row[col+2] & 0x7f) << 14); + uint32_t w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) + | (((uint32_t) vram_row[col+1] & 0x7f) << 7) + | (((uint32_t) vram_row[col+2] & 0x7f) << 14); - artifact_map_ptr = &m_hires_artifact_map[((vram_row[col+1] & 0x80) >> 7) * 16]; - for (b = 0; b < 7; b++) + uint16_t const *const artifact_map_ptr = &m_hires_artifact_map[((vram_row[col+1] & 0x80) >> 7) * 16]; + for (int b = 0; b < 7; b++) { - v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; + uint16_t v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; *(p++) = v; *(p++) = v; } @@ -629,14 +617,6 @@ void laser3k_state::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, cons void laser3k_state::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - const uint8_t *vram; - int row, col, b; - int offset; - uint8_t vram_row[82]; - uint16_t v; - uint16_t *p; - uint32_t w; - /* sanity checks */ if (beginrow < cliprect.min_y) beginrow = cliprect.min_y; @@ -645,16 +625,17 @@ void laser3k_state::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, con if (endrow < beginrow) return; - vram = m_ram->pointer() + (m_disp_page ? 0x8000 : 0x4000); + uint8_t const *const vram = m_ram->pointer() + (m_disp_page ? 0x8000 : 0x4000); + uint8_t vram_row[82]; vram_row[0] = 0; vram_row[81] = 0; - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { - offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); + int offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); if (col < 40) { vram_row[1+(col*2)+0] = vram[offset]; @@ -667,17 +648,17 @@ void laser3k_state::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, con } } - p = &bitmap.pix16(row); + uint16_t *p = &bitmap.pix(row); - for (col = 0; col < 80; col++) + for (int col = 0; col < 80; col++) { - w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) - | (((uint32_t) vram_row[col+1] & 0x7f) << 7) - | (((uint32_t) vram_row[col+2] & 0x7f) << 14); + uint32_t w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) + | (((uint32_t) vram_row[col+1] & 0x7f) << 7) + | (((uint32_t) vram_row[col+2] & 0x7f) << 14); - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = m_dhires_artifact_map[((((w >> (b + 7-1)) & 0x0F) * 0x11) >> (((2-(col*7+b))) & 0x03)) & 0x0F]; + uint16_t v = m_dhires_artifact_map[((((w >> (b + 7-1)) & 0x0F) * 0x11) >> (((2-(col*7+b))) & 0x03)) & 0x0F]; *(p++) = v; } } |