apple/macpwrbk030.cpp: convert macpb180c to use a WD90C26 VGA device

This commit is contained in:
angelosa 2023-07-15 00:32:32 +02:00
parent f9d675e5ea
commit 778f805f6a
5 changed files with 121 additions and 83 deletions

View File

@ -941,6 +941,18 @@ if (VIDEOS["PC_VGA_PARADISE"]~=null) then
}
end
--------------------------------------------------
--
--@src/devices/video/wd90c26.h,VIDEOS["WD90C26"] = true
--------------------------------------------------
if (VIDEOS["WD90C26"]~=null) then
files {
MAME_DIR .. "src/devices/video/wd90c26.cpp",
MAME_DIR .. "src/devices/video/wd90c26.h",
}
end
--------------------------------------------------
--
--@src/devices/video/pc_vga_s3.h,VIDEOS["PC_VGA_S3"] = true

View File

@ -11,11 +11,10 @@ Paradise / Western Digital (S)VGA chipsets
- WD90C30-LR
- WD90C31-LR / WD90C31-ZS / WD90C31A-LR / WD90C31A-ZS
- WD90C33-ZZ
- WD90C24A-ZZ / WD90C24A2-ZZ / WD90C26A (cfr. video/wd90c26.cpp)
TODO:
- WD90C24A-ZZ / WD90C24A2-ZZ (mobile chips, no ISA option)
- WD90C26A (apple/macpwrbk030.cpp macpb180c, no ISA)
- WD9710-MZ (PCI + MPEG-1, a.k.a. Pipeline 9710 / 9712)
- WD9710-MZ (PCI + MPEG-1, a.k.a. Pipeline 9710 / 9712, to be added in specific sub-file as well)
- 'C31A difference compared to 'C31 (just "reserved" PR35?);
- Emulate new features of 'C31 & 'C33;
@ -110,7 +109,7 @@ void pvga1a_vga_device::mem_w(offs_t offset, uint8_t data)
u8 pvga1a_vga_device::gc_data_r(offs_t offset)
{
if (m_ega_compatible_mode && vga.gc.index >= 9 && vga.gc.index <= 0xe)
if (m_ega_compatible_mode && vga.gc.index >= 9 && vga.gc.index <= 0xe && !machine().side_effects_disabled())
{
LOGLOCKED("Attempt to read ext. GC register offset [%02x] while locked\n", vga.gc.index);
return 0xff;
@ -120,7 +119,7 @@ u8 pvga1a_vga_device::gc_data_r(offs_t offset)
void pvga1a_vga_device::gc_data_w(offs_t offset, u8 data)
{
if (!m_ext_gc_unlock && vga.gc.index >= 9 && vga.gc.index <= 0xe)
if (!m_ext_gc_unlock && vga.gc.index >= 9 && vga.gc.index <= 0xe && !machine().side_effects_disabled())
{
LOGLOCKED("Attempt to write ext. GC register offset [%02x] <- %02x while locked\n", vga.gc.index, data);
return;
@ -333,7 +332,8 @@ void wd90c00_vga_device::crtc_map(address_map &map)
map(0x2a, 0x3f).view(m_ext_crtc_view);
m_ext_crtc_view[0](0x2a, 0x3f).lr8(
NAME([this] (offs_t offset) {
LOGLOCKED("Attempt to R ext. CRTC register offset %02x while locked\n", offset + 0x2a);
if (!machine().side_effects_disabled())
LOGLOCKED("Attempt to R ext. CRTC register offset %02x while locked\n", offset + 0x2a);
return 0xff;
})
);
@ -525,7 +525,8 @@ void wd90c11a_vga_device::sequencer_map(address_map &map)
map(0x07, 0x1f).view(m_ext_seq_view);
m_ext_seq_view[0](0x07, 0x1f).lr8(
NAME([this] (offs_t offset) {
LOGLOCKED("Attempt to R ext. Sequencer register offset %02x while locked\n", offset + 0x07);
if (!machine().side_effects_disabled())
LOGLOCKED("Attempt to R ext. Sequencer register offset %02x while locked\n", offset + 0x07);
return 0xff;
})
);

View File

@ -0,0 +1,62 @@
// license:BSD-3-Clause
// copyright-holders:Angelo Salese
/**************************************************************************************************
Paradise / Western Digital SVGA LCD chipsets variants
TODO:
- WD90C24;
- Locking for extra GC addresses;
**************************************************************************************************/
#include "emu.h"
#include "wd90c26.h"
DEFINE_DEVICE_TYPE(WD90C26, wd90c26_vga_device, "wd90c26_vga", "Western Digital WD90C26 VGA Controller")
wd90c26_vga_device::wd90c26_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: wd90c11a_vga_device(mconfig, WD90C26, tag, owner, clock)
{
m_crtc_space_config = address_space_config("crtc_regs", ENDIANNESS_LITTLE, 8, 8, 0, address_map_constructor(FUNC(wd90c26_vga_device::crtc_map), this));
m_gc_space_config = address_space_config("gc_regs", ENDIANNESS_LITTLE, 8, 8, 0, address_map_constructor(FUNC(wd90c26_vga_device::gc_map), this));
m_seq_space_config = address_space_config("sequencer_regs", ENDIANNESS_LITTLE, 8, 8, 0, address_map_constructor(FUNC(wd90c26_vga_device::sequencer_map), this));
}
// PR0:PR5, PR10:PR17, PR20:PR21, PR31:PR32 assumed same as derived class
void wd90c26_vga_device::crtc_map(address_map &map)
{
wd90c11a_vga_device::crtc_map(map);
// m_ext_crtc_view[1](0x31, 0x31) PR18 Flat Panel Status
// m_ext_crtc_view[1](0x32, 0x33) PR19/PR1A Flat Panel Control
// m_ext_crtc_view[1](0x34, 0x34) PR1B Flat Panel Unlock
// m_ext_crtc_view[1](0x35, 0x35) PR30 Mapping RAM Unlock
// m_ext_crtc_view[1](0x37, 0x37) PR41 Vertical Expansion Initial Value
// m_ext_crtc_view[1](0x38, 0x38) PR33 Mapping RAM Address Counter
// m_ext_crtc_view[1](0x39, 0x39) PR34 Mapping RAM Data
// m_ext_crtc_view[1](0x3a, 0x3a) PR35 Mapping RAM Control and Power-Down
// m_ext_crtc_view[1](0x3b, 0x3b) PR36 LCD Panel Height Select
// m_ext_crtc_view[1](0x3c, 0x3c) PR37 Flat Panel Blinking Control
// m_ext_crtc_view[1](0x3e, 0x3e) PR39 Color LCD Control
// m_ext_crtc_view[1](0x3f, 0x3f) PR44 Power-Down Memory Refresh Control
}
void wd90c26_vga_device::gc_map(address_map &map)
{
wd90c11a_vga_device::gc_map(map);
// map(0x10, 0x11) PR57/PR58 WD90C26 Feature Register I/II
// map(0x12, 0x12) PR59 Memory Arbitration Cycle Setup
// map(0x15, 0x15) PR62 FR Timing
}
void wd90c26_vga_device::sequencer_map(address_map &map)
{
wd90c11a_vga_device::sequencer_map(map);
m_ext_seq_view[1](0x08, 0x08).unmaprw(); // undefined, assume unmapped
m_ext_seq_view[1](0x09, 0x09).unmaprw(); // ^
// m_ext_seq_view[1](0x10, 0x10) PR30A Memory Interface Write Buffer & FIFO Control
// m_ext_seq_view[1](0x14, 0x14) PR34A Video Memory Virtual Page
// m_ext_seq_view[1](0x16, 0x16) PR45 Video Signature Control
// m_ext_seq_view[1](0x17, 0x18) PR45A/PR45B Signature Analyzer
}

View File

@ -0,0 +1,24 @@
// license:BSD-3-Clause
// copyright-holders:Angelo Salese
#ifndef MAME_VIDEO_WD902C26_H
#define MAME_VIDEO_WD902C26_H
#pragma once
#include "video/pc_vga_paradise.h"
class wd90c26_vga_device : public wd90c11a_vga_device
{
public:
wd90c26_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
virtual void crtc_map(address_map &map) override;
virtual void gc_map(address_map &map) override;
virtual void sequencer_map(address_map &map) override;
};
DECLARE_DEVICE_TYPE(WD90C26, wd90c26_vga_device)
#endif // MAME_VIDEO_WD902C26_H

View File

@ -121,6 +121,7 @@
#include "machine/nscsi_bus.h"
#include "bus/nscsi/devices.h"
#include "sound/asc.h"
#include "video/wd90c26.h"
#include "emupal.h"
#include "screen.h"
@ -156,7 +157,8 @@ public:
m_palette(*this, "palette"),
m_asc(*this, "asc"),
m_scc(*this, "scc"),
m_vram(*this, "vram")
m_vram(*this, "vram"),
m_vga(*this, "vga")
{
}
@ -191,14 +193,14 @@ private:
required_device<palette_device> m_palette;
required_device<asc_device> m_asc;
required_device<z80scc_device> m_scc;
required_shared_ptr<u32> m_vram;
optional_shared_ptr<u32> m_vram;
optional_device<wd90c26_vga_device> m_vga;
virtual void machine_start() override;
virtual void machine_reset() override;
u32 screen_update_macpb140(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
u32 screen_update_macpb160(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
u32 screen_update_macpbwd(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
u32 *m_ram_ptr = nullptr, *m_rom_ptr = nullptr;
u32 m_ram_mask = 0, m_ram_size = 0, m_rom_size = 0;
@ -280,11 +282,6 @@ private:
void mac_gsc_w(uint8_t data);
void macgsc_palette(palette_device &palette) const;
uint8_t macwd_r(offs_t offset);
void macwd_w(offs_t offset, uint8_t data);
u32 m_colors[3]{}, m_count = 0, m_clutoffs = 0, m_wd_palette[256]{};
u8 m_pmu_via_bus = 0, m_pmu_ack = 0, m_pmu_req = 0;
u8 pmu_data_r() { return m_pmu_via_bus; }
void pmu_data_w(u8 data)
@ -494,23 +491,6 @@ u32 macpb030_state::screen_update_macpb160(screen_device &screen, bitmap_ind16 &
return 0;
}
u32 macpb030_state::screen_update_macpbwd(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) /* Color PowerBooks using an off-the-shelf WD video chipset */
{
u8 const *vram8 = (uint8_t *)m_vram.target();
for (int y = 0; y < 480; y++)
{
u32 *line = &bitmap.pix(y);
for (int x = 0; x < 640; x++)
{
u8 const pixels = vram8[(y * 640) + (BYTE4_XOR_BE(x))];
*line++ = m_wd_palette[pixels];
}
}
return 0;
}
u16 macpb030_state::mac_via_r(offs_t offset)
{
u16 data;
@ -695,52 +675,6 @@ void macpb030_state::mac_gsc_w(uint8_t data)
{
}
uint8_t macpb030_state::macwd_r(offs_t offset)
{
switch (offset)
{
case 0x3da: // VGA "Input Status 1"
if (m_screen->vblank())
{
return 0x8;
}
else
{
return 0;
}
default:
// printf("macwd_r: @ %x, mask %08x (PC=%x)\n", offset, mem_mask, m_maincpu->pc());
break;
}
return 0;
}
void macpb030_state::macwd_w(offs_t offset, uint8_t data)
{
switch (offset)
{
case 0x3c8: // VGA palette address
m_clutoffs = data;
m_count = 0;
break;
case 0x3c9: // VGA palette data
m_colors[m_count++] = (data & 0x3f) << 2;
if (m_count == 3)
{
m_wd_palette[m_clutoffs] = rgb_t(m_colors[0], m_colors[1], m_colors[2]);
m_clutoffs++;
m_count = 0;
}
break;
default:
//printf("macwd_w: %x @ %x (PC=%x)\n", data, offset, m_maincpu->pc());
break;
}
}
/***************************************************************************
ADDRESS MAPS
****************************************************************************/
@ -797,8 +731,9 @@ void macpb030_state::macpb165c_map(address_map &map)
map(0x50f24000, 0x50f27fff).r(FUNC(macpb030_state::buserror_r)); // bus error here to make sure we aren't mistaken for another decoder
// on-board color video on 165c/180c
map(0xfc000000, 0xfc07ffff).ram().share("vram").mirror(0x00380000); // 512k of VRAM
map(0xfc400000, 0xfc7fffff).rw(FUNC(macpb030_state::macwd_r), FUNC(macpb030_state::macwd_w));
map(0xfc000000, 0xfc07ffff).rw(m_vga, FUNC(wd90c26_vga_device::mem_linear_r), FUNC(wd90c26_vga_device::mem_linear_w)).mirror(0x00380000); // 512k of VRAM
// map(0xfc400000, 0xfc7fffff).rw(FUNC(macpb030_state::macwd_r), FUNC(macpb030_state::macwd_w));
map(0xfc4003b0, 0xfc4003df).m(m_vga, FUNC(wd90c26_vga_device::io_map));
// something else video related? is at fc800000
map(0xfcff8000, 0xfcffffff).rom().region("vrom", 0x0000);
}
@ -1103,10 +1038,14 @@ void macpb030_state::macpb180c(machine_config &config)
m_maincpu->set_clock(33000000);
m_maincpu->set_addrmap(AS_PROGRAM, &macpb030_state::macpb165c_map);
m_screen->set_size(800, 525);
m_screen->set_visarea(0, 640 - 1, 0, 480 - 1);
m_screen->set_screen_update(FUNC(macpb030_state::screen_update_macpbwd));
m_screen->set_raw(25.175_MHz_XTAL, 800, 0, 640, 524, 0, 480);
m_screen->set_screen_update("vga", FUNC(wd90c26_vga_device::screen_update));
m_screen->set_no_palette();
WD90C26(config, m_vga, 0);
m_vga->set_screen(m_screen);
// 512KB
m_vga->set_vram_size(0x80000);
}
void macpb030_state::macpd210(machine_config &config)