summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2025-01-18 06:46:02 +1100
committer Vas Crabb <vas@vastheman.com>2025-01-18 06:46:02 +1100
commitd7492dd3cd85ca218d4cc9f4f0622a2f6082e1a6 (patch)
tree504d13ac2f093c18a723bbc6db4ba6c33f55bc64
parentf7f3257411f7432179b18f2be3d311d9cf7b63c1 (diff)
Tidy up some stuff.
-rw-r--r--src/devices/bus/heathzenith/h89/h17_fdc.cpp3
-rw-r--r--src/devices/cpu/drcbearm64.cpp22
-rw-r--r--src/lib/formats/h17disk.cpp33
-rw-r--r--src/mame/apple/lisa.cpp6
-rw-r--r--src/mame/apple/lisa.h6
-rw-r--r--src/mame/sharp/x68k.h2
-rw-r--r--src/mame/skeleton/tvcobrasd.cpp16
7 files changed, 51 insertions, 37 deletions
diff --git a/src/devices/bus/heathzenith/h89/h17_fdc.cpp b/src/devices/bus/heathzenith/h89/h17_fdc.cpp
index 8f57a8ed72d..ba43a379b8b 100644
--- a/src/devices/bus/heathzenith/h89/h17_fdc.cpp
+++ b/src/devices/bus/heathzenith/h89/h17_fdc.cpp
@@ -15,10 +15,11 @@
#include "emu.h"
#include "h17_fdc.h"
-#include "formats/h17disk.h"
#include "imagedev/floppy.h"
#include "machine/s2350.h"
+#include "formats/h17disk.h"
+
#define LOG_REG (1U << 1) // Register setup
#define LOG_LINES (1U << 2) // Control lines
diff --git a/src/devices/cpu/drcbearm64.cpp b/src/devices/cpu/drcbearm64.cpp
index 36a03a793be..195a0bda9a8 100644
--- a/src/devices/cpu/drcbearm64.cpp
+++ b/src/devices/cpu/drcbearm64.cpp
@@ -272,7 +272,7 @@ bool emit_sub_optimized(a64::Assembler &a, const a64::Gp &dst, const a64::Gp &sr
arm::Mem get_mem_absolute(a64::Assembler &a, const void *ptr)
{
const uint64_t codeoffs = a.code()->baseAddress() + a.offset();
- const int64_t reloffs = codeoffs - (int64_t)ptr;
+ const int64_t reloffs = (int64_t)ptr - codeoffs;
if (is_valid_immediate_signed(reloffs, 21))
{
a.adr(MEM_SCRATCH_REG, ptr);
@@ -474,30 +474,30 @@ a64::Gp drcbe_arm64::be_parameter::select_register(a64::Gp const &reg, uint32_t
return reg.x();
}
-void drcbe_arm64::get_imm_relative(a64::Assembler &a, const a64::Gp &reg, const uint64_t ptr) const
+void drcbe_arm64::get_imm_relative(a64::Assembler &a, const a64::Gp &reg, const uint64_t val) const
{
// If a value can be expressed relative to the base register then it's worth using it instead of a mov
// which can be expanded to up to 4 instructions for large immediates
- const int64_t diff = (int64_t)ptr - (int64_t)m_baseptr;
+ const int64_t diff = (int64_t)val - (int64_t)m_baseptr;
if (diff > 0 && emit_add_optimized(a, reg, BASE_REG, diff))
return;
else if (diff < 0 && emit_sub_optimized(a, reg, BASE_REG, diff))
return;
const uint64_t codeoffs = a.code()->baseAddress() + a.offset();
- const int64_t reloffs = codeoffs - (int64_t)ptr;
+ const int64_t reloffs = (int64_t)val - codeoffs;
if (is_valid_immediate_signed(reloffs, 21))
{
- a.adr(reg, ptr);
+ a.adr(reg, val);
return;
}
const uint64_t pagebase = codeoffs & ~make_bitmask<uint64_t>(12);
- const int64_t pagerel = (int64_t)ptr - pagebase;
+ const int64_t pagerel = (int64_t)val - pagebase;
if (is_valid_immediate_signed(pagerel, 33))
{
- const uint64_t targetpage = (uint64_t)ptr & ~make_bitmask<uint64_t>(12);
- const uint64_t pageoffs = (uint64_t)ptr & util::make_bitmask<uint64_t>(12);
+ const uint64_t targetpage = val & ~make_bitmask<uint64_t>(12);
+ const uint64_t pageoffs = val & util::make_bitmask<uint64_t>(12);
a.adrp(reg.x(), targetpage);
if (pageoffs != 0)
@@ -506,7 +506,7 @@ void drcbe_arm64::get_imm_relative(a64::Assembler &a, const a64::Gp &reg, const
return;
}
- a.mov(reg, ptr);
+ a.mov(reg, val);
}
void drcbe_arm64::emit_ldr_str_base_mem(a64::Assembler &a, a64::Inst::Id opcode, const a64::Reg &reg, const void *ptr) const
@@ -521,7 +521,7 @@ void drcbe_arm64::emit_ldr_str_base_mem(a64::Assembler &a, a64::Inst::Id opcode,
// If it can fit as an offset relative to PC
const uint64_t codeoffs = a.code()->baseAddress() + a.offset();
- const int64_t reloffs = codeoffs - (int64_t)ptr;
+ const int64_t reloffs = (int64_t)ptr - codeoffs;
if (is_valid_immediate_signed(reloffs, 21))
{
a.adr(MEM_SCRATCH_REG, ptr);
@@ -802,7 +802,7 @@ void drcbe_arm64::mov_float_param_param(a64::Assembler &a, uint32_t regsize, con
void drcbe_arm64::call_arm_addr(a64::Assembler &a, const void *offs) const
{
const uint64_t codeoffs = a.code()->baseAddress() + a.offset();
- const int64_t reloffs = codeoffs - (int64_t)offs;
+ const int64_t reloffs = (int64_t)offs - codeoffs;
if (is_valid_immediate_signed(reloffs, 26))
{
a.bl(offs);
diff --git a/src/lib/formats/h17disk.cpp b/src/lib/formats/h17disk.cpp
index 47d164fda1d..a02112d8ec7 100644
--- a/src/lib/formats/h17disk.cpp
+++ b/src/lib/formats/h17disk.cpp
@@ -13,23 +13,23 @@ Heath H17D disk image format (version 2.0.0)
*********************************************************************/
#include "h17disk.h"
-#include "ioprocs.h"
+
#include "imageutl.h"
+#include "ioprocs.h"
+
#include <cstring>
-static constexpr int TRACK_SIZE = 50'000;
-static constexpr int BITCELL_SIZE = 4000;
-static constexpr int SECTOR_METADATA_SIZE = 16;
+namespace {
-static constexpr int SECTOR_DATA_SIZE = 256;
-static constexpr int SECTORS_PER_TRACK = 10;
+constexpr int TRACK_SIZE = 50'000;
+constexpr int BITCELL_SIZE = 4000;
+constexpr int SECTOR_METADATA_SIZE = 16;
-heath_h17d_format::heath_h17d_format() : floppy_image_format_t()
-{
-}
+constexpr int SECTOR_DATA_SIZE = 256;
+constexpr int SECTORS_PER_TRACK = 10;
struct format {
int head_count;
@@ -37,7 +37,7 @@ struct format {
uint32_t variant;
};
-static const format formats[] = {
+const format formats[] = {
{ 1, 40, floppy_image::SSSD10 }, // H-17-1
{ 2, 40, floppy_image::DSSD10 },
{ 1, 80, floppy_image::SSQD10 },
@@ -64,7 +64,7 @@ enum {
Comm = 0x6d6d6f43, //!< "Comm", Comment
};
-static std::pair<std::uint64_t, std::size_t> find_block(util::random_read &io, uint32_t block_id)
+std::pair<std::uint64_t, std::size_t> find_block(util::random_read &io, uint32_t block_id)
{
LOG_FORMATS("find_block: 0x%x\n", block_id);
@@ -88,7 +88,7 @@ static std::pair<std::uint64_t, std::size_t> find_block(util::random_read &io, u
return std::make_pair(pos + 8, header.length);
}
-static format find_format(util::random_read &io)
+format find_format(util::random_read &io)
{
auto const [pos, length] = find_block(io, DskF);
if ((pos == 0) || (length < 2) || (length > 3))
@@ -125,6 +125,13 @@ static format find_format(util::random_read &io)
return {};
}
+} // anonymous namespace
+
+
+heath_h17d_format::heath_h17d_format() : floppy_image_format_t()
+{
+}
+
int heath_h17d_format::identify(util::random_read &io, uint32_t form_factor, const std::vector<uint32_t> &variants) const
{
uint8_t h[4];
@@ -238,7 +245,7 @@ bool heath_h17d_format::load(util::random_read &io, uint32_t form_factor, const
void heath_h17d_format::fm_reverse_byte_w(std::vector<uint32_t> &buffer, uint8_t val) const
{
- static unsigned char lookup[16] = { 0x0, 0x8, 0x4, 0xc, 0x2, 0xa, 0x6, 0xe, 0x1, 0x9, 0x5, 0xd, 0x3, 0xb, 0x7, 0xf };
+ constexpr unsigned char lookup[16] = { 0x0, 0x8, 0x4, 0xc, 0x2, 0xa, 0x6, 0xe, 0x1, 0x9, 0x5, 0xd, 0x3, 0xb, 0x7, 0xf };
fm_w(buffer, 8, lookup[val & 0x0f] << 4 | lookup[val >> 4], BITCELL_SIZE);
}
diff --git a/src/mame/apple/lisa.cpp b/src/mame/apple/lisa.cpp
index 4b6fa2e5fee..537608dc6e2 100644
--- a/src/mame/apple/lisa.cpp
+++ b/src/mame/apple/lisa.cpp
@@ -12,12 +12,16 @@
#include "emu.h"
#include "lisa.h"
+
#include "cpu/cop400/cop400.h"
-#include "formats/ap_dsk35.h"
+
#include "screen.h"
#include "softlist_dev.h"
#include "speaker.h"
+#include "formats/ap_dsk35.h"
+
+
/***************************************************************************
ADDRESS MAP
***************************************************************************/
diff --git a/src/mame/apple/lisa.h b/src/mame/apple/lisa.h
index 065212287c5..1c7f93b64b7 100644
--- a/src/mame/apple/lisa.h
+++ b/src/mame/apple/lisa.h
@@ -13,19 +13,21 @@
#include "cpu/m6502/m6504.h"
#include "cpu/m68000/m68000.h"
-#include "machine/74259.h"
#include "machine/6522via.h"
#include "machine/6522via.h"
-#include "machine/z80scc.h"
+#include "machine/74259.h"
#include "machine/applefdintf.h"
#include "machine/iwm.h"
#include "machine/nvram.h"
+#include "machine/z80scc.h"
#include "sound/spkrdev.h"
+
#include "emupal.h"
#include "screen.h"
#include "formats/ap_dsk35.h"
+
/* lisa MMU segment regs */
struct real_mmu_entry
{
diff --git a/src/mame/sharp/x68k.h b/src/mame/sharp/x68k.h
index b5c40b213b6..70554ee8328 100644
--- a/src/mame/sharp/x68k.h
+++ b/src/mame/sharp/x68k.h
@@ -20,7 +20,6 @@
#include "cpu/m68000/m68000.h"
#include "cpu/m68000/m68030.h"
#include "imagedev/floppy.h"
-#include "machine/z80scc.h"
#include "machine/hd63450.h"
#include "machine/i8255.h"
#include "machine/mb87030.h"
@@ -28,6 +27,7 @@
#include "machine/ram.h"
#include "machine/rp5c15.h"
#include "machine/upd765.h"
+#include "machine/z80scc.h"
#include "sound/flt_vol.h"
#include "sound/okim6258.h"
#include "sound/ymopm.h"
diff --git a/src/mame/skeleton/tvcobrasd.cpp b/src/mame/skeleton/tvcobrasd.cpp
index ba327dbfa23..1b769e7da8b 100644
--- a/src/mame/skeleton/tvcobrasd.cpp
+++ b/src/mame/skeleton/tvcobrasd.cpp
@@ -86,13 +86,13 @@ public:
m_maincpu(*this, "maincpu")
{ }
- void cobrasdoki(machine_config &config);
- void cobrasday(machine_config &config);
+ void cobrasd_oki(machine_config &config) ATTR_COLD;
+ void cobrasd_ay(machine_config &config) ATTR_COLD;
private:
required_device<v25_device> m_maincpu;
- void cobrasd(machine_config &config);
+ void cobrasd(machine_config &config) ATTR_COLD;
void program_map(address_map &map) ATTR_COLD;
void io_map(address_map &map) ATTR_COLD;
@@ -159,7 +159,7 @@ void cobrasd_state::cobrasd(machine_config &config)
PCF8583(config, "rtc", 32.768_kHz_XTAL); // External xtal labeled "S833", unknown frequency
}
-void cobrasd_state::cobrasdoki(machine_config &config)
+void cobrasd_state::cobrasd_oki(machine_config &config)
{
// Basic machine hardware
@@ -172,7 +172,7 @@ void cobrasd_state::cobrasdoki(machine_config &config)
OKIM6376(config, "oki", 4_MHz_XTAL / 8).add_route(ALL_OUTPUTS, "mono", 0.5); // Divider not verified
}
-void cobrasd_state::cobrasday(machine_config &config)
+void cobrasd_state::cobrasd_ay(machine_config &config)
{
// Basic machine hardware
@@ -210,6 +210,6 @@ ROM_END
} // anonymous namespace
-// YEAR NAME PARENT MACHINE INPUT CLASS INIT ROT COMPANY FULLNAME FLAGS
-GAME(1998, cobrasd, 0, cobrasdoki, cobrasd, cobrasd_state, empty_init, ROT0, u8"TourVisión", "Cobra Sport Dart / Tour Sport Dart (OKI M6376 sound)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING | MACHINE_MECHANICAL | MACHINE_REQUIRES_ARTWORK)
-GAME(1997, cobrasda, cobrasd, cobrasday, cobrasd, cobrasd_state, empty_init, ROT0, u8"TourVisión", "Cobra Sport Dart / Tour Sport Dart (AY-8910 sound)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING | MACHINE_MECHANICAL | MACHINE_REQUIRES_ARTWORK)
+// YEAR NAME PARENT MACHINE INPUT CLASS INIT ROT COMPANY FULLNAME FLAGS
+GAME(1998, cobrasd, 0, cobrasd_oki, cobrasd, cobrasd_state, empty_init, ROT0, u8"TourVisión", "Cobra Sport Dart / Tour Sport Dart (Oki MSM6376 sound)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING | MACHINE_MECHANICAL | MACHINE_REQUIRES_ARTWORK)
+GAME(1997, cobrasda, cobrasd, cobrasd_ay, cobrasd, cobrasd_state, empty_init, ROT0, u8"TourVisión", "Cobra Sport Dart / Tour Sport Dart (AY-8910 sound)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING | MACHINE_MECHANICAL | MACHINE_REQUIRES_ARTWORK)