summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/nubus/nubus_m2hires.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/bus/nubus/nubus_m2hires.cpp')
-rw-r--r--src/devices/bus/nubus/nubus_m2hires.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/devices/bus/nubus/nubus_m2hires.cpp b/src/devices/bus/nubus/nubus_m2hires.cpp
index e913c0cb0cb..2e8d5cd0657 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"
@@ -29,7 +32,7 @@ ROM_END
// GLOBAL VARIABLES
//**************************************************************************
-DEFINE_DEVICE_TYPE(NUBUS_M2HIRES, nubus_m2hires_device, "nb_m2hr", "Macintosh II Hi-Resolution video card")
+DEFINE_DEVICE_TYPE(NUBUS_M2HIRES, nubus_m2hires_device, "nb_m2hr", "Apple Macintosh II High Resolution Video Card")
//-------------------------------------------------
@@ -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,20 +87,19 @@ 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)));
nubus().install_device(slotspace+0x80000, slotspace+0xeffff, read32s_delegate(*this, FUNC(nubus_m2hires_device::m2hires_r)), write32s_delegate(*this, FUNC(nubus_m2hires_device::m2hires_w)));
- m_timer = timer_alloc(0, nullptr);
+ m_timer = timer_alloc(FUNC(nubus_m2hires_device::vbl_tick), this);
m_timer->adjust(screen().time_until_pos(479, 0), 0);
}
@@ -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);
@@ -119,7 +121,7 @@ void nubus_m2hires_device::device_reset()
}
-void nubus_m2hires_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr)
+TIMER_CALLBACK_MEMBER(nubus_m2hires_device::vbl_tick)
{
if (!m_vbl_disable)
{
@@ -137,7 +139,7 @@ void nubus_m2hires_device::device_timer(emu_timer &timer, device_timer_id tid, i
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;
}