summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2022-06-18 04:00:14 +1000
committer Vas Crabb <vas@vastheman.com>2022-06-18 04:00:14 +1000
commit6afc168d5411ab99c20ede39e7b9a9dce6dc3120 (patch)
treee0ef30c9701609180afb5fa03f85dc8d1b3ef424 /src
parentbf0c459df00090a4320e86a68c2a2291863fa136 (diff)
bus/nubus, bus/sbus: Removed a redundant parameter, modernised endian helpers.
Diffstat (limited to 'src')
-rw-r--r--src/devices/bus/nubus/bootbug.cpp2
-rw-r--r--src/devices/bus/nubus/laserview.cpp12
-rw-r--r--src/devices/bus/nubus/laserview.h2
-rw-r--r--src/devices/bus/nubus/nubus.cpp27
-rw-r--r--src/devices/bus/nubus/nubus.h6
-rw-r--r--src/devices/bus/nubus/nubus_48gc.cpp35
-rw-r--r--src/devices/bus/nubus/nubus_48gc.h2
-rw-r--r--src/devices/bus/nubus/nubus_asntmc3b.cpp2
-rw-r--r--src/devices/bus/nubus/nubus_cb264.cpp23
-rw-r--r--src/devices/bus/nubus/nubus_cb264.h2
-rw-r--r--src/devices/bus/nubus/nubus_image.cpp2
-rw-r--r--src/devices/bus/nubus/nubus_m2hires.cpp26
-rw-r--r--src/devices/bus/nubus/nubus_m2hires.h3
-rw-r--r--src/devices/bus/nubus/nubus_m2video.cpp25
-rw-r--r--src/devices/bus/nubus/nubus_m2video.h3
-rw-r--r--src/devices/bus/nubus/nubus_radiustpd.cpp21
-rw-r--r--src/devices/bus/nubus/nubus_radiustpd.h3
-rw-r--r--src/devices/bus/nubus/nubus_spec8.cpp25
-rw-r--r--src/devices/bus/nubus/nubus_spec8.h3
-rw-r--r--src/devices/bus/nubus/nubus_specpdq.cpp66
-rw-r--r--src/devices/bus/nubus/nubus_specpdq.h3
-rw-r--r--src/devices/bus/nubus/nubus_vikbw.cpp9
-rw-r--r--src/devices/bus/nubus/nubus_vikbw.h2
-rw-r--r--src/devices/bus/nubus/nubus_wsportrait.cpp25
-rw-r--r--src/devices/bus/nubus/nubus_wsportrait.h3
-rw-r--r--src/devices/bus/nubus/pds30_30hr.cpp23
-rw-r--r--src/devices/bus/nubus/pds30_30hr.h3
-rw-r--r--src/devices/bus/nubus/pds30_cb264.cpp31
-rw-r--r--src/devices/bus/nubus/pds30_cb264.h3
-rw-r--r--src/devices/bus/nubus/pds30_mc30.cpp31
-rw-r--r--src/devices/bus/nubus/pds30_mc30.h1
-rw-r--r--src/devices/bus/nubus/pds30_procolor816.cpp30
-rw-r--r--src/devices/bus/nubus/pds30_procolor816.h3
-rw-r--r--src/devices/bus/nubus/pds30_sigmalview.cpp20
-rw-r--r--src/devices/bus/nubus/pds30_sigmalview.h3
-rw-r--r--src/devices/bus/nubus/quadralink.cpp2
-rw-r--r--src/devices/bus/sbus/cgsix.cpp35
-rw-r--r--src/devices/bus/sbus/cgthree.cpp4
-rw-r--r--src/mame/drivers/astinvad.cpp16
-rw-r--r--src/mame/drivers/hp2640.cpp42
40 files changed, 275 insertions, 304 deletions
diff --git a/src/devices/bus/nubus/bootbug.cpp b/src/devices/bus/nubus/bootbug.cpp
index eceaf61c9d3..5c59fff0f3f 100644
--- a/src/devices/bus/nubus/bootbug.cpp
+++ b/src/devices/bus/nubus/bootbug.cpp
@@ -98,7 +98,7 @@ void nubus_bootbug_device::device_start()
{
uint32_t slotspace;
- install_declaration_rom(this, BOOTBUG_ROM_REGION);
+ install_declaration_rom(BOOTBUG_ROM_REGION);
slotspace = get_slotspace();
diff --git a/src/devices/bus/nubus/laserview.cpp b/src/devices/bus/nubus/laserview.cpp
index bd9647c9e72..9e9d8ef131b 100644
--- a/src/devices/bus/nubus/laserview.cpp
+++ b/src/devices/bus/nubus/laserview.cpp
@@ -14,6 +14,9 @@
#include "laserview.h"
#include "screen.h"
+#include <algorithm>
+
+
#define LASERVIEW_SCREEN_NAME "laserview_screen"
#define LASERVIEW_ROM_REGION "laserview_rom"
@@ -81,13 +84,13 @@ void nubus_laserview_device::device_start()
{
uint32_t slotspace;
- install_declaration_rom(this, LASERVIEW_ROM_REGION, true);
+ install_declaration_rom(LASERVIEW_ROM_REGION, true);
slotspace = get_slotspace();
// printf("[laserview %p] slotspace = %x\n", this, slotspace);
- m_vram.resize(VRAM_SIZE);
+ m_vram.resize(VRAM_SIZE / sizeof(uint32_t));
install_bank(slotspace, slotspace+VRAM_SIZE-1, &m_vram[0]);
install_bank(slotspace+0x900000, slotspace+0x900000+VRAM_SIZE-1, &m_vram[0]);
@@ -103,7 +106,7 @@ void nubus_laserview_device::device_reset()
m_vbl_disable = 1;
m_prot_state = 0;
m_toggle = 0;
- memset(&m_vram[0], 0, VRAM_SIZE);
+ std::fill(m_vram.begin(), m_vram.end(), 0);
m_palette[0] = rgb_t(255, 255, 255);
m_palette[1] = rgb_t(0, 0, 0);
@@ -122,12 +125,13 @@ uint32_t nubus_laserview_device::screen_update(screen_device &screen, bitmap_rgb
raise_slot_irq();
}
+ auto const vram8 = util::big_endian_cast<uint8_t const>(&m_vram[0]);
for (int y = 0; y < 600; y++)
{
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 832/8; x++)
{
- uint8_t const pixels = m_vram[(y * 104) + (BYTE4_XOR_BE(x)) + 0x20];
+ uint8_t const pixels = vram8[(y * 104) + x + 0x20];
*scanline++ = m_palette[BIT(pixels, 7)];
*scanline++ = m_palette[BIT(pixels, 6)];
diff --git a/src/devices/bus/nubus/laserview.h b/src/devices/bus/nubus/laserview.h
index 88131ca72ec..a2d99227566 100644
--- a/src/devices/bus/nubus/laserview.h
+++ b/src/devices/bus/nubus/laserview.h
@@ -38,7 +38,7 @@ private:
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- std::vector<uint8_t> m_vram;
+ std::vector<uint32_t> m_vram;
uint32_t m_vbl_disable, m_palette[2];
int m_prot_state;
int m_toggle;
diff --git a/src/devices/bus/nubus/nubus.cpp b/src/devices/bus/nubus/nubus.cpp
index 31c169017f3..4cf28122207 100644
--- a/src/devices/bus/nubus/nubus.cpp
+++ b/src/devices/bus/nubus/nubus.cpp
@@ -11,6 +11,8 @@
#include "emu.h"
#include "nubus.h"
+#include <algorithm>
+
//**************************************************************************
// GLOBAL VARIABLES
@@ -185,7 +187,7 @@ void nubus_device::install_writeonly_device(offs_t start, offs_t end, write32_de
}
}
-void nubus_device::install_bank(offs_t start, offs_t end, uint8_t *data)
+void nubus_device::install_bank(offs_t start, offs_t end, void *data)
{
// printf("install_bank: %s @ %x->%x\n", tag, start, end);
m_space->install_ram(start, end, data);
@@ -277,31 +279,26 @@ void device_nubus_card_interface::interface_pre_start()
}
}
-void device_nubus_card_interface::install_bank(offs_t start, offs_t end, uint8_t *data)
+void device_nubus_card_interface::install_bank(offs_t start, offs_t end, void *data)
{
nubus().install_bank(start, end, data);
}
-void device_nubus_card_interface::install_declaration_rom(device_t *dev, const char *romregion, bool mirror_all_mb, bool reverse_rom)
+void device_nubus_card_interface::install_declaration_rom(const char *romregion, bool mirror_all_mb, bool reverse_rom)
{
bool inverted = false;
- uint8_t *rom = device().machine().root_device().memregion(dev->subtag(romregion).c_str())->base();
- uint32_t romlen = device().machine().root_device().memregion(dev->subtag(romregion).c_str())->bytes();
+ uint8_t *rom = device().memregion(romregion)->base();
+ uint32_t romlen = device().memregion(romregion)->bytes();
// printf("ROM length is %x, last bytes are %02x %02x\n", romlen, rom[romlen-2], rom[romlen-1]);
if (reverse_rom)
{
- uint8_t temp;
- uint32_t endptr = romlen-1;
-
- for (uint32_t idx = 0; idx < romlen / 2; idx++)
+ for (uint32_t idx = 0, endptr = romlen-1; idx < endptr; idx++, endptr--)
{
- temp = rom[idx];
- rom[idx] = rom[endptr];
- rom[endptr] = temp;
- endptr--;
+ using std::swap;
+ swap(rom[idx], rom[endptr]);
}
}
@@ -313,12 +310,12 @@ void device_nubus_card_interface::install_declaration_rom(device_t *dev, const c
inverted = true;
}
- #if 0
+#if 0
FILE *f;
f = fopen("romout.bin", "wb");
fwrite(rom, romlen, 1, f);
fclose(f);
- #endif
+#endif
switch (byteLanes)
{
diff --git a/src/devices/bus/nubus/nubus.h b/src/devices/bus/nubus/nubus.h
index 0b07b04b381..cc9a434d205 100644
--- a/src/devices/bus/nubus/nubus.h
+++ b/src/devices/bus/nubus/nubus.h
@@ -36,8 +36,8 @@ public:
void set_nubus_device();
// helper functions for card devices
- void install_declaration_rom(device_t *dev, const char *romregion, bool mirror_all_mb = false, bool reverse_rom = false);
- void install_bank(offs_t start, offs_t end, uint8_t *data);
+ void install_declaration_rom(const char *romregion, bool mirror_all_mb = false, bool reverse_rom = false);
+ void install_bank(offs_t start, offs_t end, void *data);
uint32_t get_slotspace() { return 0xf0000000 | (m_slot<<24); }
uint32_t get_super_slotspace() { return m_slot<<28; }
@@ -125,7 +125,7 @@ public:
template<typename R, typename W> void install_device(offs_t start, offs_t end, R rhandler, W whandler, uint32_t mask=0xffffffff);
void install_readonly_device(offs_t start, offs_t end, read32_delegate rhandler, uint32_t mask=0xffffffff);
void install_writeonly_device(offs_t start, offs_t end, write32_delegate whandler, uint32_t mask=0xffffffff);
- void install_bank(offs_t start, offs_t end, uint8_t *data);
+ void install_bank(offs_t start, offs_t end, void *data);
void set_irq_line(int slot, int state);
DECLARE_WRITE_LINE_MEMBER( irq9_w );
diff --git a/src/devices/bus/nubus/nubus_48gc.cpp b/src/devices/bus/nubus/nubus_48gc.cpp
index b9f6801e3cf..d39aecd7d46 100644
--- a/src/devices/bus/nubus/nubus_48gc.cpp
+++ b/src/devices/bus/nubus/nubus_48gc.cpp
@@ -103,13 +103,13 @@ void jmfb_device::device_start()
{
uint32_t slotspace;
- install_declaration_rom(this, GC48_ROM_REGION);
+ install_declaration_rom(GC48_ROM_REGION);
slotspace = get_slotspace();
// printf("[JMFB %p] slotspace = %x\n", this, slotspace);
- m_vram.resize(VRAM_SIZE);
+ m_vram.resize(VRAM_SIZE / sizeof(uint32_t));
install_bank(slotspace, slotspace+VRAM_SIZE-1, &m_vram[0]);
nubus().install_device(slotspace+0x200000, slotspace+0x2003ff, read32s_delegate(*this, FUNC(jmfb_device::mac_48gc_r)), write32s_delegate(*this, FUNC(jmfb_device::mac_48gc_w)));
@@ -128,12 +128,12 @@ void jmfb_device::device_reset()
m_clutoffs = 0;
m_count = 0;
m_vbl_disable = 1;
- m_stride = 80;
+ m_stride = 80/4;
m_base = 0;
m_xres = 640;
m_yres = 480;
m_mode = 0;
- memset(&m_vram[0], 0, VRAM_SIZE);
+ std::fill(m_vram.begin(), m_vram.end(), 0);
memset(m_palette, 0, sizeof(m_palette));
}
@@ -155,7 +155,7 @@ TIMER_CALLBACK_MEMBER(jmfb_device::vbl_tick)
uint32_t jmfb_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- uint8_t const *const vram8 = &m_vram[0xa00];
+ auto const vram8 = util::big_endian_cast<uint8_t const>(&m_vram[0]) + 0xa00;
// first time? kick off the VBL timer
if (!m_screen)
@@ -172,7 +172,7 @@ uint32_t jmfb_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap,
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < m_xres/8; x++)
{
- uint8_t const pixels = vram8[(y * m_stride) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * m_stride * 4) + x];
*scanline++ = m_palette[BIT(pixels, 7)];
*scanline++ = m_palette[BIT(pixels, 6)];
@@ -192,7 +192,7 @@ uint32_t jmfb_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap,
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < m_xres/4; x++)
{
- uint8_t const pixels = vram8[(y * m_stride) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * m_stride * 4) + x];
*scanline++ = m_palette[(pixels>>6)&0x3];
*scanline++ = m_palette[(pixels>>4)&0x3];
@@ -208,7 +208,7 @@ uint32_t jmfb_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap,
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < m_xres/2; x++)
{
- uint8_t const pixels = vram8[(y * m_stride) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * m_stride * 4) + x];
*scanline++ = m_palette[(pixels>>4)&0xf];
*scanline++ = m_palette[pixels&0xf];
@@ -222,17 +222,19 @@ uint32_t jmfb_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap,
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < m_xres; x++)
{
- uint8_t const pixels = vram8[(y * m_stride) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * m_stride * 4) + x];
*scanline++ = m_palette[pixels];
}
}
break;
case 4: // 24 bpp
- for (int y = 0; y < m_yres; y++)
{
- uint32_t const *base = (uint32_t *)&m_vram[y * m_stride];
- std::copy_n(base, m_xres, &bitmap.pix(y));
+ uint32_t const stride = m_stride * 8 / 3;
+ for (int y = 0; y < m_yres; y++)
+ {
+ std::copy_n(&m_vram[y * stride], m_xres, &bitmap.pix(y));
+ }
}
break;
}
@@ -254,14 +256,7 @@ void jmfb_device::mac_48gc_w(offs_t offset, uint32_t data, uint32_t mem_mask)
case 0xc/4: // stride
// printf("%x to stride\n", data);
// this value is in DWORDs for 1-8 bpp and, uhh, strange for 24bpp
- if (m_mode < 4)
- {
- m_stride = data*4;
- }
- else
- {
- m_stride = (data*32)/3;
- }
+ m_stride = data;
break;
case 0x200/4: // DAC control
diff --git a/src/devices/bus/nubus/nubus_48gc.h b/src/devices/bus/nubus/nubus_48gc.h
index fc3cc59e8f4..e6eac697ede 100644
--- a/src/devices/bus/nubus/nubus_48gc.h
+++ b/src/devices/bus/nubus/nubus_48gc.h
@@ -41,7 +41,7 @@ private:
screen_device *m_screen;
emu_timer *m_timer;
- std::vector<uint8_t> m_vram;
+ std::vector<uint32_t> m_vram;
uint32_t m_mode, m_vbl_disable, m_toggle, m_stride, m_base;
uint32_t m_palette[256], m_colors[3], m_count, m_clutoffs;
uint32_t m_registers[0x100];
diff --git a/src/devices/bus/nubus/nubus_asntmc3b.cpp b/src/devices/bus/nubus/nubus_asntmc3b.cpp
index c3692ad441c..2a45e2f2f3f 100644
--- a/src/devices/bus/nubus/nubus_asntmc3b.cpp
+++ b/src/devices/bus/nubus/nubus_asntmc3b.cpp
@@ -103,7 +103,7 @@ void nubus_mac8390_device::device_start()
memcpy(m_prom, mac, 6);
m_dp83902->set_mac(mac);
- install_declaration_rom(this, MAC8390_ROM_REGION, true);
+ install_declaration_rom(MAC8390_ROM_REGION, true);
slotspace = get_slotspace();
diff --git a/src/devices/bus/nubus/nubus_cb264.cpp b/src/devices/bus/nubus/nubus_cb264.cpp
index b3af9d82fba..5ee4efff01b 100644
--- a/src/devices/bus/nubus/nubus_cb264.cpp
+++ b/src/devices/bus/nubus/nubus_cb264.cpp
@@ -89,13 +89,13 @@ void nubus_cb264_device::device_start()
{
uint32_t slotspace;
- install_declaration_rom(this, CB264_ROM_REGION);
+ install_declaration_rom(CB264_ROM_REGION);
slotspace = get_slotspace();
// printf("[cb264 %p] slotspace = %x\n", this, slotspace);
- m_vram.resize(VRAM_SIZE);
+ m_vram.resize(VRAM_SIZE / sizeof(uint32_t));
install_bank(slotspace, slotspace+VRAM_SIZE-1, &m_vram[0]);
nubus().install_device(slotspace+0xff6000, slotspace+0xff60ff, read32s_delegate(*this, FUNC(nubus_cb264_device::cb264_r)), write32s_delegate(*this, FUNC(nubus_cb264_device::cb264_w)));
@@ -113,7 +113,7 @@ void nubus_cb264_device::device_reset()
m_clutoffs = 0;
m_cb264_vbl_disable = 1;
m_cb264_mode = 0;
- memset(&m_vram[0], 0, VRAM_SIZE);
+ std::fill(m_vram.begin(), m_vram.end(), 0);
memset(m_palette, 0, sizeof(m_palette));
}
@@ -130,6 +130,7 @@ uint32_t nubus_cb264_device::screen_update(screen_device &screen, bitmap_rgb32 &
raise_slot_irq();
}
+ auto const vram8 = util::big_endian_cast<uint8_t const>(&m_vram[0]);
switch (m_cb264_mode)
{
case 0: // 1 bpp
@@ -138,7 +139,7 @@ uint32_t nubus_cb264_device::screen_update(screen_device &screen, bitmap_rgb32 &
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 640/8; x++)
{
- uint8_t const pixels = m_vram[(y * 1024) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 1024) + x];
*scanline++ = m_palette[pixels&0x80];
*scanline++ = m_palette[(pixels<<1)&0x80];
@@ -158,7 +159,7 @@ uint32_t nubus_cb264_device::screen_update(screen_device &screen, bitmap_rgb32 &
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 640/4; x++)
{
- uint8_t const pixels = m_vram[(y * 1024) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 1024) + x];
*scanline++ = m_palette[pixels&0xc0];
*scanline++ = m_palette[(pixels<<2)&0xc0];
@@ -174,7 +175,7 @@ uint32_t nubus_cb264_device::screen_update(screen_device &screen, bitmap_rgb32 &
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 640/2; x++)
{
- uint8_t const pixels = m_vram[(y * 1024) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 1024) + x];
*scanline++ = m_palette[pixels&0xf0];
*scanline++ = m_palette[(pixels<<4)&0xf0];
@@ -188,7 +189,7 @@ uint32_t nubus_cb264_device::screen_update(screen_device &screen, bitmap_rgb32 &
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 640; x++)
{
- uint8_t const pixels = m_vram[(y * 1024) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 1024) + x];
*scanline++ = m_palette[pixels];
}
}
@@ -196,13 +197,9 @@ uint32_t nubus_cb264_device::screen_update(screen_device &screen, bitmap_rgb32 &
case 4: // 24 bpp
case 7: // ???
+ for (int y = 0; y < 480; y++)
{
- uint32_t const *const vram32 = (uint32_t *)&m_vram[0];
-
- for (int y = 0; y < 480; y++)
- {
- std::copy_n(&vram32[y * 1024], 640, &bitmap.pix(y));
- }
+ std::copy_n(&m_vram[y * 1024], 640, &bitmap.pix(y));
}
break;
diff --git a/src/devices/bus/nubus/nubus_cb264.h b/src/devices/bus/nubus/nubus_cb264.h
index d587fc16780..bb7d0e3ac98 100644
--- a/src/devices/bus/nubus/nubus_cb264.h
+++ b/src/devices/bus/nubus/nubus_cb264.h
@@ -40,7 +40,7 @@ protected:
private:
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- std::vector<uint8_t> m_vram;
+ std::vector<uint32_t> m_vram;
uint32_t m_cb264_mode, m_cb264_vbl_disable, m_cb264_toggle;
uint32_t m_palette[256], m_colors[3], m_count, m_clutoffs;
};
diff --git a/src/devices/bus/nubus/nubus_image.cpp b/src/devices/bus/nubus/nubus_image.cpp
index ee7bacc4064..b3c741cb3a9 100644
--- a/src/devices/bus/nubus/nubus_image.cpp
+++ b/src/devices/bus/nubus/nubus_image.cpp
@@ -183,7 +183,7 @@ void nubus_image_device::device_start()
uint32_t slotspace;
uint32_t superslotspace;
- install_declaration_rom(this, IMAGE_ROM_REGION);
+ install_declaration_rom(IMAGE_ROM_REGION);
slotspace = get_slotspace();
superslotspace = get_super_slotspace();
diff --git a/src/devices/bus/nubus/nubus_m2hires.cpp b/src/devices/bus/nubus/nubus_m2hires.cpp
index 7c590595f3a..6451279dcb9 100644
--- a/src/devices/bus/nubus/nubus_m2hires.cpp
+++ b/src/devices/bus/nubus/nubus_m2hires.cpp
@@ -14,6 +14,9 @@
#include "nubus_m2hires.h"
#include "screen.h"
+#include <algorithm>
+
+
#define M2HIRES_SCREEN_NAME "m2hires_screen"
#define M2HIRES_ROM_REGION "m2hires_rom"
@@ -71,7 +74,7 @@ nubus_m2hires_device::nubus_m2hires_device(const machine_config &mconfig, device
device_t(mconfig, type, tag, owner, clock),
device_video_interface(mconfig, *this),
device_nubus_card_interface(mconfig, *this),
- m_vram32(nullptr), m_mode(0), m_vbl_disable(0), m_toggle(0), m_count(0), m_clutoffs(0), m_timer(nullptr)
+ m_mode(0), m_vbl_disable(0), m_toggle(0), m_count(0), m_clutoffs(0), m_timer(nullptr)
{
set_screen(*this, M2HIRES_SCREEN_NAME);
}
@@ -84,14 +87,13 @@ void nubus_m2hires_device::device_start()
{
uint32_t slotspace;
- install_declaration_rom(this, M2HIRES_ROM_REGION, true);
+ install_declaration_rom(M2HIRES_ROM_REGION, true);
slotspace = get_slotspace();
// logerror("[m2hires %p] slotspace = %x\n", this, slotspace);
- m_vram.resize(VRAM_SIZE);
- m_vram32 = (uint32_t *)&m_vram[0];
+ m_vram.resize(VRAM_SIZE / sizeof(uint32_t));
nubus().install_device(slotspace, slotspace+VRAM_SIZE-1, read32s_delegate(*this, FUNC(nubus_m2hires_device::vram_r)), write32s_delegate(*this, FUNC(nubus_m2hires_device::vram_w)));
nubus().install_device(slotspace+0x900000, slotspace+VRAM_SIZE-1+0x900000, read32s_delegate(*this, FUNC(nubus_m2hires_device::vram_r)), write32s_delegate(*this, FUNC(nubus_m2hires_device::vram_w)));
@@ -111,7 +113,7 @@ void nubus_m2hires_device::device_reset()
m_clutoffs = 0;
m_vbl_disable = 1;
m_mode = 0;
- memset(&m_vram[0], 0, VRAM_SIZE);
+ std::fill(m_vram.begin(), m_vram.end(), 0);
memset(m_palette, 0, sizeof(m_palette));
m_palette[0] = rgb_t(255, 255, 255);
@@ -137,7 +139,7 @@ TIMER_CALLBACK_MEMBER(nubus_m2hires_device::vbl_tick)
uint32_t nubus_m2hires_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- uint8_t const *const vram = &m_vram[0x20];
+ auto const vram8 = util::big_endian_cast<uint8_t const>(&m_vram[0]) + 0x20;
switch (m_mode)
{
@@ -147,7 +149,7 @@ uint32_t nubus_m2hires_device::screen_update(screen_device &screen, bitmap_rgb32
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 640/8; x++)
{
- uint8_t const pixels = vram[(y * 128) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 128) + x];
*scanline++ = m_palette[BIT(pixels, 7)];
*scanline++ = m_palette[BIT(pixels, 6)];
@@ -167,7 +169,7 @@ uint32_t nubus_m2hires_device::screen_update(screen_device &screen, bitmap_rgb32
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 640/4; x++)
{
- uint8_t const pixels = vram[(y * 256) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 256) + x];
*scanline++ = m_palette[((pixels>>6)&3)];
*scanline++ = m_palette[((pixels>>4)&3)];
@@ -184,7 +186,7 @@ uint32_t nubus_m2hires_device::screen_update(screen_device &screen, bitmap_rgb32
for (int x = 0; x < 640/2; x++)
{
- uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 512) + x];
*scanline++ = m_palette[((pixels&0xf0)>>4)];
*scanline++ = m_palette[(pixels&0xf)];
@@ -199,7 +201,7 @@ uint32_t nubus_m2hires_device::screen_update(screen_device &screen, bitmap_rgb32
for (int x = 0; x < 640; x++)
{
- uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 1024) + x];
*scanline++ = m_palette[pixels];
}
}
@@ -292,10 +294,10 @@ uint32_t nubus_m2hires_device::m2hires_r(offs_t offset, uint32_t mem_mask)
void nubus_m2hires_device::vram_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
data ^= 0xffffffff;
- COMBINE_DATA(&m_vram32[offset]);
+ COMBINE_DATA(&m_vram[offset]);
}
uint32_t nubus_m2hires_device::vram_r(offs_t offset, uint32_t mem_mask)
{
- return m_vram32[offset] ^ 0xffffffff;
+ return m_vram[offset] ^ 0xffffffff;
}
diff --git a/src/devices/bus/nubus/nubus_m2hires.h b/src/devices/bus/nubus/nubus_m2hires.h
index 43870794dfb..91af4aedafd 100644
--- a/src/devices/bus/nubus/nubus_m2hires.h
+++ b/src/devices/bus/nubus/nubus_m2hires.h
@@ -43,8 +43,7 @@ private:
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- std::vector<uint8_t> m_vram;
- uint32_t *m_vram32;
+ std::vector<uint32_t> m_vram;
uint32_t m_mode, m_vbl_disable, m_toggle;
uint32_t m_palette[256], m_colors[3], m_count, m_clutoffs;
emu_timer *m_timer;
diff --git a/src/devices/bus/nubus/nubus_m2video.cpp b/src/devices/bus/nubus/nubus_m2video.cpp
index 55bc936f4d2..b7d6e9fcc4f 100644
--- a/src/devices/bus/nubus/nubus_m2video.cpp
+++ b/src/devices/bus/nubus/nubus_m2video.cpp
@@ -15,6 +15,8 @@
#include "nubus_m2video.h"
#include "screen.h"
+#include <algorithm>
+
#define M2VIDEO_SCREEN_NAME "m2video_screen"
#define M2VIDEO_ROM_REGION "m2video_rom"
@@ -73,7 +75,7 @@ nubus_m2video_device::nubus_m2video_device(const machine_config &mconfig, device
device_t(mconfig, type, tag, owner, clock),
device_video_interface(mconfig, *this),
device_nubus_card_interface(mconfig, *this),
- m_vram32(nullptr), m_mode(0), m_vbl_disable(0), m_toggle(0), m_count(0), m_clutoffs(0), m_timer(nullptr)
+ m_mode(0), m_vbl_disable(0), m_toggle(0), m_count(0), m_clutoffs(0), m_timer(nullptr)
{
set_screen(*this, M2VIDEO_SCREEN_NAME);
}
@@ -86,14 +88,13 @@ void nubus_m2video_device::device_start()
{
uint32_t slotspace;
- install_declaration_rom(this, M2VIDEO_ROM_REGION, true, true);
+ install_declaration_rom(M2VIDEO_ROM_REGION, true, true);
slotspace = get_slotspace();
// logerror("[m2video %p] slotspace = %x\n", this, slotspace);
- m_vram.resize(VRAM_SIZE);
- m_vram32 = (uint32_t *)&m_vram[0];
+ m_vram.resize(VRAM_SIZE / sizeof(uint32_t));
nubus().install_device(slotspace, slotspace+VRAM_SIZE-1, read32s_delegate(*this, FUNC(nubus_m2video_device::vram_r)), write32s_delegate(*this, FUNC(nubus_m2video_device::vram_w)));
nubus().install_device(slotspace+0x900000, slotspace+VRAM_SIZE-1+0x900000, read32s_delegate(*this, FUNC(nubus_m2video_device::vram_r)), write32s_delegate(*this, FUNC(nubus_m2video_device::vram_w)));
@@ -113,7 +114,7 @@ void nubus_m2video_device::device_reset()
m_clutoffs = 0;
m_vbl_disable = 1;
m_mode = 0;
- memset(&m_vram[0], 0, VRAM_SIZE);
+ std::fill(m_vram.begin(), m_vram.end(), 0);
memset(m_palette, 0, sizeof(m_palette));
m_palette[0] = rgb_t(255, 255, 255);
@@ -139,7 +140,7 @@ TIMER_CALLBACK_MEMBER(nubus_m2video_device::vbl_tick)
uint32_t nubus_m2video_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- uint8_t const *const vram = &m_vram[0x20];
+ auto const vram8 = util::big_endian_cast<uint8_t const>(&m_vram[0]) + 0x20;
switch (m_mode)
{
@@ -149,7 +150,7 @@ uint32_t nubus_m2video_device::screen_update(screen_device &screen, bitmap_rgb32
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 640/8; x++)
{
- uint8_t const pixels = vram[(y * 128) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 128) + x];
*scanline++ = m_palette[(pixels&0x80)];
*scanline++ = m_palette[((pixels<<1)&0x80)];
@@ -169,7 +170,7 @@ uint32_t nubus_m2video_device::screen_update(screen_device &screen, bitmap_rgb32
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 640/4; x++)
{
- uint8_t const pixels = vram[(y * 256) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 256) + x];
*scanline++ = m_palette[(pixels&0xc0)];
*scanline++ = m_palette[((pixels<<2)&0xc0)];
@@ -185,7 +186,7 @@ uint32_t nubus_m2video_device::screen_update(screen_device &screen, bitmap_rgb32
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 640/2; x++)
{
- uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 512) + x];
*scanline++ = m_palette[(pixels&0xf0)];
*scanline++ = m_palette[((pixels&0x0f)<<4)];
@@ -199,7 +200,7 @@ uint32_t nubus_m2video_device::screen_update(screen_device &screen, bitmap_rgb32
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 640; x++)
{
- uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 1024) + x];
*scanline++ = m_palette[pixels];
}
}
@@ -291,10 +292,10 @@ uint32_t nubus_m2video_device::m2video_r(offs_t offset, uint32_t mem_mask)
void nubus_m2video_device::vram_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
data ^= 0xffffffff;
- COMBINE_DATA(&m_vram32[offset]);
+ COMBINE_DATA(&m_vram[offset]);
}
uint32_t nubus_m2video_device::vram_r(offs_t offset, uint32_t mem_mask)
{
- return m_vram32[offset] ^ 0xffffffff;
+ return m_vram[offset] ^ 0xffffffff;
}
diff --git a/src/devices/bus/nubus/nubus_m2video.h b/src/devices/bus/nubus/nubus_m2video.h
index 38467dbe75d..79f0f777eed 100644
--- a/src/devices/bus/nubus/nubus_m2video.h
+++ b/src/devices/bus/nubus/nubus_m2video.h
@@ -43,8 +43,7 @@ private:
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- std::vector<uint8_t> m_vram;
- uint32_t *m_vram32;
+ std::vector<uint32_t> m_vram;
uint32_t m_mode, m_vbl_disable, m_toggle;
uint32_t m_palette[256], m_colors[3], m_count, m_clutoffs;
emu_timer *m_timer;
diff --git a/src/devices/bus/nubus/nubus_radiustpd.cpp b/src/devices/bus/nubus/nubus_radiustpd.cpp
index f2f68f4bb8c..5bd9cb26475 100644
--- a/src/devices/bus/nubus/nubus_radiustpd.cpp
+++ b/src/devices/bus/nubus/nubus_radiustpd.cpp
@@ -14,6 +14,8 @@
#include "nubus_radiustpd.h"
#include "screen.h"
+#include <algorithm>
+
#define RADIUSTPD_SCREEN_NAME "tpd_screen"
#define RADIUSTPD_ROM_REGION "tpd_rom"
@@ -72,7 +74,7 @@ nubus_radiustpd_device::nubus_radiustpd_device(const machine_config &mconfig, de
device_t(mconfig, type, tag, owner, clock),
device_video_interface(mconfig, *this),
device_nubus_card_interface(mconfig, *this),
- m_vram32(nullptr), m_mode(0), m_vbl_disable(0), m_toggle(0), m_count(0), m_clutoffs(0), m_timer(nullptr)
+ m_mode(0), m_vbl_disable(0), m_toggle(0), m_count(0), m_clutoffs(0), m_timer(nullptr)
{
set_screen(*this, RADIUSTPD_SCREEN_NAME);
}
@@ -85,14 +87,13 @@ void nubus_radiustpd_device::device_start()
{
uint32_t slotspace;
- install_declaration_rom(this, RADIUSTPD_ROM_REGION, true, true);
+ install_declaration_rom(RADIUSTPD_ROM_REGION, true, true);
slotspace = get_slotspace();
- printf("[radiustpd %p] slotspace = %x\n", (void *)this, slotspace);
+// printf("[radiustpd %p] slotspace = %x\n", (void *)this, slotspace);
- m_vram.resize(VRAM_SIZE);
- m_vram32 = (uint32_t *)&m_vram[0];
+ m_vram.resize(VRAM_SIZE / sizeof(uint32_t));
nubus().install_device(slotspace, slotspace+VRAM_SIZE-1, read32s_delegate(*this, FUNC(nubus_radiustpd_device::vram_r)), write32s_delegate(*this, FUNC(nubus_radiustpd_device::vram_w)));
nubus().install_device(slotspace+0x900000, slotspace+VRAM_SIZE-1+0x900000, read32s_delegate(*this, FUNC(nubus_radiustpd_device::vram_r)), write32s_delegate(*this, FUNC(nubus_radiustpd_device::vram_w)));
@@ -113,7 +114,7 @@ void nubus_radiustpd_device::device_reset()
m_clutoffs = 0;
m_vbl_disable = 1;
m_mode = 0;
- memset(&m_vram[0], 0, VRAM_SIZE);
+ std::fill(m_vram.begin(), m_vram.end(), 0);
memset(m_palette, 0, sizeof(m_palette));
m_palette[1] = rgb_t(255, 255, 255);
@@ -139,14 +140,14 @@ TIMER_CALLBACK_MEMBER(nubus_radiustpd_device::vbl_tick)
uint32_t nubus_radiustpd_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- uint8_t const *const vram = &m_vram[0x200];
+ auto const vram8 = util::big_endian_cast<uint8_t const>(&m_vram[0]) + 0x200;
for (int y = 0; y < 880; y++)
{
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 1152/8; x++)
{
- uint8_t const pixels = vram[(y * (1152/8)) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * (1152/8)) + x];
*scanline++ = m_palette[BIT(pixels, 7)];
*scanline++ = m_palette[BIT(pixels, 6)];
@@ -193,10 +194,10 @@ uint32_t nubus_radiustpd_device::radiustpd_r(offs_t offset, uint32_t mem_mask)
void nubus_radiustpd_device::vram_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
data ^= 0xffffffff;
- COMBINE_DATA(&m_vram32[offset]);
+ COMBINE_DATA(&m_vram[offset]);
}
uint32_t nubus_radiustpd_device::vram_r(offs_t offset, uint32_t mem_mask)
{
- return m_vram32[offset] ^ 0xffffffff;
+ return m_vram[offset] ^ 0xffffffff;
}
diff --git a/src/devices/bus/nubus/nubus_radiustpd.h b/src/devices/bus/nubus/nubus_radiustpd.h
index ef8d8fac1eb..54fbbaa329e 100644
--- a/src/devices/bus/nubus/nubus_radiustpd.h
+++ b/src/devices/bus/nubus/nubus_radiustpd.h
@@ -43,8 +43,7 @@ private:
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- std::vector<uint8_t> m_vram;
- uint32_t *m_vram32;
+ std::vector<uint32_t> m_vram;
uint32_t m_mode, m_vbl_disable, m_toggle;
uint32_t m_palette[256], m_colors[3], m_count, m_clutoffs;
emu_timer *m_timer;
diff --git a/src/devices/bus/nubus/nubus_spec8.cpp b/src/devices/bus/nubus/nubus_spec8.cpp
index 3cbe4062578..77d892b1e63 100644
--- a/src/devices/bus/nubus/nubus_spec8.cpp
+++ b/src/devices/bus/nubus/nubus_spec8.cpp
@@ -16,6 +16,8 @@
#include "nubus_spec8.h"
#include "screen.h"
+#include <algorithm>
+
#define SPEC8S3_SCREEN_NAME "spec8s3_screen"
#define SPEC8S3_ROM_REGION "spec8s3_rom"
@@ -75,7 +77,7 @@ nubus_spec8s3_device::nubus_spec8s3_device(const machine_config &mconfig, device
device_t(mconfig, type, tag, owner, clock),
device_video_interface(mconfig, *this),
device_nubus_card_interface(mconfig, *this),
- m_vram32(nullptr), m_mode(0), m_vbl_disable(0), m_count(0), m_clutoffs(0), m_timer(nullptr),
+ m_mode(0), m_vbl_disable(0), m_count(0), m_clutoffs(0), m_timer(nullptr),
m_vbl_pending(false), m_parameter(0)
{
set_screen(*this, SPEC8S3_SCREEN_NAME);
@@ -89,14 +91,13 @@ void nubus_spec8s3_device::device_start()
{
uint32_t slotspace;
- install_declaration_rom(this, SPEC8S3_ROM_REGION);
+ install_declaration_rom(SPEC8S3_ROM_REGION);
slotspace = get_slotspace();
// printf("[SPEC8S3 %p] slotspace = %x\n", this, slotspace);
- m_vram.resize(VRAM_SIZE);
- m_vram32 = (uint32_t *)&m_vram[0];
+ m_vram.resize(VRAM_SIZE / sizeof(uint32_t));
nubus().install_device(slotspace, slotspace+VRAM_SIZE-1, read32s_delegate(*this, FUNC(nubus_spec8s3_device::vram_r)), write32s_delegate(*this, FUNC(nubus_spec8s3_device::vram_w)));
nubus().install_device(slotspace+0x900000, slotspace+VRAM_SIZE-1+0x900000, read32s_delegate(*this, FUNC(nubus_spec8s3_device::vram_r)), write32s_delegate(*this, FUNC(nubus_spec8s3_device::vram_w)));
nubus().install_device(slotspace+0xd0000, slotspace+0xfffff, read32s_delegate(*this, FUNC(nubus_spec8s3_device::spec8s3_r)), write32s_delegate(*this, FUNC(nubus_spec8s3_device::spec8s3_w)));
@@ -117,7 +118,7 @@ void nubus_spec8s3_device::device_reset()
m_mode = 0;
m_vbl_pending = false;
m_parameter = 0;
- memset(&m_vram[0], 0, VRAM_SIZE);
+ std::fill(m_vram.begin(), m_vram.end(), 0);
memset(m_palette, 0, sizeof(m_palette));
m_palette[0] = rgb_t(255, 255, 255);
@@ -144,7 +145,7 @@ TIMER_CALLBACK_MEMBER(nubus_spec8s3_device::vbl_tick)
uint32_t nubus_spec8s3_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- uint8_t const *const vram = &m_vram[0x400];
+ auto const vram8 = util::big_endian_cast<uint8_t const>(&m_vram[0]) + 0x400;
switch (m_mode)
{
@@ -154,7 +155,7 @@ uint32_t nubus_spec8s3_device::screen_update(screen_device &screen, bitmap_rgb32
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 1024/8; x++)
{
- uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 512) + x];
*scanline++ = m_palette[pixels&0x80];
*scanline++ = m_palette[(pixels<<1)&0x80];
@@ -174,7 +175,7 @@ uint32_t nubus_spec8s3_device::screen_update(screen_device &screen, bitmap_rgb32
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 1024/4; x++)
{
- uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 512) + x];
*scanline++ = m_palette[pixels&0xc0];
*scanline++ = m_palette[(pixels<<2)&0xc0];
@@ -190,7 +191,7 @@ uint32_t nubus_spec8s3_device::screen_update(screen_device &screen, bitmap_rgb32
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 1024/2; x++)
{
- uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 512) + x];
*scanline++ = m_palette[pixels&0xf0];
*scanline++ = m_palette[(pixels<<4)&0xf0];
@@ -204,7 +205,7 @@ uint32_t nubus_spec8s3_device::screen_update(screen_device &screen, bitmap_rgb32
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 1024; x++)
{
- uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 1024) + x];
*scanline++ = m_palette[pixels];
}
}
@@ -334,10 +335,10 @@ uint32_t nubus_spec8s3_device::spec8s3_r(offs_t offset, uint32_t mem_mask)
void nubus_spec8s3_device::vram_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
data ^= 0xffffffff;
- COMBINE_DATA(&m_vram32[offset]);
+ COMBINE_DATA(&m_vram[offset]);
}
uint32_t nubus_spec8s3_device::vram_r(offs_t offset, uint32_t mem_mask)
{
- return m_vram32[offset] ^ 0xffffffff;
+ return m_vram[offset] ^ 0xffffffff;
}
diff --git a/src/devices/bus/nubus/nubus_spec8.h b/src/devices/bus/nubus/nubus_spec8.h
index caf0a0ef60b..36e812c410b 100644
--- a/src/devices/bus/nubus/nubus_spec8.h
+++ b/src/devices/bus/nubus/nubus_spec8.h
@@ -43,8 +43,7 @@ private:
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- std::vector<uint8_t> m_vram;
- uint32_t *m_vram32;
+ std::vector<uint32_t> m_vram;
uint32_t m_mode, m_vbl_disable;
uint32_t m_palette[256], m_colors[3], m_count, m_clutoffs;
emu_timer *m_timer;
diff --git a/src/devices/bus/nubus/nubus_specpdq.cpp b/src/devices/bus/nubus/nubus_specpdq.cpp
index 9f878e1b85a..224b19a2a59 100644
--- a/src/devices/bus/nubus/nubus_specpdq.cpp
+++ b/src/devices/bus/nubus/nubus_specpdq.cpp
@@ -32,6 +32,8 @@
//#define VERBOSE 1
#include "logmacro.h"
+#include <algorithm>
+
#define SPECPDQ_SCREEN_NAME "specpdq_screen"
#define SPECPDQ_ROM_REGION "specpdq_rom"
@@ -91,7 +93,7 @@ nubus_specpdq_device::nubus_specpdq_device(const machine_config &mconfig, device
device_t(mconfig, type, tag, owner, clock),
device_video_interface(mconfig, *this),
device_nubus_card_interface(mconfig, *this),
- m_vram32(nullptr), m_mode(0), m_vbl_disable(0), m_count(0), m_clutoffs(0), m_timer(nullptr),
+ m_mode(0), m_vbl_disable(0), m_count(0), m_clutoffs(0), m_timer(nullptr),
m_width(0), m_height(0), m_patofsx(0), m_patofsy(0), m_vram_addr(0), m_vram_src(0),
m_palette(*this, "palette")
{
@@ -106,14 +108,13 @@ void nubus_specpdq_device::device_start()
{
uint32_t slotspace;
- install_declaration_rom(this, SPECPDQ_ROM_REGION);
+ install_declaration_rom(SPECPDQ_ROM_REGION);
slotspace = get_slotspace();
// logerror("[specpdq %p] slotspace = %x\n", this, slotspace);
- m_vram.resize(VRAM_SIZE);
- m_vram32 = (uint32_t *)&m_vram[0];
+ m_vram.resize(VRAM_SIZE / sizeof(uint32_t));
nubus().install_device(slotspace, slotspace+VRAM_SIZE-1, read32s_delegate(*this, FUNC(nubus_specpdq_device::vram_r)), write32s_delegate(*this, FUNC(nubus_specpdq_device::vram_w)));
nubus().install_device(slotspace+0x400000, slotspace+0xfbffff, read32s_delegate(*this, FUNC(nubus_specpdq_device::specpdq_r)), write32s_delegate(*this, FUNC(nubus_specpdq_device::specpdq_w)));
@@ -131,7 +132,7 @@ void nubus_specpdq_device::device_reset()
m_clutoffs = 0;
m_vbl_disable = 1;
m_mode = 0;
- memset(&m_vram[0], 0, VRAM_SIZE);
+ std::fill(m_vram.begin(), m_vram.end(), 0);
memset(m_palette_val, 0, sizeof(m_palette_val));
m_palette_val[0] = rgb_t(255, 255, 255);
@@ -158,7 +159,7 @@ TIMER_CALLBACK_MEMBER(nubus_specpdq_device::vbl_tick)
uint32_t nubus_specpdq_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
// first time? kick off the VBL timer
- uint8_t const *const vram = &m_vram[0x9000];
+ auto const vram8 = util::big_endian_cast<uint8_t const>(&m_vram[0]) + 0x9000;
switch (m_mode)
{
@@ -168,7 +169,7 @@ uint32_t nubus_specpdq_device::screen_update(screen_device &screen, bitmap_rgb32
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 1152/8; x++)
{
- uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 512) + x];
*scanline++ = m_palette_val[(pixels&0x80)];
*scanline++ = m_palette_val[((pixels<<1)&0x80)];
@@ -188,7 +189,7 @@ uint32_t nubus_specpdq_device::screen_update(screen_device &screen, bitmap_rgb32
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 1152/4; x++)
{
- uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 512) + x];
*scanline++ = m_palette_val[(pixels&0xc0)];
*scanline++ = m_palette_val[((pixels<<2)&0xc0)];
@@ -204,7 +205,7 @@ uint32_t nubus_specpdq_device::screen_update(screen_device &screen, bitmap_rgb32
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 1152/2; x++)
{
- uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 1024) + x];
*scanline++ = m_palette_val[(pixels&0xf0)];
*scanline++ = m_palette_val[((pixels<<4)&0xf0)];
@@ -218,7 +219,7 @@ uint32_t nubus_specpdq_device::screen_update(screen_device &screen, bitmap_rgb32
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 1152; x++)
{
- uint8_t const pixels = vram[(y * 1152) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 1152) + x];
*scanline++ = m_palette_val[pixels];
}
}
@@ -416,60 +417,47 @@ void nubus_specpdq_device::specpdq_w(offs_t offset, uint32_t data, uint32_t mem_
// fill rectangle
if (data == 2)
{
- int x, y;
- uint8_t *vram = &m_vram[m_vram_addr & ~3];
-
- int ddx = m_vram_addr & 3;
+ auto const vram8 = util::big_endian_cast<uint8_t>(&m_vram[0]) + m_vram_addr;
LOG("Fill rectangle with %02x %02x %02x %02x, adr %x (%d, %d) width %d height %d delta %d %d\n", m_fillbytes[0], m_fillbytes[1], m_fillbytes[2], m_fillbytes[3], m_vram_addr, m_vram_addr % 1152, m_vram_addr / 1152, m_width, m_height, m_patofsx, m_patofsy);
- for (y = 0; y <= m_height; y++)
+ for (int y = 0; y <= m_height; y++)
{
- for (x = 0; x <= m_width; x++)
+ for (int x = 0; x <= m_width; x++)
{
- vram[(y * 1152)+BYTE4_XOR_BE(x + ddx)] = m_fillbytes[((m_patofsx + x) & 0x1f)+(((m_patofsy + y) & 0x7) << 5)];
+ vram8[(y * 1152)+x] = m_fillbytes[((m_patofsx + x) & 0x1f)+(((m_patofsy + y) & 0x7) << 5)];
}
}
}
else if (data == 0x100)
{
- int x, y;
- uint8_t *vram = &m_vram[m_vram_addr & ~3];
- uint8_t *vramsrc = &m_vram[m_vram_src & ~3];
-
- int sdx = m_vram_src & 3;
- int ddx = m_vram_addr & 3;
+ auto const vram8 = util::big_endian_cast<uint8_t>(&m_vram[0]) + m_vram_addr;
+ auto const vramsrc8 = util::big_endian_cast<uint8_t const>(&m_vram[0]) + m_vram_src;
LOG("Copy rectangle forwards, width %d height %d dst %x (%d, %d) src %x (%d, %d)\n", m_width, m_height, m_vram_addr, m_vram_addr % 1152, m_vram_addr / 1152, m_vram_src, m_vram_src % 1152, m_vram_src / 1152);
- for (y = 0; y <= m_height; y++)
+ for (int y = 0; y <= m_height; y++)
{
- for (x = 0; x <= m_width; x++)
+ for (int x = 0; x <= m_width; x++)
{
- vram[(y * 1152)+BYTE4_XOR_BE(x + ddx)] = vramsrc[(y * 1152)+BYTE4_XOR_BE(x + sdx)];
+ vram8[(y * 1152)+x] = vramsrc8[(y * 1152)+x];
}
}
- (void)vramsrc; (void)sdx;
}
else if (data == 0x101)
{
- int x, y;
- uint8_t *vram = &m_vram[m_vram_addr & ~3];
- uint8_t *vramsrc = &m_vram[m_vram_src & ~3];
-
- int sdx = m_vram_src & 3;
- int ddx = m_vram_addr & 3;
+ auto const vram8 = util::big_endian_cast<uint8_t>(&m_vram[0]) + m_vram_addr;
+ auto const vramsrc8 = util::big_endian_cast<uint8_t const>(&m_vram[0]) + m_vram_src;
LOG("Copy rectangle backwards, width %d height %d dst %x (%d, %d) src %x (%d, %d)\n", m_width, m_height, m_vram_addr, m_vram_addr % 1152, m_vram_addr / 1152, m_vram_src, m_vram_src % 1152, m_vram_src / 1152);
- for (y = 0; y < m_height; y++)
+ for (int y = 0; y < m_height; y++)
{
- for (x = 0; x < m_width; x++)
+ for (int x = 0; x < m_width; x++)
{
- vram[(-y * 1152)+BYTE4_XOR_BE(-x + ddx)] = vramsrc[(-y * 1152)+BYTE4_XOR_BE(-x + sdx)];
+ vram8[(-y * 1152)-x] = vramsrc8[(-y * 1152)-x];
}
}
- (void)vramsrc; (void)sdx;
}
else
{
@@ -498,10 +486,10 @@ uint32_t nubus_specpdq_device::specpdq_r(offs_t offset, uint32_t mem_mask)
void nubus_specpdq_device::vram_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
data ^= 0xffffffff;
- COMBINE_DATA(&m_vram32[offset]);
+ COMBINE_DATA(&m_vram[offset]);
}
uint32_t nubus_specpdq_device::vram_r(offs_t offset, uint32_t mem_mask)
{
- return m_vram32[offset] ^ 0xffffffff;
+ return m_vram[offset] ^ 0xffffffff;
}
diff --git a/src/devices/bus/nubus/nubus_specpdq.h b/src/devices/bus/nubus/nubus_specpdq.h
index c133c0fa4db..c224c2bf520 100644
--- a/src/devices/bus/nubus/nubus_specpdq.h
+++ b/src/devices/bus/nubus/nubus_specpdq.h
@@ -44,8 +44,7 @@ private:
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- std::vector<uint8_t> m_vram;
- uint32_t *m_vram32;
+ std::vector<uint32_t> m_vram;
uint32_t m_mode, m_vbl_disable;
uint32_t m_palette_val[256], m_colors[3], m_count, m_clutoffs;
emu_timer *m_timer;
diff --git a/src/devices/bus/nubus/nubus_vikbw.cpp b/src/devices/bus/nubus/nubus_vikbw.cpp
index d05495afe54..af61f6dc45f 100644
--- a/src/devices/bus/nubus/nubus_vikbw.cpp
+++ b/src/devices/bus/nubus/nubus_vikbw.cpp
@@ -82,13 +82,13 @@ void nubus_vikbw_device::device_start()
{
uint32_t slotspace;
- install_declaration_rom(this, VIKBW_ROM_REGION, true);
+ install_declaration_rom(VIKBW_ROM_REGION, true);
slotspace = get_slotspace();
// printf("[vikbw %p] slotspace = %x\n", this, slotspace);
- m_vram.resize(VRAM_SIZE);
+ m_vram.resize(VRAM_SIZE / sizeof(uint32_t));
install_bank(slotspace+0x40000, slotspace+0x40000+VRAM_SIZE-1, &m_vram[0]);
install_bank(slotspace+0x940000, slotspace+0x940000+VRAM_SIZE-1, &m_vram[0]);
@@ -103,7 +103,7 @@ void nubus_vikbw_device::device_start()
void nubus_vikbw_device::device_reset()
{
m_vbl_disable = 1;
- memset(&m_vram[0], 0, VRAM_SIZE);
+ std::fill(m_vram.begin(), m_vram.end(), 0);
m_palette[0] = rgb_t(255, 255, 255);
m_palette[1] = rgb_t(0, 0, 0);
@@ -122,12 +122,13 @@ uint32_t nubus_vikbw_device::screen_update(screen_device &screen, bitmap_rgb32 &
raise_slot_irq();
}
+ auto const vram8 = util::big_endian_cast<uint8_t const>(&m_vram[0]);
for (int y = 0; y < 768; y++)
{
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 1024/8; x++)
{
- uint8_t const pixels = m_vram[(y * 128) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 128) + x];
*scanline++ = m_palette[BIT(pixels, 7)];
*scanline++ = m_palette[BIT(pixels, 6)];
diff --git a/src/devices/bus/nubus/nubus_vikbw.h b/src/devices/bus/nubus/nubus_vikbw.h
index a2a28a510f2..9cd8a0f295a 100644
--- a/src/devices/bus/nubus/nubus_vikbw.h
+++ b/src/devices/bus/nubus/nubus_vikbw.h
@@ -40,7 +40,7 @@ private:
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- std::vector<uint8_t> m_vram;
+ std::vector<uint32_t> m_vram;
uint32_t m_vbl_disable, m_palette[2];
};
diff --git a/src/devices/bus/nubus/nubus_wsportrait.cpp b/src/devices/bus/nubus/nubus_wsportrait.cpp
index cbbaed619c8..fb9c7167da9 100644
--- a/src/devices/bus/nubus/nubus_wsportrait.cpp
+++ b/src/devices/bus/nubus/nubus_wsportrait.cpp
@@ -17,6 +17,8 @@
#include "nubus_wsportrait.h"
#include "screen.h"
+#include <algorithm>
+
#define WSPORTRAIT_SCREEN_NAME "wsport_screen"
#define WSPORTRAIT_ROM_REGION "wsport_rom"
@@ -74,7 +76,7 @@ nubus_wsportrait_device::nubus_wsportrait_device(const machine_config &mconfig,
device_t(mconfig, type, tag, owner, clock),
device_video_interface(mconfig, *this),
device_nubus_card_interface(mconfig, *this),
- m_vram32(nullptr), m_mode(0), m_vbl_disable(0), m_toggle(0), m_count(0), m_clutoffs(0), m_timer(nullptr)
+ m_mode(0), m_vbl_disable(0), m_toggle(0), m_count(0), m_clutoffs(0), m_timer(nullptr)
{
set_screen(*this, WSPORTRAIT_SCREEN_NAME);
}
@@ -87,14 +89,13 @@ void nubus_wsportrait_device::device_start()
{
uint32_t slotspace;
- install_declaration_rom(this, WSPORTRAIT_ROM_REGION, true);
+ install_declaration_rom(WSPORTRAIT_ROM_REGION, true);
slotspace = get_slotspace();
- printf("[wsportrait %p] slotspace = %x\n", (void *)this, slotspace);
+// printf("[wsportrait %p] slotspace = %x\n", (void *)this, slotspace);
- m_vram.resize(VRAM_SIZE);
- m_vram32 = (uint32_t *)&m_vram[0];
+ m_vram.resize(VRAM_SIZE / sizeof(uint32_t));
nubus().install_device(slotspace, slotspace+VRAM_SIZE-1, read32s_delegate(*this, FUNC(nubus_wsportrait_device::vram_r)), write32s_delegate(*this, FUNC(nubus_wsportrait_device::vram_w)));
nubus().install_device(slotspace+0x900000, slotspace+0x900000+VRAM_SIZE-1, read32s_delegate(*this, FUNC(nubus_wsportrait_device::vram_r)), write32s_delegate(*this, FUNC(nubus_wsportrait_device::vram_w)));
@@ -114,7 +115,7 @@ void nubus_wsportrait_device::device_reset()
m_clutoffs = 0;
m_vbl_disable = 1;
m_mode = 0;
- memset(&m_vram[0], 0, VRAM_SIZE);
+ std::fill(m_vram.begin(), m_vram.end(), 0);
memset(m_palette, 0, sizeof(m_palette));
}
@@ -138,7 +139,7 @@ TIMER_CALLBACK_MEMBER(nubus_wsportrait_device::vbl_tick)
uint32_t nubus_wsportrait_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
// first time? kick off the VBL timer
- uint8_t const *const vram = &m_vram[0x80];
+ auto const vram8 = util::big_endian_cast<uint8_t const>(&m_vram[0]) + 0x80;
switch (m_mode)
{
@@ -148,7 +149,7 @@ uint32_t nubus_wsportrait_device::screen_update(screen_device &screen, bitmap_rg
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 640/8; x++)
{
- uint8_t const pixels = vram[(y * 128) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 128) + x];
*scanline++ = m_palette[BIT(pixels, 7)];
*scanline++ = m_palette[BIT(pixels, 6)];
@@ -168,7 +169,7 @@ uint32_t nubus_wsportrait_device::screen_update(screen_device &screen, bitmap_rg
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 640/4; x++)
{
- uint8_t const pixels = vram[(y * 256) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 256) + x];
*scanline++ = m_palette[((pixels>>6)&3)];
*scanline++ = m_palette[((pixels>>4)&3)];
@@ -184,7 +185,7 @@ uint32_t nubus_wsportrait_device::screen_update(screen_device &screen, bitmap_rg
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 640/2; x++)
{
- uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 512) + x];
*scanline++ = m_palette[((pixels&0xf0)>>4)];
*scanline++ = m_palette[(pixels&0xf)];
@@ -287,10 +288,10 @@ uint32_t nubus_wsportrait_device::wsportrait_r(offs_t offset, uint32_t mem_mask)
void nubus_wsportrait_device::vram_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
data ^= 0xffffffff;
- COMBINE_DATA(&m_vram32[offset]);
+ COMBINE_DATA(&m_vram[offset]);
}
uint32_t nubus_wsportrait_device::vram_r(offs_t offset, uint32_t mem_mask)
{
- return m_vram32[offset] ^ 0xffffffff;
+ return m_vram[offset] ^ 0xffffffff;
}
diff --git a/src/devices/bus/nubus/nubus_wsportrait.h b/src/devices/bus/nubus/nubus_wsportrait.h
index afbb7abdd67..e25292c792d 100644
--- a/src/devices/bus/nubus/nubus_wsportrait.h
+++ b/src/devices/bus/nubus/nubus_wsportrait.h
@@ -43,8 +43,7 @@ private:
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- std::vector<uint8_t> m_vram;
- uint32_t *m_vram32;
+ std::vector<uint32_t> m_vram;
uint32_t m_mode, m_vbl_disable, m_toggle;
uint32_t m_palette[256], m_colors[3], m_count, m_clutoffs;
emu_timer *m_timer;
diff --git a/src/devices/bus/nubus/pds30_30hr.cpp b/src/devices/bus/nubus/pds30_30hr.cpp
index efbc761d4af..064932d8f5c 100644
--- a/src/devices/bus/nubus/pds30_30hr.cpp
+++ b/src/devices/bus/nubus/pds30_30hr.cpp
@@ -74,7 +74,7 @@ nubus_xceed30hr_device::nubus_xceed30hr_device(const machine_config &mconfig, de
device_t(mconfig, type, tag, owner, clock),
device_video_interface(mconfig, *this),
device_nubus_card_interface(mconfig, *this),
- m_vram32(nullptr), m_mode(0), m_vbl_disable(0), m_toggle(0), m_count(0), m_clutoffs(0), m_timer(nullptr)
+ m_mode(0), m_vbl_disable(0), m_toggle(0), m_count(0), m_clutoffs(0), m_timer(nullptr)
{
set_screen(*this, XCEED30HR_SCREEN_NAME);
}
@@ -87,14 +87,13 @@ void nubus_xceed30hr_device::device_start()
{
uint32_t slotspace;
- install_declaration_rom(this, XCEED30HR_ROM_REGION);
+ install_declaration_rom(XCEED30HR_ROM_REGION);
slotspace = get_slotspace();
// printf("[xceed30hr %p] slotspace = %x\n", this, slotspace);
- m_vram.resize(VRAM_SIZE);
- m_vram32 = (uint32_t *)&m_vram[0];
+ m_vram.resize(VRAM_SIZE / sizeof(uint32_t));
nubus().install_device(slotspace, slotspace+VRAM_SIZE-1, read32s_delegate(*this, FUNC(nubus_xceed30hr_device::vram_r)), write32s_delegate(*this, FUNC(nubus_xceed30hr_device::vram_w)));
nubus().install_device(slotspace+0x800000, slotspace+0xefffff, read32s_delegate(*this, FUNC(nubus_xceed30hr_device::xceed30hr_r)), write32s_delegate(*this, FUNC(nubus_xceed30hr_device::xceed30hr_w)));
@@ -113,7 +112,7 @@ void nubus_xceed30hr_device::device_reset()
m_clutoffs = 0;
m_vbl_disable = 1;
m_mode = 0;
- memset(&m_vram[0], 0, VRAM_SIZE);
+ std::fill(m_vram.begin(), m_vram.end(), 0);
memset(m_palette, 0, sizeof(m_palette));
m_palette[0] = rgb_t(255, 255, 255);
@@ -139,7 +138,7 @@ TIMER_CALLBACK_MEMBER(nubus_xceed30hr_device::vbl_tick)
uint32_t nubus_xceed30hr_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- uint8_t const *const vram = &m_vram[1024];
+ auto const vram8 = util::big_endian_cast<uint8_t const>(&m_vram[0]) + 1024;
switch (m_mode)
{
@@ -149,7 +148,7 @@ uint32_t nubus_xceed30hr_device::screen_update(screen_device &screen, bitmap_rgb
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 640/8; x++)
{
- uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 1024) + x];
*scanline++ = m_palette[BIT(pixels, 7)];
*scanline++ = m_palette[BIT(pixels, 6)];
@@ -169,7 +168,7 @@ uint32_t nubus_xceed30hr_device::screen_update(screen_device &screen, bitmap_rgb
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 640/4; x++)
{
- uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 1024) + x];
*scanline++ = m_palette[((pixels>>6)&3)];
*scanline++ = m_palette[((pixels>>4)&3)];
@@ -185,7 +184,7 @@ uint32_t nubus_xceed30hr_device::screen_update(screen_device &screen, bitmap_rgb
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 640/2; x++)
{
- uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 1024) + x];
*scanline++ = m_palette[(pixels>>4)];
*scanline++ = m_palette[(pixels&0xf)];
@@ -199,7 +198,7 @@ uint32_t nubus_xceed30hr_device::screen_update(screen_device &screen, bitmap_rgb
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 640; x++)
{
- uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 1024) + x];
*scanline++ = m_palette[pixels];
}
}
@@ -295,10 +294,10 @@ uint32_t nubus_xceed30hr_device::xceed30hr_r(offs_t offset, uint32_t mem_mask)
void nubus_xceed30hr_device::vram_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
- COMBINE_DATA(&m_vram32[offset]);
+ COMBINE_DATA(&m_vram[offset]);
}
uint32_t nubus_xceed30hr_device::vram_r(offs_t offset, uint32_t mem_mask)
{
- return m_vram32[offset];
+ return m_vram[offset];
}
diff --git a/src/devices/bus/nubus/pds30_30hr.h b/src/devices/bus/nubus/pds30_30hr.h
index f3592acdb1c..6114a5dcfa8 100644
--- a/src/devices/bus/nubus/pds30_30hr.h
+++ b/src/devices/bus/nubus/pds30_30hr.h
@@ -43,8 +43,7 @@ private:
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- std::vector<uint8_t> m_vram;
- uint32_t *m_vram32;
+ std::vector<uint32_t> m_vram;
uint32_t m_mode, m_vbl_disable, m_toggle;
uint32_t m_palette[256], m_colors[3], m_count, m_clutoffs;
emu_timer *m_timer;
diff --git a/src/devices/bus/nubus/pds30_cb264.cpp b/src/devices/bus/nubus/pds30_cb264.cpp
index ce7a2f7372e..c485772c843 100644
--- a/src/devices/bus/nubus/pds30_cb264.cpp
+++ b/src/devices/bus/nubus/pds30_cb264.cpp
@@ -71,7 +71,7 @@ nubus_cb264se30_device::nubus_cb264se30_device(const machine_config &mconfig, de
device_t(mconfig, type, tag, owner, clock),
device_video_interface(mconfig, *this),
device_nubus_card_interface(mconfig, *this),
- m_vram32(nullptr), m_mode(0), m_vbl_disable(0), m_toggle(0), m_count(0), m_clutoffs(0), m_timer(nullptr)
+ m_mode(0), m_vbl_disable(0), m_toggle(0), m_count(0), m_clutoffs(0), m_timer(nullptr)
{
set_screen(*this, CB264SE30_SCREEN_NAME);
}
@@ -84,14 +84,13 @@ void nubus_cb264se30_device::device_start()
{
uint32_t slotspace;
- install_declaration_rom(this, CB264SE30_ROM_REGION);
+ install_declaration_rom(CB264SE30_ROM_REGION);
slotspace = get_slotspace();
// printf("[cb264se30 %p] slotspace = %x\n", this, slotspace);
- m_vram.resize(VRAM_SIZE);
- m_vram32 = (uint32_t *)&m_vram[0];
+ m_vram.resize(VRAM_SIZE / sizeof(uint32_t));
nubus().install_device(slotspace, slotspace+VRAM_SIZE-1, read32s_delegate(*this, FUNC(nubus_cb264se30_device::vram_r)), write32s_delegate(*this, FUNC(nubus_cb264se30_device::vram_w)));
nubus().install_device(slotspace+0xf00000, slotspace+0xfeffff, read32s_delegate(*this, FUNC(nubus_cb264se30_device::cb264se30_r)), write32s_delegate(*this, FUNC(nubus_cb264se30_device::cb264se30_w)));
@@ -110,7 +109,7 @@ void nubus_cb264se30_device::device_reset()
m_clutoffs = 0;
m_vbl_disable = 1;
m_mode = 4;
- memset(&m_vram[0], 0, VRAM_SIZE);
+ std::fill(m_vram.begin(), m_vram.end(), 0);
memset(m_palette, 0, sizeof(m_palette));
m_palette[0] = rgb_t(255, 255, 255);
@@ -136,7 +135,7 @@ TIMER_CALLBACK_MEMBER(nubus_cb264se30_device::vbl_tick)
uint32_t nubus_cb264se30_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- uint8_t const *const vram = &m_vram[8*1024];
+ auto const vram8 = util::big_endian_cast<uint8_t const>(&m_vram[0]) + (8*1024);
switch (m_mode)
{
@@ -146,7 +145,7 @@ uint32_t nubus_cb264se30_device::screen_update(screen_device &screen, bitmap_rgb
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 640/8; x++)
{
- uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 1024) + x];
*scanline++ = m_palette[(pixels&0x80)];
*scanline++ = m_palette[((pixels<<1)&0x80)];
@@ -166,7 +165,7 @@ uint32_t nubus_cb264se30_device::screen_update(screen_device &screen, bitmap_rgb
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 640/4; x++)
{
- uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 1024) + x];
*scanline++ = m_palette[(pixels&0xc0)];
*scanline++ = m_palette[((pixels<<2)&0xc0)];
@@ -182,7 +181,7 @@ uint32_t nubus_cb264se30_device::screen_update(screen_device &screen, bitmap_rgb
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 640/2; x++)
{
- uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 1024) + x];
*scanline++ = m_palette[(pixels&0xf0)];
*scanline++ = m_palette[((pixels&0x0f)<<4)];
@@ -196,20 +195,16 @@ uint32_t nubus_cb264se30_device::screen_update(screen_device &screen, bitmap_rgb
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 640; x++)
{
- uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 1024) + x];
*scanline++ = m_palette[pixels];
}
}
break;
case 4: // 24 bpp
+ for (int y = 0; y < 480; y++)
{
- uint32_t const *const vram32 = (uint32_t *)&m_vram[0];
-
- for (int y = 0; y < 480; y++)
- {
- std::copy_n(&vram32[y * 1024], 640, &bitmap.pix(y));
- }
+ std::copy_n(&m_vram[y * 1024], 640, &bitmap.pix(y));
}
break;
@@ -298,10 +293,10 @@ uint32_t nubus_cb264se30_device::cb264se30_r(offs_t offset, uint32_t mem_mask)
void nubus_cb264se30_device::vram_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
- COMBINE_DATA(&m_vram32[offset]);
+ COMBINE_DATA(&m_vram[offset]);
}
uint32_t nubus_cb264se30_device::vram_r(offs_t offset, uint32_t mem_mask)
{
- return m_vram32[offset];
+ return m_vram[offset];
}
diff --git a/src/devices/bus/nubus/pds30_cb264.h b/src/devices/bus/nubus/pds30_cb264.h
index 9c94a6afc1c..b991dc44d1f 100644
--- a/src/devices/bus/nubus/pds30_cb264.h
+++ b/src/devices/bus/nubus/pds30_cb264.h
@@ -43,8 +43,7 @@ private:
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- std::vector<uint8_t> m_vram;
- uint32_t *m_vram32;
+ std::vector<uint32_t> m_vram;
uint32_t m_mode, m_vbl_disable, m_toggle;
uint32_t m_palette[256], m_colors[3], m_count, m_clutoffs;
emu_timer *m_timer;
diff --git a/src/devices/bus/nubus/pds30_mc30.cpp b/src/devices/bus/nubus/pds30_mc30.cpp
index ede7240cc9a..2e21efd9886 100644
--- a/src/devices/bus/nubus/pds30_mc30.cpp
+++ b/src/devices/bus/nubus/pds30_mc30.cpp
@@ -73,7 +73,7 @@ nubus_xceedmc30_device::nubus_xceedmc30_device(const machine_config &mconfig, de
device_t(mconfig, type, tag, owner, clock),
device_video_interface(mconfig, *this),
device_nubus_card_interface(mconfig, *this),
- m_vram32(nullptr), m_mode(0), m_vbl_disable(0), m_toggle(0), m_count(0), m_clutoffs(0), m_timer(nullptr)
+ m_mode(0), m_vbl_disable(0), m_toggle(0), m_count(0), m_clutoffs(0), m_timer(nullptr)
{
set_screen(*this, XCEEDMC30_SCREEN_NAME);
}
@@ -86,14 +86,13 @@ void nubus_xceedmc30_device::device_start()
{
uint32_t slotspace;
- install_declaration_rom(this, XCEEDMC30_ROM_REGION);
+ install_declaration_rom(XCEEDMC30_ROM_REGION);
slotspace = get_slotspace();
// printf("[xceedmc30 %p] slotspace = %x\n", this, slotspace);
- m_vram.resize(VRAM_SIZE);
- m_vram32 = (uint32_t *)&m_vram[0];
+ m_vram.resize(VRAM_SIZE / sizeof(uint32_t));
nubus().install_device(slotspace, slotspace+VRAM_SIZE-1, read32s_delegate(*this, FUNC(nubus_xceedmc30_device::vram_r)), write32s_delegate(*this, FUNC(nubus_xceedmc30_device::vram_w)));
nubus().install_device(slotspace+0x800000, slotspace+0xefffff, read32s_delegate(*this, FUNC(nubus_xceedmc30_device::xceedmc30_r)), write32s_delegate(*this, FUNC(nubus_xceedmc30_device::xceedmc30_w)));
@@ -112,7 +111,7 @@ void nubus_xceedmc30_device::device_reset()
m_clutoffs = 0;
m_vbl_disable = 1;
m_mode = 0;
- memset(&m_vram[0], 0, VRAM_SIZE);
+ std::fill(m_vram.begin(), m_vram.end(), 0);
memset(m_palette, 0, sizeof(m_palette));
m_palette[0] = rgb_t(255, 255, 255);
@@ -138,7 +137,7 @@ TIMER_CALLBACK_MEMBER(nubus_xceedmc30_device::vbl_tick)
uint32_t nubus_xceedmc30_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- uint8_t const *const vram = &m_vram[4*1024];
+ auto const vram8 = util::big_endian_cast<uint8_t const>(&m_vram[1024]);
switch (m_mode)
{
@@ -148,7 +147,7 @@ uint32_t nubus_xceedmc30_device::screen_update(screen_device &screen, bitmap_rgb
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 640/8; x++)
{
- uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 1024) + x];
*scanline++ = m_palette[BIT(pixels, 7)];
*scanline++ = m_palette[BIT(pixels, 6)];
@@ -168,7 +167,7 @@ uint32_t nubus_xceedmc30_device::screen_update(screen_device &screen, bitmap_rgb
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 640/4; x++)
{
- uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 1024) + x];
*scanline++ = m_palette[((pixels>>6)&3)];
*scanline++ = m_palette[((pixels>>4)&3)];
@@ -185,7 +184,7 @@ uint32_t nubus_xceedmc30_device::screen_update(screen_device &screen, bitmap_rgb
for (int x = 0; x < 640/2; x++)
{
- uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 1024) + x];
*scanline++ = m_palette[(pixels>>4)];
*scanline++ = m_palette[(pixels&0xf)];
@@ -200,20 +199,16 @@ uint32_t nubus_xceedmc30_device::screen_update(screen_device &screen, bitmap_rgb
for (int x = 0; x < 640; x++)
{
- uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 1024) + x];
*scanline++ = m_palette[pixels];
}
}
break;
case 4: // 24 bpp
+ for (int y = 0; y < 480; y++)
{
- uint32_t const *const vram32 = (uint32_t *)vram;
-
- for (int y = 0; y < 480; y++)
- {
- std::copy_n(&vram32[y * 1024], 640, &bitmap.pix(y));
- }
+ std::copy_n(&m_vram[y * 1024], 640, &bitmap.pix(y));
}
break;
@@ -311,10 +306,10 @@ uint32_t nubus_xceedmc30_device::xceedmc30_r(offs_t offset, uint32_t mem_mask)
void nubus_xceedmc30_device::vram_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
- COMBINE_DATA(&m_vram32[offset]);
+ COMBINE_DATA(&m_vram[offset]);
}
uint32_t nubus_xceedmc30_device::vram_r(offs_t offset, uint32_t mem_mask)
{
- return m_vram32[offset];
+ return m_vram[offset];
}
diff --git a/src/devices/bus/nubus/pds30_mc30.h b/src/devices/bus/nubus/pds30_mc30.h
index 518f863667a..8bb8b951dbb 100644
--- a/src/devices/bus/nubus/pds30_mc30.h
+++ b/src/devices/bus/nubus/pds30_mc30.h
@@ -44,7 +44,6 @@ private:
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
std::vector<uint8_t> m_vram;
- uint32_t *m_vram32;
uint32_t m_mode, m_vbl_disable, m_toggle;
uint32_t m_palette[256], m_colors[3], m_count, m_clutoffs;
emu_timer *m_timer;
diff --git a/src/devices/bus/nubus/pds30_procolor816.cpp b/src/devices/bus/nubus/pds30_procolor816.cpp
index 14fc289ec0f..e58f55ac07d 100644
--- a/src/devices/bus/nubus/pds30_procolor816.cpp
+++ b/src/devices/bus/nubus/pds30_procolor816.cpp
@@ -16,6 +16,9 @@
#include "pds30_procolor816.h"
#include "screen.h"
+#include <algorithm>
+
+
#define PROCOLOR816_SCREEN_NAME "cb264_screen"
#define PROCOLOR816_ROM_REGION "cb264_rom"
@@ -73,7 +76,7 @@ nubus_procolor816_device::nubus_procolor816_device(const machine_config &mconfig
device_t(mconfig, type, tag, owner, clock),
device_video_interface(mconfig, *this),
device_nubus_card_interface(mconfig, *this),
- m_vram32(nullptr), m_mode(0), m_vbl_disable(0), m_toggle(0), m_count(0), m_clutoffs(0), m_timer(nullptr)
+ m_mode(0), m_vbl_disable(0), m_toggle(0), m_count(0), m_clutoffs(0), m_timer(nullptr)
{
set_screen(*this, PROCOLOR816_SCREEN_NAME);
}
@@ -86,14 +89,13 @@ void nubus_procolor816_device::device_start()
{
uint32_t slotspace;
- install_declaration_rom(this, PROCOLOR816_ROM_REGION);
+ install_declaration_rom(PROCOLOR816_ROM_REGION);
slotspace = get_slotspace();
// printf("[procolor816 %p] slotspace = %x\n", this, slotspace);
- m_vram.resize(VRAM_SIZE);
- m_vram32 = (uint32_t *)&m_vram[0];
+ m_vram.resize(VRAM_SIZE / sizeof(uint32_t));
nubus().install_device(slotspace, slotspace+VRAM_SIZE-1, read32s_delegate(*this, FUNC(nubus_procolor816_device::vram_r)), write32s_delegate(*this, FUNC(nubus_procolor816_device::vram_w)));
nubus().install_device(slotspace+0x900000, slotspace+VRAM_SIZE-1+0x900000, read32s_delegate(*this, FUNC(nubus_procolor816_device::vram_r)), write32s_delegate(*this, FUNC(nubus_procolor816_device::vram_w)));
@@ -113,7 +115,7 @@ void nubus_procolor816_device::device_reset()
m_clutoffs = 0;
m_vbl_disable = 1;
m_mode = 3;
- memset(&m_vram[0], 0, VRAM_SIZE);
+ std::fill(m_vram.begin(), m_vram.end(), 0);
memset(m_palette, 0, sizeof(m_palette));
m_palette[0] = rgb_t(255, 255, 255);
@@ -139,7 +141,7 @@ TIMER_CALLBACK_MEMBER(nubus_procolor816_device::vbl_tick)
uint32_t nubus_procolor816_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- uint8_t const *const vram = &m_vram[4];
+ auto const vram8 = util::big_endian_cast<uint8_t const>(&m_vram[0]) + 4;
switch (m_mode)
{
@@ -149,7 +151,7 @@ uint32_t nubus_procolor816_device::screen_update(screen_device &screen, bitmap_r
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 640/8; x++)
{
- uint8_t const pixels = vram[(y * 640/8) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 640/8) + x];
*scanline++ = m_palette[(pixels&0x80)];
*scanline++ = m_palette[((pixels<<1)&0x80)];
@@ -169,7 +171,7 @@ uint32_t nubus_procolor816_device::screen_update(screen_device &screen, bitmap_r
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 640/4; x++)
{
- uint8_t const pixels = vram[(y * 640/4) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 640/4) + x];
*scanline++ = m_palette[(pixels&0xc0)];
*scanline++ = m_palette[((pixels<<2)&0xc0)];
@@ -185,7 +187,7 @@ uint32_t nubus_procolor816_device::screen_update(screen_device &screen, bitmap_r
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 640/2; x++)
{
- uint8_t const pixels = vram[(y * 640/2) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 640/2) + x];
*scanline++ = m_palette[(pixels&0xf0)];
*scanline++ = m_palette[((pixels&0x0f)<<4)];
@@ -199,7 +201,7 @@ uint32_t nubus_procolor816_device::screen_update(screen_device &screen, bitmap_r
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 640; x++)
{
- uint8_t const pixels = vram[(y * 640) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * 640) + x];
*scanline++ = m_palette[pixels];
}
}
@@ -207,14 +209,14 @@ uint32_t nubus_procolor816_device::screen_update(screen_device &screen, bitmap_r
case 4: // 15 bpp
{
- uint16_t const *const vram16 = (uint16_t *)&m_vram[0];
+ auto const vram16 = util::big_endian_cast<uint16_t const>(&m_vram[0]);
for (int y = 0; y < 480; y++)
{
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 640; x++)
{
- uint16_t const pixels = vram16[(y * 640) + BYTE_XOR_BE(x)];
+ uint16_t const pixels = vram16[(y * 640) + x];
*scanline++ = rgb_t(pal5bit((pixels>>10) & 0x1f), pal5bit((pixels>>5) & 0x1f), pal5bit(pixels & 0x1f));
}
}
@@ -325,10 +327,10 @@ uint32_t nubus_procolor816_device::procolor816_r(offs_t offset, uint32_t mem_mas
void nubus_procolor816_device::vram_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
- COMBINE_DATA(&m_vram32[offset]);
+ COMBINE_DATA(&m_vram[offset]);
}
uint32_t nubus_procolor816_device::vram_r(offs_t offset, uint32_t mem_mask)
{
- return m_vram32[offset];
+ return m_vram[offset];
}
diff --git a/src/devices/bus/nubus/pds30_procolor816.h b/src/devices/bus/nubus/pds30_procolor816.h
index c5b5ec5068b..653186d572b 100644
--- a/src/devices/bus/nubus/pds30_procolor816.h
+++ b/src/devices/bus/nubus/pds30_procolor816.h
@@ -43,8 +43,7 @@ private:
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- std::vector<uint8_t> m_vram;
- uint32_t *m_vram32;
+ std::vector<uint32_t> m_vram;
uint32_t m_mode, m_vbl_disable, m_toggle;
uint32_t m_palette[256], m_colors[3], m_count, m_clutoffs;
emu_timer *m_timer;
diff --git a/src/devices/bus/nubus/pds30_sigmalview.cpp b/src/devices/bus/nubus/pds30_sigmalview.cpp
index d116496d7ec..0e82f923cda 100644
--- a/src/devices/bus/nubus/pds30_sigmalview.cpp
+++ b/src/devices/bus/nubus/pds30_sigmalview.cpp
@@ -10,6 +10,9 @@
#include "pds30_sigmalview.h"
#include "screen.h"
+#include <algorithm>
+
+
#define LVIEW_SCREEN_NAME "lview_screen"
#define LVIEW_ROM_REGION "lview_rom"
@@ -68,7 +71,7 @@ nubus_lview_device::nubus_lview_device(const machine_config &mconfig, device_typ
device_t(mconfig, type, tag, owner, clock),
device_video_interface(mconfig, *this),
device_nubus_card_interface(mconfig, *this),
- m_vram32(nullptr), m_vbl_disable(0), m_toggle(0), m_timer(nullptr), m_protstate(0)
+ m_vbl_disable(0), m_toggle(0), m_timer(nullptr), m_protstate(0)
{
set_screen(*this, LVIEW_SCREEN_NAME);
}
@@ -81,14 +84,13 @@ void nubus_lview_device::device_start()
{
uint32_t slotspace;
- install_declaration_rom(this, LVIEW_ROM_REGION);
+ install_declaration_rom(LVIEW_ROM_REGION);
slotspace = get_slotspace();
// printf("[lview %p] slotspace = %x\n", this, slotspace);
- m_vram.resize(VRAM_SIZE);
- m_vram32 = (uint32_t *)&m_vram[0];
+ m_vram.resize(VRAM_SIZE / sizeof(uint32_t));
nubus().install_device(slotspace, slotspace+VRAM_SIZE-1, read32s_delegate(*this, FUNC(nubus_lview_device::vram_r)), write32s_delegate(*this, FUNC(nubus_lview_device::vram_w)));
nubus().install_device(slotspace+0x900000, slotspace+VRAM_SIZE-1+0x900000, read32s_delegate(*this, FUNC(nubus_lview_device::vram_r)), write32s_delegate(*this, FUNC(nubus_lview_device::vram_w)));
@@ -106,7 +108,7 @@ void nubus_lview_device::device_reset()
{
m_vbl_disable = 1;
m_protstate = 0;
- memset(&m_vram[0], 0, VRAM_SIZE);
+ std::fill(m_vram.begin(), m_vram.end(), 0);
memset(m_palette, 0, sizeof(m_palette));
m_palette[0] = rgb_t(255, 255, 255);
@@ -132,14 +134,14 @@ TIMER_CALLBACK_MEMBER(nubus_lview_device::vbl_tick)
uint32_t nubus_lview_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- uint8_t const *const vram = &m_vram[0x20];
+ auto const vram8 = util::big_endian_cast<uint8_t const>(&m_vram[0]) + 0x20;
for (int y = 0; y < 600; y++)
{
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 832/8; x++)
{
- uint8_t const pixels = vram[(y * (832/8)) + (BYTE4_XOR_BE(x))];
+ uint8_t const pixels = vram8[(y * (832/8)) + x];
*scanline++ = m_palette[(pixels&0x80)];
*scanline++ = m_palette[((pixels<<1)&0x80)];
@@ -195,10 +197,10 @@ void nubus_lview_device::lview_w(offs_t offset, uint32_t data, uint32_t mem_mask
void nubus_lview_device::vram_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
- COMBINE_DATA(&m_vram32[offset]);
+ COMBINE_DATA(&m_vram[offset]);
}
uint32_t nubus_lview_device::vram_r(offs_t offset, uint32_t mem_mask)
{
- return m_vram32[offset];
+ return m_vram[offset];
}
diff --git a/src/devices/bus/nubus/pds30_sigmalview.h b/src/devices/bus/nubus/pds30_sigmalview.h
index 677d59ee4c2..e120b00ab53 100644
--- a/src/devices/bus/nubus/pds30_sigmalview.h
+++ b/src/devices/bus/nubus/pds30_sigmalview.h
@@ -43,8 +43,7 @@ private:
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- std::vector<uint8_t> m_vram;
- uint32_t *m_vram32;
+ std::vector<uint32_t> m_vram;
uint32_t m_vbl_disable, m_toggle;
uint32_t m_palette[256];
emu_timer *m_timer;
diff --git a/src/devices/bus/nubus/quadralink.cpp b/src/devices/bus/nubus/quadralink.cpp
index 732e56f1367..0e6ecd1a567 100644
--- a/src/devices/bus/nubus/quadralink.cpp
+++ b/src/devices/bus/nubus/quadralink.cpp
@@ -106,7 +106,7 @@ void nubus_quadralink_device::device_start()
{
uint32_t slotspace;
- install_declaration_rom(this, QUADRALINK_ROM_REGION);
+ install_declaration_rom(QUADRALINK_ROM_REGION);
slotspace = get_slotspace();
diff --git a/src/devices/bus/sbus/cgsix.cpp b/src/devices/bus/sbus/cgsix.cpp
index 65a24e1b505..4ae3301c285 100644
--- a/src/devices/bus/sbus/cgsix.cpp
+++ b/src/devices/bus/sbus/cgsix.cpp
@@ -172,7 +172,7 @@ void sbus_cgsix_device::device_reset()
uint32_t sbus_cgsix_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
pen_t const *const pens = m_ramdac->pens();
- uint8_t const *const vram = (uint8_t *)&m_vram[0];
+ auto const vram = util::big_endian_cast<uint8_t const>(&m_vram[0]);
for (int16_t y = 0; y < 900; y++)
{
@@ -196,7 +196,7 @@ uint32_t sbus_cgsix_device::screen_update(screen_device &screen, bitmap_rgb32 &b
}
}
- const uint8_t pixel = vram[y * 1152 + BYTE4_XOR_BE(x)];
+ const uint8_t pixel = vram[y * 1152 + x];
*scanline++ = pens[pixel];
}
}
@@ -295,8 +295,7 @@ void sbus_cgsix_device::handle_font_poke()
uint8_t plane_mask = fbc_get_plane_mask();
const uint32_t daddr = m_fbc.m_y0 * 1152;
- uint8_t *vram = (uint8_t*)&m_vram[0];
- vram += daddr;
+ auto const vram = util::big_endian_cast<uint8_t>(&m_vram[0]) + daddr;
const int width = (int)m_fbc.m_x1 - (int)m_fbc.m_x0;
const uint32_t font = m_fbc.m_font;
uint32_t x = m_fbc.m_x0;
@@ -314,8 +313,8 @@ void sbus_cgsix_device::handle_font_poke()
src = (font >> bit) & 0xff;
else
src = BIT(font, bit) ? 0xff : 0x00;
- const uint8_t dst = vram[BYTE4_XOR_BE(x)];
- vram[BYTE4_XOR_BE(x)]= perform_rasterop(src, dst, plane_mask);
+ const uint8_t dst = vram[x];
+ vram[x] = perform_rasterop(src, dst, plane_mask);
}
m_fbc.m_x0 += m_fbc.m_autoincx;
m_fbc.m_x1 += m_fbc.m_autoincx;
@@ -376,7 +375,7 @@ void sbus_cgsix_device::handle_draw_command()
return;
}
- uint8_t *vram = (uint8_t*)&m_vram[0];
+ auto const vram = util::big_endian_cast<uint8_t>(&m_vram[0]);
uint32_t pixel_mask = fbc_get_pixel_mask();
uint8_t plane_mask = fbc_get_plane_mask();
@@ -389,15 +388,14 @@ void sbus_cgsix_device::handle_draw_command()
for (uint32_t y = v0.m_absy; y <= v1.m_absy; y++)
{
- uint8_t *line = &vram[y * 1152];
+ auto const line = vram + (y * 1152);
const uint16_t patt_y_index = (y - m_fbc.m_patt_align_y) % 16;
for (uint32_t x = v0.m_absx; x <= v1.m_absx; x++)
{
if (!BIT(pixel_mask, 31 - (x % 32)))
continue;
- const uint32_t native_x = BYTE4_XOR_BE(x);
- uint8_t src = line[native_x];
+ uint8_t src = line[x];
switch (fbc_rasterop_pattern())
{
@@ -417,8 +415,8 @@ void sbus_cgsix_device::handle_draw_command()
}
}
- const uint8_t dst = line[native_x];
- line[native_x] = perform_rasterop(src, dst, plane_mask);
+ const uint8_t dst = line[x];
+ line[x] = perform_rasterop(src, dst, plane_mask);
}
}
}
@@ -428,7 +426,7 @@ void sbus_cgsix_device::handle_draw_command()
// NOTE: This is basically untested, and probably full of bugs!
void sbus_cgsix_device::handle_blit_command()
{
- uint8_t *vram = (uint8_t*)&m_vram[0];
+ auto const vram = util::big_endian_cast<uint8_t>(&m_vram[0]);
const uint32_t fbw = 1152;//(m_fbc.m_clip_maxx + 1);
logerror("Copying from %d,%d-%d,%d to %d,%d-%d,%d, width %d, height %d\n"
, m_fbc.m_x0, m_fbc.m_y0
@@ -440,18 +438,17 @@ void sbus_cgsix_device::handle_blit_command()
uint32_t dsty = m_fbc.m_y2;
for (; srcy < m_fbc.m_y1; srcy++, dsty++)
{
- uint8_t *srcline = &vram[srcy * fbw];
- uint8_t *dstline = &vram[dsty * fbw];
+ auto srcline = vram + (srcy * fbw);
+ auto dstline = vram + (dsty * fbw);
uint32_t srcx = m_fbc.m_x0;
uint32_t dstx = m_fbc.m_x2;
for (; srcx < m_fbc.m_x1; srcx++, dstx++)
{
- const uint32_t native_dstx = BYTE4_XOR_BE(dstx);
- const uint8_t src = srcline[BYTE4_XOR_BE(srcx)];
- const uint8_t dst = dstline[native_dstx];
+ const uint8_t src = srcline[srcx];
+ const uint8_t dst = dstline[dstx];
const uint8_t result = perform_rasterop(src, dst);
//logerror("vram[%d] = %02x\n", result);
- dstline[native_dstx] = result;
+ dstline[dstx] = result;
}
}
}
diff --git a/src/devices/bus/sbus/cgthree.cpp b/src/devices/bus/sbus/cgthree.cpp
index ad0ba5c1467..2ca7e930c04 100644
--- a/src/devices/bus/sbus/cgthree.cpp
+++ b/src/devices/bus/sbus/cgthree.cpp
@@ -68,14 +68,14 @@ void sbus_cgthree_device::install_device()
uint32_t sbus_cgthree_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
pen_t const *const pens = m_ramdac->pens();
- uint8_t const *const vram = (uint8_t *)&m_vram[0];
+ auto const vram = util::big_endian_cast<uint8_t const>(&m_vram[0]);
for (int y = 0; y < 900; y++)
{
uint32_t *scanline = &bitmap.pix(y);
for (int x = 0; x < 1152; x++)
{
- const uint8_t pixel = vram[y * 1152 + BYTE4_XOR_BE(x)];
+ const uint8_t pixel = vram[y * 1152 + x];
*scanline++ = pens[pixel];
}
}
diff --git a/src/mame/drivers/astinvad.cpp b/src/mame/drivers/astinvad.cpp
index b5c18154519..5c70e9eb2aa 100644
--- a/src/mame/drivers/astinvad.cpp
+++ b/src/mame/drivers/astinvad.cpp
@@ -147,7 +147,6 @@ public:
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void video_start() override;
private:
void color_latch_w(uint8_t data);
@@ -168,12 +167,6 @@ private:
*
*************************************/
-void spaceint_state::video_start()
-{
- save_item(NAME(m_color_latch));
-}
-
-
void spaceint_state::color_latch_w(uint8_t data)
{
m_color_latch = data & 0x0f;
@@ -287,6 +280,8 @@ TIMER_CALLBACK_MEMBER(kamikaze_state::int_gen)
void kamikaze_state::machine_start()
{
+ base_state::machine_start();
+
m_int_timer = timer_alloc(FUNC(kamikaze_state::int_gen), this);
m_int_timer->adjust(m_screen->time_until_pos(128), 128);
m_int_off_timer = timer_alloc(FUNC(kamikaze_state::int_off), this);
@@ -298,6 +293,8 @@ void kamikaze_state::machine_start()
void kamikaze_state::machine_reset()
{
+ base_state::machine_reset();
+
m_screen_flip = 0;
m_screen_red = 0;
m_sound_state[0] = 0;
@@ -307,12 +304,17 @@ void kamikaze_state::machine_reset()
void spaceint_state::machine_start()
{
+ base_state::machine_start();
+
save_item(NAME(m_screen_flip));
save_item(NAME(m_sound_state));
+ save_item(NAME(m_color_latch));
}
void spaceint_state::machine_reset()
{
+ base_state::machine_reset();
+
m_screen_flip = 0;
m_sound_state[0] = 0;
m_sound_state[1] = 0;
diff --git a/src/mame/drivers/hp2640.cpp b/src/mame/drivers/hp2640.cpp
index 85c98f71d43..35438955326 100644
--- a/src/mame/drivers/hp2640.cpp
+++ b/src/mame/drivers/hp2640.cpp
@@ -120,30 +120,30 @@
#define VERBOSE 0
#include "logmacro.h"
-// Bit manipulation
namespace {
- template<typename T> constexpr T BIT_MASK(unsigned n)
- {
- return (T)1U << n;
- }
- template<typename T> void BIT_CLR(T& w , unsigned n)
- {
- w &= ~BIT_MASK<T>(n);
- }
+// Bit manipulation
+template<typename T> constexpr T BIT_MASK(unsigned n)
+{
+ return (T)1U << n;
+}
- template<typename T> void BIT_SET(T& w , unsigned n)
- {
- w |= BIT_MASK<T>(n);
- }
+template<typename T> void BIT_CLR(T& w , unsigned n)
+{
+ w &= ~BIT_MASK<T>(n);
+}
- template<typename T> void COPY_BIT(bool bit , T& w , unsigned n)
- {
- if (bit) {
- BIT_SET(w , n);
- } else {
- BIT_CLR(w , n);
- }
+template<typename T> void BIT_SET(T& w , unsigned n)
+{
+ w |= BIT_MASK<T>(n);
+}
+
+template<typename T> void COPY_BIT(bool bit , T& w , unsigned n)
+{
+ if (bit) {
+ BIT_SET(w , n);
+ } else {
+ BIT_CLR(w , n);
}
}
@@ -1270,5 +1270,7 @@ ROM_START(hp2645)
ROM_LOAD("1816-1425.bin", 0x0000, 0x400, CRC(69a34fef) SHA1(816929cadd53c2fe42b3ca561c029cb1ccd4ca24))
ROM_END
+} // anonymous namespace
+
COMP( 1976, hp2641, 0, 0, hp2641, hp2641 , hp2641_state, empty_init, "Hewlett-Packard", "HP 2641A", 0)
COMP( 1976, hp2645, 0, 0, hp2645, hp2640_base, hp2645_state, empty_init, "Hewlett-Packard", "HP 2645A", 0)