summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author angelosa <lordkale4@gmail.com>2026-01-18 15:02:35 +0100
committer angelosa <lordkale4@gmail.com>2026-01-18 15:02:43 +0100
commit7a1ed354d25215dc21e5c0336c542db4a010eb32 (patch)
treea1b2729f689b298068e22f39962c1badb41f1119
parente1f7f1c641b93509ee6e73f4670d58f6f858ae3b (diff)
misc/3do.cpp: move drawing into Amy
-rw-r--r--src/devices/bus/a800/a800_carts.cpp2
-rw-r--r--src/mame/misc/3do.cpp6
-rw-r--r--src/mame/misc/3do.h1
-rw-r--r--src/mame/misc/3do_amy.cpp81
-rw-r--r--src/mame/misc/3do_amy.h13
-rw-r--r--src/mame/misc/3do_clio.cpp4
-rw-r--r--src/mame/misc/3do_m.cpp50
-rw-r--r--src/mame/misc/3do_madam.cpp68
-rw-r--r--src/mame/misc/3do_madam.h1
9 files changed, 134 insertions, 92 deletions
diff --git a/src/devices/bus/a800/a800_carts.cpp b/src/devices/bus/a800/a800_carts.cpp
index a497da257d9..5e867667af6 100644
--- a/src/devices/bus/a800/a800_carts.cpp
+++ b/src/devices/bus/a800/a800_carts.cpp
@@ -86,7 +86,7 @@ void a800_left(device_slot_interface &device)
// converts analog mono sound to digital by reading $d500 low 4 bitset
// device.option_add( "ad_converter", A800_AD_CONVERTER);
device.option_add( "supercharger", A800_SUPER_CHARGER);
- // The PILL! / Super PILL! / Super Cart with RD4/RD5 held high and that's about it (lolwut)
+ // The PILL! / Super PILL! / Super Cart with RD4/RD5 held high, cart copier thru own floppy based program
// device.option_add( "pill", A800_PILL);
// Thompson Proburner, EPROM burner
// device.option_add( "proburner", A800_PROBURNER);
diff --git a/src/mame/misc/3do.cpp b/src/mame/misc/3do.cpp
index e78401cc251..24f40be9867 100644
--- a/src/mame/misc/3do.cpp
+++ b/src/mame/misc/3do.cpp
@@ -269,7 +269,7 @@ void _3do_state::_3do(machine_config &config)
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
// TODO: proper params (mostly running in interlace mode)
m_screen->set_raw(X2_CLOCK_NTSC / 2, 1592, 254, 1534, 263, 22, 262);
- m_screen->set_screen_update(FUNC(_3do_state::screen_update));
+ m_screen->set_screen_update(m_amy, FUNC(amy_device::screen_update));
SPEAKER(config, "speaker", 2).front();
}
@@ -286,8 +286,8 @@ void _3do_state::_3do_pal(machine_config &config)
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
// TODO: proper params
- m_screen->set_raw(X2_CLOCK_PAL / 2, 1592, 254, 1534, 263, 22, 262);
- m_screen->set_screen_update(FUNC(_3do_state::screen_update));
+ m_screen->set_raw(X2_CLOCK_PAL / 2, 1592, 254, 1534, 313, 22, 312);
+ m_screen->set_screen_update(m_amy, FUNC(amy_device::screen_update));
SPEAKER(config, "speaker", 2).front();
}
diff --git a/src/mame/misc/3do.h b/src/mame/misc/3do.h
index a56512469f2..3371821389e 100644
--- a/src/mame/misc/3do.h
+++ b/src/mame/misc/3do.h
@@ -96,7 +96,6 @@ private:
void slow2_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
uint32_t svf_r(offs_t offset);
void svf_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
- uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void main_mem(address_map &map) ATTR_COLD;
diff --git a/src/mame/misc/3do_amy.cpp b/src/mame/misc/3do_amy.cpp
index 42cab839c4c..27520b4ad52 100644
--- a/src/mame/misc/3do_amy.cpp
+++ b/src/mame/misc/3do_amy.cpp
@@ -10,27 +10,102 @@ DEFINE_DEVICE_TYPE(AMY, amy_device, "amy", "3DO DA9103KPJ-XN \"Amy\" Digital Col
amy_device::amy_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, AMY, tag, owner, clock)
, device_video_interface(mconfig, *this)
-// , device_memory_interface(mconfig, *this)
{
}
void amy_device::device_start()
{
screen().register_screen_bitmap(m_bitmap);
+
+ save_item(NAME(m_is_dac_enabled));
}
void amy_device::device_reset()
{
+ m_is_dac_enabled = false;
+}
+
+void amy_device::clut_write(u32 data)
+{
+ const u8 reg = data >> 24;
+
+ //printf("%02x %06x\n",reg, data & 0xffffff);
+
+ // to color CLUT
+ if (!BIT(reg, 7))
+ {
+ const u8 which = reg & 0x1f;
+
+ switch(reg & 0x60)
+ {
+ case 0x00:
+ m_custom_clut[which].r = (data >> 16) & 0xff;
+ m_custom_clut[which].g = (data >> 8) & 0xff;
+ m_custom_clut[which].b = (data >> 0) & 0xff;
+ break;
+ case 0x20:
+ m_custom_clut[which].b = (data >> 0) & 0xff;
+ break;
+ case 0x40:
+ m_custom_clut[which].g = (data >> 8) & 0xff;
+ break;
+ case 0x60:
+ m_custom_clut[which].r = (data >> 16) & 0xff;
+ break;
+ }
+ }
+ else
+ {
+ // TODO: background color (0xe0) & control word (0xc0)
+ }
}
void amy_device::pixel_xfer(int x, int y, u16 dot)
{
- // ...
+ u8 r, g, b;
+
+ // TODO: modes thru functional fns
+ r = m_custom_clut[(dot & 0x7c00) >> 10].r;
+ g = m_custom_clut[(dot & 0x03e0) >> 5].g;
+ b = m_custom_clut[(dot & 0x001f) >> 0].b;
+
+
+ //r = (dot & 0x7c00) >> 10;
+ //g = (dot & 0x03e0) >> 5;
+ //b = (dot & 0x001f) >> 0;
+ //r = (r << 3) | (r & 7);
+ //g = (g << 3) | (g & 7);
+ //b = (b << 3) | (b & 7);
+
+ const u32 pix = r << 16 | g << 8 | b;
+
+ for (int xi = 0; xi < 4; xi++)
+ m_bitmap.pix(y, x * 4 + xi + 254) = pix;
+}
+
+void amy_device::blank_line(int y)
+{
+ const rectangle clip(0, y, 1592, y + 1);
+
+ // TODO: vblank color really
+ m_bitmap.fill(rgb_t::black(), clip);
+}
+
+void amy_device::dac_enable(bool enabled)
+{
+ m_is_dac_enabled = enabled;
}
u32 amy_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- copyrozbitmap(bitmap, cliprect, m_bitmap, 0, 0, 0x4000, 0, 0, 0x10000, false);
+ if (!m_is_dac_enabled)
+ {
+ // TODO: vblank or background color
+ bitmap.fill(rgb_t::black(), cliprect);
+ return 0;
+ }
+
+ copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect);
return 0;
}
diff --git a/src/mame/misc/3do_amy.h b/src/mame/misc/3do_amy.h
index c2e30bfd1e0..213d9943892 100644
--- a/src/mame/misc/3do_amy.h
+++ b/src/mame/misc/3do_amy.h
@@ -10,27 +10,28 @@
class amy_device : public device_t
, public device_video_interface
- //, public device_memory_interface
{
public:
- // construction/destruction
amy_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
void pixel_xfer(int x, int y, u16 dot);
+ void blank_line(int y);
+ void dac_enable(bool enabled);
+ void clut_write(u32 data);
u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
protected:
- // device-level overrides
virtual void device_start() override ATTR_COLD;
virtual void device_reset() override ATTR_COLD;
-// virtual space_config_vector memory_space_config() const override;
private:
-// void clut_map(address_map &map) ATTR_COLD;
-// const address_space_config m_space_clut_config;
bitmap_rgb32 m_bitmap;
+ bool m_is_dac_enabled;
+ struct {
+ u8 r, g, b;
+ } m_custom_clut[32];
};
DECLARE_DEVICE_TYPE(AMY, amy_device)
diff --git a/src/mame/misc/3do_clio.cpp b/src/mame/misc/3do_clio.cpp
index 246c245b792..9000fa9f2d6 100644
--- a/src/mame/misc/3do_clio.cpp
+++ b/src/mame/misc/3do_clio.cpp
@@ -582,11 +582,11 @@ TIMER_CALLBACK_MEMBER(clio_device::scan_timer_cb)
{
m_vsync_cb(1);
}
- else if (scanline == 21)
+ else if (scanline == 22 - 6)
{
m_vsync_cb(0);
}
- else if (scanline >= 22)
+ else if (scanline > 22 - 6)
{
m_hsync_cb(1);
m_hsync_cb(0);
diff --git a/src/mame/misc/3do_m.cpp b/src/mame/misc/3do_m.cpp
index 710a4f3f208..dbcab7be80a 100644
--- a/src/mame/misc/3do_m.cpp
+++ b/src/mame/misc/3do_m.cpp
@@ -231,56 +231,6 @@ void _3do_state::video_start()
}
-// TODO: move to madam
-uint32_t _3do_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
-{
- uint32_t *source_p = m_vram + 0x1c0000 / 4;
-
- for ( int y = 0; y < 120; y++ )
- {
- uint32_t *dest_p0 = &bitmap.pix(22 + y * 2, 254 );
- uint32_t *dest_p1 = &bitmap.pix(22 + y * 2 + 1, 254 );
-
- for ( int x = 0; x < 320; x++ )
- {
- /* Every dword contains two pixels, upper word is top pixel, lower is bottom. */
- uint32_t lower = *source_p & 0xffff;
- uint32_t upper = ( *source_p >> 16 ) & 0xffff;
- int r, g, b;
-
- /* Format is RGB555 */
- r = (upper & 0x7c00) >> 10;
- g = (upper & 0x03e0) >> 5;
- b = (upper & 0x001f) >> 0;
- r = (r << 3) | (r & 7);
- g = (g << 3) | (g & 7);
- b = (b << 3) | (b & 7);
-
- dest_p0[0] = r << 16 | g << 8 | b;
- dest_p0[1] = r << 16 | g << 8 | b;
- dest_p0[2] = r << 16 | g << 8 | b;
- dest_p0[3] = r << 16 | g << 8 | b;
-
- r = (lower & 0x7c00) >> 10;
- g = (lower & 0x03e0) >> 5;
- b = (lower & 0x001f) >> 0;
- r = (r << 3) | (r & 7);
- g = (g << 3) | (g & 7);
- b = (b << 3) | (b & 7);
-
- dest_p1[0] = r << 16 | g << 8 | b;
- dest_p1[1] = r << 16 | g << 8 | b;
- dest_p1[2] = r << 16 | g << 8 | b;
- dest_p1[3] = r << 16 | g << 8 | b;
-
- source_p++;
- dest_p0 += 4;
- dest_p1 += 4;
- }
- }
-
- return 0;
-}
/*
*
diff --git a/src/mame/misc/3do_madam.cpp b/src/mame/misc/3do_madam.cpp
index ed82c63579d..5e9ee144a72 100644
--- a/src/mame/misc/3do_madam.cpp
+++ b/src/mame/misc/3do_madam.cpp
@@ -129,10 +129,10 @@ void madam_device::map(address_map &map)
// 0x0044: Anvil "feature"
// CEL engine
-// map(0x0100, 0x0103) SPRSTRT - Start the CEL engine (W)
-// map(0x0104, 0x0107) SPRSTOP - Stop the CEL engine (W)
-// map(0x0108, 0x010b) SPRCNTU - Continue the CEL engine (W)
-// map(0x010c, 0x010f) SPRPAUS - Pause the CEL engine (W)
+// map(0x0100, 0x0103) SPRSTRT - Start the CEL engine (W)
+// map(0x0104, 0x0107) SPRSTOP - Stop the CEL engine (W)
+// map(0x0108, 0x010b) SPRCNTU - Continue the CEL engine (W)
+// map(0x010c, 0x010f) SPRPAUS - Pause the CEL engine (W)
map(0x0110, 0x0113).lrw32(
NAME([this] () { return m_ccobctl0; }),
NAME([this] (offs_t offset, u32 data, u32 mem_mask) {
@@ -334,7 +334,7 @@ void madam_device::map(address_map &map)
})
);
map(0x07f8, 0x07fb).lr32(NAME([this] () { return m_mult_status; }));
-// map(0x07fc, 0x07ff) start process
+// map(0x07fc, 0x07ff) start process
}
u32 madam_device::mctl_r()
@@ -364,6 +364,8 @@ void madam_device::mctl_w(offs_t offset, u32 data, u32 mem_mask)
LOG("mctl: Player bus DMA abort?\n");
m_dma_playerbus_timer->adjust(attotime::never);
}
+
+ m_amy->dac_enable(!!BIT(data, 13));
}
if (data != 0x0001e000)
@@ -407,13 +409,22 @@ TIMER_CALLBACK_MEMBER(madam_device::dma_playerbus_cb)
void madam_device::vdlp_start_w(int state)
{
// PLAYXEN
- if (!state || !BIT(m_mctl, 14))
+ if (state || !BIT(m_mctl, 14))
+ {
+ m_vdlp.fetch = false;
return;
+ }
+
+// if (m_vdlp.address == m_dma[24][0])
+// {
+// m_vdlp.fetch = false;
+// return;
+// }
m_vdlp.address = m_dma[24][0];
m_vdlp.scanlines = 0;
m_vdlp.fetch = true;
- m_vdlp.y_dest = 0;
+ m_vdlp.y_dest = 6;
LOGVDLP("VDLP start %08x\n", m_vdlp.address);
}
@@ -443,11 +454,11 @@ void madam_device::vdlp_continue_w(int state)
return;
}
- // TODO: upper limit of 34 due of hblank
- m_vdlp.clut_words = (control_word >> 9) & 0x1f;
+ // upper limit of 34 due of hblank
+ const u16 clut_words = std::min<u16>((control_word >> 9) & 0x3f, 34) << 2;
static const u16 modulo_values[8] = { 320, 384, 512, 640, 1024, 1, 1, 1 };
- m_vdlp.modulo = modulo_values[(control_word >> 23) & 7];
- if (m_vdlp.modulo == 1)
+ m_vdlp.modulo = modulo_values[(control_word >> 23) & 7] >> 1;
+ if (m_vdlp.modulo == 0)
{
m_vdlp.fetch = false;
popmessage("3do_madam.cpp: undocumented modulo fetch %08x", (control_word >> 23) & 7);
@@ -457,11 +468,11 @@ void madam_device::vdlp_continue_w(int state)
const bool current_fb = !!BIT(control_word, 16);
m_vdlp.video_dma = !!BIT(control_word, 21);
- LOGVDLP("line=%d Control word %08x\n", m_vdlp.y_dest, control_word);
+ LOGVDLP("%08x: line=%d Control word %08x\n", m_vdlp.address, m_vdlp.y_dest, control_word);
LOGVDLP(" scanline length %d mode=%d| CLUT words %02x FB mode %d|%d|%d|%d video DMA %d| modulo %d\n"
, m_vdlp.scanlines
, BIT(control_word, 19) ? 480 : 240
- , m_vdlp.clut_words
+ , clut_words
, !!BIT(control_word, 15) // previous FB
, current_fb
, !!BIT(control_word, 17) // previous modulo
@@ -479,26 +490,33 @@ void madam_device::vdlp_continue_w(int state)
}
// TODO: previous fb handling
- // TODO: CLUT transfer to AMY
+
+ // CLUT transfers
+ for (int c = 0; c < clut_words; c+= 4)
+ m_amy->clut_write(m_dma_read_cb(m_vdlp.address + 0x10 + c));
m_vdlp.link = m_dma_read_cb(m_vdlp.address + 0x0c);
m_vdlp.y_src = 0;
}
- // TODO: FB transfers to AMY here
- // if (m_vdlp.video_dma)
- // {
- // u32 y_base = (m_vdlp.y_src & ~1) * m_vdlp.modulo;
- // u8 shift = (m_vdlp.y_src & 1) * 16;
- // for (int x = 0; x < 320; x++)
- // {
- // const u32 dot = m_dma_read_cb(m_vdlp.fb_address + ((x + y_base) << 2));
- // m_amy->pixel_xfer(x, m_vdlp.y_dest, dot >> shift);
- // }
- // }
+ if (m_vdlp.video_dma)
+ {
+ u32 y_base = (m_vdlp.y_src & ~1) * (m_vdlp.modulo);
+ u8 shift = ((m_vdlp.y_src & 1) ^ 1) * 16;
+ for (int x = 0; x < 320; x++)
+ {
+ const u32 dot = m_dma_read_cb(m_vdlp.fb_address + ((x + y_base) << 2));
+ m_amy->pixel_xfer(x, m_vdlp.y_dest, dot >> shift);
+ }
+ }
+ else
+ m_amy->blank_line(m_vdlp.y_dest);
+
m_vdlp.scanlines --;
m_vdlp.y_dest ++;
m_vdlp.y_src ++;
if (m_vdlp.scanlines == 0)
+ {
m_vdlp.address = m_vdlp.link;
+ }
}
diff --git a/src/mame/misc/3do_madam.h b/src/mame/misc/3do_madam.h
index 983446b1b88..967f9b292ae 100644
--- a/src/mame/misc/3do_madam.h
+++ b/src/mame/misc/3do_madam.h
@@ -75,7 +75,6 @@ private:
struct {
u32 address;
u16 scanlines;
- u16 clut_words;
u16 modulo;
u32 fb_address;
bool fetch;