summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2020-07-29 17:16:15 -0400
committer AJR <ajrhacker@users.noreply.github.com>2020-07-29 17:16:15 -0400
commitb5bbf672f0c765b6b79aa9b06b7756c198a8f9f5 (patch)
treeb4e8630d798a8fe0b5d97444d328e043bb053c1f /src/devices/bus
parent5de0896497c87f7240cda43a90192d50035f38db (diff)
Use swapendian_int16/int32 in more devices
Diffstat (limited to 'src/devices/bus')
-rw-r--r--src/devices/bus/amiga/zorro/buddha.cpp32
-rw-r--r--src/devices/bus/gio64/newport.cpp7
-rw-r--r--src/devices/bus/gio64/newport.h2
-rw-r--r--src/devices/bus/nubus/nubus_image.cpp4
4 files changed, 19 insertions, 26 deletions
diff --git a/src/devices/bus/amiga/zorro/buddha.cpp b/src/devices/bus/amiga/zorro/buddha.cpp
index 83fe8bbcfd1..842a32f7f2d 100644
--- a/src/devices/bus/amiga/zorro/buddha.cpp
+++ b/src/devices/bus/amiga/zorro/buddha.cpp
@@ -248,8 +248,8 @@ void buddha_device::ide_interrupt_enable_w(offs_t offset, uint16_t data, uint16_
uint16_t buddha_device::ide_0_cs0_r(offs_t offset, uint16_t mem_mask)
{
- uint16_t data = m_ata_0->cs0_r((offset >> 1) & 0x07, (mem_mask << 8) | (mem_mask >> 8));
- data = (data << 8) | (data >> 8);
+ uint16_t data = m_ata_0->cs0_r((offset >> 1) & 0x07, swapendian_int16(mem_mask));
+ data = swapendian_int16(data);
LOG("ide_0_cs0_r(%04x) %04x [mask = %04x]\n", offset, data, mem_mask);
@@ -260,16 +260,16 @@ void buddha_device::ide_0_cs0_w(offs_t offset, uint16_t data, uint16_t mem_mask)
{
LOG("ide_0_cs0_w(%04x) %04x [mask = %04x]\n", offset, data, mem_mask);
- mem_mask = (mem_mask << 8) | (mem_mask >> 8);
- data = (data << 8) | (data >> 8);
+ mem_mask = swapendian_int16(mem_mask);
+ data = swapendian_int16(data);
m_ata_0->cs0_w((offset >> 1) & 0x07, data, mem_mask);
}
uint16_t buddha_device::ide_0_cs1_r(offs_t offset, uint16_t mem_mask)
{
- uint16_t data = m_ata_0->cs1_r((offset >> 1) & 0x07, (mem_mask << 8) | (mem_mask >> 8));
- data = (data << 8) | (data >> 8);
+ uint16_t data = m_ata_0->cs1_r((offset >> 1) & 0x07, swapendian_int16(mem_mask));
+ data = swapendian_int16(data);
LOG("ide_0_cs1_r(%04x) %04x [mask = %04x]\n", offset, data, mem_mask);
@@ -280,16 +280,16 @@ void buddha_device::ide_0_cs1_w(offs_t offset, uint16_t data, uint16_t mem_mask)
{
LOG("ide_0_cs1_w(%04x) %04x [mask = %04x]\n", offset, data, mem_mask);
- mem_mask = (mem_mask << 8) | (mem_mask >> 8);
- data = (data << 8) | (data >> 8);
+ mem_mask = swapendian_int16(mem_mask);
+ data = swapendian_int16(data);
m_ata_0->cs1_w((offset >> 1) & 0x07, data, mem_mask);
}
uint16_t buddha_device::ide_1_cs0_r(offs_t offset, uint16_t mem_mask)
{
- uint16_t data = m_ata_1->cs0_r((offset >> 1) & 0x07, (mem_mask << 8) | (mem_mask >> 8));
- data = (data << 8) | (data >> 8);
+ uint16_t data = m_ata_1->cs0_r((offset >> 1) & 0x07, swapendian_int16(mem_mask));
+ data = swapendian_int16(data);
LOG("ide_1_cs0_r(%04x) %04x [mask = %04x]\n", offset, data, mem_mask);
@@ -300,16 +300,16 @@ void buddha_device::ide_1_cs0_w(offs_t offset, uint16_t data, uint16_t mem_mask)
{
LOG("ide_1_cs0_w(%04x) %04x [mask = %04x]\n", offset, data, mem_mask);
- mem_mask = (mem_mask << 8) | (mem_mask >> 8);
- data = (data << 8) | (data >> 8);
+ mem_mask = swapendian_int16(mem_mask);
+ data = swapendian_int16(data);
m_ata_1->cs0_w((offset >> 1) & 0x07, data, mem_mask);
}
uint16_t buddha_device::ide_1_cs1_r(offs_t offset, uint16_t mem_mask)
{
- uint16_t data = m_ata_1->cs1_r((offset >> 1) & 0x07, (mem_mask << 8) | (mem_mask >> 8));
- data = (data << 8) | (data >> 8);
+ uint16_t data = m_ata_1->cs1_r((offset >> 1) & 0x07, swapendian_int16(mem_mask));
+ data = swapendian_int16(data);
LOG("ide_1_cs1_r(%04x) %04x [mask = %04x]\n", offset, data, mem_mask);
@@ -320,8 +320,8 @@ void buddha_device::ide_1_cs1_w(offs_t offset, uint16_t data, uint16_t mem_mask)
{
LOG("ide_1_cs1_w(%04x) %04x [mask = %04x]\n", offset, data, mem_mask);
- mem_mask = (mem_mask << 8) | (mem_mask >> 8);
- data = (data << 8) | (data >> 8);
+ mem_mask = swapendian_int16(mem_mask);
+ data = swapendian_int16(data);
m_ata_1->cs1_w((offset >> 1) & 0x07, data, mem_mask);
}
diff --git a/src/devices/bus/gio64/newport.cpp b/src/devices/bus/gio64/newport.cpp
index fdf69a5e240..1be643afddd 100644
--- a/src/devices/bus/gio64/newport.cpp
+++ b/src/devices/bus/gio64/newport.cpp
@@ -2199,11 +2199,6 @@ uint64_t newport_base_device::rex3_r(offs_t offset, uint64_t mem_mask)
return ret;
}
-uint32_t newport_base_device::do_endian_swap(uint32_t color)
-{
- return (color >> 24) | (color << 24) | ((color >> 8) & 0x0000ff00) | ((color << 8) & 0x00ff0000);
-}
-
uint32_t newport_base_device::get_host_color()
{
static const uint32_t s_color_masks[4] = { 0xf, 0xff, 0xfff, 0xffffffff };
@@ -2259,7 +2254,7 @@ uint32_t newport_base_device::get_host_color()
break;
}
if (BIT(m_rex3.m_draw_mode1, 11))
- color = do_endian_swap(color);
+ color = swapendian_int32(color);
return color;
}
diff --git a/src/devices/bus/gio64/newport.h b/src/devices/bus/gio64/newport.h
index 2bca4c1d8b9..cd894510e05 100644
--- a/src/devices/bus/gio64/newport.h
+++ b/src/devices/bus/gio64/newport.h
@@ -476,8 +476,6 @@ protected:
uint32_t convert_8bpp_bgr_to_24bpp_rgb(uint8_t pix_in);
uint32_t convert_12bpp_bgr_to_24bpp_rgb(uint16_t pix_in);
- uint32_t do_endian_swap(uint32_t color);
-
struct bresenham_octant_info_t
{
int16_t incrx1;
diff --git a/src/devices/bus/nubus/nubus_image.cpp b/src/devices/bus/nubus/nubus_image.cpp
index 434d6bd2ded..32b1d33100a 100644
--- a/src/devices/bus/nubus/nubus_image.cpp
+++ b/src/devices/bus/nubus/nubus_image.cpp
@@ -315,7 +315,7 @@ void nubus_image_device::file_data_w(uint32_t data)
std::uint32_t count = 4;
std::uint32_t actualcount = 0;
- data = ((data & 0xff) << 24) | ((data & 0xff00) << 8) | ((data & 0xff0000) >> 8) | ((data & 0xff000000) >> 24);
+ data = swapendian_int32(data);
if(filectx.fd) {
//data = big_endianize_int32(data);
if((filectx.bytecount + count) > filectx.filelen) count = filectx.filelen - filectx.bytecount;
@@ -345,7 +345,7 @@ uint32_t nubus_image_device::file_data_r()
void nubus_image_device::file_len_w(uint32_t data)
{
- data = ((data & 0xff) << 24) | ((data & 0xff00) << 8) | ((data & 0xff0000) >> 8) | ((data & 0xff000000) >> 24);
+ data = swapendian_int32(data);
filectx.filelen = big_endianize_int32(data);
}