diff options
author | 2019-09-29 22:47:19 -0400 | |
---|---|---|
committer | 2019-09-29 22:48:10 -0400 | |
commit | f208dcc64735237d8c55792ce7de24f71dff9127 (patch) | |
tree | 4c3937235b72b6b7f721b43af400e118333d0ac2 | |
parent | ee166520e3ec26cb10d31495f74ccb65eebb3d64 (diff) |
sed1330: Various improvements
- Allow character drawing from external ROM
- Fix display on/off command
- Fix screen area definition
-rw-r--r-- | src/devices/video/sed1330.cpp | 127 | ||||
-rw-r--r-- | src/devices/video/sed1330.h | 3 | ||||
-rw-r--r-- | src/mame/drivers/textelcomp.cpp | 4 |
3 files changed, 82 insertions, 52 deletions
diff --git a/src/devices/video/sed1330.cpp b/src/devices/video/sed1330.cpp index 73e92561e33..862c0ba675b 100644 --- a/src/devices/video/sed1330.cpp +++ b/src/devices/video/sed1330.cpp @@ -51,11 +51,17 @@ #define FC_OFF 0x00 -#define FC_SOLID 0x01 // unimplemented +#define FC_SOLID 0x01 #define FC_FLASH_32 0x02 // unimplemented #define FC_FLASH_64 0x03 // unimplemented +#define FP_OFF 0x00 +#define FP_SOLID 0x01 +#define FP_FLASH_32 0x02 // unimplemented +#define FP_FLASH_4 0x03 // unimplemented + + //************************************************************************** // GLOBAL VARIABLES @@ -167,6 +173,8 @@ const tiny_rom_entry *sed1330_device::device_rom_region() const void sed1330_device::device_start() { + m_cache = space().cache<0, 0, ENDIANNESS_LITTLE>(); + // register for state saving save_item(NAME(m_bf)); save_item(NAME(m_ir)); @@ -393,10 +401,10 @@ WRITE8_MEMBER( sed1330_device::data_w ) case INSTRUCTION_DISP_ON: case INSTRUCTION_DISP_OFF: - m_d = BIT(data, 0); + m_d = BIT(m_ir, 0); m_fc = data & 0x03; m_fp = data >> 2; - LOG("SED1330 Display: %s\n", BIT(data, 0) ? "enabled" : "disabled"); + LOG("SED1330 Display: %s\n", BIT(m_ir, 0) ? "enabled" : "disabled"); switch (m_fc) { @@ -408,26 +416,26 @@ WRITE8_MEMBER( sed1330_device::data_w ) switch (m_fp & 0x03) { - case FC_OFF: LOG("SED1330 Display Page 1: disabled\n"); break; - case FC_SOLID: LOG("SED1330 Display Page 1: enabled\n"); break; - case FC_FLASH_32: LOG("SED1330 Display Page 1: flash fFR/32\n"); break; - case FC_FLASH_64: LOG("SED1330 Display Page 1: flash fFR/64\n"); break; + case FP_OFF: LOG("SED1330 Display Page 1: disabled\n"); break; + case FP_SOLID: LOG("SED1330 Display Page 1: enabled\n"); break; + case FP_FLASH_32: LOG("SED1330 Display Page 1: flash fFR/32\n"); break; + case FP_FLASH_4: LOG("SED1330 Display Page 1: flash fFR/4\n"); break; } switch ((m_fp >> 2) & 0x03) { - case FC_OFF: LOG("SED1330 Display Page 2/4: disabled\n"); break; - case FC_SOLID: LOG("SED1330 Display Page 2/4: enabled\n"); break; - case FC_FLASH_32: LOG("SED1330 Display Page 2/4: flash fFR/32\n"); break; - case FC_FLASH_64: LOG("SED1330 Display Page 2/4: flash fFR/64\n"); break; + case FP_OFF: LOG("SED1330 Display Page 2/4: disabled\n"); break; + case FP_SOLID: LOG("SED1330 Display Page 2/4: enabled\n"); break; + case FP_FLASH_32: LOG("SED1330 Display Page 2/4: flash fFR/32\n"); break; + case FP_FLASH_4: LOG("SED1330 Display Page 2/4: flash fFR/4\n"); break; } switch ((m_fp >> 4) & 0x03) { - case FC_OFF: LOG("SED1330 Display Page 3: disabled\n"); break; - case FC_SOLID: LOG("SED1330 Display Page 3: enabled\n"); break; - case FC_FLASH_32: LOG("SED1330 Display Page 3: flash fFR/32\n"); break; - case FC_FLASH_64: LOG("SED1330 Display Page 3: flash fFR/64\n"); break; + case FP_OFF: LOG("SED1330 Display Page 3: disabled\n"); break; + case FP_SOLID: LOG("SED1330 Display Page 3: enabled\n"); break; + case FP_FLASH_32: LOG("SED1330 Display Page 3: flash fFR/32\n"); break; + case FP_FLASH_4: LOG("SED1330 Display Page 3: flash fFR/4\n"); break; } break; @@ -588,36 +596,37 @@ WRITE8_MEMBER( sed1330_device::data_w ) // draw_text_scanline - //------------------------------------------------- -void sed1330_device::draw_text_scanline(bitmap_ind16 &bitmap, const rectangle &cliprect, int y, uint16_t va) +void sed1330_device::draw_text_scanline(bitmap_ind16 &bitmap, const rectangle &cliprect, int y, int r, uint16_t va, bool cursor) { - int sx, x; + uint16_t *p = &bitmap.pix16(y, 0); - for (sx = 0; sx < m_cr; sx++) + for (int sx = 0; sx < m_cr; sx++, p += m_fx) { - if ((va + sx) == m_csr) + if (m_m0 && !m_m1) { - if (m_fc == FC_OFF) continue; + uint8_t c = m_cache->read_byte(va + sx); + uint8_t data = m_cache->read_byte(0xf000 | (m_m2 ? u16(c) << 4 | r : u16(c) << 3 | (r & 7))); + for (int x = 0; x < m_fx; x++, data <<= 1) + if (BIT(data, 7)) + p[x] = 1; + } + if (cursor && (va + sx) == m_csr) + { if (m_cm) { // block cursor - if (y % m_fy < m_cry) + if (r < m_cry) { - for (x = 0; x < m_crx; x++) - { - bitmap.pix16(y, (sx * m_fx) + x) = 1; - } + std::fill_n(p, m_crx, 1); } } else { // underscore cursor - if (y % m_fy == m_cry) + if (r == m_cry) { - for (x = 0; x < m_crx; x++) - { - bitmap.pix16(y, (sx * m_fx) + x) = 1; - } + std::fill_n(p, m_crx, 1); } } } @@ -631,13 +640,11 @@ void sed1330_device::draw_text_scanline(bitmap_ind16 &bitmap, const rectangle &c void sed1330_device::draw_graphics_scanline(bitmap_ind16 &bitmap, const rectangle &cliprect, int y, uint16_t va) { - int sx, x; - - for (sx = 0; sx < m_cr; sx++) + for (int sx = 0; sx < m_cr; sx++) { uint8_t data = readbyte(va++); - for (x = 0; x < m_fx; x++) + for (int x = 0; x < m_fx; x++) { bitmap.pix16(y, (sx * m_fx) + x) = BIT(data, 7); data <<= 1; @@ -661,28 +668,49 @@ void sed1330_device::update_graphics(bitmap_ind16 &bitmap, const rectangle &clip void sed1330_device::update_text(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int y; + uint8_t attr1 = m_fp & 0x03; + uint8_t attr2 = (m_fp >> 2) & 0x03; + uint8_t attr3 = (m_fp >> 4) & 0x03; - if (m_ws) + for (int y = 0; y < m_lf; y++) { - for (y = 0; y < m_sl1; y++) + if (y >= m_sl1) { - uint16_t sad1 = m_sad1 + ((y / m_fy) * m_ap); - uint16_t sad2 = m_sad2 + (y * m_ap); - uint16_t sad3 = m_sad3 + ((y / m_fy) * m_ap); - uint16_t sad4 = m_sad4 + (y * m_ap); + if (attr3 != FP_OFF) + { + uint16_t sad3 = m_sad3 + (((y - m_sl1) / m_fy) * m_ap); - // draw graphics display page 2 scanline - draw_graphics_scanline(bitmap, cliprect, y, sad2); + // draw text display page 3 scanline + draw_text_scanline(bitmap, cliprect, y, (y - m_sl1) % m_fy, sad3, m_ov && m_fc != FC_OFF); + } + } + else + { + if (attr1 != FP_OFF) + { + uint16_t sad1 = m_sad1 + ((y / m_fy) * m_ap); - // draw text display page 1 scanline - draw_text_scanline(bitmap, cliprect, y, sad1); + // draw text display page 1 scanline + draw_text_scanline(bitmap, cliprect, y, y % m_fy, sad1, !m_ov && m_fc != FC_OFF); + } + } + + if (attr2 != FP_OFF) + { + if (m_ws && y >= m_sl2) + { + uint16_t sad4 = m_sad4 + ((y - m_sl2) * m_ap); - // draw graphics display page 4 scanline - draw_graphics_scanline(bitmap, cliprect, y + m_sl1, sad4); + // draw graphics display page 4 scanline + draw_graphics_scanline(bitmap, cliprect, y, sad4); + } + else + { + uint16_t sad2 = m_sad2 + (y * m_ap); - // draw text display page 3 scanline - draw_text_scanline(bitmap, cliprect, y + m_sl1, sad3); + // draw graphics display page 2 scanline + draw_graphics_scanline(bitmap, cliprect, y, sad2); + } } } } @@ -694,6 +722,7 @@ void sed1330_device::update_text(bitmap_ind16 &bitmap, const rectangle &cliprect uint32_t sed1330_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { + bitmap.fill(0, cliprect); if (m_d) { if (m_dm) diff --git a/src/devices/video/sed1330.h b/src/devices/video/sed1330.h index d29f24a721f..aa1b7f38194 100644 --- a/src/devices/video/sed1330.h +++ b/src/devices/video/sed1330.h @@ -94,12 +94,13 @@ private: // address space configurations const address_space_config m_space_config; + memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_cache; inline uint8_t readbyte(offs_t address); inline void writebyte(offs_t address, uint8_t m_data); inline void increment_csr(); - void draw_text_scanline(bitmap_ind16 &bitmap, const rectangle &cliprect, int y, uint16_t va); + void draw_text_scanline(bitmap_ind16 &bitmap, const rectangle &cliprect, int y, int r, uint16_t va, bool cursor); void draw_graphics_scanline(bitmap_ind16 &bitmap, const rectangle &cliprect, int y, uint16_t va); void update_graphics(bitmap_ind16 &bitmap, const rectangle &cliprect); void update_text(bitmap_ind16 &bitmap, const rectangle &cliprect); diff --git a/src/mame/drivers/textelcomp.cpp b/src/mame/drivers/textelcomp.cpp index 35c51c8a1da..c79304b3244 100644 --- a/src/mame/drivers/textelcomp.cpp +++ b/src/mame/drivers/textelcomp.cpp @@ -126,8 +126,8 @@ void textelcomp_state::textelcomp(machine_config &config) screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_LCD)); screen.set_refresh_hz(50); - screen.set_size(480, 128); - screen.set_visarea(0, 480-1, 0, 128-1); + screen.set_size(640, 201); + screen.set_visarea(0, 640-1, 0, 201-1); screen.set_palette("palette"); screen.set_screen_update("lcdc", FUNC(sed1330_device::screen_update)); |