summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author angelosa <lordkale4@gmail.com>2022-05-25 00:40:12 +0200
committer angelosa <lordkale4@gmail.com>2022-05-25 00:40:12 +0200
commitfd248a15b84b1f4079a2442bd8b746ccb4961394 (patch)
treeb2de99cb8e5c50656e155f60ba128093bab08ee2
parentad1aabe7d161ce4d740db3faaa25d240aeca7c7e (diff)
pc9821.cpp: start exposing PEGC 256 color mode, fixes at very least aitdpc98floppy
-rw-r--r--src/mame/drivers/pc9821.cpp45
-rw-r--r--src/mame/includes/pc9801.h5
-rw-r--r--src/mame/includes/pc9821.h4
3 files changed, 49 insertions, 5 deletions
diff --git a/src/mame/drivers/pc9821.cpp b/src/mame/drivers/pc9821.cpp
index 648c38c00c3..067d0f0c2a2 100644
--- a/src/mame/drivers/pc9821.cpp
+++ b/src/mame/drivers/pc9821.cpp
@@ -45,6 +45,48 @@
#include "emu.h"
#include "includes/pc9821.h"
+uint32_t pc9821_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
+{
+ bitmap.fill(m_palette->black_pen(), cliprect);
+
+ // PEGC 256 mode
+ // TODO: elaborate
+ // TODO: getter cliprect from bitmap GDC
+ if(m_video_ff[DISPLAY_REG] != 0)
+ {
+ if (m_ex_video_ff[ANALOG_256_MODE])
+ {
+ rgb_t const *const palette = m_palette->palette()->entry_list_raw();
+ u16 *ext_gvram = (u16 *)m_ext_gvram.target();
+ int base_y = cliprect.min_y;
+
+ for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
+ {
+ for (int x = cliprect.min_x; x <= cliprect.max_x; x += 8)
+ {
+ u32 address = (y - base_y) * (640 / 8) + (x / 8);
+ for(int xi = 0; xi < 8; xi += 2)
+ {
+ int res_x = x + xi;
+ int res_y = y;
+
+ u16 pen = ext_gvram[(address << 2) + (xi >> 1) + (m_vram_disp * 0x20000)];
+
+ bitmap.pix(res_y, res_x + 0) = palette[(pen & 0xff) + 0x20];
+ bitmap.pix(res_y, res_x + 1) = palette[(pen >> 8) + 0x20];
+ }
+ }
+ }
+ }
+ else
+ m_hgdc[1]->screen_update(screen, bitmap, cliprect);
+ }
+ m_hgdc[0]->screen_update(screen, bitmap, cliprect);
+
+ return 0;
+}
+
+#if 0
UPD7220_DISPLAY_PIXELS_MEMBER( pc9821_state::pegc_display_pixels )
{
if(m_ex_video_ff[ANALOG_256_MODE])
@@ -69,6 +111,7 @@ UPD7220_DISPLAY_PIXELS_MEMBER( pc9821_state::pegc_display_pixels )
else
pc9801_state::hgdc_display_pixels(bitmap, y, x, address);
}
+#endif
void pc9821_state::pc9821_egc_w(offs_t offset, u16 data, u16 mem_mask)
{
@@ -665,7 +708,7 @@ void pc9821_state::pc9821(machine_config &config)
PALETTE(config.replace(), m_palette, FUNC(pc9821_state::pc9801_palette), 16 + 16 + 256);
- m_hgdc[1]->set_display_pixels(FUNC(pc9821_state::pegc_display_pixels));
+// m_hgdc[1]->set_display_pixels(FUNC(pc9821_state::pegc_display_pixels));
}
void pc9821_mate_a_state::pc9821as(machine_config &config)
diff --git a/src/mame/includes/pc9801.h b/src/mame/includes/pc9801.h
index d82314e7aa3..7eebb801619 100644
--- a/src/mame/includes/pc9801.h
+++ b/src/mame/includes/pc9801.h
@@ -321,9 +321,8 @@ private:
uint8_t txt_scrl_r(offs_t offset);
void txt_scrl_w(offs_t offset, uint8_t data);
- // TODO: make this virtual
- // (necessary for H98 high-reso mode, PC9821-E02, SVGA binds)
- uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
+ // virtual is necessary for H98 high-reso mode, PC9821-E02, SVGA binds
+ virtual uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
uint8_t m_font_line = 0;
std::unique_ptr<uint16_t[]> m_tvram;
diff --git a/src/mame/includes/pc9821.h b/src/mame/includes/pc9821.h
index 744b5656e1f..30d2b4c2357 100644
--- a/src/mame/includes/pc9821.h
+++ b/src/mame/includes/pc9821.h
@@ -56,7 +56,9 @@ private:
void pc9821_egc_w(offs_t offset, u16 data, u16 mem_mask = ~0);
- UPD7220_DISPLAY_PIXELS_MEMBER( pegc_display_pixels );
+ virtual uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) override;
+
+// UPD7220_DISPLAY_PIXELS_MEMBER( pegc_display_pixels );
};
// MATE A