diff options
| author | 2026-03-18 01:33:31 +1100 | |
|---|---|---|
| committer | 2026-03-18 01:40:45 +1100 | |
| commit | f23087d395f323a64bd9f6f799bdca0bd55319c5 (patch) | |
| tree | 07a79ee6b0d354014bb859c8352c132acf52ac35 | |
| parent | 4b73e05ba266ed43d38d3f931242c9ff8cfb5abb (diff) | |
Some prep work for extending offs_t to 64 bits. [Vas Crabb, Ryan Holtz]
This covers some of stuff highlighted in #14689 where the approach to
apply is reasonably obvious and the changes are harmless when offs_t
doesn't change size. Most of this is being more strict with offs_t vs
uint32_t and switching to type-safe formatting functions.
Also renamed gaelco/gaelcof3.cpp to gaelco/futbol3.cpp since the company
name is in the project name anyway.
42 files changed, 292 insertions, 239 deletions
diff --git a/src/devices/bus/coco/coco_dwsock.cpp b/src/devices/bus/coco/coco_dwsock.cpp index b11172ec8a2..f716dc14b41 100644 --- a/src/devices/bus/coco/coco_dwsock.cpp +++ b/src/devices/bus/coco/coco_dwsock.cpp @@ -3,14 +3,17 @@ #include "emu.h" #include "coco_dwsock.h" -#include <cstdio> #include <cstdlib> + #ifdef __GNUC__ #include <unistd.h> #endif #include <fcntl.h> #include <sys/types.h> +//#define VERBOSE 1 +#include "logmacro.h" + //************************************************************************** // DEVICE DEFINITIONS @@ -110,7 +113,7 @@ void beckerport_device::device_stop() { if (m_pSocket) { - printf("%s: Closing connection to Drivewire server\n", tag()); + osd_printf_verbose("%s: Closing connection to Drivewire server\n", tag()); m_pSocket.reset(); } } @@ -144,11 +147,11 @@ u8 beckerport_device::read(offs_t offset) // Try to read from dws std::error_condition filerr = m_pSocket->read(m_buf, 0, sizeof(m_buf), m_rx_pending); if (filerr && (std::errc::operation_would_block != filerr)) - osd_printf_error("%s: coco_dwsock.c: beckerport_device::read() socket read operation failed with error %s:%d %s\n", tag(), filerr.category().name(), filerr.value(), filerr.message()); + osd_printf_error("%s: beckerport_device::read() socket read operation failed with error %s:%d %s\n", tag(), filerr.category().name(), filerr.value(), filerr.message()); else m_head = 0; } - //logerror("beckerport_device: status read. %i bytes remaining.\n", m_rx_pending); + LOG("status read. %d bytes remaining.\n", m_rx_pending); data = (m_rx_pending > 0) ? 2 : 0; break; case DWS_DATA: @@ -162,7 +165,7 @@ u8 beckerport_device::read(offs_t offset) //logerror("beckerport_device: data read 1 byte (0x%02x). %i bytes remaining.\n", data&0xff, m_rx_pending); break; default: - fprintf(stderr, "%s: read from bad offset %d\n", __FILE__, offset); + logerror("read from bad offset %u\n", offset); } return data; @@ -184,16 +187,16 @@ void beckerport_device::write(offs_t offset, u8 data) switch (offset) { case DWS_STATUS: - //logerror("beckerport_write: error: write (0x%02x) to status register\n", d); + LOG("beckerport_write: error: write (0x%02x) to status register\n", data); break; case DWS_DATA: filerr = m_pSocket->write(&d, 0, 1, written); if (filerr) osd_printf_error("%s: coco_dwsock.c: beckerport_device::write() socket write operation failed with error %s:%d %s\n", tag(), filerr.category().name(), filerr.value(), filerr.message()); - //logerror("beckerport_write: data write one byte (0x%02x)\n", d & 0xff); + LOG("beckerport_write: data write one byte (0x%02x)\n", data); break; default: - fprintf(stderr, "%s: write to bad offset %d\n", __FILE__, offset); + logerror("write to bad offset %u\n", offset); } } diff --git a/src/devices/bus/coco/cococart.cpp b/src/devices/bus/coco/cococart.cpp index 59ebce1852d..0e15bc9b3c1 100644 --- a/src/devices/bus/coco/cococart.cpp +++ b/src/devices/bus/coco/cococart.cpp @@ -556,7 +556,7 @@ static std::error_condition read_coco_rpk(std::unique_ptr<util::random_read> &&s return err; // copy the bytes - offs_t size = (offs_t) std::min(contents.size(), (size_t)cart_length - pos); + size_t const size = std::min<size_t>(contents.size(), cart_length - pos); memcpy(&mem[pos], &contents[0], size); pos += size; } diff --git a/src/devices/bus/isa/ex1280.cpp b/src/devices/bus/isa/ex1280.cpp index d96b9d74d53..4a11bbce58f 100644 --- a/src/devices/bus/isa/ex1280.cpp +++ b/src/devices/bus/isa/ex1280.cpp @@ -167,7 +167,7 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(isa16_ex1280_device::scanline_update) TMS340X0_TO_SHIFTREG_CB_MEMBER(isa16_ex1280_device::to_shiftreg) { - printf("address to shiftreg: %08x\n", address); + logerror("address to shiftreg: %08x\n", address); if (address < 0xa00000) { memcpy(shiftreg, &m_vram[address >> 4], 0x400); @@ -181,7 +181,7 @@ TMS340X0_TO_SHIFTREG_CB_MEMBER(isa16_ex1280_device::to_shiftreg) TMS340X0_FROM_SHIFTREG_CB_MEMBER(isa16_ex1280_device::from_shiftreg) { - printf("address from shiftreg: %08x\n", address); + logerror("address from shiftreg: %08x\n", address); if (address < 0xa00000) { memcpy(&m_vram[address >> 4], shiftreg, 0x400); diff --git a/src/devices/bus/pet/superpet.cpp b/src/devices/bus/pet/superpet.cpp index 1b6bb9e80df..5c54638f749 100644 --- a/src/devices/bus/pet/superpet.cpp +++ b/src/devices/bus/pet/superpet.cpp @@ -8,6 +8,7 @@ #include "emu.h" #include "superpet.h" + #include "bus/rs232/rs232.h" #include "cpu/m6809/m6809.h" @@ -312,7 +313,7 @@ void superpet_device::pet_bd_w(offs_t offset, uint8_t data, int &sel) case 0xefe2: case 0xefe3: m_dongle->write(offset & 0x03, data); - printf("6702 %u %02x\n", offset & 0x03, data); + logerror("6702 %u %02x\n", offset & 0x03, data); break; case 0xeff0: @@ -343,7 +344,7 @@ void superpet_device::pet_bd_w(offs_t offset, uint8_t data, int &sel) m_system = data; update_cpu(); - printf("SYSTEM %02x\n", data); + logerror("SYSTEM %02x\n", data); } break; @@ -365,7 +366,7 @@ void superpet_device::pet_bd_w(offs_t offset, uint8_t data, int &sel) */ m_bank = data; - printf("BANK %02x\n", data); + logerror("BANK %02x\n", data); break; } } diff --git a/src/devices/cpu/arm7/arm7.cpp b/src/devices/cpu/arm7/arm7.cpp index 89c89afada5..0fbd29062dd 100644 --- a/src/devices/cpu/arm7/arm7.cpp +++ b/src/devices/cpu/arm7/arm7.cpp @@ -2104,7 +2104,7 @@ void arm946es_cpu_device::RefreshITCM() } } -void arm946es_cpu_device::arm7_cpu_write32(uint32_t addr, uint32_t data) +void arm946es_cpu_device::arm7_cpu_write32(offs_t addr, uint32_t data) { addr &= ~3; @@ -2125,7 +2125,7 @@ void arm946es_cpu_device::arm7_cpu_write32(uint32_t addr, uint32_t data) } -void arm946es_cpu_device::arm7_cpu_write16(uint32_t addr, uint16_t data) +void arm946es_cpu_device::arm7_cpu_write16(offs_t addr, uint16_t data) { addr &= ~1; if ((addr >= cp15_itcm_base) && (addr <= cp15_itcm_end)) @@ -2144,7 +2144,7 @@ void arm946es_cpu_device::arm7_cpu_write16(uint32_t addr, uint16_t data) m_program->write_word(addr, data); } -void arm946es_cpu_device::arm7_cpu_write8(uint32_t addr, uint8_t data) +void arm946es_cpu_device::arm7_cpu_write8(offs_t addr, uint8_t data) { if ((addr >= cp15_itcm_base) && (addr <= cp15_itcm_end)) { @@ -2160,7 +2160,7 @@ void arm946es_cpu_device::arm7_cpu_write8(uint32_t addr, uint8_t data) m_program->write_byte(addr, data); } -uint32_t arm946es_cpu_device::arm7_cpu_read32(uint32_t addr) +uint32_t arm946es_cpu_device::arm7_cpu_read32(offs_t addr) { uint32_t result; @@ -2204,7 +2204,7 @@ uint32_t arm946es_cpu_device::arm7_cpu_read32(uint32_t addr) return result; } -uint32_t arm946es_cpu_device::arm7_cpu_read16(uint32_t addr) +uint32_t arm946es_cpu_device::arm7_cpu_read16(offs_t addr) { addr &= ~1; @@ -2222,7 +2222,7 @@ uint32_t arm946es_cpu_device::arm7_cpu_read16(uint32_t addr) return m_program->read_word(addr); } -uint8_t arm946es_cpu_device::arm7_cpu_read8(uint32_t addr) +uint8_t arm946es_cpu_device::arm7_cpu_read8(offs_t addr) { if ((addr >= cp15_itcm_base) && (addr <= cp15_itcm_end)) { @@ -2308,7 +2308,7 @@ void arm1176jzf_s_cpu_device::arm7_rt_w_callback(offs_t offset, uint32_t data) /*************************************************************************** * Default Memory Handlers ***************************************************************************/ -void arm7_cpu_device::arm7_cpu_write32(uint32_t addr, uint32_t data) +void arm7_cpu_device::arm7_cpu_write32(offs_t addr, uint32_t data) { if( COPRO_CTRL & COPRO_CTRL_MMU_EN ) { @@ -2323,7 +2323,7 @@ void arm7_cpu_device::arm7_cpu_write32(uint32_t addr, uint32_t data) } -void arm7_cpu_device::arm7_cpu_write16(uint32_t addr, uint16_t data) +void arm7_cpu_device::arm7_cpu_write16(offs_t addr, uint16_t data) { if( COPRO_CTRL & COPRO_CTRL_MMU_EN ) { @@ -2337,7 +2337,7 @@ void arm7_cpu_device::arm7_cpu_write16(uint32_t addr, uint16_t data) m_program->write_word(addr, data); } -void arm7_cpu_device::arm7_cpu_write8(uint32_t addr, uint8_t data) +void arm7_cpu_device::arm7_cpu_write8(offs_t addr, uint8_t data) { if( COPRO_CTRL & COPRO_CTRL_MMU_EN ) { @@ -2350,7 +2350,7 @@ void arm7_cpu_device::arm7_cpu_write8(uint32_t addr, uint8_t data) m_program->write_byte(addr, data); } -uint32_t arm7_cpu_device::arm7_cpu_read32(uint32_t addr) +uint32_t arm7_cpu_device::arm7_cpu_read32(offs_t addr) { uint32_t result; @@ -2374,7 +2374,7 @@ uint32_t arm7_cpu_device::arm7_cpu_read32(uint32_t addr) return result; } -uint32_t arm7_cpu_device::arm7_cpu_read16(uint32_t addr) +uint32_t arm7_cpu_device::arm7_cpu_read16(offs_t addr) { uint32_t result; @@ -2396,7 +2396,7 @@ uint32_t arm7_cpu_device::arm7_cpu_read16(uint32_t addr) return result; } -uint8_t arm7_cpu_device::arm7_cpu_read8(uint32_t addr) +uint8_t arm7_cpu_device::arm7_cpu_read8(offs_t addr) { if( COPRO_CTRL & COPRO_CTRL_MMU_EN ) { diff --git a/src/devices/cpu/arm7/arm7.h b/src/devices/cpu/arm7/arm7.h index 15931cadb44..bffd51fbe05 100644 --- a/src/devices/cpu/arm7/arm7.h +++ b/src/devices/cpu/arm7/arm7.h @@ -233,12 +233,12 @@ protected: int detect_fault(int desc_lvl1, int ap, int flags); void arm7_check_irq_state(); void update_irq_state(); - virtual void arm7_cpu_write32(uint32_t addr, uint32_t data); - virtual void arm7_cpu_write16(uint32_t addr, uint16_t data); - virtual void arm7_cpu_write8(uint32_t addr, uint8_t data); - virtual uint32_t arm7_cpu_read32(uint32_t addr); - virtual uint32_t arm7_cpu_read16(uint32_t addr); - virtual uint8_t arm7_cpu_read8(uint32_t addr); + virtual void arm7_cpu_write32(offs_t addr, uint32_t data); + virtual void arm7_cpu_write16(offs_t addr, uint16_t data); + virtual void arm7_cpu_write8(offs_t addr, uint8_t data); + virtual uint32_t arm7_cpu_read32(offs_t addr); + virtual uint32_t arm7_cpu_read16(offs_t addr); + virtual uint8_t arm7_cpu_read8(offs_t addr); // Coprocessor support void arm7_do_callback(uint32_t data); @@ -417,12 +417,12 @@ public: virtual uint32_t arm7_rt_r_callback(offs_t offset) override; virtual void arm7_rt_w_callback(offs_t offset, uint32_t data) override; - virtual void arm7_cpu_write32(uint32_t addr, uint32_t data) override; - virtual void arm7_cpu_write16(uint32_t addr, uint16_t data) override; - virtual void arm7_cpu_write8(uint32_t addr, uint8_t data) override; - virtual uint32_t arm7_cpu_read32(uint32_t addr) override; - virtual uint32_t arm7_cpu_read16(uint32_t addr) override; - virtual uint8_t arm7_cpu_read8(uint32_t addr) override; + virtual void arm7_cpu_write32(offs_t addr, uint32_t data) override; + virtual void arm7_cpu_write16(offs_t addr, uint16_t data) override; + virtual void arm7_cpu_write8(offs_t addr, uint8_t data) override; + virtual uint32_t arm7_cpu_read32(offs_t addr) override; + virtual uint32_t arm7_cpu_read16(offs_t addr) override; + virtual uint8_t arm7_cpu_read8(offs_t addr) override; protected: arm946es_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); diff --git a/src/devices/cpu/dspp/dspp.cpp b/src/devices/cpu/dspp/dspp.cpp index 9d7ed45d37b..492cd90a3e3 100644 --- a/src/devices/cpu/dspp/dspp.cpp +++ b/src/devices/cpu/dspp/dspp.cpp @@ -599,12 +599,12 @@ void dspp_device::parse_operands(uint32_t numops) uint16_t dspp_device::read_next_operand() { int32_t value = m_core->m_operands[m_core->m_opidx].value; - //if (m_core->m_op == 0x46a0) printf("Value is %08x\n", value); + //if (m_core->m_op == 0x46a0) logerror("Value is %08x\n", value); if (value < 0) { value = read_data(m_core->m_operands[m_core->m_opidx].addr); - //if (m_core->m_op == 0x46a0) printf("New value is %08x from %08x\n", value, m_core->m_operands[m_core->m_opidx].addr); + //if (m_core->m_op == 0x46a0) logerror("New value is %08x from %08x\n", value, m_core->m_operands[m_core->m_opidx].addr); } // Next operand @@ -760,7 +760,7 @@ void dspp_device::execute_run() debugger_instruction_hook(m_core->m_pc); m_core->m_op = read_op(m_core->m_pc); - //printf("%04x: %04x\n", (uint16_t)m_core->m_pc, (uint16_t)m_core->m_op); + //logerror("%04x: %04x\n", (uint16_t)m_core->m_pc, (uint16_t)m_core->m_op); update_pc(); // Decode and execute @@ -922,7 +922,7 @@ void dspp_device::exec_branch() if (mode == 2) branch = !branch; - //printf("Branch: %d %d %d %d %d\n", branch ? 1 : 0, flag0 ? 1 : 0, mask0 ? 1 : 0, flag1 ? 1 : 0, mask1 ? 1 : 0); + //logerror("Branch: %d %d %d %d %d\n", branch ? 1 : 0, flag0 ? 1 : 0, mask0 ? 1 : 0, flag1 ? 1 : 0, mask1 ? 1 : 0); if (branch) m_core->m_pc = m_core->m_op & 0x3ff; @@ -1057,7 +1057,7 @@ inline void dspp_device::exec_arithmetic() int32_t alu_a, alu_b; //if (m_core->m_op == 0x46a0) - //printf("Arithmetic: numops:%d, muxa:%d, muxb:%d, alu_op:%d, barrel_code:%d\n", numops, muxa, muxb, alu_op, barrel_code); + //logerror("Arithmetic: numops:%d, muxa:%d, muxb:%d, alu_op:%d, barrel_code:%d\n", numops, muxa, muxb, alu_op, barrel_code); switch (muxa) { @@ -1070,7 +1070,7 @@ inline void dspp_device::exec_arithmetic() { alu_a = read_next_operand() << 4; //if (m_core->m_op == 0x46a0) - //printf("Arithmetic: Next operand: %04x\n", alu_a >> 4); + //logerror("Arithmetic: Next operand: %04x\n", alu_a >> 4); break; } case 3: @@ -1573,7 +1573,7 @@ void dspp_device::service_input_dma(int32_t channel) if (isSQXD) { - printf("SQXD NOT TESTED!"); + logerror("SQXD NOT TESTED!"); sample = decode_sqxd(curbyte, dma.m_prev_value); dma.m_prev_value = sample; @@ -2146,7 +2146,7 @@ uint32_t dspp_device::read_ext_control(offs_t offset) } default: { - printf("DSPP: Unhandled external control read (%.4x)\n", offset << 2); + logerror("DSPP: Unhandled external control read (%.4x)\n", offset << 2); break; } } @@ -2381,7 +2381,7 @@ void dspp_device::write_ext_control(offs_t offset, uint32_t data) } default: { - printf("DSPP: Unhandled external control write (%.4x with %.8x)\n", offset << 2, data); + logerror("DSPP: Unhandled external control write (%.4x with %.8x)\n", offset << 2, data); break; } } @@ -2607,7 +2607,7 @@ uint16_t dspp_device::read_output_fifo() // DEBUG! -char * GetBinary(char * buffer, uint32_t val, uint32_t bits) +inline char *GetBinary(char *buffer, uint32_t val, uint32_t bits) { uint32_t i; @@ -2619,33 +2619,33 @@ char * GetBinary(char * buffer, uint32_t val, uint32_t bits) return buffer; } -void dspp_device::dump_state() +void dspp_device::dump_state(std::ostream &str) { // DMA for (uint32_t i = 0; i < NUM_DMA_CHANNELS; ++i) { - printf("\n=== CHANNEL %02X ===\n", i); - printf("CURR_ADDRESS: %08X\n", m_fifo_dma[i].m_current_addr); - printf("CURR_COUNT: %08X\n", m_fifo_dma[i].m_current_count); - printf("NEXT_ADDR: %08X\n", m_fifo_dma[i].m_next_addr); - printf("NEXT_COUNT: %08X\n", m_fifo_dma[i].m_next_count); - printf("PREV_VALUE: %08X\n", m_fifo_dma[i].m_prev_value); - printf("PREV_CURRENT: %08X\n", m_fifo_dma[i].m_prev_current); - printf("GO_FOREVER: %X\n", m_fifo_dma[i].m_go_forever); - printf("NEXT_VALID: %X\n", m_fifo_dma[i].m_next_valid); + util::stream_format(str, "\n=== CHANNEL %02X ===\n", i); + util::stream_format(str, "CURR_ADDRESS: %08X\n", m_fifo_dma[i].m_current_addr); + util::stream_format(str, "CURR_COUNT: %08X\n", m_fifo_dma[i].m_current_count); + util::stream_format(str, "NEXT_ADDR: %08X\n", m_fifo_dma[i].m_next_addr); + util::stream_format(str, "NEXT_COUNT: %08X\n", m_fifo_dma[i].m_next_count); + util::stream_format(str, "PREV_VALUE: %08X\n", m_fifo_dma[i].m_prev_value); + util::stream_format(str, "PREV_CURRENT: %08X\n", m_fifo_dma[i].m_prev_current); + util::stream_format(str, "GO_FOREVER: %X\n", m_fifo_dma[i].m_go_forever); + util::stream_format(str, "NEXT_VALID: %X\n", m_fifo_dma[i].m_next_valid); } char buffer[64]; - printf("\n=== GLOBAL REGISTER===\n"); - printf("DSPX_CONTROL: %08X\n", m_core->m_dspx_control); - printf("DSPX_RESET: %08X\n", m_dspx_reset); - printf("DSPX_INT_ENABLE: %08X\n", m_dspx_int_enable); - printf("DSPX_CHANNEL_ENABLE: %08X %s\n", m_dspx_channel_enable, GetBinary(buffer, m_dspx_channel_enable, 32)); - printf("DSPX_CHANNEL_COMPLETE: %08X %s\n", m_dspx_channel_complete, GetBinary(buffer, m_dspx_channel_complete, 32)); - printf("DSPX_CHANNEL_DIRECTION: %08X %s\n", m_dspx_channel_direction, GetBinary(buffer, m_dspx_channel_direction, 32)); - printf("DSPX_CHANNEL_8BIT: %08X %s\n", m_dspx_channel_8bit, GetBinary(buffer, m_dspx_channel_8bit, 32)); - printf("DSPX_CHANNEL_SQXD: %08X %s\n", m_dspx_channel_sqxd, GetBinary(buffer, m_dspx_channel_sqxd, 32)); + util::stream_format(str, "\n=== GLOBAL REGISTER===\n"); + util::stream_format(str, "DSPX_CONTROL: %08X\n", m_core->m_dspx_control); + util::stream_format(str, "DSPX_RESET: %08X\n", m_dspx_reset); + util::stream_format(str, "DSPX_INT_ENABLE: %08X\n", m_dspx_int_enable); + util::stream_format(str, "DSPX_CHANNEL_ENABLE: %08X %s\n", m_dspx_channel_enable, GetBinary(buffer, m_dspx_channel_enable, 32)); + util::stream_format(str, "DSPX_CHANNEL_COMPLETE: %08X %s\n", m_dspx_channel_complete, GetBinary(buffer, m_dspx_channel_complete, 32)); + util::stream_format(str, "DSPX_CHANNEL_DIRECTION: %08X %s\n", m_dspx_channel_direction, GetBinary(buffer, m_dspx_channel_direction, 32)); + util::stream_format(str, "DSPX_CHANNEL_8BIT: %08X %s\n", m_dspx_channel_8bit, GetBinary(buffer, m_dspx_channel_8bit, 32)); + util::stream_format(str, "DSPX_CHANNEL_SQXD: %08X %s\n", m_dspx_channel_sqxd, GetBinary(buffer, m_dspx_channel_sqxd, 32)); #if 0 uint32_t m_dspx_shadow_current_addr; diff --git a/src/devices/cpu/dspp/dspp.h b/src/devices/cpu/dspp/dspp.h index f5a2bd770b7..310b9ab2996 100644 --- a/src/devices/cpu/dspp/dspp.h +++ b/src/devices/cpu/dspp/dspp.h @@ -36,7 +36,7 @@ public: uint16_t read_output_fifo(); - void dump_state(); // TODO: DEBUG REMOVE ME + void dump_state(std::ostream &str); // TODO: DEBUG REMOVE ME // Internal registers uint16_t input_r(); diff --git a/src/devices/cpu/f2mc16/f2mc16d.cpp b/src/devices/cpu/f2mc16/f2mc16d.cpp index 90aaf712ca5..c0f7612dd67 100644 --- a/src/devices/cpu/f2mc16/f2mc16d.cpp +++ b/src/devices/cpu/f2mc16/f2mc16d.cpp @@ -66,7 +66,7 @@ const std::string_view f2mc16_disassembler::s_bcc_ops[16] = "BLS", "BHI" }; -offs_t f2mc16_disassembler::opcode_alignment() const +u32 f2mc16_disassembler::opcode_alignment() const { return 1; } diff --git a/src/devices/cpu/f2mc16/f2mc16d.h b/src/devices/cpu/f2mc16/f2mc16d.h index 10aa6595235..d8a86006652 100644 --- a/src/devices/cpu/f2mc16/f2mc16d.h +++ b/src/devices/cpu/f2mc16/f2mc16d.h @@ -13,7 +13,7 @@ public: protected: // disasm_interface overrides - virtual offs_t opcode_alignment() const override; + virtual u32 opcode_alignment() const override; virtual u32 interface_flags() const override; virtual u32 page_address_bits() const override; virtual offs_t disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer ¶ms) override; diff --git a/src/devices/cpu/h8500/h8500dasm.cpp b/src/devices/cpu/h8500/h8500dasm.cpp index 5bea8496b50..178bd52845f 100644 --- a/src/devices/cpu/h8500/h8500dasm.cpp +++ b/src/devices/cpu/h8500/h8500dasm.cpp @@ -63,7 +63,7 @@ const char *const h8500_disassembler::s_branches[0x10] = "BGT", "BLE" }; -offs_t h8500_disassembler::opcode_alignment() const +u32 h8500_disassembler::opcode_alignment() const { return 1; } diff --git a/src/devices/cpu/h8500/h8500dasm.h b/src/devices/cpu/h8500/h8500dasm.h index 698d27db764..14218f94f44 100644 --- a/src/devices/cpu/h8500/h8500dasm.h +++ b/src/devices/cpu/h8500/h8500dasm.h @@ -13,7 +13,7 @@ public: protected: // disasm_interface overrides - virtual offs_t opcode_alignment() const override; + virtual u32 opcode_alignment() const override; virtual u32 interface_flags() const override; virtual u32 page_address_bits() const override; virtual offs_t disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer ¶ms) override; diff --git a/src/devices/cpu/i386/athlon.cpp b/src/devices/cpu/i386/athlon.cpp index d4a582d6756..0c3e65aea6b 100644 --- a/src/devices/cpu/i386/athlon.cpp +++ b/src/devices/cpu/i386/athlon.cpp @@ -407,7 +407,8 @@ void athlonxp_device::cache_clean() uint8_t athlonxp_device::READ8PL(uint32_t ea, uint8_t privilege) { - uint32_t address = ea, error; + offs_t address = ea; + uint32_t error; if(!translate_address(privilege,TR_READ,&address,&error)) PF_THROW(error); @@ -421,7 +422,8 @@ uint8_t athlonxp_device::READ8PL(uint32_t ea, uint8_t privilege) uint16_t athlonxp_device::READ16PL(uint32_t ea, uint8_t privilege) { uint16_t value; - uint32_t address = ea, error; + offs_t address = ea; + uint32_t error; switch (ea & 3) { @@ -462,7 +464,8 @@ uint16_t athlonxp_device::READ16PL(uint32_t ea, uint8_t privilege) uint32_t athlonxp_device::READ32PL(uint32_t ea, uint8_t privilege) { uint32_t value; - uint32_t address = ea, error; + offs_t address = ea; + uint32_t error; switch (ea & 3) { @@ -507,7 +510,8 @@ uint32_t athlonxp_device::READ32PL(uint32_t ea, uint8_t privilege) uint64_t athlonxp_device::READ64PL(uint32_t ea, uint8_t privilege) { uint64_t value; - uint32_t address = ea, error; + offs_t address = ea; + uint32_t error; switch (ea & 3) { @@ -551,7 +555,9 @@ uint64_t athlonxp_device::READ64PL(uint32_t ea, uint8_t privilege) void athlonxp_device::WRITE8PL(uint32_t ea, uint8_t privilege, uint8_t value) { - uint32_t address = ea, error; + offs_t address = ea; + uint32_t error; + if(!translate_address(privilege,TR_WRITE,&address,&error)) PF_THROW(error); @@ -563,7 +569,8 @@ void athlonxp_device::WRITE8PL(uint32_t ea, uint8_t privilege, uint8_t value) void athlonxp_device::WRITE16PL(uint32_t ea, uint8_t privilege, uint16_t value) { - uint32_t address = ea, error; + offs_t address = ea; + uint32_t error; switch(ea & 3) { @@ -600,7 +607,8 @@ void athlonxp_device::WRITE16PL(uint32_t ea, uint8_t privilege, uint16_t value) void athlonxp_device::WRITE32PL(uint32_t ea, uint8_t privilege, uint32_t value) { - uint32_t address = ea, error; + offs_t address = ea; + uint32_t error; switch(ea & 3) { @@ -641,7 +649,8 @@ void athlonxp_device::WRITE32PL(uint32_t ea, uint8_t privilege, uint32_t value) void athlonxp_device::WRITE64PL(uint32_t ea, uint8_t privilege, uint64_t value) { - uint32_t address = ea, error; + offs_t address = ea; + uint32_t error; switch(ea & 3) { diff --git a/src/devices/cpu/i386/i386.cpp b/src/devices/cpu/i386/i386.cpp index 9daec3ec4e0..80af52f6baa 100644 --- a/src/devices/cpu/i386/i386.cpp +++ b/src/devices/cpu/i386/i386.cpp @@ -194,10 +194,10 @@ device_vtlb_interface::vtlb_entry i386_device::get_permissions(uint32_t pte, int bool i386_device::i386_translate_address(int intention, bool debug, offs_t *address, vtlb_entry *entry) { - uint32_t a = *address; - uint32_t pdbr = m_cr[3] & 0xfffff000; - uint32_t directory = (a >> 22) & 0x3ff; - uint32_t table = (a >> 12) & 0x3ff; + offs_t a = *address; + offs_t pdbr = m_cr[3] & 0xfffff000; + offs_t directory = (a >> 22) & 0x3ff; + offs_t table = (a >> 12) & 0x3ff; vtlb_entry perm = 0; bool ret; bool user = (intention & TR_USER) ? true : false; @@ -281,20 +281,20 @@ bool i386_device::i386_translate_address(int intention, bool debug, offs_t *addr //#define TEST_TLB -bool i386_device::translate_address(int pl, int type, uint32_t *address, uint32_t *error) +bool i386_device::translate_address(int pl, int type, offs_t *address, uint32_t *error) { if (!(m_cr[0] & CR0_PG)) // Some (very few) old OS's won't work with this return true; const vtlb_entry *table = vtlb_table(); - uint32_t index = *address >> 12; + offs_t index = *address >> 12; vtlb_entry entry = table[index]; if (type == TR_FETCH) type = TR_READ; if (pl == 3) type |= TR_USER; #ifdef TEST_TLB - uint32_t test_addr = *address; + offs_t test_addr = *address; #endif if (!(entry & FLAG_VALID) || ((type & TR_WRITE) && !(entry & FLAG_DIRTY))) @@ -340,7 +340,8 @@ void i386_device::NEAR_BRANCH(int32_t offs) uint8_t i386_device::FETCH() { uint8_t value; - uint32_t address = m_pc, error; + offs_t address = m_pc; + uint32_t error; if(!translate_address(m_CPL,TR_FETCH,&address,&error)) PF_THROW(error); @@ -357,7 +358,8 @@ uint8_t i386_device::FETCH() uint16_t i386_device::FETCH16() { uint16_t value; - uint32_t address = m_pc, error; + offs_t address = m_pc; + uint32_t error; if( !WORD_ALIGNED(address) ) { /* Unaligned read */ value = (FETCH() << 0); @@ -375,7 +377,8 @@ uint16_t i386_device::FETCH16() uint32_t i386_device::FETCH32() { uint32_t value; - uint32_t address = m_pc, error; + offs_t address = m_pc; + uint32_t error; if( !DWORD_ALIGNED(m_pc) ) { /* Unaligned read */ value = (FETCH() << 0); @@ -396,7 +399,8 @@ uint32_t i386_device::FETCH32() uint8_t i386_device::READ8PL(uint32_t ea, uint8_t privilege) { - uint32_t address = ea, error; + offs_t address = ea; + uint32_t error; if(!translate_address(privilege,TR_READ,&address,&error)) PF_THROW(error); @@ -408,7 +412,8 @@ uint8_t i386_device::READ8PL(uint32_t ea, uint8_t privilege) uint16_t i386_device::READ16PL(uint32_t ea, uint8_t privilege) { uint16_t value; - uint32_t address = ea, error; + offs_t address = ea; + uint32_t error; switch (ea & 3) { @@ -442,7 +447,8 @@ uint16_t i386_device::READ16PL(uint32_t ea, uint8_t privilege) uint32_t i386_device::READ32PL(uint32_t ea, uint8_t privilege) { uint32_t value; - uint32_t address = ea, error; + offs_t address = ea; + uint32_t error; switch (ea & 3) { @@ -487,7 +493,8 @@ uint32_t i386_device::READ32PL(uint32_t ea, uint8_t privilege) uint64_t i386_device::READ64PL(uint32_t ea, uint8_t privilege) { uint64_t value; - uint32_t address = ea, error; + offs_t address = ea; + uint32_t error; switch (ea & 3) { @@ -532,7 +539,8 @@ uint64_t i386_device::READ64PL(uint32_t ea, uint8_t privilege) uint16_t i386sx_device::READ16PL(uint32_t ea, uint8_t privilege) { uint16_t value; - uint32_t address = ea, error; + offs_t address = ea; + uint32_t error; if (WORD_ALIGNED(ea)) { @@ -595,14 +603,18 @@ uint64_t i386sx_device::READ64PL(uint32_t ea, uint8_t privilege) void i386_device::WRITE_TEST(uint32_t ea) { - uint32_t address = ea, error; + offs_t address = ea; + uint32_t error; + if(!translate_address(m_CPL,TR_WRITE,&address,&error)) PF_THROW(error); } void i386_device::WRITE8PL(uint32_t ea, uint8_t privilege, uint8_t value) { - uint32_t address = ea, error; + offs_t address = ea; + uint32_t error; + if(!translate_address(privilege,TR_WRITE,&address,&error)) PF_THROW(error); @@ -612,7 +624,8 @@ void i386_device::WRITE8PL(uint32_t ea, uint8_t privilege, uint8_t value) void i386_device::WRITE16PL(uint32_t ea, uint8_t privilege, uint16_t value) { - uint32_t address = ea, error; + offs_t address = ea; + uint32_t error; switch(ea & 3) { @@ -642,7 +655,8 @@ void i386_device::WRITE16PL(uint32_t ea, uint8_t privilege, uint16_t value) void i386_device::WRITE32PL(uint32_t ea, uint8_t privilege, uint32_t value) { - uint32_t address = ea, error; + offs_t address = ea; + uint32_t error; switch(ea & 3) { @@ -683,7 +697,8 @@ void i386_device::WRITE32PL(uint32_t ea, uint8_t privilege, uint32_t value) void i386_device::WRITE64PL(uint32_t ea, uint8_t privilege, uint64_t value) { - uint32_t address = ea, error; + offs_t address = ea; + uint32_t error; switch(ea & 3) { @@ -724,7 +739,8 @@ void i386_device::WRITE64PL(uint32_t ea, uint8_t privilege, uint64_t value) void i386sx_device::WRITE16PL(uint32_t ea, uint8_t privilege, uint16_t value) { - uint32_t address = ea, error; + offs_t address = ea; + uint32_t error; if (WORD_ALIGNED(ea)) { @@ -1740,9 +1756,9 @@ void i386_device::i386_decode_four_byte38f3() uint8_t i386_device::read8_debug(uint32_t ea, uint8_t *data) { - uint32_t address = ea; + offs_t address = ea; - if(!i386_translate_address(TR_READ, true, &address,nullptr)) + if(!i386_translate_address(TR_READ, true, &address, nullptr)) return 0; address &= m_a20_mask; @@ -1875,9 +1891,9 @@ uint64_t i386_device::debug_segofftovirt(int params, const uint64_t *param) uint64_t i386_device::debug_virttophys(int params, const uint64_t *param) { - uint32_t result = param[0]; + offs_t result = param[0]; - if(!i386_translate_address(TR_READ,true,&result,nullptr)) + if(!i386_translate_address(TR_READ, true, &result, nullptr)) return 0; return result; } @@ -2761,11 +2777,11 @@ void i386_device::i386_set_a20_line(int state) { if (state) { - m_a20_mask = ~0; + m_a20_mask = ~offs_t(0); } else { - m_a20_mask = ~(1 << 20); + m_a20_mask = ~(offs_t(1) << 20); } // TODO: how does A20M and the tlb interact vtlb_flush_dynamic(); @@ -2802,7 +2818,16 @@ void i386_device::execute_run() { uint32_t phys_addr = 0; uint32_t error; - phys_addr = (m_cr[0] & CR0_PG) ? translate_address(m_CPL, TR_FETCH, &m_dr[i], &error) : m_dr[i]; + if(m_cr[0] & CR0_PG) + { + offs_t addr = m_dr[i]; + phys_addr = translate_address(m_CPL, TR_FETCH, &addr, &error); + m_dr[i] = uint32_t(addr); + } + else + { + phys_addr = m_dr[i]; + } if(breakpoint_length != 0) // Not one byte in length? logerror it, I have no idea how this works on real processors. { LOGMASKED(LOG_INVALID_OPCODE, "i386: Breakpoint length not 1 byte on an instruction breakpoint\n"); diff --git a/src/devices/cpu/i386/i386.h b/src/devices/cpu/i386/i386.h index c32db6a29a0..7a0ac627429 100644 --- a/src/devices/cpu/i386/i386.h +++ b/src/devices/cpu/i386/i386.h @@ -347,7 +347,7 @@ protected: uint8_t m_irq_state; address_space *m_program; address_space *m_io; - uint32_t m_a20_mask; + offs_t m_a20_mask; memory_access<32, 1, 0, ENDIANNESS_LITTLE>::cache macache16; memory_access<32, 2, 0, ENDIANNESS_LITTLE>::cache macache32; @@ -438,7 +438,7 @@ protected: uint32_t i386_translate(int segment, uint32_t ip, int rwn, int size = 1); inline vtlb_entry get_permissions(uint32_t pte, int wp); bool i386_translate_address(int intention, bool debug, offs_t *address, vtlb_entry *entry); - bool translate_address(int pl, int type, uint32_t *address, uint32_t *error); + bool translate_address(int pl, int type, offs_t *address, uint32_t *error); void CHANGE_PC(uint32_t pc); inline void NEAR_BRANCH(int32_t offs); inline uint8_t FETCH(); diff --git a/src/devices/cpu/i386/i386op16.hxx b/src/devices/cpu/i386/i386op16.hxx index 695ee2a6877..c5aed97bf7e 100644 --- a/src/devices/cpu/i386/i386op16.hxx +++ b/src/devices/cpu/i386/i386op16.hxx @@ -3215,7 +3215,7 @@ void i386_device::i386_group0F00_16() // Opcode 0x0f 00 seg.selector = m_task.segment; i386_load_protected_mode_segment(&seg,nullptr); - uint32_t addr = ((seg.selector & 4) ? m_ldtr.base : m_gdtr.base) + (seg.selector & ~7) + 5; + offs_t addr = ((seg.selector & 4) ? m_ldtr.base : m_gdtr.base) + (seg.selector & ~7) + 5; i386_translate_address(TR_READ, false, &addr, nullptr); m_program->write_byte(addr, (seg.flags & 0xff) | 2); diff --git a/src/devices/cpu/i386/i386op32.hxx b/src/devices/cpu/i386/i386op32.hxx index 9ba00fbc4e5..5f1eba89b69 100644 --- a/src/devices/cpu/i386/i386op32.hxx +++ b/src/devices/cpu/i386/i386op32.hxx @@ -3017,7 +3017,7 @@ void i386_device::i386_group0F00_32() // Opcode 0x0f 00 seg.selector = m_task.segment; i386_load_protected_mode_segment(&seg,nullptr); - uint32_t addr = ((seg.selector & 4) ? m_ldtr.base : m_gdtr.base) + (seg.selector & ~7) + 5; + offs_t addr = ((seg.selector & 4) ? m_ldtr.base : m_gdtr.base) + (seg.selector & ~7) + 5; i386_translate_address(TR_READ, false, &addr, nullptr); m_program->write_byte(addr, (seg.flags & 0xff) | 2); diff --git a/src/devices/cpu/i386/i386segs.hxx b/src/devices/cpu/i386/i386segs.hxx index 20b456c81b8..e2445d5df75 100644 --- a/src/devices/cpu/i386/i386segs.hxx +++ b/src/devices/cpu/i386/i386segs.hxx @@ -80,7 +80,7 @@ void i386_device::i386_load_call_gate(I386_CALL_GATE *gate) void i386_device::i386_set_descriptor_accessed(uint16_t selector) { // assume the selector is valid, we don't need to check it again - uint32_t base, addr; + offs_t base, addr; uint8_t rights; if(!(selector & ~3)) return; @@ -2500,7 +2500,7 @@ inline void i386_device::dri_changed() { int breakpoint_type = (m_dr[7] >> ((dr << 2) + 16)) & 3; int breakpoint_length = (m_dr[7] >> ((dr << 2) + 16 + 2)) & 3; - uint32_t phys_addr = m_dr[dr]; + offs_t phys_addr = m_dr[dr]; uint32_t error; if(translate_address(m_CPL, TR_READ, &phys_addr, &error)) { diff --git a/src/devices/cpu/mips/mips1.cpp b/src/devices/cpu/mips/mips1.cpp index 2316da4b25d..f61abd3cad6 100644 --- a/src/devices/cpu/mips/mips1.cpp +++ b/src/devices/cpu/mips/mips1.cpp @@ -1117,7 +1117,8 @@ std::tuple<struct mips1core_device_base::cache::line &, bool> mips1core_device_b } // compute bit position of sub-unit within a word given endianness and address -template <typename T> unsigned mips1core_device_base::shift_factor(u32 address) const +template <typename T> +unsigned mips1core_device_base::shift_factor(u32 address) const { if constexpr (sizeof(T) == 1) return ((m_endianness == ENDIANNESS_BIG) ? (address & 3) ^ 3 : (address & 3)) * 8; @@ -1127,7 +1128,8 @@ template <typename T> unsigned mips1core_device_base::shift_factor(u32 address) return 0; } -template <typename T, bool Aligned, typename U> std::enable_if_t<std::is_convertible<U, std::function<void(T)>>::value, void> mips1core_device_base::load(u32 address, U &&apply) +template <typename T, bool Aligned, typename U> +std::enable_if_t<std::is_convertible<U, std::function<void(T)>>::value, void> mips1core_device_base::load(offs_t address, U &&apply) { // alignment error if (Aligned && (address & (sizeof(T) - 1))) @@ -1204,7 +1206,8 @@ template <typename T, bool Aligned, typename U> std::enable_if_t<std::is_convert apply(data); } -template <typename T, bool Aligned> void mips1core_device_base::store(u32 address, T data, T mem_mask) +template <typename T, bool Aligned> +void mips1core_device_base::store(offs_t address, T data, T mem_mask) { // alignment error if (Aligned && (address & (sizeof(T) - 1))) @@ -1274,7 +1277,7 @@ template <typename T, bool Aligned> void mips1core_device_base::store(u32 addres } } -void mips1core_device_base::fetch(u32 address, std::function<void(u32)> &&apply) +void mips1core_device_base::fetch(offs_t address, std::function<void(u32)> &&apply) { // alignment error if (address & 3) diff --git a/src/devices/cpu/mips/mips1.h b/src/devices/cpu/mips/mips1.h index 5de7238281c..ddc10d618f9 100644 --- a/src/devices/cpu/mips/mips1.h +++ b/src/devices/cpu/mips/mips1.h @@ -59,9 +59,9 @@ protected: // memory enum translate_result : unsigned { ERROR, UNCACHED, CACHED }; virtual translate_result translate(int intention, offs_t &address, bool debug); - template <typename T, bool Aligned = true, typename U> std::enable_if_t<std::is_convertible<U, std::function<void(T)>>::value, void> load(u32 address, U &&apply); - template <typename T, bool Aligned = true> void store(u32 address, T data, T mem_mask = ~T(0)); - void fetch(u32 address, std::function<void(u32)> &&apply); + template <typename T, bool Aligned = true, typename U> std::enable_if_t<std::is_convertible<U, std::function<void(T)>>::value, void> load(offs_t address, U &&apply); + template <typename T, bool Aligned = true> void store(offs_t address, T data, T mem_mask = ~T(0)); + void fetch(offs_t address, std::function<void(u32)> &&apply); // cache template <typename T> unsigned shift_factor(u32 address) const; diff --git a/src/devices/cpu/olms66k/nx8dasm.cpp b/src/devices/cpu/olms66k/nx8dasm.cpp index 2b56815369d..ac85bb1a122 100644 --- a/src/devices/cpu/olms66k/nx8dasm.cpp +++ b/src/devices/cpu/olms66k/nx8dasm.cpp @@ -190,7 +190,7 @@ nx8_500s_disassembler::nx8_500s_disassembler(const u16 &psw) { } -offs_t nx8_500s_disassembler::opcode_alignment() const +u32 nx8_500s_disassembler::opcode_alignment() const { return 1; } diff --git a/src/devices/cpu/olms66k/nx8dasm.h b/src/devices/cpu/olms66k/nx8dasm.h index 2d3a4fba02e..bb79c6b3a29 100644 --- a/src/devices/cpu/olms66k/nx8dasm.h +++ b/src/devices/cpu/olms66k/nx8dasm.h @@ -14,7 +14,7 @@ public: protected: // disasm_interface overrides - virtual offs_t opcode_alignment() const override; + virtual u32 opcode_alignment() const override; virtual u32 interface_flags() const override; virtual u32 page_address_bits() const override; virtual offs_t disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer ¶ms) override; diff --git a/src/devices/cpu/powerpc/ppccom.cpp b/src/devices/cpu/powerpc/ppccom.cpp index 79e591e197a..210936d7c73 100644 --- a/src/devices/cpu/powerpc/ppccom.cpp +++ b/src/devices/cpu/powerpc/ppccom.cpp @@ -1575,18 +1575,11 @@ void ppc_device::ppccom_tlb_flush() void ppc_device::ppccom_get_dsisr() { - int intent = 0; + int intent = (m_core->param1 & 1) ? TR_WRITE : TR_READ; - if (m_core->param1 & 1) - { - intent = TR_WRITE; - } - else - { - intent = TR_READ; - } - - m_core->param1 = ppccom_translate_address_internal(intent, false, m_core->param0); + offs_t address = m_core->param0; + m_core->param1 = ppccom_translate_address_internal(intent, false, address); + m_core->param0 = address; } /*------------------------------------------------- @@ -2825,7 +2818,7 @@ void ppc_device::ppc4xx_spu_timer_reset() attotime charperiod = clockperiod * (divisor * 16 * bpc); m_spu.timer->adjust(charperiod, 0, charperiod); if (PRINTF_SPU) - printf("ppc4xx_spu_timer_reset: baud rate = %.0f\n", charperiod.as_hz() * bpc); + osd_printf_debug("ppc4xx_spu_timer_reset: baud rate = %.0f\n", charperiod.as_hz() * bpc); } /* otherwise, disable the timer */ @@ -2924,7 +2917,7 @@ uint8_t ppc4xx_device::ppc4xx_spu_r(offs_t offset) break; } if (PRINTF_SPU) - printf("spu_r(%d) = %02X\n", offset, result); + osd_printf_debug("spu_r(%d) = %02X\n", offset, result); return result; } @@ -2938,7 +2931,7 @@ void ppc4xx_device::ppc4xx_spu_w(offs_t offset, uint8_t data) uint8_t oldstate, newstate; if (PRINTF_SPU) - printf("spu_w(%d) = %02X\n", offset, data); + osd_printf_debug("spu_w(%d) = %02X\n", offset, data); switch (offset) { /* clear error bits */ diff --git a/src/devices/machine/68340ser.cpp b/src/devices/machine/68340ser.cpp index c74fc375f04..574c3ee99ce 100644 --- a/src/devices/machine/68340ser.cpp +++ b/src/devices/machine/68340ser.cpp @@ -15,7 +15,7 @@ #define LOG_INT (1U << 4) //#define VERBOSE (LOG_SETUP|LOG_READ|LOG_SERIAL|LOG_INT) -#define LOG_OUTPUT_FUNC printf // Needs always to be enabled as the default value 'logerror' is not available here +//#define LOG_OUTPUT_FUNC osd_printf_info #include "logmacro.h" diff --git a/src/devices/machine/68340sim.cpp b/src/devices/machine/68340sim.cpp index 4ef9a9c28a0..7e287c93e93 100644 --- a/src/devices/machine/68340sim.cpp +++ b/src/devices/machine/68340sim.cpp @@ -20,7 +20,7 @@ #define LOG_CS (1U << 9) #define VERBOSE (LOG_PIT) -#define LOG_OUTPUT_FUNC printf // Needs always to be enabled as the default value 'logerror' is not available here +//#define LOG_OUTPUT_FUNC osd_printf_info #include "logmacro.h" @@ -498,8 +498,6 @@ void m68340_cpu_device::start_68340_sim() void m68340_sim::reset() { - LOG("%s\n", FUNCNAME); - // Ports - only setup those that are affected by reset m_ddra = 0x00; m_ppara1 = 0xff; diff --git a/src/devices/machine/generalplus_gpl162xx_soc.cpp b/src/devices/machine/generalplus_gpl162xx_soc.cpp index 5aa93f1b156..2dcfd255bd6 100644 --- a/src/devices/machine/generalplus_gpl162xx_soc.cpp +++ b/src/devices/machine/generalplus_gpl162xx_soc.cpp @@ -1710,9 +1710,9 @@ void sunplus_gcm394_base_device::videoirq_w(int state) set_state_unsynced(UNSP_IRQ5_LINE, state); } -uint16_t sunplus_gcm394_base_device::read_space(uint32_t offset) +uint16_t sunplus_gcm394_base_device::read_space(offs_t offset) { - address_space& space = this->space(AS_PROGRAM); + address_space &space = this->space(AS_PROGRAM); uint16_t val; if (offset < m_csbase) { @@ -1720,7 +1720,7 @@ uint16_t sunplus_gcm394_base_device::read_space(uint32_t offset) } else { - val = m_cs_space->read_word(offset-m_csbase); + val = m_cs_space->read_word(offset - m_csbase); } return val; @@ -1728,16 +1728,16 @@ uint16_t sunplus_gcm394_base_device::read_space(uint32_t offset) -void sunplus_gcm394_base_device::write_space(uint32_t offset, uint16_t data) +void sunplus_gcm394_base_device::write_space(offs_t offset, uint16_t data) { - address_space& space = this->space(AS_PROGRAM); + address_space &space = this->space(AS_PROGRAM); if (offset < m_csbase) { space.write_word(offset, data); } else { - m_cs_space->write_word(offset-m_csbase, data); + m_cs_space->write_word(offset - m_csbase, data); } } diff --git a/src/devices/machine/generalplus_gpl162xx_soc.h b/src/devices/machine/generalplus_gpl162xx_soc.h index b8d9e9940cc..5426fe2c6c9 100644 --- a/src/devices/machine/generalplus_gpl162xx_soc.h +++ b/src/devices/machine/generalplus_gpl162xx_soc.h @@ -339,8 +339,8 @@ private: TIMER_CALLBACK_MEMBER(unknown_tick); - inline uint16_t read_space(uint32_t offset); - inline void write_space(uint32_t offset, uint16_t data); + inline uint16_t read_space(offs_t offset); + inline void write_space(offs_t offset, uint16_t data); bool m_alt_periodic_irq; // might be multiple timers, might be a register to configure, currently a config option. diff --git a/src/devices/machine/gt64xxx.cpp b/src/devices/machine/gt64xxx.cpp index 3f3ea408022..b24bf45418f 100644 --- a/src/devices/machine/gt64xxx.cpp +++ b/src/devices/machine/gt64xxx.cpp @@ -945,7 +945,7 @@ TIMER_CALLBACK_MEMBER(gt64xxx_device::timer_callback) * Galileo DMA handler * *************************************/ -address_space* gt64xxx_device::dma_decode_address(uint32_t &addr) +address_space* gt64xxx_device::dma_decode_address(offs_t &addr) { for (size_t index = 0; index < proc_addr_bank::ADDR_NUM; ++index) { diff --git a/src/devices/machine/gt64xxx.h b/src/devices/machine/gt64xxx.h index c82a54061ca..4a4dd11513e 100644 --- a/src/devices/machine/gt64xxx.h +++ b/src/devices/machine/gt64xxx.h @@ -148,7 +148,7 @@ private: galileo_addr_map dma_addr_map[proc_addr_bank::ADDR_NUM]; int dma_fetch_next(address_space &space, int which); TIMER_CALLBACK_MEMBER(perform_dma); - address_space* dma_decode_address(uint32_t &addr); + address_space* dma_decode_address(offs_t &addr); }; // Supports R4600/4650/4700/R5000 CPUs diff --git a/src/devices/machine/sis630_host.cpp b/src/devices/machine/sis630_host.cpp index dca6fdad62f..165dc168092 100644 --- a/src/devices/machine/sis630_host.cpp +++ b/src/devices/machine/sis630_host.cpp @@ -25,7 +25,7 @@ TODO: #define LOG_AGP (1U << 4) // log AGP #define VERBOSE (LOG_GENERAL | LOG_IO | LOG_TODO | LOG_AGP) -//#define LOG_OUTPUT_FUNC osd_printf_warning +//#define LOG_OUTPUT_FUNC osd_printf_info #include "logmacro.h" @@ -160,7 +160,7 @@ void sis630_host_device::memory_map(address_map &map) { } -void sis630_host_device::map_shadowram(address_space *memory_space, uint32_t start_offs, uint32_t end_offs, bool read_enable, bool write_enable) +void sis630_host_device::map_shadowram(address_space *memory_space, offs_t start_offs, offs_t end_offs, bool read_enable, bool write_enable) { LOGMAP("- 0x%08x-0x%08x ", start_offs, end_offs); diff --git a/src/devices/sound/discrete.cpp b/src/devices/sound/discrete.cpp index 3e97bff89da..2d60244b5bc 100644 --- a/src/devices/sound/discrete.cpp +++ b/src/devices/sound/discrete.cpp @@ -41,8 +41,9 @@ #include "wavwrite.h" #include <atomic> -#include <cstdarg> +#include <fstream> #include <iostream> +#include <locale> // device type definition @@ -471,21 +472,15 @@ const double *discrete_device::node_output_ptr(int onode) // discrete_log: Debug logging //------------------------------------------------- -void CLIB_DECL discrete_device::discrete_log(const char *text, ...) const +void discrete_device::discrete_vlog(util::format_argument_pack<char> &&args) { if (DISCRETE_DEBUGLOG) { - va_list arg; - va_start(arg, text); - - if(m_disclogfile) + if (m_disclogfile) { - vfprintf(m_disclogfile, text, arg); - fprintf(m_disclogfile, "\n"); - fflush(m_disclogfile); + util::stream_format(*m_disclogfile, std::move(args)); + *m_disclogfile << std::endl; } - - va_end(arg); } } @@ -825,7 +820,6 @@ discrete_device::discrete_device(const machine_config &mconfig, device_type type m_sample_time(0), m_neg_sample_time(0), m_indexed_node(nullptr), - m_disclogfile(nullptr), m_queue(nullptr), m_profiling(0), m_total_samples(0), @@ -865,7 +859,16 @@ void discrete_device::device_start() /* create the logfile */ if (DISCRETE_DEBUGLOG) - m_disclogfile = fopen(util::string_format("discrete%s.log", this->tag()).c_str(), "w"); + { + std::string fname = util::string_format("discrete%s.log", tag()); + for (char &ch : fname) + { + if (ch == ':') + ch = '_'; + } + m_disclogfile = std::make_unique<std::ofstream>(fname.c_str()); + m_disclogfile->imbue(std::locale::classic()); + } /* enable profiling */ m_profiling = 0; @@ -933,13 +936,8 @@ void discrete_device::device_stop() node->stop(); } - if (DISCRETE_DEBUGLOG) - { - /* close the debug log */ - if (m_disclogfile) - fclose(m_disclogfile); - m_disclogfile = nullptr; - } + /* close the debug log */ + m_disclogfile.reset(); } //------------------------------------------------- diff --git a/src/devices/sound/discrete.h b/src/devices/sound/discrete.h index 2a5b34dfef6..9570a258b25 100644 --- a/src/devices/sound/discrete.h +++ b/src/devices/sound/discrete.h @@ -7,7 +7,9 @@ #include "machine/rescap.h" +#include <iosfwd> #include <memory> +#include <utility> #include <vector> @@ -4208,7 +4210,12 @@ public: void process(int samples); /* access to the discrete_logging facility */ - void CLIB_DECL discrete_log(const char *text, ...) const ATTR_PRINTF(2,3); + void discrete_vlog(util::format_argument_pack<char> &&args); + template <typename Format, typename... Params> + void discrete_log(Format &&fmt, Params &&... args) + { + discrete_vlog(util::make_format_argument_pack(std::forward<Format>(fmt), std::forward<Params>(args)...)); + } /* get pointer to a info struct node ref */ const double *node_output_ptr(int onode); @@ -4262,7 +4269,7 @@ private: task_list_t task_list; /* discrete_task_context * */ /* debugging statistics */ - FILE * m_disclogfile; + std::unique_ptr<std::ostream> m_disclogfile; /* parallel tasks */ osd_work_queue * m_queue; diff --git a/src/devices/sound/qs1000.cpp b/src/devices/sound/qs1000.cpp index c5b99a167f4..02dadff01fa 100644 --- a/src/devices/sound/qs1000.cpp +++ b/src/devices/sound/qs1000.cpp @@ -127,7 +127,9 @@ #include "qs1000.h" -#define LOGGING_ENABLED 0 +//#define VERBOSE 1 +//#define LOG_OUTPUT_FUNC osd_printf_info +#include "logmacro.h" // device type definition @@ -357,8 +359,7 @@ void qs1000_device::wave_w(offs_t offset, uint8_t data) { m_stream->update(); - if (LOGGING_ENABLED) - printf("QS1000 W[%x] %x\n", 0x200 + offset, data); + LOG("QS1000 W[%x] %x\n", 0x200 + offset, data); switch (offset) { @@ -527,8 +528,7 @@ void qs1000_device::start_voice(int ch) uint16_t word1 = (read_byte(table_addr + 2) << 8) | read_byte(table_addr + 3); uint16_t base = (read_byte(table_addr + 4) << 8) | read_byte(table_addr + 5); - if (LOGGING_ENABLED) - printf("[%.6x] Freq:%.4x ????:%.4x Addr:%.4x\n", table_addr, freq, word1, base); + LOG("[%.6x] Freq:%.4x ????:%.4x Addr:%.4x\n", table_addr, freq, word1, base); // See Raccoon World and Wyvern Wings nullptr sound if (freq == 0) @@ -562,7 +562,7 @@ void qs1000_device::start_voice(int ch) uint8_t byte8 = read_byte(base + 8); - if (LOGGING_ENABLED) + if (VERBOSE & LOG_GENERAL) { uint8_t byte9 = read_byte(base + 9); uint8_t byte10 = read_byte(base + 10); @@ -572,7 +572,7 @@ void qs1000_device::start_voice(int ch) uint8_t byte14 = read_byte(base + 14); uint8_t byte15 = read_byte(base + 15); - printf("[%.6x] Sample Start:%.6x Loop Start:%.6x Loop End:%.6x Params: %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x\n", base, start_addr, loop_start, loop_end, byte8, byte9, byte10, byte11, byte12, byte13, byte14, byte15); + LOG("[%.6x] Sample Start:%.6x Loop Start:%.6x Loop End:%.6x Params: %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x\n", base, start_addr, loop_start, loop_end, byte8, byte9, byte10, byte11, byte12, byte13, byte14, byte15); } m_channels[ch].m_acc = 0; diff --git a/src/devices/video/ym7101.cpp b/src/devices/video/ym7101.cpp index 6a3578dfda3..be3a95536e7 100644 --- a/src/devices/video/ym7101.cpp +++ b/src/devices/video/ym7101.cpp @@ -439,7 +439,7 @@ void ym7101_device::vram_w(offs_t offset, u16 data, u16 mem_mask) COMBINE_DATA(&m_vram[offset]); gfx(0)->mark_dirty(offset >> 4); - const u32 sprite_table = m_sprite_attribute_table >> 1; + const offs_t sprite_table = m_sprite_attribute_table >> 1; // TODO: check akumajo Stage 6-3 // TODO: check segacd:snatcheru (H32, puts sprite_table at $fe00) diff --git a/src/mame/gaelco/gaelcof3.cpp b/src/mame/gaelco/futbol3.cpp index 74127902b88..7e9cafa4481 100644 --- a/src/mame/gaelco/gaelcof3.cpp +++ b/src/mame/gaelco/futbol3.cpp @@ -43,8 +43,10 @@ */ #include "emu.h" + #include "cpu/pic16c5x/pic16c5x.h" #include "sound/okim6295.h" + #include "speaker.h" @@ -58,7 +60,7 @@ public: m_maincpu(*this, "maincpu") { } - void gaelcof3(machine_config &config); + void gaelcof3(machine_config &config) ATTR_COLD; private: required_device<pic16c56_device> m_maincpu; diff --git a/src/mame/konami/konamim2.cpp b/src/mame/konami/konamim2.cpp index 72958b5ea6d..015db543617 100644 --- a/src/mame/konami/konamim2.cpp +++ b/src/mame/konami/konamim2.cpp @@ -233,6 +233,8 @@ Notes: #include "cdrom.h" +#include <sstream> + namespace { @@ -1500,11 +1502,19 @@ void konamim2_state::debug_commands(const std::vector<std::string_view> ¶ms) return; if (params[0] == "help") + { debug_help_command(params); + } else if (params[0] == "dump_task") + { dump_task_command(params); + } else if (params[0] == "dump_dspp") - subdevice<dspp_device>("bda:dspp")->dump_state(); + { + std::ostringstream str; + subdevice<dspp_device>("bda:dspp")->dump_state(str); + machine().debugger().console().printf("%s", std::move(str).str()); + } } void konamim2_state::dump_task_command(const std::vector<std::string_view> ¶ms) diff --git a/src/mame/konami/xmen.cpp b/src/mame/konami/xmen.cpp index d56aa88201b..fab5a540e38 100644 --- a/src/mame/konami/xmen.cpp +++ b/src/mame/konami/xmen.cpp @@ -48,6 +48,9 @@ Reverse-engineered schematics: https://github.com/jotego/jtbin/blob/master/sch/x #include "layout/generic.h" +//#define VERBOSE 1 +#include "logmacro.h" + namespace { @@ -67,13 +70,17 @@ public: m_okibank(*this, "okibank") { } - void xmen(machine_config &config); - void xmenabl(machine_config &config); + void xmen(machine_config &config) ATTR_COLD; + void xmenabl(machine_config &config) ATTR_COLD; protected: virtual void machine_start() override ATTR_COLD; virtual void machine_reset() override ATTR_COLD; + void control_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + + void base(machine_config &config) ATTR_COLD; + // video-related uint8_t m_layer_colorbase[3]{}; uint8_t m_sprite_colorbase = 0; @@ -91,14 +98,7 @@ protected: required_device<screen_device> m_screen; required_device<eeprom_serial_er5911_device> m_eeprom; - void control_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - - void base(machine_config &config); - private: - optional_memory_bank m_z80bank; - optional_memory_bank m_okibank; - void sound_bankswitch_w(uint8_t data); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -111,6 +111,9 @@ private: void main_map(address_map &map) ATTR_COLD; void oki_map(address_map &map) ATTR_COLD; void sound_map(address_map &map) ATTR_COLD; + + optional_memory_bank m_z80bank; + optional_memory_bank m_okibank; }; class xmen6p_state : public xmen_state @@ -122,7 +125,7 @@ public: m_tilemap(*this, "tilemap%u", 0) { } - void xmen6p(machine_config &config); + void xmen6p(machine_config &config) ATTR_COLD; int field_r() { return (m_screen->frame_number() & 1) ^ m_screen->vblank(); } @@ -130,15 +133,15 @@ protected: virtual void video_start() override ATTR_COLD; private: - bitmap_ind16 m_screen_bitmap[2]; // 0 left screen, 1 right screen - required_shared_ptr_array<uint16_t, 2> m_spriteram; - required_shared_ptr_array<uint16_t, 4> m_tilemap; - uint16_t *m_k053247_ram; - template <uint8_t Which> uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void screen_vblank(int state); void main_map(address_map &map) ATTR_COLD; + + bitmap_ind16 m_screen_bitmap[2]; // 0 left screen, 1 right screen + required_shared_ptr_array<uint16_t, 2> m_spriteram; + required_shared_ptr_array<uint16_t, 4> m_tilemap; + uint16_t *m_k053247_ram; }; @@ -325,7 +328,7 @@ void xmen6p_state::screen_vblank(int state) void xmen_state::control_w(offs_t offset, uint16_t data, uint16_t mem_mask) { - //logerror("%06x: write %04x mask %04x to 108000\n", m_maincpu->pc(), data, mem_mask); + LOG("%06x: write %04x mask %04x to 108000\n", m_maincpu->pc(), data, mem_mask); if (ACCESSING_BITS_0_7) { // bits 0/1 = coin counters diff --git a/src/mame/mame.lst b/src/mame/mame.lst index c35d1aba9b7..67968a8c784 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -18794,6 +18794,16 @@ watrball @source:gaelco/ds5002fp_programmer.cpp gaelcods +@source:gaelco/futbol3.cpp +autopapa +donpepito +futbol +futbola +futbolt +mueve +obladi +susanita + @source:gaelco/gaelco.cpp bigkarnk bigkarnka @@ -18891,16 +18901,6 @@ surfplnt30 surfplnt31 surfplnt40 -@source:gaelco/gaelcof3.cpp -autopapa -donpepito -futbol -futbola -futbolt -mueve -obladi -susanita - @source:gaelco/gaelcopc.cpp rriders tokyocop diff --git a/src/mame/skeleton/molecular.cpp b/src/mame/skeleton/molecular.cpp index f8c04137353..0342c85b6c5 100644 --- a/src/mame/skeleton/molecular.cpp +++ b/src/mame/skeleton/molecular.cpp @@ -155,7 +155,7 @@ void molecula_state::file_output_w(offs_t offset, uint8_t data) file_ram_enable = (data & 0x80) >> 7; if(data & 0x7f || offset) - printf("FILE output -> %02x %02x\n",data,offset); + logerror("FILE output -> %02x %02x\n", data, offset); } @@ -164,7 +164,7 @@ void molecula_state::app_output_w(uint8_t data) app_ram_enable = (data & 0x80) >> 7; if(data & 0x7f) - printf("APP 0x10 -> %02x\n",data); + logerror("APP 0x10 -> %02x\n", data); } uint8_t molecula_state::sio_r(offs_t offset) @@ -178,7 +178,7 @@ uint8_t molecula_state::sio_r(offs_t offset) void molecula_state::sio_w(offs_t offset, uint8_t data) { if(offset == 0) - printf("%c\n",data); + logerror("%c\n", data); } void molecula_state::molecula_file_map(address_map &map) diff --git a/src/mame/taito/gladiatr.cpp b/src/mame/taito/gladiatr.cpp index ad868849514..f55481d50db 100644 --- a/src/mame/taito/gladiatr.cpp +++ b/src/mame/taito/gladiatr.cpp @@ -496,7 +496,7 @@ u8 ppking_state::ppking_qx0_r(offs_t offset) m_mcu[0].rxd |= 0x40; } - //printf("%04x rst %d\n",m_maincpu->pc(),m_mcu[0].rst); + //logerror("%04x rst %d\n", m_maincpu->pc(),m_mcu[0].rst); return m_mcu[0].rxd; } @@ -536,8 +536,7 @@ void ppking_state::ppking_qx0_w(offs_t offset, u8 data) break; default: - printf("%02x %02x\n",offset,data); - break; + logerror("ppking_qx0_w: %02x %02x\n", offset, data); } } else diff --git a/src/mame/taito/taitoair.cpp b/src/mame/taito/taitoair.cpp index 26a9de6b5f2..58a9e14124e 100644 --- a/src/mame/taito/taitoair.cpp +++ b/src/mame/taito/taitoair.cpp @@ -233,7 +233,7 @@ void taitoair_state::lineram_w(offs_t offset, u16 data, u16 mem_mask) m_line_ram[offset] = data; //if (offset == 0x3fff) - // printf("LineRAM go %d\n",(int)m_screen->frame_number()); + // logerror("LineRAM go %d\n", m_screen->frame_number()); } u16 taitoair_state::dspram_r(offs_t offset) @@ -346,7 +346,7 @@ void taitoair_state::sound_bankswitch_w(u8 data) */ void taitoair_state::dma_regs_w(offs_t offset, u16 data, u16 mem_mask) { - printf("%08x %04x\n",offset,data); + logerror("dma_regs_w: %08x %04x\n", offset, data); if (offset == 0 && ACCESSING_BITS_8_15) { diff --git a/src/mame/televideo/ts803.cpp b/src/mame/televideo/ts803.cpp index 83f83b6be53..290f6089782 100644 --- a/src/mame/televideo/ts803.cpp +++ b/src/mame/televideo/ts803.cpp @@ -45,17 +45,19 @@ PAGE SEL bit in PORT0 set to 1: **************************************************************************************************/ #include "emu.h" -#include "machine/clock.h" + #include "bus/rs232/rs232.h" #include "cpu/z80/z80.h" #include "imagedev/floppy.h" -#include "machine/z80daisy.h" +#include "machine/clock.h" #include "machine/keyboard.h" #include "machine/timer.h" -#include "machine/z80sio.h" #include "machine/wd_fdc.h" +#include "machine/z80daisy.h" +#include "machine/z80sio.h" #include "machine/z80sti.h" #include "video/mc6845.h" + #include "emupal.h" #include "screen.h" @@ -76,9 +78,9 @@ public: , m_io_dsw(*this, "DSW") { } - void ts803(machine_config &config); + void ts803(machine_config &config) ATTR_COLD; - void init_ts803(); + void init_ts803() ATTR_COLD; private: uint8_t port10_r(offs_t offset); @@ -227,7 +229,7 @@ d7 Drive select 3 (active low) uint8_t ts803_state::disk_0_control_r() { - printf("Disk0 control register read\n"); + logerror("Disk0 control register read\n"); return 0xff; } @@ -237,23 +239,23 @@ uint8_t ts803_state::porta0_r(offs_t offset) switch(offset) { case 0xb2: - printf("B2 WDC read\n"); + logerror("B2 WDC read\n"); return 0x11; case 0xb3: - printf("B3 WDC read\n"); + logerror("B3 WDC read\n"); return 0x15; case 0xb4: - printf("B4 WDC read\n"); + logerror("B4 WDC read\n"); return 0x55; case 0xb5: - printf("B5 WDC read\n"); + logerror("B5 WDC read\n"); return 0x01; case 0xb6: - printf("B6 WDC read\n"); + logerror("B6 WDC read\n"); return 0x25; } @@ -267,7 +269,7 @@ void ts803_state::porta0_w(offs_t offset, uint8_t data) switch (offset) { case 0xc4: - //printf("Control Register for Alpha or Graphics Mode Selection\n"); + //logerror("Control Register for Alpha or Graphics Mode Selection\n"); break; default: @@ -278,7 +280,7 @@ void ts803_state::porta0_w(offs_t offset, uint8_t data) uint8_t ts803_state::port10_r(offs_t offset) { offset += 0x10; - printf("Port read [%x]\n",offset); + logerror("Port read [%x]\n", offset); return 0xff; } @@ -290,17 +292,17 @@ void ts803_state::port10_w(offs_t offset, uint8_t data) { case 0x10: data &= 3; - printf("Writing to diagnostic indicators 1 & 2: %X\n", data); + logerror("Writing to diagnostic indicators 1 & 2: %X\n", data); break; case 0x11: data &= 3; - printf("Writing to diagnostic indicators 3 & 4: %X\n", data); + logerror("Writing to diagnostic indicators 3 & 4: %X\n", data); break; case 0x12: data &= 3; - printf("RS-422 control: %X\n", data); + logerror("RS-422 control: %X\n", data); break; case 0x13: @@ -311,19 +313,19 @@ void ts803_state::port10_w(offs_t offset, uint8_t data) membank("bank4")->set_entry(BIT(data, 0)); } else - printf("Error: unknown memory config: %X.\n", data); + logerror("Error: unknown memory config: %X.\n", data); break; default: - printf("unknown port [%2.2x] write of [%2.2x]\n",offset,data); + logerror("unknown port [%2.2x] write of [%2.2x]\n",offset,data); break; } } MC6845_ON_UPDATE_ADDR_CHANGED( ts803_state::crtc_update_addr ) { - //printf("CRTC::address update [%x]\n",address); + //logerror("CRTC::address update [%x]\n",address); } MC6845_UPDATE_ROW( ts803_state::crtc_update_row ) @@ -372,7 +374,7 @@ Bit 2 = 0 alpha memory access (round off) 1 graphics memory access (normal CPU address) */ - //printf("CRTC::c4 write [%2x]\n",data); + //logerror("CRTC::c4 write [%2x]\n",data); m_graphics_mode = BIT(data, 0); } |
