diff options
author | cracyc <cracyc@users.noreply.github.com> | 2014-11-04 19:39:38 -0600 |
---|---|---|
committer | cracyc <cracyc@users.noreply.github.com> | 2014-11-04 19:39:38 -0600 |
commit | f064ff99823d2b3582667db9027a82fbc36445af (patch) | |
tree | f30ada00048fb77d4da11acb6701d2dba96e1e49 | |
parent | 8ed26fea73457e781c067fbe253faac814e18870 (diff) |
(mess) num9rev: add number 9 revolution 512x32 [Carl]
---
Only the demo programs tested for now
-rw-r--r-- | src/emu/bus/bus.mak | 1 | ||||
-rw-r--r-- | src/emu/bus/isa/isa_cards.c | 2 | ||||
-rw-r--r-- | src/emu/bus/isa/isa_cards.h | 1 | ||||
-rw-r--r-- | src/emu/bus/isa/num9rev.c | 318 | ||||
-rw-r--r-- | src/emu/bus/isa/num9rev.h | 61 | ||||
-rw-r--r-- | src/emu/video/upd7220.c | 15 | ||||
-rw-r--r-- | src/emu/video/upd7220.h | 2 |
7 files changed, 393 insertions, 7 deletions
diff --git a/src/emu/bus/bus.mak b/src/emu/bus/bus.mak index 45cb07c3fe3..78180db84d4 100644 --- a/src/emu/bus/bus.mak +++ b/src/emu/bus/bus.mak @@ -511,6 +511,7 @@ BUSOBJS += $(BUSOBJ)/isa/xsu_cards.o BUSOBJS += $(BUSOBJ)/isa/sc499.o BUSOBJS += $(BUSOBJ)/isa/aga.o BUSOBJS += $(BUSOBJ)/isa/svga_trident.o +BUSOBJS += $(BUSOBJ)/isa/num9rev.o endif #------------------------------------------------- diff --git a/src/emu/bus/isa/isa_cards.c b/src/emu/bus/isa/isa_cards.c index 5913486424a..4bd09ba9c7f 100644 --- a/src/emu/bus/isa/isa_cards.c +++ b/src/emu/bus/isa/isa_cards.c @@ -19,6 +19,7 @@ SLOT_INTERFACE_START( pc_isa8_cards ) SLOT_INTERFACE("aga_pc200", ISA8_AGA_PC200) SLOT_INTERFACE("ega", ISA8_EGA) SLOT_INTERFACE("svga_et4k", ISA8_SVGA_ET4K) + SLOT_INTERFACE("num9rev",ISA8_NUM_9_REV) SLOT_INTERFACE("com", ISA8_COM) SLOT_INTERFACE("fdc", ISA8_FDC_SUPERIO) SLOT_INTERFACE("fdc_xt", ISA8_FDC_XT) @@ -57,6 +58,7 @@ SLOT_INTERFACE_START( pc_isa16_cards ) SLOT_INTERFACE("vga", ISA8_VGA) SLOT_INTERFACE("svga_et4k", ISA8_SVGA_ET4K) SLOT_INTERFACE("svga_dm",ISA8_SVGA_CIRRUS) + SLOT_INTERFACE("num9rev",ISA8_NUM_9_REV) SLOT_INTERFACE("com", ISA8_COM) SLOT_INTERFACE("comat", ISA8_COM_AT) SLOT_INTERFACE("fdc", ISA8_FDC_AT) diff --git a/src/emu/bus/isa/isa_cards.h b/src/emu/bus/isa/isa_cards.h index 8c3f11b9145..d7762ab4bcf 100644 --- a/src/emu/bus/isa/isa_cards.h +++ b/src/emu/bus/isa/isa_cards.h @@ -25,6 +25,7 @@ #include "svga_s3.h" #include "svga_tseng.h" #include "svga_trident.h" +#include "num9rev.h" // storage #include "fdc.h" diff --git a/src/emu/bus/isa/num9rev.c b/src/emu/bus/isa/num9rev.c new file mode 100644 index 00000000000..891c10600c9 --- /dev/null +++ b/src/emu/bus/isa/num9rev.c @@ -0,0 +1,318 @@ +// license:BSD-3-Clause +// Number Nine Revolution 512x32/1024x8 +// TODO: for 1024x768 mode the 7220 is programmed for 512x768, how does that work? + +#include "emu.h" +#include "num9rev.h" + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +const device_type ISA8_NUM_9_REV = &device_creator<isa8_number_9_rev_device>; + +static ADDRESS_MAP_START( upd7220_map, AS_0, 8, isa8_number_9_rev_device ) + AM_RANGE(0x00000, 0x3ffff) AM_NOP +ADDRESS_MAP_END + +UPD7220_DISPLAY_PIXELS_MEMBER( isa8_number_9_rev_device::hgdc_display_pixels ) +{ + palette_t *pal = m_palette->palette(); + if(!m_1024) + { + rgb_t color(0); + UINT16 overlay; + if(((address << 3) + 0xc0008) > (1024*1024)) + return; + for(int i = 0; i < 8; i++) + { + UINT32 addr = (address << 3) + i; + overlay = m_ram[addr + 0xc0000] << 1; + overlay = m_overlay[overlay + ((m_mode & 8) ? 512 : 0)] | (m_overlay[overlay + 1 + ((m_mode & 8) ? 512 : 0)] << 8); + color.set_r(pal->entry_color(m_ram[addr] | ((overlay & 0xf) << 8)).r()); + color.set_g(pal->entry_color(m_ram[addr + 0x40000] | ((overlay & 0xf0) << 4)).g()); + color.set_b(pal->entry_color(m_ram[addr + 0x80000] | (overlay & 0xf00)).b()); + bitmap.pix32(y, x + i) = color; + } + } + else + { + if(((address << 3) + 8) > (1024*1024)) + return; + for(int i = 0; i < 8; i++) + bitmap.pix32(y, x + i) = pal->entry_color(m_ram[(address << 3) + i]); + } +} + +static MACHINE_CONFIG_FRAGMENT( num_9_rev ) + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_SIZE(512, 448) + MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 448-1) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_UPDATE_DRIVER(isa8_number_9_rev_device, screen_update) + MCFG_PALETTE_ADD("palette", 4096) + + MCFG_DEVICE_ADD("upd7220", UPD7220, XTAL_4_433619MHz/2) // unknown clock + MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map) + MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(isa8_number_9_rev_device, hgdc_display_pixels) + MCFG_VIDEO_SET_SCREEN("screen") +MACHINE_CONFIG_END + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor isa8_number_9_rev_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( num_9_rev ); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// isa16_vga_device - constructor +//------------------------------------------------- + +isa8_number_9_rev_device::isa8_number_9_rev_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, ISA8_NUM_9_REV, "Number Nine Revolution 512x32/1024x8", tag, owner, clock, "number_9_rev", __FILE__), + device_isa8_card_interface(mconfig, *this), + m_upd7220(*this, "upd7220"), + m_palette(*this, "palette"), + m_ram(1024*1024), + m_overlay(1024) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void isa8_number_9_rev_device::device_start() +{ + set_isa_device(); + + m_isa->install_memory(0xc0000, 0xc0001, 0, 0, read8_delegate(FUNC(upd7220_device::read), (upd7220_device *)m_upd7220), write8_delegate(FUNC(upd7220_device::write), (upd7220_device *)m_upd7220)); + m_isa->install_memory(0xc0100, 0xc03ff, 0, 0, read8_delegate(FUNC(isa8_number_9_rev_device::pal8_r), this), write8_delegate(FUNC(isa8_number_9_rev_device::pal8_w), this)); + m_isa->install_memory(0xc0400, 0xc0401, 0, 0, read8_delegate(FUNC(isa8_number_9_rev_device::bank_r), this), write8_delegate(FUNC(isa8_number_9_rev_device::bank_w), this)); + m_isa->install_memory(0xc0500, 0xc06ff, 0, 0, read8_delegate(FUNC(isa8_number_9_rev_device::overlay_r), this), write8_delegate(FUNC(isa8_number_9_rev_device::overlay_w), this)); + m_isa->install_memory(0xc0700, 0xc070f, 0, 0, read8_delegate(FUNC(isa8_number_9_rev_device::ctrl_r), this), write8_delegate(FUNC(isa8_number_9_rev_device::ctrl_w), this)); + m_isa->install_memory(0xc1000, 0xc3fff, 0, 0, read8_delegate(FUNC(isa8_number_9_rev_device::pal12_r), this), write8_delegate(FUNC(isa8_number_9_rev_device::pal12_w), this)); + m_isa->install_memory(0xa0000, 0xaffff, 0, 0, read8_delegate(FUNC(isa8_number_9_rev_device::read8), this), write8_delegate(FUNC(isa8_number_9_rev_device::write8), this)); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void isa8_number_9_rev_device::device_reset() +{ + m_bank = 0; + m_mode = 0; + m_1024 = false; +} + +READ8_MEMBER(isa8_number_9_rev_device::read8) +{ + if((m_mode & 1) && !m_1024) + return m_ram[offset + ((m_mode & 0xc) << 14)]; + else if((m_mode & 4) && !m_1024) + { + UINT32 newoff = ((offset & 3) << 18) | (m_bank << 14) | ((offset >> 2) & 0x3fff); + return m_ram[newoff]; + } + else + return m_ram[offset + (m_bank << 16)]; +} + +WRITE8_MEMBER(isa8_number_9_rev_device::write8) +{ + if(m_1024 || ((m_mode & 6) == 0)) + m_ram[offset + (m_bank << 16)] = data; + else if((m_mode & 1) || ((m_mode & 6) == 2)) + { + UINT8 bank = m_bank; + if(m_mode & 1) + bank = (m_mode & 0xc) >> 2; + else + { + if(m_bank >= 12) + { + m_ram[offset + (m_bank << 16)] = data; + return; + } + bank &= 3; + } + + m_ram[offset + (bank << 16)] = data; + m_ram[offset + ((bank + 4) << 16)] = data; + m_ram[offset + ((bank + 8) << 16)] = data; + } + else if(m_mode & 4) + { + UINT32 newoff = ((offset & 3) << 18) | (m_bank << 14) | ((offset >> 2) & 0x3fff); + if((newoff >= 0xc0000) && ((m_mode & 6) == 6)) + return; + m_ram[newoff] = data; + } +} + +READ8_MEMBER(isa8_number_9_rev_device::pal8_r) +{ + offset += 0x100; + palette_t *pal = m_palette->palette(); + switch(offset & 0xf00) + { + case 0x100: + return pal->entry_color(offset).r(); + case 0x200: + return pal->entry_color(offset).g(); + case 0x300: + return pal->entry_color(offset).b(); + } + return 0; +} + +WRITE8_MEMBER(isa8_number_9_rev_device::pal8_w) +{ + offset += 0x100; + palette_t *pal = m_palette->palette(); + rgb_t pen = pal->entry_color(offset); + switch(offset & 0xf00) + { + case 0x100: + pen.set_r(data); + break; + case 0x200: + pen.set_g(data); + break; + case 0x300: + pen.set_b(data); + break; + } + pal->entry_set_color(offset, pen); +} + +READ8_MEMBER(isa8_number_9_rev_device::pal12_r) +{ + UINT16 color = offset & 0xfff; + palette_t *pal = m_palette->palette(); + switch(offset & 0xf000) + { + case 0x0000: + return pal->entry_color(color).r(); + case 0x1000: + return pal->entry_color(color).g(); + case 0x2000: + return pal->entry_color(color).b(); + } + return 0; +} + +WRITE8_MEMBER(isa8_number_9_rev_device::pal12_w) +{ + UINT16 color = offset & 0xfff; + palette_t *pal = m_palette->palette(); + rgb_t pen = pal->entry_color(color); + switch(offset & 0xf000) + { + case 0x0000: + pen.set_r(data); + break; + case 0x1000: + pen.set_g(data); + break; + case 0x2000: + pen.set_b(data); + break; + } + pal->entry_set_color(color, pen); +} + +READ8_MEMBER(isa8_number_9_rev_device::overlay_r) +{ + return m_overlay[offset + ((m_mode & 8) ? 512 : 0)]; +} +WRITE8_MEMBER(isa8_number_9_rev_device::overlay_w) +{ + m_overlay[offset + ((m_mode & 8) ? 512 : 0)] = data; +} + +READ8_MEMBER(isa8_number_9_rev_device::bank_r) +{ + return m_bank; +} + +WRITE8_MEMBER(isa8_number_9_rev_device::bank_w) +{ + m_bank = data & 0xf; +} + +READ8_MEMBER(isa8_number_9_rev_device::ctrl_r) +{ + switch(offset & 0xf) + { + case 0: + case 1: + case 2: + case 3: + // zoom, set to same value as 7220 external zoom factor + break; + case 4: + return (m_mode & 2) ? 0xff : 0; + case 5: + return (m_mode & 4) ? 0xff : 0; + case 6: + return (m_mode & 8) ? 0xff : 0; + case 15: + return (m_mode & 1) ? 0xff : 0; + } + return 0; +} + +WRITE8_MEMBER(isa8_number_9_rev_device::ctrl_w) +{ + switch(offset & 0xf) + { + case 0: + case 1: + case 2: + case 3: + // zoom + break; + case 4: + if(data & 0x80) + m_mode |= 2; + else + m_mode &= ~2; + break; + case 5: + if(data & 0x80) + m_mode |= 4; + else + m_mode &= ~4; + break; + case 6: + if(data & 0x80) + m_mode |= 8; + else + m_mode &= ~8; + break; + case 15: + if(data & 0x80) + m_mode |= 1; + else + m_mode &= ~1; + break; + } +} + +UINT32 isa8_number_9_rev_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + rectangle visarea = screen.visible_area(); + // try to support the 1024x8 or at least don't crash as there's no way to detect it + m_1024 = (visarea.width() * visarea.height()) > (512 * 512); + return m_upd7220->screen_update(screen, bitmap, cliprect); +} diff --git a/src/emu/bus/isa/num9rev.h b/src/emu/bus/isa/num9rev.h new file mode 100644 index 00000000000..5bace1297f5 --- /dev/null +++ b/src/emu/bus/isa/num9rev.h @@ -0,0 +1,61 @@ +#pragma once + +#ifndef __NUM9REV_H__ +#define __NUM9REV_H__ + +#include "emu.h" +#include "isa.h" +#include "video/upd7220.h" +#include "machine/bankdev.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> isa16_vga_device + +class isa8_number_9_rev_device : + public device_t, + public device_isa8_card_interface +{ +public: + // construction/destruction + isa8_number_9_rev_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual machine_config_constructor device_mconfig_additions() const; + + UPD7220_DISPLAY_PIXELS_MEMBER(hgdc_display_pixels); + DECLARE_READ8_MEMBER(pal8_r); + DECLARE_WRITE8_MEMBER(pal8_w); + DECLARE_READ8_MEMBER(pal12_r); + DECLARE_WRITE8_MEMBER(pal12_w); + DECLARE_READ8_MEMBER(overlay_r); + DECLARE_WRITE8_MEMBER(overlay_w); + DECLARE_READ8_MEMBER(bank_r); + DECLARE_WRITE8_MEMBER(bank_w); + DECLARE_READ8_MEMBER(ctrl_r); + DECLARE_WRITE8_MEMBER(ctrl_w); + DECLARE_READ8_MEMBER(read8); + DECLARE_WRITE8_MEMBER(write8); + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); +private: + required_device<upd7220_device> m_upd7220; + required_device<palette_device> m_palette; + dynamic_buffer m_ram; + dynamic_buffer m_overlay; + + UINT8 m_bank; + UINT8 m_mode; + bool m_1024; +}; + +// device type definition +extern const device_type ISA8_NUM_9_REV; + +#endif /* __NUM9REV_H__ */ diff --git a/src/emu/video/upd7220.c b/src/emu/video/upd7220.c index 4187ebdeb19..c930853dac3 100644 --- a/src/emu/video/upd7220.c +++ b/src/emu/video/upd7220.c @@ -1566,13 +1566,13 @@ void upd7220_device::update_text(bitmap_rgb32 &bitmap, const rectangle &cliprect // draw_graphics_line - //------------------------------------------------- -void upd7220_device::draw_graphics_line(bitmap_rgb32 &bitmap, UINT32 addr, int y, int wd) +void upd7220_device::draw_graphics_line(bitmap_rgb32 &bitmap, UINT32 addr, int y, int wd, int pitch) { - int sx; + int sx, al = bitmap.cliprect().height(); - for (sx = 0; sx < 80; sx++) + for (sx = 0; sx < pitch; sx++) { - if((sx << 3) < m_aw * 16 && y < (m_al + m_vbp)) + if((sx << 3) < m_aw * 16 && y < al) m_display_cb(bitmap, y, sx << 3, addr); addr+= wd + 1; @@ -1591,6 +1591,7 @@ void upd7220_device::update_graphics(bitmap_rgb32 &bitmap, const rectangle &clip int im, wd, area; int y = 0, tsy = 0, bsy = 0; bool mixed = ((m_mode & UPD7220_MODE_DISPLAY_MASK) == UPD7220_MODE_DISPLAY_MIXED); + UINT8 interlace = ((m_mode & UPD7220_MODE_INTERLACE_MASK) == UPD7220_MODE_INTERLACE_ON) ? 0 : 1; for (area = 0; area < 4; area++) { @@ -1602,8 +1603,10 @@ void upd7220_device::update_graphics(bitmap_rgb32 &bitmap, const rectangle &clip if(area >= 3) // TODO: most likely to be correct, Quarth (PC-98xx) definitely draws with area 2. We might see an area 3 someday ... break; - if(((m_mode & UPD7220_MODE_INTERLACE_MASK) == UPD7220_MODE_INTERLACE_ON)) + + if(!interlace) len <<= 1; + for (y = 0; y < len; y++) { /* TODO: again correct? @@ -1613,7 +1616,7 @@ void upd7220_device::update_graphics(bitmap_rgb32 &bitmap, const rectangle &clip addr = ((sad << 1) & 0x3ffff) + (y * (m_pitch << (im ? 0 : 1))); if (!m_display_cb.isnull()) - draw_graphics_line(bitmap, addr, y + ((bsy + m_vbp) / (mixed ? 1 : m_lr)), wd); + draw_graphics_line(bitmap, addr, y + ((bsy + m_vbp) / (mixed ? 1 : m_lr)), wd, (m_pitch << interlace)); } } else diff --git a/src/emu/video/upd7220.h b/src/emu/video/upd7220.h index affbe531c40..d91ed53c24a 100644 --- a/src/emu/video/upd7220.h +++ b/src/emu/video/upd7220.h @@ -150,7 +150,7 @@ private: void process_fifo(); void continue_command(); void update_text(bitmap_rgb32 &bitmap, const rectangle &cliprect); - void draw_graphics_line(bitmap_rgb32 &bitmap, UINT32 addr, int y, int wd); + void draw_graphics_line(bitmap_rgb32 &bitmap, UINT32 addr, int y, int wd, int pitch); void update_graphics(bitmap_rgb32 &bitmap, const rectangle &cliprect, int force_bitmap); upd7220_display_pixels_delegate m_display_cb; |