From be704c00abe1eaaa442db81db04c8b71595d5c41 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 5 Dec 2015 10:00:21 +0100 Subject: [PATCH] use c++ cast instead of c casts (nw) --- src/devices/bus/a1bus/a1cassette.cpp | 2 +- src/devices/bus/a1bus/a1cffa.cpp | 2 +- src/devices/bus/a2bus/corvfdc02.cpp | 2 +- src/devices/bus/a2bus/mouse.cpp | 4 +- src/devices/bus/a7800/a78_slot.cpp | 4 +- src/devices/bus/a800/a800_slot.cpp | 2 +- src/devices/bus/adamnet/ddp.cpp | 4 +- src/devices/bus/bml3/bml3kanji.cpp | 2 +- src/devices/bus/bml3/bml3mp1802.cpp | 2 +- src/devices/bus/bml3/bml3mp1805.cpp | 2 +- src/devices/bus/c64/turbo232.cpp | 2 - src/devices/bus/cgenie/expansion/floppy.cpp | 2 +- src/devices/bus/coco/coco_dwsock.cpp | 6 +- src/devices/bus/coco/cococart.cpp | 8 +-- src/devices/bus/cpc/smartwatch.cpp | 4 +- src/devices/bus/cpc/symbfac2.cpp | 8 +-- src/devices/bus/gameboy/gb_slot.cpp | 6 +- src/devices/bus/gba/gba_slot.cpp | 4 +- src/devices/bus/gba/rom.cpp | 4 +- src/devices/bus/generic/rom.cpp | 8 +-- src/devices/bus/intv/ecs.h | 2 +- src/devices/bus/intv/rom.h | 4 +- src/devices/bus/intv/slot.cpp | 4 +- src/devices/bus/iq151/disc2.cpp | 2 +- src/devices/bus/iq151/minigraf.cpp | 2 +- src/devices/bus/iq151/ms151a.cpp | 2 +- src/devices/bus/iq151/rom.cpp | 2 +- src/devices/bus/iq151/video32.cpp | 4 +- src/devices/bus/iq151/video64.cpp | 4 +- src/devices/bus/isa/3c505.cpp | 4 +- src/devices/bus/isa/gus.cpp | 8 +-- src/devices/bus/isa/num9rev.cpp | 2 +- src/devices/bus/isa/omti8621.cpp | 2 +- src/devices/bus/isa/pgc.cpp | 2 +- src/devices/bus/isa/s3virge.cpp | 2 +- src/devices/bus/isa/sblaster.cpp | 6 +- src/devices/bus/isa/sblaster.h | 2 +- src/devices/bus/isa/sc499.cpp | 4 +- src/devices/bus/lpci/i82371ab.cpp | 2 +- src/devices/bus/lpci/mpc105.cpp | 4 +- src/devices/bus/lpci/pci.cpp | 4 +- src/devices/bus/lpci/southbridge.cpp | 16 ++--- src/devices/bus/megadrive/md_slot.cpp | 80 ++++++++++----------- src/devices/bus/megadrive/stm95.cpp | 2 +- src/devices/bus/megadrive/svp.cpp | 30 ++++---- src/devices/bus/neogeo/bootleg_prot.cpp | 32 ++++----- src/devices/bus/neogeo/kof98_prot.cpp | 2 +- src/devices/bus/neogeo/kog_prot.cpp | 2 +- src/devices/bus/neogeo/neogeo_slot.cpp | 4 +- src/devices/bus/neogeo/pcm2_prot.cpp | 2 +- src/devices/bus/neogeo/sbp_prot.cpp | 4 +- src/devices/bus/neogeo/sma_prot.cpp | 26 +++---- src/devices/bus/nes/aladdin.cpp | 4 +- src/devices/bus/nes/datach.cpp | 2 +- src/devices/bus/nes/disksys.cpp | 2 +- src/devices/bus/nes/karastudio.cpp | 2 +- src/devices/bus/nes/nes_slot.cpp | 2 +- src/devices/bus/nes/sunsoft_dcs.cpp | 2 +- src/devices/bus/nes_ctrl/arkpaddle.cpp | 2 +- src/devices/bus/nubus/nubus.cpp | 10 +-- src/devices/bus/nubus/nubus_48gc.cpp | 2 +- src/devices/bus/nubus/nubus_cb264.cpp | 2 +- src/devices/bus/nubus/nubus_image.cpp | 40 +++++------ src/devices/bus/nubus/nubus_m2hires.cpp | 2 +- src/devices/bus/nubus/nubus_m2video.cpp | 2 +- src/devices/bus/nubus/nubus_radiustpd.cpp | 4 +- src/devices/bus/nubus/nubus_spec8.cpp | 2 +- src/devices/bus/nubus/nubus_specpdq.cpp | 2 +- src/devices/bus/nubus/nubus_wsportrait.cpp | 4 +- src/devices/bus/nubus/pds30_30hr.cpp | 2 +- src/devices/bus/nubus/pds30_cb264.cpp | 4 +- src/devices/bus/nubus/pds30_mc30.cpp | 4 +- src/devices/bus/nubus/pds30_procolor816.cpp | 4 +- src/devices/bus/nubus/pds30_sigmalview.cpp | 2 +- src/devices/bus/oricext/oricext.cpp | 4 +- src/devices/bus/saturn/sat_slot.cpp | 2 +- src/devices/bus/scsi/acb4070.cpp | 2 +- src/devices/bus/scsi/cdu76s.cpp | 6 +- src/devices/bus/sega8/sega8_slot.cpp | 12 ++-- src/devices/bus/sms_ctrl/lphaser.cpp | 4 +- src/devices/bus/snes/sa1.cpp | 20 +++--- src/devices/bus/snes/sdd1.cpp | 4 +- src/devices/bus/snes/snes_slot.cpp | 2 +- src/devices/bus/snes/spc7110.cpp | 44 ++++++------ src/devices/bus/ti99_peb/bwg.cpp | 4 +- src/devices/bus/ti99_peb/hfdc.cpp | 4 +- src/devices/bus/ti99_peb/ti_32kmem.cpp | 2 +- src/devices/bus/ti99x/990_hd.cpp | 13 ++-- src/devices/bus/ti99x/990_tap.cpp | 16 ++--- src/devices/bus/ti99x/998board.cpp | 8 +-- src/devices/bus/ti99x/datamux.cpp | 2 +- src/devices/bus/ti99x/genboard.cpp | 4 +- src/devices/bus/ti99x/gromport.cpp | 18 ++--- src/devices/bus/ti99x/gromport.h | 4 +- src/devices/bus/ti99x/handset.cpp | 4 +- src/devices/bus/ti99x/videowrp.cpp | 4 +- src/devices/bus/vboy/slot.cpp | 4 +- src/devices/bus/vcs/vcs_slot.cpp | 2 +- src/devices/bus/z88/flash.cpp | 2 +- 99 files changed, 317 insertions(+), 322 deletions(-) diff --git a/src/devices/bus/a1bus/a1cassette.cpp b/src/devices/bus/a1bus/a1cassette.cpp index 7168133647c..f3e88082469 100644 --- a/src/devices/bus/a1bus/a1cassette.cpp +++ b/src/devices/bus/a1bus/a1cassette.cpp @@ -81,7 +81,7 @@ void a1bus_cassette_device::device_start() m_rom = device().machine().root_device().memregion(this->subtag(CASSETTE_ROM_REGION).c_str())->base(); install_device(0xc000, 0xc0ff, read8_delegate(FUNC(a1bus_cassette_device::cassette_r), this), write8_delegate(FUNC(a1bus_cassette_device::cassette_w), this)); - install_bank(0xc100, 0xc1ff, 0, 0, (char *)"bank_a1cas", m_rom); + install_bank(0xc100, 0xc1ff, 0, 0, static_cast("bank_a1cas"), m_rom); save_item(NAME(m_cassette_output_flipflop)); } diff --git a/src/devices/bus/a1bus/a1cffa.cpp b/src/devices/bus/a1bus/a1cffa.cpp index 912401a0642..63287585e40 100644 --- a/src/devices/bus/a1bus/a1cffa.cpp +++ b/src/devices/bus/a1bus/a1cffa.cpp @@ -76,7 +76,7 @@ void a1bus_cffa_device::device_start() m_rom = device().machine().root_device().memregion(this->subtag(CFFA_ROM_REGION).c_str())->base(); install_device(0xafe0, 0xafff, read8_delegate(FUNC(a1bus_cffa_device::cffa_r), this), write8_delegate(FUNC(a1bus_cffa_device::cffa_w), this)); - install_bank(0x9000, 0xafdf, 0, 0, (char *)"bank_cffa1", m_rom); + install_bank(0x9000, 0xafdf, 0, 0, static_cast("bank_cffa1"), m_rom); save_item(NAME(m_lastdata)); save_item(NAME(m_writeprotect)); diff --git a/src/devices/bus/a2bus/corvfdc02.cpp b/src/devices/bus/a2bus/corvfdc02.cpp index 870fc194bfb..9ee53b18f54 100644 --- a/src/devices/bus/a2bus/corvfdc02.cpp +++ b/src/devices/bus/a2bus/corvfdc02.cpp @@ -221,7 +221,7 @@ void a2bus_corvfdc02_device::write_c0nx(address_space &space, UINT8 offset, UINT break; } - logerror("corvfdc02: selecting drive %d: %p\n", data & 3, (void *) floppy); + logerror("corvfdc02: selecting drive %d: %p\n", data & 3, static_cast(floppy)); if (floppy != m_curfloppy) { diff --git a/src/devices/bus/a2bus/mouse.cpp b/src/devices/bus/a2bus/mouse.cpp index 3d4e11d3487..11cc39b8fd0 100644 --- a/src/devices/bus/a2bus/mouse.cpp +++ b/src/devices/bus/a2bus/mouse.cpp @@ -437,8 +437,8 @@ WRITE8_MEMBER(a2bus_mouse_device::mcu_timer_w) // recalculate the timer now UINT32 m_ticks = 2043600 / 4; m_ticks /= prescale[m_timer_ctl & 7]; - m_ticks /= (int)(m_timer_cnt + 1); - m_timer->adjust(attotime::from_hz((double)m_ticks), TIMER_68705, attotime::from_hz((double)m_ticks)); + m_ticks /= static_cast(m_timer_cnt + 1); + m_timer->adjust(attotime::from_hz(static_cast(m_ticks)), TIMER_68705, attotime::from_hz(static_cast(m_ticks))); } } diff --git a/src/devices/bus/a7800/a78_slot.cpp b/src/devices/bus/a7800/a78_slot.cpp index 7fda107b70c..39dd933e2aa 100644 --- a/src/devices/bus/a7800/a78_slot.cpp +++ b/src/devices/bus/a7800/a78_slot.cpp @@ -378,7 +378,7 @@ bool a78_cart_slot_device::call_load() char head[128]; fread(head, 128); - if (verify_header((char *)head) == IMAGE_VERIFY_FAIL) + if (verify_header(static_cast(head)) == IMAGE_VERIFY_FAIL) return IMAGE_INIT_FAIL; len = (head[49] << 24) | (head[50] << 16) | (head[51] << 8) | head[52]; @@ -449,7 +449,7 @@ bool a78_cart_slot_device::call_load() osd_printf_info("Run it through the expansion to exploit this feature.\n"); } - internal_header_logging((UINT8 *)head, length()); + internal_header_logging(reinterpret_cast(head), length()); m_cart->rom_alloc(len, tag()); fread(m_cart->get_rom_base(), len); diff --git a/src/devices/bus/a800/a800_slot.cpp b/src/devices/bus/a800/a800_slot.cpp index 148ab38ed03..b1ef629c14e 100644 --- a/src/devices/bus/a800/a800_slot.cpp +++ b/src/devices/bus/a800/a800_slot.cpp @@ -319,7 +319,7 @@ int a800_cart_slot_device::identify_cart_type(UINT8 *header) int type = A800_8K; // check CART format - if (strncmp((const char *)header, "CART", 4)) + if (strncmp(reinterpret_cast(header), "CART", 4)) fatalerror("Invalid header detected!\n"); switch ((header[4] << 24) + (header[5] << 16) + (header[6] << 8) + (header[7] << 0)) diff --git a/src/devices/bus/adamnet/ddp.cpp b/src/devices/bus/adamnet/ddp.cpp index 2a2f674d0c3..5a8021afa70 100644 --- a/src/devices/bus/adamnet/ddp.cpp +++ b/src/devices/bus/adamnet/ddp.cpp @@ -174,7 +174,7 @@ WRITE8_MEMBER( adam_digital_data_pack_device::p1_w ) if (m_ddp0->exists()) { - m_ddp0->set_speed(BIT(data, 0) ? (double) 80/1.875 : 20/1.875); // speed select + m_ddp0->set_speed(BIT(data, 0) ? static_cast(80)/1.875 : 20/1.875); // speed select if(!(data & 0x08)) m_ddp0->go_forward(); if(!(data & 0x10)) m_ddp0->go_reverse(); m_ddp0->change_state(BIT(data, 1) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); // motor control @@ -182,7 +182,7 @@ WRITE8_MEMBER( adam_digital_data_pack_device::p1_w ) if (m_ddp1->exists()) { - m_ddp1->set_speed(BIT(data, 0) ? (double) 80/1.875 : 20/1.875); // speed select + m_ddp1->set_speed(BIT(data, 0) ? static_cast(80)/1.875 : 20/1.875); // speed select if(!(data & 0x08)) m_ddp1->go_forward(); if(!(data & 0x10)) m_ddp1->go_reverse(); m_ddp1->change_state(BIT(data, 2) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); // motor control diff --git a/src/devices/bus/bml3/bml3kanji.cpp b/src/devices/bus/bml3/bml3kanji.cpp index 0b0d4f519e2..2bf425455bd 100644 --- a/src/devices/bus/bml3/bml3kanji.cpp +++ b/src/devices/bus/bml3/bml3kanji.cpp @@ -58,7 +58,7 @@ const rom_entry *bml3bus_kanji_device::device_rom_region() const READ8_MEMBER( bml3bus_kanji_device::bml3_kanji_r ) { - return m_rom[((UINT32)m_kanji_addr << 1) + offset]; + return m_rom[(static_cast(m_kanji_addr) << 1) + offset]; } WRITE8_MEMBER( bml3bus_kanji_device::bml3_kanji_w ) diff --git a/src/devices/bus/bml3/bml3mp1802.cpp b/src/devices/bus/bml3/bml3mp1802.cpp index 911d72c725e..7d66cea765a 100644 --- a/src/devices/bus/bml3/bml3mp1802.cpp +++ b/src/devices/bus/bml3/bml3mp1802.cpp @@ -131,7 +131,7 @@ void bml3bus_mp1802_device::device_start() // install into memory address_space &space_prg = machine().firstcpu->space(AS_PROGRAM); - space_prg.install_readwrite_handler(0xff00, 0xff03, read8_delegate(FUNC(mb8866_t::read),(mb8866_t*)m_fdc), write8_delegate(FUNC(mb8866_t::write),(mb8866_t*)m_fdc)); + space_prg.install_readwrite_handler(0xff00, 0xff03, read8_delegate(FUNC(mb8866_t::read),static_cast(m_fdc)), write8_delegate(FUNC(mb8866_t::write),static_cast(m_fdc))); space_prg.install_readwrite_handler(0xff04, 0xff04, read8_delegate(FUNC(bml3bus_mp1802_device::bml3_mp1802_r), this), write8_delegate(FUNC(bml3bus_mp1802_device::bml3_mp1802_w), this)); // overwriting the main ROM (rather than using e.g. install_rom) should mean that bank switches for RAM expansion still work... UINT8 *mainrom = device().machine().root_device().memregion("maincpu")->base(); diff --git a/src/devices/bus/bml3/bml3mp1805.cpp b/src/devices/bus/bml3/bml3mp1805.cpp index e1b2317b7c6..5077f4d77cc 100644 --- a/src/devices/bus/bml3/bml3mp1805.cpp +++ b/src/devices/bus/bml3/bml3mp1805.cpp @@ -158,7 +158,7 @@ void bml3bus_mp1805_device::device_start() // install into memory address_space &space_prg = machine().firstcpu->space(AS_PROGRAM); - space_prg.install_readwrite_handler(0xff18, 0xff1f, read8_delegate( FUNC(mc6843_device::read), (mc6843_device*)m_mc6843), write8_delegate(FUNC(mc6843_device::write), (mc6843_device*)m_mc6843) ); + space_prg.install_readwrite_handler(0xff18, 0xff1f, read8_delegate( FUNC(mc6843_device::read), static_cast(m_mc6843)), write8_delegate(FUNC(mc6843_device::write), static_cast(m_mc6843)) ); space_prg.install_readwrite_handler(0xff20, 0xff20, read8_delegate( FUNC(bml3bus_mp1805_device::bml3_mp1805_r), this), write8_delegate(FUNC(bml3bus_mp1805_device::bml3_mp1805_w), this) ); // overwriting the main ROM (rather than using e.g. install_rom) should mean that bank switches for RAM expansion still work... UINT8 *mainrom = device().machine().root_device().memregion("maincpu")->base(); diff --git a/src/devices/bus/c64/turbo232.cpp b/src/devices/bus/c64/turbo232.cpp index 1dd43b2011d..5204c3e1fda 100644 --- a/src/devices/bus/c64/turbo232.cpp +++ b/src/devices/bus/c64/turbo232.cpp @@ -189,8 +189,6 @@ void c64_turbo232_cartridge_device::c64_cd_w(address_space &space, offs_t offset case 7: if (m_es & ES_M) { - data = m_es; - switch (m_es & ES_S_MASK) { case ES_S_230400: m_acia->set_xtal(XTAL_3_6864MHz); break; diff --git a/src/devices/bus/cgenie/expansion/floppy.cpp b/src/devices/bus/cgenie/expansion/floppy.cpp index c3099cd533c..ec74f971c71 100644 --- a/src/devices/bus/cgenie/expansion/floppy.cpp +++ b/src/devices/bus/cgenie/expansion/floppy.cpp @@ -140,7 +140,7 @@ void cgenie_fdc_device::device_reset() // map extra socket if (m_socket->exists()) { - m_slot->m_program->install_read_handler(0xe000, 0xefff, read8_delegate(FUNC(generic_slot_device::read_rom), (generic_slot_device *) m_socket)); + m_slot->m_program->install_read_handler(0xe000, 0xefff, read8_delegate(FUNC(generic_slot_device::read_rom), static_cast(m_socket))); } } diff --git a/src/devices/bus/coco/coco_dwsock.cpp b/src/devices/bus/coco/coco_dwsock.cpp index e48b3e565d1..84db24ab4e6 100644 --- a/src/devices/bus/coco/coco_dwsock.cpp +++ b/src/devices/bus/coco/coco_dwsock.cpp @@ -97,7 +97,7 @@ void beckerport_device::device_start(void) file_error filerr = osd_open(chAddress, 0, &m_pSocket, &filesize); if (filerr != FILERR_NONE) { - osd_printf_verbose("Error: osd_open returned error %i!\n", (int) filerr); + osd_printf_verbose("Error: osd_open returned error %i!\n", static_cast(filerr)); return; } @@ -167,7 +167,7 @@ READ8_MEMBER(beckerport_device::read) fprintf(stderr, "%s: read from bad offset %d\n", __FILE__, offset); } - return (int)data; + return static_cast(data); } /*------------------------------------------------- @@ -176,7 +176,7 @@ READ8_MEMBER(beckerport_device::read) WRITE8_MEMBER(beckerport_device::write) { - char d = (char)data; + char d = static_cast(data); file_error filerr; if (m_pSocket == nullptr) diff --git a/src/devices/bus/coco/cococart.cpp b/src/devices/bus/coco/cococart.cpp index e3f25389eb1..1d5af3ee031 100644 --- a/src/devices/bus/coco/cococart.cpp +++ b/src/devices/bus/coco/cococart.cpp @@ -114,15 +114,15 @@ void cococart_slot_device::device_timer(emu_timer &timer, device_timer_id id, in switch(id) { case TIMER_CART: - set_line("CART", m_cart_line, (cococart_line_value) param); + set_line("CART", m_cart_line, static_cast(param)); break; case TIMER_NMI: - set_line("NMI", m_nmi_line, (cococart_line_value) param); + set_line("NMI", m_nmi_line, static_cast(param)); break; case TIMER_HALT: - set_line("HALT", m_halt_line, (cococart_line_value) param); + set_line("HALT", m_halt_line, static_cast(param)); break; } } @@ -231,7 +231,7 @@ void cococart_slot_device::set_line_timer(coco_cartridge_line &line, cococart_li ? machine().firstcpu->cycles_to_attotime(line.delay) : attotime::zero; - line.timer[line.timer_index]->adjust(delay, (int) value); + line.timer[line.timer_index]->adjust(delay, static_cast(value)); line.timer_index = (line.timer_index + 1) % TIMER_POOL; } diff --git a/src/devices/bus/cpc/smartwatch.cpp b/src/devices/bus/cpc/smartwatch.cpp index e4304323932..129b9cbccb7 100644 --- a/src/devices/bus/cpc/smartwatch.cpp +++ b/src/devices/bus/cpc/smartwatch.cpp @@ -76,7 +76,7 @@ void cpc_smartwatch_device::device_reset() READ8_MEMBER(cpc_smartwatch_device::rtc_w) { - UINT8* bank = (UINT8*)m_bank->base(); + UINT8* bank = static_cast(m_bank->base()); if(offset & 1) m_rtc->read_1(space,0); else @@ -86,6 +86,6 @@ READ8_MEMBER(cpc_smartwatch_device::rtc_w) READ8_MEMBER(cpc_smartwatch_device::rtc_r) { - UINT8* bank = (UINT8*)m_bank->base(); + UINT8* bank = static_cast(m_bank->base()); return ((bank[(offset & 1)+4]) & 0xfe) | (m_rtc->read_data(space,0) & 0x01); } diff --git a/src/devices/bus/cpc/symbfac2.cpp b/src/devices/bus/cpc/symbfac2.cpp index c80d22da6c6..2c599d49a8e 100644 --- a/src/devices/bus/cpc/symbfac2.cpp +++ b/src/devices/bus/cpc/symbfac2.cpp @@ -273,10 +273,10 @@ READ8_MEMBER(cpc_symbiface2_device::rom_rewrite_r) if(bank >= 32) return 0xff; - m_4xxx_ptr_r = (UINT8*)machine().root_device().membank("bank3")->base(); - m_4xxx_ptr_w = (UINT8*)machine().root_device().membank("bank11")->base(); - m_6xxx_ptr_r = (UINT8*)machine().root_device().membank("bank4")->base(); - m_6xxx_ptr_w = (UINT8*)machine().root_device().membank("bank12")->base(); + m_4xxx_ptr_r = static_cast(machine().root_device().membank("bank3")->base()); + m_4xxx_ptr_w = static_cast(machine().root_device().membank("bank11")->base()); + m_6xxx_ptr_r = static_cast(machine().root_device().membank("bank4")->base()); + m_6xxx_ptr_w = static_cast(machine().root_device().membank("bank12")->base()); machine().root_device().membank("bank3")->set_base(&m_rom_space[bank*16384]); machine().root_device().membank("bank4")->set_base(&m_rom_space[bank*16384+8192]); machine().root_device().membank("bank11")->set_base(&m_rom_space[bank*16384]); diff --git a/src/devices/bus/gameboy/gb_slot.cpp b/src/devices/bus/gameboy/gb_slot.cpp index e70eb07c6d2..bcbe12c9a03 100644 --- a/src/devices/bus/gameboy/gb_slot.cpp +++ b/src/devices/bus/gameboy/gb_slot.cpp @@ -399,8 +399,8 @@ bool base_gb_cart_slot_device::call_load() // Hack to support Donkey Kong Land 2 + 3 in SGB // For some reason, these store the tile data differently. Hacks will go once it's been figured out - if (strncmp((const char*)(ROM + 0x134), "DONKEYKONGLAND 2", 16) == 0 || - strncmp((const char*)(ROM + 0x134), "DONKEYKONGLAND 3", 16) == 0) + if (strncmp(reinterpret_cast(ROM + 0x134), "DONKEYKONGLAND 2", 16) == 0 || + strncmp(reinterpret_cast(ROM + 0x134), "DONKEYKONGLAND 3", 16) == 0) m_sgb_hack = 1; return IMAGE_INIT_PASS; @@ -817,7 +817,7 @@ void base_gb_cart_slot_device::internal_header_logging(UINT8 *ROM, UINT32 len) break; } - strncpy(soft, (char *)&ROM[0x0134], 16); + strncpy(soft, reinterpret_cast(&ROM[0x0134]), 16); soft[16] = '\0'; logerror("Cart Information\n"); logerror("\tName: %s\n", soft); diff --git a/src/devices/bus/gba/gba_slot.cpp b/src/devices/bus/gba/gba_slot.cpp index fc8f09f30a0..c56ba152e7f 100644 --- a/src/devices/bus/gba/gba_slot.cpp +++ b/src/devices/bus/gba/gba_slot.cpp @@ -51,7 +51,7 @@ void device_gba_cart_interface::rom_alloc(UINT32 size, const char *tag) if (m_rom == nullptr) { // we always alloc 32MB of rom region! - m_rom = (UINT32 *)device().machine().memory().region_alloc(std::string(tag).append(GBASLOT_ROM_REGION_TAG).c_str(), 0x2000000, 4, ENDIANNESS_LITTLE)->base(); + m_rom = reinterpret_cast(device().machine().memory().region_alloc(std::string(tag).append(GBASLOT_ROM_REGION_TAG).c_str(), 0x2000000, 4, ENDIANNESS_LITTLE)->base()); m_rom_size = size; } } @@ -176,7 +176,7 @@ bool gba_cart_slot_device::call_load() } m_cart->rom_alloc(size, tag()); - ROM = (UINT8 *)m_cart->get_rom_base(); + ROM = reinterpret_cast(m_cart->get_rom_base()); if (software_entry() == nullptr) { diff --git a/src/devices/bus/gba/rom.cpp b/src/devices/bus/gba/rom.cpp index 8e857dfe004..2ce7a81d004 100644 --- a/src/devices/bus/gba/rom.cpp +++ b/src/devices/bus/gba/rom.cpp @@ -96,14 +96,14 @@ void gba_rom_eeprom_device::device_start() { // for the moment we use a custom eeprom implementation, so we alloc/save it as nvram nvram_alloc(0x200); - m_eeprom = std::make_unique(machine(), (UINT8*)get_nvram_base(), get_nvram_size(), 6); + m_eeprom = std::make_unique(machine(), reinterpret_cast(get_nvram_base()), get_nvram_size(), 6); } void gba_rom_eeprom64_device::device_start() { // for the moment we use a custom eeprom implementation, so we alloc/save it as nvram nvram_alloc(0x2000); - m_eeprom = std::make_unique(machine(), (UINT8*)get_nvram_base(), get_nvram_size(), 14); + m_eeprom = std::make_unique(machine(), reinterpret_cast(get_nvram_base()), get_nvram_size(), 14); } diff --git a/src/devices/bus/generic/rom.cpp b/src/devices/bus/generic/rom.cpp index a816040e229..c2239d41d39 100644 --- a/src/devices/bus/generic/rom.cpp +++ b/src/devices/bus/generic/rom.cpp @@ -72,7 +72,7 @@ READ8_MEMBER(generic_rom_plain_device::read_rom) READ16_MEMBER(generic_rom_plain_device::read16_rom) { - UINT16 *ROM = (UINT16 *)m_rom; + UINT16 *ROM = reinterpret_cast(m_rom); if (offset < m_rom_size/2) return ROM[offset]; else @@ -81,7 +81,7 @@ READ16_MEMBER(generic_rom_plain_device::read16_rom) READ32_MEMBER(generic_rom_plain_device::read32_rom) { - UINT32 *ROM = (UINT32 *)m_rom; + UINT32 *ROM = reinterpret_cast(m_rom); if (offset < m_rom_size/4) return ROM[offset]; else @@ -96,13 +96,13 @@ READ8_MEMBER(generic_rom_linear_device::read_rom) READ16_MEMBER(generic_rom_linear_device::read16_rom) { - UINT16 *ROM = (UINT16 *)m_rom; + UINT16 *ROM = reinterpret_cast(m_rom); return ROM[offset % (m_rom_size/2)]; } READ32_MEMBER(generic_rom_linear_device::read32_rom) { - UINT32 *ROM = (UINT32 *)m_rom; + UINT32 *ROM = reinterpret_cast(m_rom); return ROM[offset % (m_rom_size/4)]; } diff --git a/src/devices/bus/intv/ecs.h b/src/devices/bus/intv/ecs.h index 8148459fc22..8bcc4bb99ef 100644 --- a/src/devices/bus/intv/ecs.h +++ b/src/devices/bus/intv/ecs.h @@ -33,7 +33,7 @@ public: virtual DECLARE_READ16_MEMBER(read_rome0); virtual DECLARE_READ16_MEMBER(read_romf0); // RAM - virtual DECLARE_READ16_MEMBER(read_ram) { return (int)m_ram[offset & (m_ram.size() - 1)]; } + virtual DECLARE_READ16_MEMBER(read_ram) { return static_cast(m_ram[offset & (m_ram.size() - 1)]); } virtual DECLARE_WRITE16_MEMBER(write_ram) { m_ram[offset & (m_ram.size() - 1)] = data & 0xff; } // AY8914 virtual DECLARE_READ16_MEMBER(read_ay); diff --git a/src/devices/bus/intv/rom.h b/src/devices/bus/intv/rom.h index 15a66e10817..4f5b24e0a18 100644 --- a/src/devices/bus/intv/rom.h +++ b/src/devices/bus/intv/rom.h @@ -47,7 +47,7 @@ public: intv_ram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); // reading and writing - virtual DECLARE_READ16_MEMBER(read_ram) { return (int)m_ram[offset & (m_ram.size() - 1)]; } + virtual DECLARE_READ16_MEMBER(read_ram) { return static_cast(m_ram[offset & (m_ram.size() - 1)]); } virtual DECLARE_WRITE16_MEMBER(write_ram) { m_ram[offset & (m_ram.size() - 1)] = data & 0xff; } }; @@ -60,7 +60,7 @@ public: intv_gfact_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); // reading and writing - virtual DECLARE_READ16_MEMBER(read_ram) { return (int)m_ram[offset & (m_ram.size() - 1)]; } + virtual DECLARE_READ16_MEMBER(read_ram) { return static_cast(m_ram[offset & (m_ram.size() - 1)]); } virtual DECLARE_WRITE16_MEMBER(write_ram) { m_ram[offset & (m_ram.size() - 1)] = data & 0xff; } }; diff --git a/src/devices/bus/intv/slot.cpp b/src/devices/bus/intv/slot.cpp index 05e55e49318..18862f0d80d 100644 --- a/src/devices/bus/intv/slot.cpp +++ b/src/devices/bus/intv/slot.cpp @@ -264,7 +264,7 @@ int intv_cart_slot_device::load_fullpath() return IMAGE_INIT_FAIL; m_cart->rom_alloc(0x20000, tag()); - ROM = (UINT8 *)m_cart->get_rom_base(); + ROM = static_cast(m_cart->get_rom_base()); for (int i = 0; i < num_segments; i++) { @@ -313,7 +313,7 @@ int intv_cart_slot_device::load_fullpath() std::string extrainfo; m_cart->rom_alloc(0x20000, tag()); - ROM = (UINT8 *)m_cart->get_rom_base(); + ROM = static_cast(m_cart->get_rom_base()); if (!hashfile_extrainfo(*this, extrainfo)) { diff --git a/src/devices/bus/iq151/disc2.cpp b/src/devices/bus/iq151/disc2.cpp index ba2cbf36137..5b6b1238a2b 100644 --- a/src/devices/bus/iq151/disc2.cpp +++ b/src/devices/bus/iq151/disc2.cpp @@ -61,7 +61,7 @@ iq151_disc2_device::iq151_disc2_device(const machine_config &mconfig, const char void iq151_disc2_device::device_start() { - m_rom = (UINT8*)memregion("disc2")->base(); + m_rom = static_cast(memregion("disc2")->base()); } //------------------------------------------------- diff --git a/src/devices/bus/iq151/minigraf.cpp b/src/devices/bus/iq151/minigraf.cpp index ca4ffdcc463..1f19330f101 100644 --- a/src/devices/bus/iq151/minigraf.cpp +++ b/src/devices/bus/iq151/minigraf.cpp @@ -59,7 +59,7 @@ iq151_minigraf_device::iq151_minigraf_device(const machine_config &mconfig, cons void iq151_minigraf_device::device_start() { - m_rom = (UINT8*)memregion("minigraf")->base(); + m_rom = static_cast(memregion("minigraf")->base()); // allocate a bitmap for represent the paper m_paper = auto_bitmap_ind16_alloc(machine(), PAPER_WIDTH, PAPER_HEIGHT); diff --git a/src/devices/bus/iq151/ms151a.cpp b/src/devices/bus/iq151/ms151a.cpp index 1a4ee73d586..7990112f672 100644 --- a/src/devices/bus/iq151/ms151a.cpp +++ b/src/devices/bus/iq151/ms151a.cpp @@ -58,7 +58,7 @@ iq151_ms151a_device::iq151_ms151a_device(const machine_config &mconfig, const ch void iq151_ms151a_device::device_start() { - m_rom = (UINT8*)memregion("ms151a")->base(); + m_rom = static_cast(memregion("ms151a")->base()); // allocate a bitmap for represent the paper m_paper = auto_bitmap_ind16_alloc(machine(), PAPER_WIDTH, PAPER_HEIGHT); diff --git a/src/devices/bus/iq151/rom.cpp b/src/devices/bus/iq151/rom.cpp index 3229e2ac2f8..d9df588fbe9 100644 --- a/src/devices/bus/iq151/rom.cpp +++ b/src/devices/bus/iq151/rom.cpp @@ -53,7 +53,7 @@ iq151_rom_device::iq151_rom_device(const machine_config &mconfig, device_type ty void iq151_rom_device::device_start() { - m_rom = (UINT8*)memregion("rom")->base(); + m_rom = static_cast(memregion("rom")->base()); } //------------------------------------------------- diff --git a/src/devices/bus/iq151/video32.cpp b/src/devices/bus/iq151/video32.cpp index b5d6a76681f..833f37c4059 100644 --- a/src/devices/bus/iq151/video32.cpp +++ b/src/devices/bus/iq151/video32.cpp @@ -72,8 +72,8 @@ iq151_video32_device::iq151_video32_device(const machine_config &mconfig, const void iq151_video32_device::device_start() { - m_videoram = (UINT8*)memregion("videoram")->base(); - m_chargen = (UINT8*)memregion("chargen")->base(); + m_videoram = static_cast(memregion("videoram")->base()); + m_chargen = static_cast(memregion("chargen")->base()); m_gfxdecode->set_gfx(0, global_alloc(gfx_element(m_palette, iq151_video32_charlayout, m_chargen, 0, 1, 0))); } diff --git a/src/devices/bus/iq151/video64.cpp b/src/devices/bus/iq151/video64.cpp index ec5e82ff645..cced8d270ea 100644 --- a/src/devices/bus/iq151/video64.cpp +++ b/src/devices/bus/iq151/video64.cpp @@ -71,8 +71,8 @@ iq151_video64_device::iq151_video64_device(const machine_config &mconfig, const void iq151_video64_device::device_start() { - m_videoram = (UINT8*)memregion("videoram")->base(); - m_chargen = (UINT8*)memregion("chargen")->base(); + m_videoram = static_cast(memregion("videoram")->base()); + m_chargen = static_cast(memregion("chargen")->base()); m_gfxdecode->set_gfx(0,global_alloc(gfx_element(m_palette, iq151_video64_charlayout, m_chargen, 0, 1, 0))); } diff --git a/src/devices/bus/isa/3c505.cpp b/src/devices/bus/isa/3c505.cpp index 2cb640e91d5..a0d6faea9d2 100644 --- a/src/devices/bus/isa/3c505.cpp +++ b/src/devices/bus/isa/3c505.cpp @@ -907,7 +907,7 @@ void threecom3c505_device::device_timer(emu_timer &timer, device_timer_id id, in void threecom3c505_device::do_command() { - pcb_struct &command_pcp = (pcb_struct &) m_command_buffer; + pcb_struct &command_pcp = reinterpret_cast(m_command_buffer); // default to successful completion m_response.command = command_pcp.command + CMD_RESPONSE_OFFSET; @@ -1011,7 +1011,7 @@ void threecom3c505_device::do_command() memcpy(m_station_address, command_pcp.data.eth_addr, command_pcp.length); } set_filter_list(); - set_mac((char *) m_station_address); + set_mac(reinterpret_cast(m_station_address)); break; case CMD_MC_17: // 0x17 diff --git a/src/devices/bus/isa/gus.cpp b/src/devices/bus/isa/gus.cpp index 2a8edf69145..7208c5c50a1 100644 --- a/src/devices/bus/isa/gus.cpp +++ b/src/devices/bus/isa/gus.cpp @@ -323,11 +323,11 @@ void gf1_device::sound_stream_update(sound_stream &stream, stream_sample_t **inp if(m_voice[x].voice_ctrl & 0x04) { // 16-bit PCM current = ((m_voice[x].current_addr >> 9) & 0xc0000) + (((m_voice[x].current_addr >> 9) & 0x1ffff) << 1); - m_voice[x].sample = (INT16)((m_wave_ram[current & 0xffffe]) | ((m_wave_ram[(current & 0xffffe)+1])<<8)); + m_voice[x].sample = static_cast((m_wave_ram[current & 0xffffe]) | ((m_wave_ram[(current & 0xffffe)+1])<<8)); } else { // 8-bit PCM - m_voice[x].sample = (INT16)(m_wave_ram[current & 0xfffff] << 8); + m_voice[x].sample = static_cast(m_wave_ram[current & 0xfffff] << 8); } if(m_voice[x].voice_ctrl & 0x40) // voice direction m_voice[x].current_addr -= (m_voice[x].freq_ctrl >> 1); @@ -376,7 +376,7 @@ void gf1_device::device_start() acia6850_device::device_start(); int i; - double out = (double)(1 << 13); + double out = static_cast(1 << 13); m_txirq_handler.resolve_safe(); m_rxirq_handler.resolve_safe(); @@ -413,7 +413,7 @@ void gf1_device::device_start() for (i=4095;i>=0;i--) { - m_volume_table[i] = (INT16)out; + m_volume_table[i] = static_cast(out); out /= 1.002709201; /* 0.0235 dB Steps */ } diff --git a/src/devices/bus/isa/num9rev.cpp b/src/devices/bus/isa/num9rev.cpp index 3ed1967df06..d68a63447fb 100644 --- a/src/devices/bus/isa/num9rev.cpp +++ b/src/devices/bus/isa/num9rev.cpp @@ -95,7 +95,7 @@ void isa8_number_9_rev_device::device_start() { set_isa_device(); - m_isa->install_memory(0xc0000, 0xc0001, 0, 0, read8_delegate(FUNC(upd7220_device::read), (upd7220_device *)m_upd7220), write8_delegate(FUNC(upd7220_device::write), (upd7220_device *)m_upd7220)); + m_isa->install_memory(0xc0000, 0xc0001, 0, 0, read8_delegate(FUNC(upd7220_device::read), static_cast(m_upd7220)), write8_delegate(FUNC(upd7220_device::write), static_cast(m_upd7220))); m_isa->install_memory(0xc0100, 0xc03ff, 0, 0, read8_delegate(FUNC(isa8_number_9_rev_device::pal8_r), this), write8_delegate(FUNC(isa8_number_9_rev_device::pal8_w), this)); m_isa->install_memory(0xc0400, 0xc0401, 0, 0, read8_delegate(FUNC(isa8_number_9_rev_device::bank_r), this), write8_delegate(FUNC(isa8_number_9_rev_device::bank_w), this)); m_isa->install_memory(0xc0500, 0xc06ff, 0, 0, read8_delegate(FUNC(isa8_number_9_rev_device::overlay_r), this), write8_delegate(FUNC(isa8_number_9_rev_device::overlay_w), this)); diff --git a/src/devices/bus/isa/omti8621.cpp b/src/devices/bus/isa/omti8621.cpp index e024f1b601c..2b062755ab4 100644 --- a/src/devices/bus/isa/omti8621.cpp +++ b/src/devices/bus/isa/omti8621.cpp @@ -1358,7 +1358,7 @@ void omti_disk_image_device::device_reset() if (exists() && fseek(0, SEEK_END) == 0) { - UINT32 disk_size = (UINT32)(ftell() / OMTI_DISK_SECTOR_SIZE); + UINT32 disk_size = static_cast(ftell() / OMTI_DISK_SECTOR_SIZE); UINT16 disk_type = disk_size >= 300000 ? OMTI_DISK_TYPE_348_MB : OMTI_DISK_TYPE_155_MB; if (disk_type != m_type) { LOG1(("device_reset_omti_disk: disk size=%d blocks, disk type=%x", disk_size, disk_type )); diff --git a/src/devices/bus/isa/pgc.cpp b/src/devices/bus/isa/pgc.cpp index f551a0fc2ec..6a87fa221d7 100644 --- a/src/devices/bus/isa/pgc.cpp +++ b/src/devices/bus/isa/pgc.cpp @@ -343,7 +343,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(isa8_pgc_device::scanline_callback) // XXX hpos shifts every frame -- fix if (y == 0) DBG_LOG(2,"scanline_cb", ("frame %d x %.4d y %.3d\n", - (int) m_screen->frame_number(), m_screen->hpos(), y)); + static_cast(m_screen->frame_number()), m_screen->hpos(), y)); if (y < PGC_VERT_START) return; y -= PGC_VERT_START; diff --git a/src/devices/bus/isa/s3virge.cpp b/src/devices/bus/isa/s3virge.cpp index 965e47e50f0..17775a7d886 100644 --- a/src/devices/bus/isa/s3virge.cpp +++ b/src/devices/bus/isa/s3virge.cpp @@ -263,7 +263,7 @@ void s3virge_vga_device::s3_define_video_mode() { // Dot clock is set via SR12 and SR13 // DCLK calculation - freq = ((double)(s3.clk_pll_m+2) / (double)((s3.clk_pll_n+2)*(pow(2.0,s3.clk_pll_r)))) * 14.318; // clock between XIN and XOUT + freq = (static_cast(s3.clk_pll_m+2) / static_cast((s3.clk_pll_n+2)*(pow(2.0,s3.clk_pll_r)))) * 14.318; // clock between XIN and XOUT xtal = freq * 1000000; //printf("DCLK set to %dHz M=%i N=%i R=%i\n",xtal,s3.clk_pll_m,s3.clk_pll_n,s3.clk_pll_r); } diff --git a/src/devices/bus/isa/sblaster.cpp b/src/devices/bus/isa/sblaster.cpp index 6895716c7af..ebe0fe4f789 100644 --- a/src/devices/bus/isa/sblaster.cpp +++ b/src/devices/bus/isa/sblaster.cpp @@ -519,7 +519,7 @@ void sb_device::process_fifo(UINT8 cmd) m_dsp.adc_length = 1; m_dsp.wbuf_status = 0x80; m_dsp.dma_no_irq = true; - m_dack_out = (UINT8)(m_dsp.prot_value & 0xff); + m_dack_out = static_cast(m_dsp.prot_value & 0xff); drq_w(1); break; @@ -1332,7 +1332,7 @@ void sb16_device::dack16_w(int line, UINT16 data) // set the transfer timer on the 1st byte if (!m_dsp.dma_timer_started) { - m_timer->adjust(attotime::from_hz((double)m_dsp.frequency), 0, attotime::from_hz((double)m_dsp.frequency)); + m_timer->adjust(attotime::from_hz(static_cast(m_dsp.frequency)), 0, attotime::from_hz(static_cast(m_dsp.frequency))); m_dsp.d_rptr = m_dsp.d_wptr = 0; m_dsp.dma_timer_started = true; } @@ -1379,7 +1379,7 @@ void sb_device::dack_w(int line, UINT8 data) // set the transfer timer on the 1st byte if (!m_dsp.dma_timer_started) { - m_timer->adjust(attotime::from_hz((double)m_dsp.frequency), 0, attotime::from_hz((double)m_dsp.frequency)); + m_timer->adjust(attotime::from_hz(static_cast(m_dsp.frequency)), 0, attotime::from_hz(static_cast(m_dsp.frequency))); m_dsp.d_rptr = m_dsp.d_wptr = 0; m_dsp.dma_timer_started = true; } diff --git a/src/devices/bus/isa/sblaster.h b/src/devices/bus/isa/sblaster.h index d1b3be92bbc..046a25e5368 100644 --- a/src/devices/bus/isa/sblaster.h +++ b/src/devices/bus/isa/sblaster.h @@ -118,7 +118,7 @@ public: DECLARE_WRITE8_MEMBER(dsp_rbuf_status_w); DECLARE_WRITE8_MEMBER(dsp_cmd_w); - DECLARE_WRITE_LINE_MEMBER( midi_rx_w ) { device_serial_interface::rx_w((UINT8)state); } + DECLARE_WRITE_LINE_MEMBER( midi_rx_w ) { device_serial_interface::rx_w(static_cast(state)); } protected: // device-level overrides diff --git a/src/devices/bus/isa/sc499.cpp b/src/devices/bus/isa/sc499.cpp index 0e0c6438410..e8a3cc44ce8 100644 --- a/src/devices/bus/isa/sc499.cpp +++ b/src/devices/bus/isa/sc499.cpp @@ -469,7 +469,7 @@ void sc499_device::check_tape() { // tape has changed, get new size m_image_length = m_image->tapelen(); - m_ctape_block_count = (UINT32)((m_image_length + SC499_CTAPE_BLOCK_SIZE - 1) / SC499_CTAPE_BLOCK_SIZE); + m_ctape_block_count = static_cast((m_image_length + SC499_CTAPE_BLOCK_SIZE - 1) / SC499_CTAPE_BLOCK_SIZE); } LOG1(("check_tape: tape image is %s with %d blocks", m_image->filename(), m_ctape_block_count)); @@ -1311,7 +1311,7 @@ bool sc499_ctape_image_device::call_load() { UINT32 size; io_generic io; - io.file = (device_image_interface *)this; + io.file = static_cast(this); io.procs = &image_ioprocs; io.filler = 0xff; diff --git a/src/devices/bus/lpci/i82371ab.cpp b/src/devices/bus/lpci/i82371ab.cpp index 9f5a9de2edd..58836e1e54e 100644 --- a/src/devices/bus/lpci/i82371ab.cpp +++ b/src/devices/bus/lpci/i82371ab.cpp @@ -229,7 +229,7 @@ void i82371ab_device::device_reset() { southbridge_device::device_reset(); memset(m_regs, 0, sizeof(m_regs)); - UINT32 (*regs32)[64] = (UINT32 (*)[64])(m_regs); + UINT32 (*regs32)[64] = reinterpret_cast(m_regs); /* isa */ regs32[0][0x00] = 0x71108086; diff --git a/src/devices/bus/lpci/mpc105.cpp b/src/devices/bus/lpci/mpc105.cpp index 74780b7159f..cdfbd50c6b2 100644 --- a/src/devices/bus/lpci/mpc105.cpp +++ b/src/devices/bus/lpci/mpc105.cpp @@ -216,9 +216,9 @@ void mpc105_device::pci_write(pci_bus_device *pcibus, int function, int offset, break; case 0xA0: /* memory enable */ - if (m_bank_enable != (UINT8) data) + if (m_bank_enable != static_cast(data)) { - m_bank_enable = (UINT8) data; + m_bank_enable = static_cast(data); update_memory(); } break; diff --git a/src/devices/bus/lpci/pci.cpp b/src/devices/bus/lpci/pci.cpp index aa095a8cd4e..3d9b9e1880e 100644 --- a/src/devices/bus/lpci/pci.cpp +++ b/src/devices/bus/lpci/pci.cpp @@ -210,9 +210,9 @@ READ64_MEMBER(pci_bus_device::read_64be) UINT64 result = 0; mem_mask = FLIPENDIAN_INT64(mem_mask); if (ACCESSING_BITS_0_31) - result |= (UINT64)read(space, offset * 2 + 0, mem_mask >> 0) << 0; + result |= static_cast(read(space, offset * 2 + 0, mem_mask >> 0)) << 0; if (ACCESSING_BITS_32_63) - result |= (UINT64)read(space, offset * 2 + 1, mem_mask >> 32) << 32; + result |= static_cast(read(space, offset * 2 + 1, mem_mask >> 32)) << 32; return FLIPENDIAN_INT64(result); } diff --git a/src/devices/bus/lpci/southbridge.cpp b/src/devices/bus/lpci/southbridge.cpp index e7858521437..b8485ab5e75 100644 --- a/src/devices/bus/lpci/southbridge.cpp +++ b/src/devices/bus/lpci/southbridge.cpp @@ -153,22 +153,22 @@ southbridge_device::southbridge_device(const machine_config &mconfig, device_typ /// HACK: the memory system cannot cope with mixing the 8 bit device map from the fdc with a 32 bit handler READ8_MEMBER(southbridge_device::ide_read_cs1_r) { - return m_ide->read_cs1(space, 1, (UINT32) 0xff0000) >> 16; + return m_ide->read_cs1(space, 1, static_cast(0xff0000)) >> 16; } WRITE8_MEMBER(southbridge_device::ide_write_cs1_w) { - m_ide->write_cs1(space, 1, (UINT32) data << 16, (UINT32) 0xff0000); + m_ide->write_cs1(space, 1, static_cast(data) << 16, static_cast(0xff0000)); } READ8_MEMBER(southbridge_device::ide2_read_cs1_r) { - return m_ide2->read_cs1(space, 1, (UINT32) 0xff0000) >> 16; + return m_ide2->read_cs1(space, 1, static_cast(0xff0000)) >> 16; } WRITE8_MEMBER(southbridge_device::ide2_write_cs1_w) { - m_ide2->write_cs1(space, 1, (UINT32) data << 16, (UINT32) 0xff0000); + m_ide2->write_cs1(space, 1, static_cast(data) << 16, static_cast(0xff0000)); } //------------------------------------------------- @@ -329,7 +329,7 @@ READ8_MEMBER(southbridge_device::pc_dma_read_byte) if(m_dma_channel == -1) return 0xff; UINT8 result; - offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16) & 0xFF0000; + offs_t page_offset = (static_cast(m_dma_offset[0][m_dma_channel]) << 16) & 0xFF0000; result = prog_space.read_byte(page_offset + offset); return result; @@ -341,7 +341,7 @@ WRITE8_MEMBER(southbridge_device::pc_dma_write_byte) address_space& prog_space = m_maincpu->space(AS_PROGRAM); // get the right address space if(m_dma_channel == -1) return; - offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16) & 0xFF0000; + offs_t page_offset = (static_cast(m_dma_offset[0][m_dma_channel]) << 16) & 0xFF0000; prog_space.write_byte(page_offset + offset, data); } @@ -353,7 +353,7 @@ READ8_MEMBER(southbridge_device::pc_dma_read_word) if(m_dma_channel == -1) return 0xff; UINT16 result; - offs_t page_offset = (((offs_t) m_dma_offset[1][m_dma_channel & 3]) << 16) & 0xFE0000; + offs_t page_offset = (static_cast(m_dma_offset[1][m_dma_channel & 3]) << 16) & 0xFE0000; result = prog_space.read_word(page_offset + ( offset << 1 ) ); m_dma_high_byte = result & 0xFF00; @@ -367,7 +367,7 @@ WRITE8_MEMBER(southbridge_device::pc_dma_write_word) address_space& prog_space = m_maincpu->space(AS_PROGRAM); // get the right address space if(m_dma_channel == -1) return; - offs_t page_offset = (((offs_t) m_dma_offset[1][m_dma_channel & 3]) << 16) & 0xFE0000; + offs_t page_offset = (static_cast(m_dma_offset[1][m_dma_channel & 3]) << 16) & 0xFE0000; prog_space.write_word(page_offset + ( offset << 1 ), m_dma_high_byte | data); } diff --git a/src/devices/bus/megadrive/md_slot.cpp b/src/devices/bus/megadrive/md_slot.cpp index 2d0ff90acb6..0523f033da0 100644 --- a/src/devices/bus/megadrive/md_slot.cpp +++ b/src/devices/bus/megadrive/md_slot.cpp @@ -87,7 +87,7 @@ void device_md_cart_interface::rom_alloc(size_t size, const char *tag) { if (m_rom == nullptr) { - m_rom = (UINT16 *)device().machine().memory().region_alloc(std::string(tag).append(MDSLOT_ROM_REGION_TAG).c_str(), size, 2, ENDIANNESS_LITTLE)->base(); + m_rom = reinterpret_cast(device().machine().memory().region_alloc(std::string(tag).append(MDSLOT_ROM_REGION_TAG).c_str(), size, 2, ENDIANNESS_LITTLE)->base()); m_rom_size = size; } } @@ -351,7 +351,7 @@ bool base_md_cart_slot_device::call_load() if (m_cart->get_nvram_size()) battery_load(m_cart->get_nvram_base(), m_cart->get_nvram_size(), 0xff); - file_logging((UINT8 *)m_cart->get_rom_base(), m_cart->get_rom_size(), m_cart->get_nvram_size()); + file_logging(reinterpret_cast(m_cart->get_rom_base()), m_cart->get_rom_size(), m_cart->get_nvram_size()); } return res; @@ -372,7 +372,7 @@ int base_md_cart_slot_device::load_list() m_cart->rom_alloc(length, tag()); ROM = m_cart->get_rom_base(); - memcpy((UINT8 *)ROM, get_software_region("rom"), get_software_region_length("rom")); + memcpy(reinterpret_cast(ROM), get_software_region("rom"), get_software_region_length("rom")); // if we allocated a ROM larger that the file (e.g. due to uneven cart size), set remaining space to 0xff if (length > get_software_region_length("rom")) @@ -402,7 +402,7 @@ static int genesis_is_SMD(unsigned char *buf, unsigned int len) return 1; /* aq quiz */ - if (len > (0xf0 + 8) && !strncmp("UZ(-01 ", (const char *) &buf[0xf0], 8)) + if (len > (0xf0 + 8) && !strncmp("UZ(-01 ", reinterpret_cast(&buf[0xf0]), 8)) return 1; /* Phelios USA redump */ @@ -412,11 +412,11 @@ static int genesis_is_SMD(unsigned char *buf, unsigned int len) return 1; /* jap baseball 94 */ - if (len > (0xf0 + 9) && !strncmp("OL R-AEAL", (const char *) &buf[0xf0], 9)) + if (len > (0xf0 + 9) && !strncmp("OL R-AEAL", reinterpret_cast(&buf[0xf0]), 9)) return 1; /* devilish Mahjong Tower */ - if (len > (0xf3 + 11) && !strncmp("optrEtranet", (const char *) &buf[0xf3], 11)) + if (len > (0xf3 + 11) && !strncmp("optrEtranet", reinterpret_cast(&buf[0xf3]), 11)) return 1; /* golden axe 2 beta */ @@ -424,27 +424,27 @@ static int genesis_is_SMD(unsigned char *buf, unsigned int len) return 1; /* omega race */ - if (len > (0x90 + 8) && !strncmp("OEARC ", (const char *) &buf[0x90], 8)) + if (len > (0x90 + 8) && !strncmp("OEARC ", reinterpret_cast(&buf[0x90]), 8)) return 1; /* budokan beta */ - if ((len >= 0x6708 + 8) && !strncmp(" NTEBDKN", (const char *) &buf[0x6708], 8)) + if ((len >= 0x6708 + 8) && !strncmp(" NTEBDKN", reinterpret_cast(&buf[0x6708]), 8)) return 1; /* cdx pro 1.8 bios */ - if (len > (0x2c0 + 7) && !strncmp("so fCXP", (const char *) &buf[0x2c0], 7)) + if (len > (0x2c0 + 7) && !strncmp("so fCXP", reinterpret_cast(&buf[0x2c0]), 7)) return 1; /* ishido (hacked) */ - if (len > (0x90 + 8) && !strncmp("sio-Wyo ", (const char *) &buf[0x0090], 8)) + if (len > (0x90 + 8) && !strncmp("sio-Wyo ", reinterpret_cast(&buf[0x0090]), 8)) return 1; /* onslaught */ - if (len > (0x88 + 8) && !strncmp("SS CAL ", (const char *) &buf[0x0088], 8)) + if (len > (0x88 + 8) && !strncmp("SS CAL ", reinterpret_cast(&buf[0x0088]), 8)) return 1; /* tram terror pirate */ - if ((len >= 0x3648 + 8) && !strncmp("SG NEPIE", (const char *) &buf[0x3648], 8)) + if ((len >= 0x3648 + 8) && !strncmp("SG NEPIE", reinterpret_cast(&buf[0x3648]), 8)) return 1; /* breath of fire 3 chinese */ @@ -452,7 +452,7 @@ static int genesis_is_SMD(unsigned char *buf, unsigned int len) return 1; /*tetris pirate */ - if ((len >= 0x1cbe + 5) && !strncmp("@TTI>", (const char *) &buf[0x1cbe], 5)) + if ((len >= 0x1cbe + 5) && !strncmp("@TTI>", reinterpret_cast(&buf[0x1cbe]), 5)) return 1; return 0; @@ -486,7 +486,7 @@ int base_md_cart_slot_device::load_nonlist() m_cart->rom_alloc((len == 0x500000) ? 0x900000 : len, tag()); // STEP 3: copy the game data in the appropriate way - ROM = (unsigned char *)m_cart->get_rom_base(); + ROM = reinterpret_cast(m_cart->get_rom_base()); if (is_smd) { @@ -580,7 +580,7 @@ void base_md_cart_slot_device::setup_custom_mappers() void base_md_cart_slot_device::setup_nvram() { - UINT8 *ROM = (UINT8 *)m_cart->get_rom_base(); + UINT8 *ROM = reinterpret_cast(m_cart->get_rom_base()); m_cart->m_nvram_readonly = 0; m_cart->m_nvram_active = 0; m_cart->m_nvram_handlers_installed = 0; @@ -715,21 +715,21 @@ int base_md_cart_slot_device::get_cart_type(UINT8 *ROM, UINT32 len) if (!memcmp(&ROM[0x08c8], smouse_sig, sizeof(smouse_sig))) type = SMOUSE; - if (!memcmp((char *)&ROM[0x7e30e], "SEGA", 4) || - !memcmp((char *)&ROM[0x7e100], "SEGA", 4) || - !memcmp((char *)&ROM[0x7e1e6], "SEGA", 4)) + if (!memcmp(reinterpret_cast(&ROM[0x7e30e]), "SEGA", 4) || + !memcmp(reinterpret_cast(&ROM[0x7e100]), "SEGA", 4) || + !memcmp(reinterpret_cast(&ROM[0x7e1e6]), "SEGA", 4)) type = REALTEC; - if (!memcmp((char *)&ROM[0x0180], "GM T-50396", 10)) // NHLPA Hockey 93 + if (!memcmp(reinterpret_cast(&ROM[0x0180]), "GM T-50396", 10)) // NHLPA Hockey 93 type = EA_NHLPA; - if (!memcmp((char *)&ROM[0x0180], "GM MK-1215", 10)) // Evander Holyfield + if (!memcmp(reinterpret_cast(&ROM[0x0180]), "GM MK-1215", 10)) // Evander Holyfield type = SEGA_EEPROM; break; case 0xc0000: - if (!memcmp((char *)&ROM[0x0180], "GM G-4060 ", 8)) // Wonder Boy V + if (!memcmp(reinterpret_cast(&ROM[0x0180]), "GM G-4060 ", 8)) // Wonder Boy V type = SEGA_EEPROM; break; @@ -743,25 +743,25 @@ int base_md_cart_slot_device::get_cart_type(UINT8 *ROM, UINT32 len) if (!memcmp(&ROM[0xee0d0], bugsl_sig, sizeof(bugsl_sig))) type = BUGSLIFE; - if (!memcmp((char *)&ROM[0x0172], "GAME : ELF WOR", 14)) + if (!memcmp(reinterpret_cast(&ROM[0x0172]), "GAME : ELF WOR", 14)) type = ELFWOR; if (!memcmp(&ROM[0x123e4], sbub_sig, sizeof(sbub_sig))) type = SBUBBOB; - if (!memcmp((char *)&ROM[0x0180], "GM T-50176", 10)) // Rings of Power + if (!memcmp(reinterpret_cast(&ROM[0x0180]), "GM T-50176", 10)) // Rings of Power type = EA_NHLPA; - if (!memcmp((char *)&ROM[0x0180], "MK 00001211-00", 14)) // Sports Talk Baseball + if (!memcmp(reinterpret_cast(&ROM[0x0180]), "MK 00001211-00", 14)) // Sports Talk Baseball type = SEGA_EEPROM; - if (!memcmp((char *)&ROM[0x0180], "GM T-120096-", 12)) // Micro Machines 2 + if (!memcmp(reinterpret_cast(&ROM[0x0180]), "GM T-120096-", 12)) // Micro Machines 2 type = CODE_MASTERS; - if (!memcmp((char *)&ROM[0x0180], "GM T-120146-", 12)) // Brian Lara Cricket 96 / Shane Wayne Cricket 96 + if (!memcmp(reinterpret_cast(&ROM[0x0180]), "GM T-120146-", 12)) // Brian Lara Cricket 96 / Shane Wayne Cricket 96 type = BRIAN_LARA; - if (!memcmp((char *)&ROM[0x0190], "OJKRPTBVFCA ", 0x10)) // Micro Machines '96 / Military TODO: better way to recognize these? + if (!memcmp(reinterpret_cast(&ROM[0x0190]), "OJKRPTBVFCA ", 0x10)) // Micro Machines '96 / Military TODO: better way to recognize these? type = CODE_MASTERS; break; @@ -799,17 +799,17 @@ int base_md_cart_slot_device::get_cart_type(UINT8 *ROM, UINT32 len) if (!memcmp(&ROM[0x17bb2], s15in1_sig, sizeof(s15in1_sig))) type = MC_PIRATE; - if (!memcmp((char *)&ROM[0x0180], "GM T-081326 ", 12)) // NBA Jam + if (!memcmp(reinterpret_cast(&ROM[0x0180]), "GM T-081326 ", 12)) // NBA Jam type = NBA_JAM; - if (!memcmp((char *)&ROM[0x0180], "GM MK-1228", 10)) // Greatest Heavyweight of the Ring + if (!memcmp(reinterpret_cast(&ROM[0x0180]), "GM MK-1228", 10)) // Greatest Heavyweight of the Ring type = SEGA_EEPROM; - if ((!memcmp((char *)&ROM[0x0180], "GM T-12046", 10)) || // Mega Man - (!memcmp((char *)&ROM[0x0180], "GM T-12053", 10) && !memcmp(&ROM[0x18e], rockman_sig, sizeof(rockman_sig)))) // / Rock Man (EEPROM version) + if ((!memcmp(reinterpret_cast(&ROM[0x0180]), "GM T-12046", 10)) || // Mega Man + (!memcmp(reinterpret_cast(&ROM[0x0180]), "GM T-12053", 10) && !memcmp(&ROM[0x18e], rockman_sig, sizeof(rockman_sig)))) // / Rock Man (EEPROM version) type = SEGA_EEPROM; - if (!memcmp((char *)&ROM[0x0150], "Virtua Racing", 13)) + if (!memcmp(reinterpret_cast(&ROM[0x0150]), "Virtua Racing", 13)) type = SEGA_SVP; break; @@ -826,10 +826,10 @@ int base_md_cart_slot_device::get_cart_type(UINT8 *ROM, UINT32 len) if (!memcmp(&ROM[0x1fd0d2], kof99_sig, sizeof(kof99_sig))) type = KOF99; - if (!memcmp((char *)&ROM[0x0180], "GM T-81406", 10)) // NBA Jam TE + if (!memcmp(reinterpret_cast(&ROM[0x0180]), "GM T-81406", 10)) // NBA Jam TE type = NBA_JAM_TE; - if (!memcmp((char *)&ROM[0x0180], "GM T-081276 ", 12)) // NFL Quarterback Club + if (!memcmp(reinterpret_cast(&ROM[0x0180]), "GM T-081276 ", 12)) // NFL Quarterback Club type = NBA_JAM_TE; break; @@ -845,24 +845,24 @@ int base_md_cart_slot_device::get_cart_type(UINT8 *ROM, UINT32 len) if (!memcmp(&ROM[0x1e700], s19in1_sig, sizeof(s19in1_sig))) type = MC_PIRATE; - if (!memcmp((char *)&ROM[0x0180], "GM T-081586-", 12)) // NFL Quarterback Club 96 + if (!memcmp(reinterpret_cast(&ROM[0x0180]), "GM T-081586-", 12)) // NFL Quarterback Club 96 type = NFL_QB_96; - if (!memcmp((char *)&ROM[0x0180], "GM T-081576 ", 12)) // College Slam + if (!memcmp(reinterpret_cast(&ROM[0x0180]), "GM T-081576 ", 12)) // College Slam type = C_SLAM; - if (!memcmp((char *)&ROM[0x0180], "GM T-81476", 10)) // Big Hurt Baseball + if (!memcmp(reinterpret_cast(&ROM[0x0180]), "GM T-81476", 10)) // Big Hurt Baseball type = C_SLAM; break; case 0x500000: - if (!memcmp((char *)&ROM[0x0120], "SUPER STREET FIGHTER2 ", 22)) + if (!memcmp(reinterpret_cast(&ROM[0x0120]), "SUPER STREET FIGHTER2 ", 22)) type = SSF2; break; case 0x800000: - if (!memcmp((char *)&ROM[0x0180], "GM T-574023-", 12)) // Pier Solar + if (!memcmp(reinterpret_cast(&ROM[0x0180]), "GM T-574023-", 12)) // Pier Solar type = PSOLAR; break; @@ -995,7 +995,7 @@ void base_md_cart_slot_device::file_logging(UINT8 *ROM8, UINT32 rom_len, UINT32 logerror("FILE DETAILS\n"); logerror("============\n"); logerror("Name: %s\n", basename()); - logerror("File Size: 0x%08x\n", (software_entry() == nullptr) ? (int)length() : (int)get_software_region_length("rom")); + logerror("File Size: 0x%08x\n", (software_entry() == nullptr) ? static_cast(length()) : static_cast(get_software_region_length("rom"))); logerror("Detected type: %s\n", md_get_slot(m_type)); logerror("ROM (Allocated) Size: 0x%X\n", rom_len); logerror("NVRAM: %s\n", nvram_len ? "Yes" : "No"); diff --git a/src/devices/bus/megadrive/stm95.cpp b/src/devices/bus/megadrive/stm95.cpp index 2c7ddf89ad4..b94724112b5 100644 --- a/src/devices/bus/megadrive/stm95.cpp +++ b/src/devices/bus/megadrive/stm95.cpp @@ -191,7 +191,7 @@ md_eeprom_stm95_device::md_eeprom_stm95_device(const machine_config &mconfig, co void md_eeprom_stm95_device::device_start() { nvram_alloc(M95320_SIZE); - m_stm95 = std::make_unique(machine(), (UINT8*)get_nvram_base()); + m_stm95 = std::make_unique(machine(), reinterpret_cast(get_nvram_base())); save_item(NAME(m_rdcnt)); save_item(NAME(m_bank)); diff --git a/src/devices/bus/megadrive/svp.cpp b/src/devices/bus/megadrive/svp.cpp index 51f6a1ea8de..91e6fa26fb7 100644 --- a/src/devices/bus/megadrive/svp.cpp +++ b/src/devices/bus/megadrive/svp.cpp @@ -101,7 +101,7 @@ UINT32 md_rom_svp_device::pm_io(int reg, int write, UINT32 d) if (reg == 4 || (m_svp->state().state_int(SSP_ST) & 0x60)) { #define CADDR ((((mode<<16)&0x7f0000)|addr)<<1) - UINT16 *dram = (UINT16 *)m_dram; + UINT16 *dram = reinterpret_cast(m_dram); if (write) { int mode = m_pmac_write[reg] >> 16; @@ -127,7 +127,7 @@ UINT32 md_rom_svp_device::pm_io(int reg, int write, UINT32 d) else if ((mode & 0x47ff) == 0x001c) // IRAM { int inc = get_inc(mode); - ((UINT16 *)m_iram)[addr & 0x3ff] = d; + reinterpret_cast(m_iram)[addr & 0x3ff] = d; m_pmac_write[reg] += inc; } else @@ -142,7 +142,7 @@ UINT32 md_rom_svp_device::pm_io(int reg, int write, UINT32 d) int addr = m_pmac_read[reg] & 0xffff; if ((mode & 0xfff0) == 0x0800) // ROM, inc 1, verified to be correct { - UINT16 *ROM = (UINT16 *)get_rom_base(); + UINT16 *ROM = static_cast(get_rom_base()); m_pmac_read[reg] += 1; d = ROM[addr | ((mode & 0xf) << 16)]; } @@ -169,13 +169,13 @@ UINT32 md_rom_svp_device::pm_io(int reg, int write, UINT32 d) return d; } - return (UINT32)-1; + return static_cast(-1); } READ16_MEMBER( md_rom_svp_device::read_pm0 ) { UINT32 d = pm_io(0, 0, 0); - if (d != (UINT32)-1) + if (d != static_cast(-1)) return d; d = m_xst2; m_xst2 &= ~2; // ? @@ -185,7 +185,7 @@ READ16_MEMBER( md_rom_svp_device::read_pm0 ) WRITE16_MEMBER( md_rom_svp_device::write_pm0 ) { UINT32 r = pm_io(0, 1, data); - if (r != (UINT32)-1) + if (r != static_cast(-1)) return; m_xst2 = data; // ? } @@ -193,7 +193,7 @@ WRITE16_MEMBER( md_rom_svp_device::write_pm0 ) READ16_MEMBER( md_rom_svp_device::read_pm1 ) { UINT32 r = pm_io(1, 0, 0); - if (r != (UINT32)-1) + if (r != static_cast(-1)) return r; logerror("svp: PM1 acces in non PM mode?\n"); return 0; @@ -202,7 +202,7 @@ READ16_MEMBER( md_rom_svp_device::read_pm1 ) WRITE16_MEMBER( md_rom_svp_device::write_pm1 ) { UINT32 r = pm_io(1, 1, data); - if (r != (UINT32)-1) + if (r != static_cast(-1)) return; logerror("svp: PM1 acces in non PM mode?\n"); } @@ -210,7 +210,7 @@ WRITE16_MEMBER( md_rom_svp_device::write_pm1 ) READ16_MEMBER( md_rom_svp_device::read_pm2 ) { UINT32 r = pm_io(2, 0, 0); - if (r != (UINT32)-1) + if (r != static_cast(-1)) return r; logerror("svp: PM2 acces in non PM mode?\n"); return 0; @@ -219,7 +219,7 @@ READ16_MEMBER( md_rom_svp_device::read_pm2 ) WRITE16_MEMBER( md_rom_svp_device::write_pm2 ) { UINT32 r = pm_io(2, 1, data); - if (r != (UINT32)-1) + if (r != static_cast(-1)) return; logerror("svp: PM2 acces in non PM mode?\n"); } @@ -227,7 +227,7 @@ WRITE16_MEMBER( md_rom_svp_device::write_pm2 ) READ16_MEMBER( md_rom_svp_device::read_xst ) { UINT32 d = pm_io(3, 0, 0); - if (d != (UINT32)-1) + if (d != static_cast(-1)) return d; return m_xst; } @@ -235,7 +235,7 @@ READ16_MEMBER( md_rom_svp_device::read_xst ) WRITE16_MEMBER( md_rom_svp_device::write_xst ) { UINT32 r = pm_io(3, 1, data); - if (r != (UINT32)-1) + if (r != static_cast(-1)) return; m_xst2 |= 1; m_xst = data; @@ -294,7 +294,7 @@ WRITE16_MEMBER( md_rom_svp_device::write_al ) READ16_MEMBER( md_rom_svp_device::rom_read1 ) { - UINT16 *IRAM = (UINT16 *)m_iram; + UINT16 *IRAM = reinterpret_cast(m_iram); return IRAM[offset]; } @@ -404,7 +404,7 @@ void md_rom_svp_device::device_start() READ16_MEMBER(md_rom_svp_device::read) { - UINT16 *DRAM = (UINT16 *)m_dram; + UINT16 *DRAM = reinterpret_cast(m_dram); if (offset >= 0x300000/2 && offset < 0x320000/2) { @@ -438,7 +438,7 @@ WRITE16_MEMBER(md_rom_svp_device::write) if (offset >= 0x300000/2 && offset < 0x320000/2) { UINT32 a1 = offset - 0x300000/2; - UINT16 *DRAM = (UINT16 *)m_dram; + UINT16 *DRAM = reinterpret_cast(m_dram); DRAM[a1] = data; } } diff --git a/src/devices/bus/neogeo/bootleg_prot.cpp b/src/devices/bus/neogeo/bootleg_prot.cpp index a577528e271..3b0a868eb4f 100644 --- a/src/devices/bus/neogeo/bootleg_prot.cpp +++ b/src/devices/bus/neogeo/bootleg_prot.cpp @@ -100,7 +100,7 @@ void ngbootleg_prot_device::kof97oro_px_decode(UINT8* cpurom, UINT32 cpurom_size { int i; std::vector tmp( 0x500000 ); - UINT16 *src = (UINT16*)cpurom; + UINT16 *src = reinterpret_cast(cpurom); for (i = 0; i < 0x500000/2; i++) { tmp[i] = src[i ^ 0x7ffef]; @@ -190,12 +190,12 @@ void ngbootleg_prot_device::decrypt_kof10th(UINT8* cpurom, UINT32 cpurom_size) } // Altera protection chip patches these over P ROM - ((UINT16*)src)[0x0124/2] = 0x000d; // Enables XOR for RAM moves, forces SoftDIPs, and USA region - ((UINT16*)src)[0x0126/2] = 0xf7a8; + reinterpret_cast(src)[0x0124/2] = 0x000d; // Enables XOR for RAM moves, forces SoftDIPs, and USA region + reinterpret_cast(src)[0x0126/2] = 0xf7a8; - ((UINT16*)src)[0x8bf4/2] = 0x4ef9; // Run code to change "S" data - ((UINT16*)src)[0x8bf6/2] = 0x000d; - ((UINT16*)src)[0x8bf8/2] = 0xf980; + reinterpret_cast(src)[0x8bf4/2] = 0x4ef9; // Run code to change "S" data + reinterpret_cast(src)[0x8bf6/2] = 0x000d; + reinterpret_cast(src)[0x8bf8/2] = 0xf980; } @@ -205,7 +205,7 @@ void ngbootleg_prot_device::decrypt_kof10th(UINT8* cpurom, UINT32 cpurom_size) void ngbootleg_prot_device::kf10thep_px_decrypt(UINT8* cpurom, UINT32 cpurom_size) { - UINT16 *rom = (UINT16*)cpurom; + UINT16 *rom = reinterpret_cast(cpurom); std::vector buf(0x100000/2); memcpy(&buf[0x000000/2], &rom[0x060000/2], 0x20000); @@ -454,7 +454,7 @@ void ngbootleg_prot_device::patch_cthd2003(cpu_device* maincpu, neogeo_banked_ca { /* patches thanks to razoola */ int i; - UINT16 *mem16 = (UINT16 *)cpurom; + UINT16 *mem16 = reinterpret_cast(cpurom); /* special ROM banking handler */ maincpu->space(AS_PROGRAM).install_write_handler(0x2ffff0, 0x2fffff, write16_delegate(FUNC(ngbootleg_prot_device::cthd2003_bankswitch_w),this)); @@ -561,7 +561,7 @@ void ngbootleg_prot_device::patch_ct2k3sa(UINT8* cpurom, UINT32 cpurom_size) { /* patches thanks to razoola - same as for cthd2003*/ int i; - UINT16 *mem16 = (UINT16 *)cpurom; + UINT16 *mem16 = reinterpret_cast(cpurom); // theres still a problem on the character select screen but it seems to be related to cpu core timing issues, // overclocking the 68k prevents it. @@ -631,7 +631,7 @@ void ngbootleg_prot_device::lans2004_decrypt_68k(UINT8* cpurom, UINT32 cpurom_si /* Descrambling P ROMs - Thanks to Razoola for the info */ int i; UINT8 *src = cpurom; - UINT16 *rom = (UINT16*)cpurom; + UINT16 *rom = reinterpret_cast(cpurom); { static const int sec[] = { 0x3, 0x8, 0x7, 0xC, 0x1, 0xA, 0x6, 0xD }; @@ -788,7 +788,7 @@ void ngbootleg_prot_device::svcplus_px_decrypt(UINT8* cpurom, UINT32 cpurom_size void ngbootleg_prot_device::svcplus_px_hack(UINT8* cpurom, UINT32 cpurom_size) { /* patched by the protection chip? */ - UINT16 *mem16 = (UINT16 *)cpurom; + UINT16 *mem16 = reinterpret_cast(cpurom); mem16[0x0f8016/2] = 0x33c1; } @@ -839,7 +839,7 @@ void ngbootleg_prot_device::svcsplus_px_decrypt(UINT8* cpurom, UINT32 cpurom_siz void ngbootleg_prot_device::svcsplus_px_hack(UINT8* cpurom, UINT32 cpurom_size) { /* patched by the protection chip? */ - UINT16 *mem16 = (UINT16 *)cpurom; + UINT16 *mem16 = reinterpret_cast(cpurom); mem16[0x9e90/2] = 0x000f; mem16[0x9e92/2] = 0xc9c0; mem16[0xa10c/2] = 0x4eb9; @@ -865,7 +865,7 @@ WRITE16_MEMBER( ngbootleg_prot_device::kof2003_w ) { data = COMBINE_DATA(&m_cartridge_ram[offset]); if (offset == 0x1ff0/2 || offset == 0x1ff2/2) { - UINT8* cr = (UINT8 *)m_cartridge_ram; + UINT8* cr = reinterpret_cast(m_cartridge_ram); UINT32 address = (cr[BYTE_XOR_LE(0x1ff3)]<<16)|(cr[BYTE_XOR_LE(0x1ff2)]<<8)|cr[BYTE_XOR_LE(0x1ff1)]; UINT8 prt = cr[BYTE_XOR_LE(0x1ff2)]; @@ -882,7 +882,7 @@ WRITE16_MEMBER( ngbootleg_prot_device::kof2003p_w ) { data = COMBINE_DATA(&m_cartridge_ram[offset]); if (offset == 0x1ff0/2 || offset == 0x1ff2/2) { - UINT8* cr = (UINT8 *)m_cartridge_ram; + UINT8* cr = reinterpret_cast(m_cartridge_ram); UINT32 address = (cr[BYTE_XOR_LE(0x1ff3)]<<16)|(cr[BYTE_XOR_LE(0x1ff2)]<<8)|cr[BYTE_XOR_LE(0x1ff0)]; UINT8 prt = cr[BYTE_XOR_LE(0x1ff2)]; @@ -929,7 +929,7 @@ void ngbootleg_prot_device::kf2k3bl_install_protection(cpu_device* maincpu, neog void ngbootleg_prot_device::kf2k3pl_px_decrypt(UINT8* cpurom, UINT32 cpurom_size) { std::vector tmp(0x100000/2); - UINT16*rom16 = (UINT16*)cpurom; + UINT16*rom16 = reinterpret_cast(cpurom); int j; int i; @@ -977,7 +977,7 @@ void ngbootleg_prot_device::kf2k3upl_px_decrypt(UINT8* cpurom, UINT32 cpurom_siz } } - UINT16*rom16 = (UINT16*)cpurom; + UINT16*rom16 = reinterpret_cast(cpurom); kof2k3_overlay = rom16[0x58196 / 2]; diff --git a/src/devices/bus/neogeo/kof98_prot.cpp b/src/devices/bus/neogeo/kof98_prot.cpp index 6fdfa5001f3..f3c93178588 100644 --- a/src/devices/bus/neogeo/kof98_prot.cpp +++ b/src/devices/bus/neogeo/kof98_prot.cpp @@ -70,7 +70,7 @@ void kof98_prot_device::kof98_decrypt_68k(UINT8* cpurom, UINT32 cpurom_size) } memmove( &src[0x100000], &src[0x200000], 0x400000 ); - UINT16* mem16 = (UINT16*)cpurom; + UINT16* mem16 = reinterpret_cast(cpurom); m_default_rom[0] = mem16[0x100 / 2]; m_default_rom[1] = mem16[0x102 / 2]; diff --git a/src/devices/bus/neogeo/kog_prot.cpp b/src/devices/bus/neogeo/kog_prot.cpp index d3caaff3e15..6b7ea2945a8 100644 --- a/src/devices/bus/neogeo/kog_prot.cpp +++ b/src/devices/bus/neogeo/kog_prot.cpp @@ -46,7 +46,7 @@ void kog_prot_device::kog_px_decrypt(UINT8* cpurom, UINT32 cpurom_size) /* the protection chip does some *very* strange things to the rom */ UINT8 *src = cpurom; dynamic_buffer dst( 0x600000 ); - UINT16 *rom = (UINT16 *)cpurom; + UINT16 *rom = reinterpret_cast(cpurom); int i; static const int sec[] = { 0x3, 0x8, 0x7, 0xC, 0x1, 0xA, 0x6, 0xD }; diff --git a/src/devices/bus/neogeo/neogeo_slot.cpp b/src/devices/bus/neogeo/neogeo_slot.cpp index 100e53e6e18..6e9a8ddb63b 100644 --- a/src/devices/bus/neogeo/neogeo_slot.cpp +++ b/src/devices/bus/neogeo/neogeo_slot.cpp @@ -125,7 +125,7 @@ bool neogeo_cart_slot_device::call_load() } m_cart->decrypt_all( - (UINT8*)m_cart->get_rom_base(), m_cart->get_rom_size(), + reinterpret_cast(m_cart->get_rom_base()), m_cart->get_rom_size(), m_cart->get_sprites_base(), m_cart->get_sprites_size(), m_cart->get_fixed_base(), m_cart->get_fixed_size(), m_cart->get_ym_base(), m_cart->get_ym_size(), @@ -151,7 +151,7 @@ void neogeo_cart_slot_device::setup_memory_banks(running_machine &machine) UINT32 size = get_rom_size(); machine.memory().region_free(":maincpu"); machine.memory().region_alloc(":maincpu",size,2, ENDIANNESS_BIG); - memcpy(memregion(":maincpu")->base(),(UINT8*)base16,size); + memcpy(memregion(":maincpu")->base(),reinterpret_cast(base16),size); UINT8* base = get_audio_base(); size = get_audio_size(); diff --git a/src/devices/bus/neogeo/pcm2_prot.cpp b/src/devices/bus/neogeo/pcm2_prot.cpp index 64159ff4185..730dfe39a50 100644 --- a/src/devices/bus/neogeo/pcm2_prot.cpp +++ b/src/devices/bus/neogeo/pcm2_prot.cpp @@ -34,7 +34,7 @@ NeoGeo 'V' (PCM) ROM encryption /* Neo-Pcm2 Drivers for Encrypted V Roms */ void pcm2_prot_device::neo_pcm2_snk_1999(UINT8* ymrom, UINT32 ymsize, int value) { /* thanks to Elsemi for the NEO-PCM2 info */ - UINT16 *rom = (UINT16 *)ymrom; + UINT16 *rom = reinterpret_cast(ymrom); int size = ymsize; int i, j; diff --git a/src/devices/bus/neogeo/sbp_prot.cpp b/src/devices/bus/neogeo/sbp_prot.cpp index b913eba75d9..d890f4d2be1 100644 --- a/src/devices/bus/neogeo/sbp_prot.cpp +++ b/src/devices/bus/neogeo/sbp_prot.cpp @@ -29,7 +29,7 @@ void sbp_prot_device::device_reset() READ16_MEMBER( sbp_prot_device::sbp_lowerrom_r ) { - UINT16* rom = (UINT16*)m_mainrom; + UINT16* rom = reinterpret_cast(m_mainrom); UINT16 origdata = rom[(offset+(0x200/2))]; UINT16 data = BITSWAP16(origdata, 11,10,9,8,15,14,13,12,3,2,1,0,7,6,5,4); int realoffset = 0x200+(offset*2); @@ -78,7 +78,7 @@ void sbp_prot_device::sbp_install_protection(cpu_device* maincpu, UINT8* cpurom, /* the game code clears the text overlay used ingame immediately after writing it.. why? protection? sloppy code that the hw ignores? imperfect emulation? */ { - UINT16* rom = (UINT16*)cpurom; + UINT16* rom = reinterpret_cast(cpurom); rom[0x2a6f8 / 2] = 0x4e71; rom[0x2a6fa / 2] = 0x4e71; diff --git a/src/devices/bus/neogeo/sma_prot.cpp b/src/devices/bus/neogeo/sma_prot.cpp index 1c91212c416..6d338dfa876 100644 --- a/src/devices/bus/neogeo/sma_prot.cpp +++ b/src/devices/bus/neogeo/sma_prot.cpp @@ -302,7 +302,7 @@ void sma_prot_device::kof99_decrypt_68k(UINT8* base) UINT16 *rom; int i,j; - rom = (UINT16 *)(base + 0x100000); + rom = reinterpret_cast(base + 0x100000); /* swap data lines on the whole ROMs */ for (i = 0;i < 0x800000/2;i++) { @@ -321,7 +321,7 @@ void sma_prot_device::kof99_decrypt_68k(UINT8* base) } /* swap address lines & relocate fixed part */ - rom = (UINT16 *)base; + rom = reinterpret_cast(base); for (i = 0;i < 0x0c0000/2;i++) { rom[i] = rom[0x700000/2 + BITSWAP24(i,23,22,21,20,19,18,11,6,14,17,16,5,8,10,12,0,4,3,2,7,9,15,13,1)]; @@ -335,7 +335,7 @@ void sma_prot_device::garou_decrypt_68k(UINT8* base) int i,j; /* thanks to Razoola and Mr K for the info */ - rom = (UINT16 *)(base + 0x100000); + rom = reinterpret_cast(base + 0x100000); /* swap data lines on the whole ROMs */ for (i = 0;i < 0x800000/2;i++) { @@ -343,14 +343,14 @@ void sma_prot_device::garou_decrypt_68k(UINT8* base) } /* swap address lines & relocate fixed part */ - rom = (UINT16 *)base; + rom = reinterpret_cast(base); for (i = 0;i < 0x0c0000/2;i++) { rom[i] = rom[0x710000/2 + BITSWAP24(i,23,22,21,20,19,18,4,5,16,14,7,9,6,13,17,15,3,1,2,12,11,8,10,0)]; } /* swap address lines for the banked part */ - rom = (UINT16 *)(base + 0x100000); + rom = reinterpret_cast(base + 0x100000); for (i = 0;i < 0x800000/2;i+=0x8000/2) { UINT16 buffer[0x8000/2]; @@ -369,7 +369,7 @@ void sma_prot_device::garouh_decrypt_68k(UINT8* base) int i,j; /* thanks to Razoola and Mr K for the info */ - rom = (UINT16 *)(base + 0x100000); + rom = reinterpret_cast(base + 0x100000); /* swap data lines on the whole ROMs */ for (i = 0;i < 0x800000/2;i++) { @@ -377,14 +377,14 @@ void sma_prot_device::garouh_decrypt_68k(UINT8* base) } /* swap address lines & relocate fixed part */ - rom = (UINT16 *)base; + rom = reinterpret_cast(base); for (i = 0;i < 0x0c0000/2;i++) { rom[i] = rom[0x7f8000/2 + BITSWAP24(i,23,22,21,20,19,18,5,16,11,2,6,7,17,3,12,8,14,4,0,9,1,10,15,13)]; } /* swap address lines for the banked part */ - rom = (UINT16 *)(base + 0x100000); + rom = reinterpret_cast(base + 0x100000); for (i = 0;i < 0x800000/2;i+=0x8000/2) { UINT16 buffer[0x8000/2]; @@ -403,7 +403,7 @@ void sma_prot_device::mslug3_decrypt_68k(UINT8* base) int i,j; /* thanks to Razoola and Mr K for the info */ - rom = (UINT16 *)(base + 0x100000); + rom = reinterpret_cast(base + 0x100000); /* swap data lines on the whole ROMs */ for (i = 0;i < 0x800000/2;i++) { @@ -411,14 +411,14 @@ void sma_prot_device::mslug3_decrypt_68k(UINT8* base) } /* swap address lines & relocate fixed part */ - rom = (UINT16 *)base; + rom = reinterpret_cast(base); for (i = 0;i < 0x0c0000/2;i++) { rom[i] = rom[0x5d0000/2 + BITSWAP24(i,23,22,21,20,19,18,15,2,1,13,3,0,9,6,16,4,11,5,7,12,17,14,10,8)]; } /* swap address lines for the banked part */ - rom = (UINT16 *)(base + 0x100000); + rom = reinterpret_cast(base + 0x100000); for (i = 0;i < 0x800000/2;i+=0x10000/2) { UINT16 buffer[0x10000/2]; @@ -437,7 +437,7 @@ void sma_prot_device::kof2000_decrypt_68k(UINT8* base) int i,j; /* thanks to Razoola and Mr K for the info */ - rom = (UINT16 *)(base + 0x100000); + rom = reinterpret_cast(base + 0x100000); /* swap data lines on the whole ROMs */ for (i = 0;i < 0x800000/2;i++) { @@ -456,7 +456,7 @@ void sma_prot_device::kof2000_decrypt_68k(UINT8* base) } /* swap address lines & relocate fixed part */ - rom = (UINT16 *)base; + rom = reinterpret_cast(base); for (i = 0;i < 0x0c0000/2;i++) { rom[i] = rom[0x73a000/2 + BITSWAP24(i,23,22,21,20,19,18,8,4,15,13,3,14,16,2,6,17,7,12,10,0,5,11,1,9)]; diff --git a/src/devices/bus/nes/aladdin.cpp b/src/devices/bus/nes/aladdin.cpp index 3022bd49f0a..a8f75ba73fa 100644 --- a/src/devices/bus/nes/aladdin.cpp +++ b/src/devices/bus/nes/aladdin.cpp @@ -202,7 +202,7 @@ nes_algq_rom_device::nes_algq_rom_device(const machine_config &mconfig, const ch void nes_algn_rom_device::device_start() { - m_rom = (UINT8*)memregion("aderom")->base(); + m_rom = static_cast(memregion("aderom")->base()); save_item(NAME(m_lobank)); } @@ -214,7 +214,7 @@ void nes_algn_rom_device::device_reset() void nes_algq_rom_device::device_start() { - m_rom = (UINT8*)memregion("aderom")->base(); + m_rom = static_cast(memregion("aderom")->base()); save_item(NAME(m_lobank)); save_item(NAME(m_hibank)); save_item(NAME(m_bank_base)); diff --git a/src/devices/bus/nes/datach.cpp b/src/devices/bus/nes/datach.cpp index e0629f74fd3..c0e1cf108eb 100644 --- a/src/devices/bus/nes/datach.cpp +++ b/src/devices/bus/nes/datach.cpp @@ -188,7 +188,7 @@ nes_datach_24c01_device::nes_datach_24c01_device(const machine_config &mconfig, void nes_datach_rom_device::device_start() { - m_rom = (UINT8*)memregion("datachrom")->base(); + m_rom = static_cast(memregion("datachrom")->base()); save_item(NAME(m_bank)); } diff --git a/src/devices/bus/nes/disksys.cpp b/src/devices/bus/nes/disksys.cpp index e89429dc0c4..48031db52d2 100644 --- a/src/devices/bus/nes/disksys.cpp +++ b/src/devices/bus/nes/disksys.cpp @@ -116,7 +116,7 @@ void nes_disksys_device::device_start() { common_start(); - m_2c33_rom = (UINT8*)memregion("drive")->base(); + m_2c33_rom = static_cast(memregion("drive")->base()); m_disk->floppy_install_load_proc(nes_disksys_device::load_proc); m_disk->floppy_install_unload_proc(nes_disksys_device::unload_proc); diff --git a/src/devices/bus/nes/karastudio.cpp b/src/devices/bus/nes/karastudio.cpp index 9342f18dd40..10fab5a9b2d 100644 --- a/src/devices/bus/nes/karastudio.cpp +++ b/src/devices/bus/nes/karastudio.cpp @@ -158,7 +158,7 @@ nes_kstudio_rom_device::nes_kstudio_rom_device(const machine_config &mconfig, co void nes_kstudio_rom_device::device_start() { - m_rom = (UINT8*)memregion("exrom")->base(); + m_rom = static_cast(memregion("exrom")->base()); save_item(NAME(m_bank)); } diff --git a/src/devices/bus/nes/nes_slot.cpp b/src/devices/bus/nes/nes_slot.cpp index 7a4065a6d80..192fe69d4ff 100644 --- a/src/devices/bus/nes/nes_slot.cpp +++ b/src/devices/bus/nes/nes_slot.cpp @@ -158,7 +158,7 @@ void device_nes_cart_interface::prg_alloc(size_t size, const char *tag) // A few pirate carts have PRG made of 32K + 2K or some weird similar config // in this case we treat the banking as if this 'extra' PRG is not present and // the pcb code has to handle it by accessing directly m_prg! - printf("Warning! The loaded PRG has size not a multiple of 8KB (0x%X)\n", (UINT32)size); + printf("Warning! The loaded PRG has size not a multiple of 8KB (0x%X)\n", static_cast(size)); m_prg_chunks--; } diff --git a/src/devices/bus/nes/sunsoft_dcs.cpp b/src/devices/bus/nes/sunsoft_dcs.cpp index 8be24a9c66d..2e8111b4d7a 100644 --- a/src/devices/bus/nes/sunsoft_dcs.cpp +++ b/src/devices/bus/nes/sunsoft_dcs.cpp @@ -136,7 +136,7 @@ nes_ntb_rom_device::nes_ntb_rom_device(const machine_config &mconfig, const char void nes_ntb_rom_device::device_start() { - m_rom = (UINT8*)memregion("ntbrom")->base(); + m_rom = static_cast(memregion("ntbrom")->base()); } const rom_entry *nes_ntb_rom_device::device_rom_region() const diff --git a/src/devices/bus/nes_ctrl/arkpaddle.cpp b/src/devices/bus/nes_ctrl/arkpaddle.cpp index 5e7e6bc992e..195d59bd43c 100644 --- a/src/devices/bus/nes_ctrl/arkpaddle.cpp +++ b/src/devices/bus/nes_ctrl/arkpaddle.cpp @@ -124,7 +124,7 @@ void nes_vaus_device::write(UINT8 data) int old = m_start_conv; if (data == 0 && old == 1) - m_latch = (UINT8) (m_paddle->read() ^ 0xff); + m_latch = static_cast(m_paddle->read() ^ 0xff); m_start_conv = data; } diff --git a/src/devices/bus/nubus/nubus.cpp b/src/devices/bus/nubus/nubus.cpp index 175139f19c2..33845037b1d 100644 --- a/src/devices/bus/nubus/nubus.cpp +++ b/src/devices/bus/nubus/nubus.cpp @@ -138,7 +138,7 @@ void nubus_device::install_device(offs_t start, offs_t end, read8_delegate rhand m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, mask); break; case 64: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, ((UINT64)mask<<32)|mask); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, (static_cast(mask)<<32)|mask); break; default: fatalerror("NUBUS: Bus width %d not supported\n", buswidth); @@ -155,7 +155,7 @@ void nubus_device::install_device(offs_t start, offs_t end, read16_delegate rhan m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, mask); break; case 64: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, ((UINT64)mask<<32)|mask); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, (static_cast(mask)<<32)|mask); break; default: fatalerror("NUBUS: Bus width %d not supported\n", buswidth); @@ -172,7 +172,7 @@ void nubus_device::install_device(offs_t start, offs_t end, read32_delegate rhan m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, mask); break; case 64: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, ((UINT64)mask<<32)|mask); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, (static_cast(mask)<<32)|mask); break; default: fatalerror("NUBUS: Bus width %d not supported\n", buswidth); @@ -189,7 +189,7 @@ void nubus_device::install_readonly_device(offs_t start, offs_t end, read32_dele m_maincpu->space(AS_PROGRAM).install_read_handler(start, end, rhandler, mask); break; case 64: - m_maincpu->space(AS_PROGRAM).install_read_handler(start, end, rhandler, ((UINT64)mask<<32)|mask); + m_maincpu->space(AS_PROGRAM).install_read_handler(start, end, rhandler, (static_cast(mask)<<32)|mask); break; default: fatalerror("NUBUS: Bus width %d not supported\n", buswidth); @@ -206,7 +206,7 @@ void nubus_device::install_writeonly_device(offs_t start, offs_t end, write32_de m_maincpu->space(AS_PROGRAM).install_write_handler(start, end, whandler, mask); break; case 64: - m_maincpu->space(AS_PROGRAM).install_write_handler(start, end, whandler, ((UINT64)mask<<32)|mask); + m_maincpu->space(AS_PROGRAM).install_write_handler(start, end, whandler, (static_cast(mask)<<32)|mask); break; default: fatalerror("NUBUS: Bus width %d not supported\n", buswidth); diff --git a/src/devices/bus/nubus/nubus_48gc.cpp b/src/devices/bus/nubus/nubus_48gc.cpp index 2021def0a5d..be13462aba0 100644 --- a/src/devices/bus/nubus/nubus_48gc.cpp +++ b/src/devices/bus/nubus/nubus_48gc.cpp @@ -243,7 +243,7 @@ UINT32 jmfb_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, c for (y = 0; y < m_yres; y++) { scanline = &bitmap.pix32(y); - base = (UINT32 *)&m_vram[y * m_stride]; + base = reinterpret_cast(&m_vram[y * m_stride]); for (x = 0; x < m_xres; x++) { *scanline++ = *base++; diff --git a/src/devices/bus/nubus/nubus_cb264.cpp b/src/devices/bus/nubus/nubus_cb264.cpp index 29889da8a46..264501aa5f8 100644 --- a/src/devices/bus/nubus/nubus_cb264.cpp +++ b/src/devices/bus/nubus/nubus_cb264.cpp @@ -205,7 +205,7 @@ UINT32 nubus_cb264_device::screen_update(screen_device &screen, bitmap_rgb32 &bi case 4: // 24 bpp case 7: // ??? { - UINT32 *vram32 = (UINT32 *)&m_vram[0]; + UINT32 *vram32 = reinterpret_cast(&m_vram[0]); for (y = 0; y < 480; y++) { diff --git a/src/devices/bus/nubus/nubus_image.cpp b/src/devices/bus/nubus/nubus_image.cpp index 5fbcb292948..9a5f98a1fe3 100644 --- a/src/devices/bus/nubus/nubus_image.cpp +++ b/src/devices/bus/nubus/nubus_image.cpp @@ -86,18 +86,18 @@ void messimg_disk_image_device::device_config_complete() void messimg_disk_image_device::device_start() { - m_data = (UINT8 *)nullptr; + m_data = static_cast(nullptr); if (exists() && fseek(0, SEEK_END) == 0) { - m_size = (UINT32)ftell(); + m_size = static_cast(ftell()); } } bool messimg_disk_image_device::call_load() { fseek(0, SEEK_END); - m_size = (UINT32)ftell(); + m_size = static_cast(ftell()); if (m_size > (256*1024*1024)) { printf("Mac image too large: must be 256MB or less!\n"); @@ -105,7 +105,7 @@ bool messimg_disk_image_device::call_load() return IMAGE_INIT_FAIL; } - m_data = (UINT8 *)auto_alloc_array_clear(machine(), UINT32, m_size/sizeof(UINT32)); + m_data = reinterpret_cast(auto_alloc_array_clear(machine(), UINT32, m_size/sizeof(UINT32))); fseek(0, SEEK_SET); fread(m_data, m_size); m_ejected = false; @@ -255,7 +255,7 @@ READ32_MEMBER( nubus_image_device::image_r ) WRITE32_MEMBER( nubus_image_device::image_super_w ) { - UINT32 *image = (UINT32*)m_image->m_data; + UINT32 *image = reinterpret_cast(m_image->m_data); data = ((data & 0xff) << 24) | ((data & 0xff00) << 8) | ((data & 0xff0000) >> 8) | ((data & 0xff000000) >> 24); mem_mask = ((mem_mask & 0xff) << 24) | ((mem_mask & 0xff00) << 8) | ((mem_mask & 0xff0000) >> 8) | ((mem_mask & 0xff000000) >> 24); @@ -264,7 +264,7 @@ WRITE32_MEMBER( nubus_image_device::image_super_w ) READ32_MEMBER( nubus_image_device::image_super_r ) { - UINT32 *image = (UINT32*)m_image->m_data; + UINT32 *image = reinterpret_cast(m_image->m_data); UINT32 data = image[offset]; return ((data & 0xff) << 24) | ((data & 0xff00) << 8) | ((data & 0xff0000) >> 8) | ((data & 0xff000000) >> 24); } @@ -279,24 +279,24 @@ WRITE32_MEMBER( nubus_image_device::file_cmd_w ) filectx.curcmd = data; switch(data) { case kFileCmdGetDir: - strcpy((char*)filectx.filename, (char*)filectx.curdir); + strcpy(reinterpret_cast(filectx.filename), reinterpret_cast(filectx.curdir)); break; case kFileCmdSetDir: if ((filectx.filename[0] == '/') || (filectx.filename[0] == '$')) { - strcpy((char*)filectx.curdir, (char*)filectx.filename); + strcpy(reinterpret_cast(filectx.curdir), reinterpret_cast(filectx.filename)); } else { - strcat((char*)filectx.curdir, "/"); - strcat((char*)filectx.curdir, (char*)filectx.filename); + strcat(reinterpret_cast(filectx.curdir), "/"); + strcat(reinterpret_cast(filectx.curdir), reinterpret_cast(filectx.filename)); } break; case kFileCmdGetFirstListing: if(filectx.dirp) osd_closedir(filectx.dirp); - filectx.dirp = osd_opendir((const char *)filectx.curdir); + filectx.dirp = osd_opendir(reinterpret_cast(filectx.curdir)); case kFileCmdGetNextListing: if (filectx.dirp) { dp = osd_readdir(filectx.dirp); if(dp) { - strncpy((char*)filectx.filename, dp->name, sizeof(filectx.filename)); + strncpy(reinterpret_cast(filectx.filename), dp->name, sizeof(filectx.filename)); } else { memset(filectx.filename, 0, sizeof(filectx.filename)); } @@ -307,18 +307,18 @@ WRITE32_MEMBER( nubus_image_device::file_cmd_w ) break; case kFileCmdGetFile: memset(fullpath, 0, sizeof(fullpath)); - strcpy(fullpath, (const char *)filectx.curdir); + strcpy(fullpath, reinterpret_cast(filectx.curdir)); strcat(fullpath, "/"); - strcat(fullpath, (const char*)filectx.filename); - if(osd_open((const char*)fullpath, OPEN_FLAG_READ, &filectx.fd, &filectx.filelen) != FILERR_NONE) printf("Error opening %s\n", fullpath); + strcat(fullpath, reinterpret_cast(filectx.filename)); + if(osd_open(static_cast(fullpath), OPEN_FLAG_READ, &filectx.fd, &filectx.filelen) != FILERR_NONE) printf("Error opening %s\n", fullpath); filectx.bytecount = 0; break; case kFileCmdPutFile: memset(fullpath, 0, sizeof(fullpath)); - strcpy(fullpath, (const char *)filectx.curdir); + strcpy(fullpath, reinterpret_cast(filectx.curdir)); strcat(fullpath, "/"); - strcat(fullpath, (const char*)filectx.filename); - if(osd_open((const char*)fullpath, OPEN_FLAG_WRITE|OPEN_FLAG_CREATE, &filectx.fd, &filesize) != FILERR_NONE) printf("Error opening %s\n", fullpath); + strcat(fullpath, reinterpret_cast(filectx.filename)); + if(osd_open(static_cast(fullpath), OPEN_FLAG_WRITE|OPEN_FLAG_CREATE, &filectx.fd, &filesize) != FILERR_NONE) printf("Error opening %s\n", fullpath); filectx.bytecount = 0; break; } @@ -377,12 +377,12 @@ READ32_MEMBER( nubus_image_device::file_len_r ) WRITE32_MEMBER( nubus_image_device::file_name_w ) { - ((UINT32*)(filectx.filename))[offset] = ni_ntohl(data); + reinterpret_cast(filectx.filename)[offset] = ni_ntohl(data); } READ32_MEMBER( nubus_image_device::file_name_r ) { UINT32 ret; - ret = ni_htonl(((UINT32*)(filectx.filename))[offset]); + ret = ni_htonl(reinterpret_cast(filectx.filename)[offset]); return ret; } diff --git a/src/devices/bus/nubus/nubus_m2hires.cpp b/src/devices/bus/nubus/nubus_m2hires.cpp index 3cf9e5abead..1057ddc8ff5 100644 --- a/src/devices/bus/nubus/nubus_m2hires.cpp +++ b/src/devices/bus/nubus/nubus_m2hires.cpp @@ -100,7 +100,7 @@ void nubus_m2hires_device::device_start() // printf("[m2hires %p] slotspace = %x\n", this, slotspace); m_vram.resize(VRAM_SIZE); - m_vram32 = (UINT32 *)&m_vram[0]; + m_vram32 = reinterpret_cast(&m_vram[0]); m_nubus->install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_m2hires_device::vram_r), this), write32_delegate(FUNC(nubus_m2hires_device::vram_w), this)); m_nubus->install_device(slotspace+0x900000, slotspace+VRAM_SIZE-1+0x900000, read32_delegate(FUNC(nubus_m2hires_device::vram_r), this), write32_delegate(FUNC(nubus_m2hires_device::vram_w), this)); diff --git a/src/devices/bus/nubus/nubus_m2video.cpp b/src/devices/bus/nubus/nubus_m2video.cpp index ec4b7fb6d4c..abfa4e78c01 100644 --- a/src/devices/bus/nubus/nubus_m2video.cpp +++ b/src/devices/bus/nubus/nubus_m2video.cpp @@ -101,7 +101,7 @@ void nubus_m2video_device::device_start() // printf("[m2video %p] slotspace = %x\n", this, slotspace); m_vram.resize(VRAM_SIZE); - m_vram32 = (UINT32 *)&m_vram[0]; + m_vram32 = reinterpret_cast(&m_vram[0]); m_nubus->install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_m2video_device::vram_r), this), write32_delegate(FUNC(nubus_m2video_device::vram_w), this)); m_nubus->install_device(slotspace+0x900000, slotspace+VRAM_SIZE-1+0x900000, read32_delegate(FUNC(nubus_m2video_device::vram_r), this), write32_delegate(FUNC(nubus_m2video_device::vram_w), this)); diff --git a/src/devices/bus/nubus/nubus_radiustpd.cpp b/src/devices/bus/nubus/nubus_radiustpd.cpp index 84188fd215e..0b445e84cd5 100644 --- a/src/devices/bus/nubus/nubus_radiustpd.cpp +++ b/src/devices/bus/nubus/nubus_radiustpd.cpp @@ -97,10 +97,10 @@ void nubus_radiustpd_device::device_start() slotspace = get_slotspace(); - printf("[radiustpd %p] slotspace = %x\n", (void *)this, slotspace); + printf("[radiustpd %p] slotspace = %x\n", static_cast(this), slotspace); m_vram.resize(VRAM_SIZE); - m_vram32 = (UINT32 *)&m_vram[0]; + m_vram32 = reinterpret_cast(&m_vram[0]); m_nubus->install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_radiustpd_device::vram_r), this), write32_delegate(FUNC(nubus_radiustpd_device::vram_w), this)); m_nubus->install_device(slotspace+0x900000, slotspace+VRAM_SIZE-1+0x900000, read32_delegate(FUNC(nubus_radiustpd_device::vram_r), this), write32_delegate(FUNC(nubus_radiustpd_device::vram_w), this)); diff --git a/src/devices/bus/nubus/nubus_spec8.cpp b/src/devices/bus/nubus/nubus_spec8.cpp index 8b2651bcff8..8b54d7cd2be 100644 --- a/src/devices/bus/nubus/nubus_spec8.cpp +++ b/src/devices/bus/nubus/nubus_spec8.cpp @@ -102,7 +102,7 @@ void nubus_spec8s3_device::device_start() // printf("[SPEC8S3 %p] slotspace = %x\n", this, slotspace); m_vram.resize(VRAM_SIZE); - m_vram32 = (UINT32 *)&m_vram[0]; + m_vram32 = reinterpret_cast(&m_vram[0]); m_nubus->install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_spec8s3_device::vram_r), this), write32_delegate(FUNC(nubus_spec8s3_device::vram_w), this)); m_nubus->install_device(slotspace+0x900000, slotspace+VRAM_SIZE-1+0x900000, read32_delegate(FUNC(nubus_spec8s3_device::vram_r), this), write32_delegate(FUNC(nubus_spec8s3_device::vram_w), this)); m_nubus->install_device(slotspace+0xd0000, slotspace+0xfffff, read32_delegate(FUNC(nubus_spec8s3_device::spec8s3_r), this), write32_delegate(FUNC(nubus_spec8s3_device::spec8s3_w), this)); diff --git a/src/devices/bus/nubus/nubus_specpdq.cpp b/src/devices/bus/nubus/nubus_specpdq.cpp index d67ac04ef31..9ddc501de7a 100644 --- a/src/devices/bus/nubus/nubus_specpdq.cpp +++ b/src/devices/bus/nubus/nubus_specpdq.cpp @@ -119,7 +119,7 @@ void nubus_specpdq_device::device_start() // printf("[specpdq %p] slotspace = %x\n", this, slotspace); m_vram.resize(VRAM_SIZE); - m_vram32 = (UINT32 *)&m_vram[0]; + m_vram32 = reinterpret_cast(&m_vram[0]); m_nubus->install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_specpdq_device::vram_r), this), write32_delegate(FUNC(nubus_specpdq_device::vram_w), this)); m_nubus->install_device(slotspace+0x400000, slotspace+0xfbffff, read32_delegate(FUNC(nubus_specpdq_device::specpdq_r), this), write32_delegate(FUNC(nubus_specpdq_device::specpdq_w), this)); diff --git a/src/devices/bus/nubus/nubus_wsportrait.cpp b/src/devices/bus/nubus/nubus_wsportrait.cpp index 3fe0e4c3ec0..3af176289d2 100644 --- a/src/devices/bus/nubus/nubus_wsportrait.cpp +++ b/src/devices/bus/nubus/nubus_wsportrait.cpp @@ -100,10 +100,10 @@ void nubus_wsportrait_device::device_start() slotspace = get_slotspace(); - printf("[wsportrait %p] slotspace = %x\n", (void *)this, slotspace); + printf("[wsportrait %p] slotspace = %x\n", static_cast(this), slotspace); m_vram.resize(VRAM_SIZE); - m_vram32 = (UINT32 *)&m_vram[0]; + m_vram32 = reinterpret_cast(&m_vram[0]); m_nubus->install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_wsportrait_device::vram_r), this), write32_delegate(FUNC(nubus_wsportrait_device::vram_w), this)); m_nubus->install_device(slotspace+0x900000, slotspace+0x900000+VRAM_SIZE-1, read32_delegate(FUNC(nubus_wsportrait_device::vram_r), this), write32_delegate(FUNC(nubus_wsportrait_device::vram_w), this)); diff --git a/src/devices/bus/nubus/pds30_30hr.cpp b/src/devices/bus/nubus/pds30_30hr.cpp index eb5550cb64e..c8ac57c86c3 100644 --- a/src/devices/bus/nubus/pds30_30hr.cpp +++ b/src/devices/bus/nubus/pds30_30hr.cpp @@ -103,7 +103,7 @@ void nubus_xceed30hr_device::device_start() // printf("[xceed30hr %p] slotspace = %x\n", this, slotspace); m_vram.resize(VRAM_SIZE); - m_vram32 = (UINT32 *)&m_vram[0]; + m_vram32 = reinterpret_cast(&m_vram[0]); m_nubus->install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_xceed30hr_device::vram_r), this), write32_delegate(FUNC(nubus_xceed30hr_device::vram_w), this)); m_nubus->install_device(slotspace+0x800000, slotspace+0xefffff, read32_delegate(FUNC(nubus_xceed30hr_device::xceed30hr_r), this), write32_delegate(FUNC(nubus_xceed30hr_device::xceed30hr_w), this)); diff --git a/src/devices/bus/nubus/pds30_cb264.cpp b/src/devices/bus/nubus/pds30_cb264.cpp index b5c10671aea..a7cee75e4d2 100644 --- a/src/devices/bus/nubus/pds30_cb264.cpp +++ b/src/devices/bus/nubus/pds30_cb264.cpp @@ -96,7 +96,7 @@ void nubus_cb264se30_device::device_start() // printf("[cb264se30 %p] slotspace = %x\n", this, slotspace); m_vram.resize(VRAM_SIZE); - m_vram32 = (UINT32 *)&m_vram[0]; + m_vram32 = reinterpret_cast(&m_vram[0]); m_nubus->install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_cb264se30_device::vram_r), this), write32_delegate(FUNC(nubus_cb264se30_device::vram_w), this)); m_nubus->install_device(slotspace+0xf00000, slotspace+0xfeffff, read32_delegate(FUNC(nubus_cb264se30_device::cb264se30_r), this), write32_delegate(FUNC(nubus_cb264se30_device::cb264se30_w), this)); @@ -215,7 +215,7 @@ UINT32 nubus_cb264se30_device::screen_update(screen_device &screen, bitmap_rgb32 case 4: // 24 bpp { - UINT32 *vram32 = (UINT32 *)&m_vram[0]; + UINT32 *vram32 = reinterpret_cast(&m_vram[0]); UINT32 *base; for (y = 0; y < 480; y++) diff --git a/src/devices/bus/nubus/pds30_mc30.cpp b/src/devices/bus/nubus/pds30_mc30.cpp index 4c0e6999541..849076592d7 100644 --- a/src/devices/bus/nubus/pds30_mc30.cpp +++ b/src/devices/bus/nubus/pds30_mc30.cpp @@ -99,7 +99,7 @@ void nubus_xceedmc30_device::device_start() // printf("[xceedmc30 %p] slotspace = %x\n", this, slotspace); m_vram.resize(VRAM_SIZE); - m_vram32 = (UINT32 *)&m_vram[0]; + m_vram32 = reinterpret_cast(&m_vram[0]); m_nubus->install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_xceedmc30_device::vram_r), this), write32_delegate(FUNC(nubus_xceedmc30_device::vram_w), this)); m_nubus->install_device(slotspace+0x800000, slotspace+0xefffff, read32_delegate(FUNC(nubus_xceedmc30_device::xceedmc30_r), this), write32_delegate(FUNC(nubus_xceedmc30_device::xceedmc30_w), this)); @@ -218,7 +218,7 @@ UINT32 nubus_xceedmc30_device::screen_update(screen_device &screen, bitmap_rgb32 case 4: // 24 bpp { - UINT32 *vram32 = (UINT32 *)vram; + UINT32 *vram32 = reinterpret_cast(vram); UINT32 *base; for (y = 0; y < 480; y++) diff --git a/src/devices/bus/nubus/pds30_procolor816.cpp b/src/devices/bus/nubus/pds30_procolor816.cpp index bb995682381..faf002c4368 100644 --- a/src/devices/bus/nubus/pds30_procolor816.cpp +++ b/src/devices/bus/nubus/pds30_procolor816.cpp @@ -102,7 +102,7 @@ void nubus_procolor816_device::device_start() // printf("[procolor816 %p] slotspace = %x\n", this, slotspace); m_vram.resize(VRAM_SIZE); - m_vram32 = (UINT32 *)&m_vram[0]; + m_vram32 = reinterpret_cast(&m_vram[0]); m_nubus->install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_procolor816_device::vram_r), this), write32_delegate(FUNC(nubus_procolor816_device::vram_w), this)); m_nubus->install_device(slotspace+0x900000, slotspace+VRAM_SIZE-1+0x900000, read32_delegate(FUNC(nubus_procolor816_device::vram_r), this), write32_delegate(FUNC(nubus_procolor816_device::vram_w), this)); @@ -222,7 +222,7 @@ UINT32 nubus_procolor816_device::screen_update(screen_device &screen, bitmap_rgb case 4: // 15 bpp { - UINT16 *vram16 = (UINT16 *)&m_vram[0]; + UINT16 *vram16 = reinterpret_cast(&m_vram[0]); UINT16 pixels; for (y = 0; y < 480; y++) diff --git a/src/devices/bus/nubus/pds30_sigmalview.cpp b/src/devices/bus/nubus/pds30_sigmalview.cpp index 88eab2ffdcb..7951b53c9b3 100644 --- a/src/devices/bus/nubus/pds30_sigmalview.cpp +++ b/src/devices/bus/nubus/pds30_sigmalview.cpp @@ -96,7 +96,7 @@ void nubus_lview_device::device_start() // printf("[lview %p] slotspace = %x\n", this, slotspace); m_vram.resize(VRAM_SIZE); - m_vram32 = (UINT32 *)&m_vram[0]; + m_vram32 = reinterpret_cast(&m_vram[0]); m_nubus->install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_lview_device::vram_r), this), write32_delegate(FUNC(nubus_lview_device::vram_w), this)); m_nubus->install_device(slotspace+0x900000, slotspace+VRAM_SIZE-1+0x900000, read32_delegate(FUNC(nubus_lview_device::vram_r), this), write32_delegate(FUNC(nubus_lview_device::vram_w), this)); diff --git a/src/devices/bus/oricext/oricext.cpp b/src/devices/bus/oricext/oricext.cpp index 2c1894b385c..7a576b12f59 100644 --- a/src/devices/bus/oricext/oricext.cpp +++ b/src/devices/bus/oricext/oricext.cpp @@ -72,8 +72,8 @@ void oricext_device::device_start() bank_c000_w = membank(":bank_c000_w"); bank_e000_w = membank(":bank_e000_w"); bank_f800_w = membank(":bank_f800_w"); - rom = (UINT8 *)machine().root_device().memregion(cputag)->base(); - ram = (UINT8 *)memshare(":ram")->ptr(); + rom = static_cast(machine().root_device().memregion(cputag)->base()); + ram = static_cast(memshare(":ram")->ptr()); memset(junk_read, 0xff, sizeof(junk_read)); memset(junk_write, 0x00, sizeof(junk_write)); diff --git a/src/devices/bus/saturn/sat_slot.cpp b/src/devices/bus/saturn/sat_slot.cpp index 7e1f0cd1233..9c33a02e236 100644 --- a/src/devices/bus/saturn/sat_slot.cpp +++ b/src/devices/bus/saturn/sat_slot.cpp @@ -60,7 +60,7 @@ void device_sat_cart_interface::rom_alloc(UINT32 size, const char *tag) { if (m_rom == nullptr) { - m_rom = (UINT32 *)device().machine().memory().region_alloc(std::string(tag).append(SATSLOT_ROM_REGION_TAG).c_str(), size, 4, ENDIANNESS_LITTLE)->base(); + m_rom = reinterpret_cast(device().machine().memory().region_alloc(std::string(tag).append(SATSLOT_ROM_REGION_TAG).c_str(), size, 4, ENDIANNESS_LITTLE)->base()); m_rom_size = size; } } diff --git a/src/devices/bus/scsi/acb4070.cpp b/src/devices/bus/scsi/acb4070.cpp index 1503272b55c..45736d5ab4c 100644 --- a/src/devices/bus/scsi/acb4070.cpp +++ b/src/devices/bus/scsi/acb4070.cpp @@ -53,7 +53,7 @@ void acb4070_device::WriteData( UINT8 *data, int dataLength ) switch( command[ 0 ] ) { case T10SPC_CMD_MODE_SELECT_6: - adaptec_sense_t *sense=(adaptec_sense_t *) data; + adaptec_sense_t *sense=reinterpret_cast(data); int tracks=(sense->cylinder_count[0]<<8)+sense->cylinder_count[1]; int capacity=(tracks * sense->head_count * 17); logerror("Tracks=%d, Heads=%d sec/track=%d\n",tracks,sense->head_count,sense->sectors_per_track); diff --git a/src/devices/bus/scsi/cdu76s.cpp b/src/devices/bus/scsi/cdu76s.cpp index bb6a70390ed..fb20af67fa9 100644 --- a/src/devices/bus/scsi/cdu76s.cpp +++ b/src/devices/bus/scsi/cdu76s.cpp @@ -27,9 +27,9 @@ void sony_cdu76s_device::ReadData( UINT8 *data, int dataLength ) data[3] = 0x02; // response data format = SPC-3 standard // some Konami games freak out if this isn't "Sony", so we'll lie // this is the actual drive on my Nagano '98 board - strcpy((char *)&data[8], "Sony"); - strcpy((char *)&data[16], "CDU-76S"); - strcpy((char *)&data[32], "1.0"); + strcpy(reinterpret_cast(&data[8]), "Sony"); + strcpy(reinterpret_cast(&data[16]), "CDU-76S"); + strcpy(reinterpret_cast(&data[32]), "1.0"); break; default: diff --git a/src/devices/bus/sega8/sega8_slot.cpp b/src/devices/bus/sega8/sega8_slot.cpp index c88be013d3f..f1565aa9227 100644 --- a/src/devices/bus/sega8/sega8_slot.cpp +++ b/src/devices/bus/sega8/sega8_slot.cpp @@ -220,7 +220,7 @@ int sega8_cart_slot_device::verify_cart( UINT8 *magic, int size ) // Verify the file is a valid image - check $7ff0 for "TMR SEGA" if (size >= 0x8000) { - if (!strncmp((char*)&magic[0x7ff0], "TMR SEGA", 8)) + if (!strncmp(reinterpret_cast(&magic[0x7ff0]), "TMR SEGA", 8)) retval = IMAGE_VERIFY_PASS; } @@ -578,21 +578,21 @@ int sega8_cart_slot_device::get_cart_type(UINT8 *ROM, UINT32 len) } // Terebi Oekaki (TV Draw) - if (len >= 0x13b3 + 7 && !strncmp((const char *)&ROM[0x13b3], "annakmn", 7)) + if (len >= 0x13b3 + 7 && !strncmp(reinterpret_cast(&ROM[0x13b3]), "annakmn", 7)) type = SEGA8_TEREBIOEKAKI; // The Castle (ROM+RAM) - if (len >= 0x1cc3 + 10 && !strncmp((const char *)&ROM[0x1cc3], "ASCII 1986", 10)) + if (len >= 0x1cc3 + 10 && !strncmp(reinterpret_cast(&ROM[0x1cc3]), "ASCII 1986", 10)) type = SEGA8_CASTLE; // BASIC Level 3 - if (len >= 0x6a20 + 29 && !strncmp((const char *)&ROM[0x6a20], "SC-3000 BASIC Level 3 ver 1.0", 29)) + if (len >= 0x6a20 + 29 && !strncmp(reinterpret_cast(&ROM[0x6a20]), "SC-3000 BASIC Level 3 ver 1.0", 29)) type = SEGA8_BASIC_L3; // Music Editor if (len >= 0x0841 + 5) { - if (!strncmp((const char *)&ROM[0x0841], "PIANO", 5) || !strncmp((const char *)&ROM[0x0841], "music", 5)) + if (!strncmp(reinterpret_cast(&ROM[0x0841]), "PIANO", 5) || !strncmp(reinterpret_cast(&ROM[0x0841]), "music", 5)) type = SEGA8_MUSIC_EDITOR; } @@ -731,7 +731,7 @@ void sega8_cart_slot_device::internal_header_logging(UINT8 *ROM, UINT32 len, UIN logerror("FILE DETAILS\n" ); logerror("============\n" ); logerror("Name: %s\n", basename()); - logerror("File Size: 0x%08x\n", (software_entry() == nullptr) ? (int)length() : (int)get_software_region_length("rom")); + logerror("File Size: 0x%08x\n", (software_entry() == nullptr) ? static_cast(length()) : static_cast(get_software_region_length("rom"))); logerror("Detected type: %s\n", sega8_get_slot(m_type)); logerror("ROM (Allocated) Size: 0x%X\n", len); logerror("RAM: %s\n", nvram_len ? "Yes" : "No"); diff --git a/src/devices/bus/sms_ctrl/lphaser.cpp b/src/devices/bus/sms_ctrl/lphaser.cpp index 9c1a2d30b9a..b1c610a7732 100644 --- a/src/devices/bus/sms_ctrl/lphaser.cpp +++ b/src/devices/bus/sms_ctrl/lphaser.cpp @@ -45,7 +45,7 @@ static INPUT_PORTS_START( sms_light_phaser ) PORT_BIT( 0xff, 0x00, IPT_LIGHTGUN_X) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(15) PORT_CHANGED_MEMBER(DEVICE_SELF, sms_light_phaser_device, position_changed, nullptr) PORT_START("LPHASER_Y") - PORT_BIT( 0xff, 0x00, IPT_LIGHTGUN_Y) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(15) PORT_CHANGED_MEMBER(DEVICE_SELF, sms_light_phaser_device, position_changed, 0) + PORT_BIT( 0xff, 0x00, IPT_LIGHTGUN_Y) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(15) PORT_CHANGED_MEMBER(DEVICE_SELF, sms_light_phaser_device, position_changed, nullptr) INPUT_PORTS_END @@ -172,7 +172,7 @@ int sms_light_phaser_device::bright_aim_area( emu_timer *timer, int lgun_x, int /* step 1: r^2 = dx^2 + dy^2 */ /* step 2: dx^2 = r^2 - dy^2 */ /* step 3: dx = sqrt(r^2 - dy^2) */ - dx_radius = ceil((float) sqrt((float) (r_x_r - (dy * dy)))); + dx_radius = ceil(static_cast(sqrt(static_cast(r_x_r - (dy * dy))))); } aim_area.min_x = MAX(lgun_x - dx_radius, visarea.min_x); diff --git a/src/devices/bus/snes/sa1.cpp b/src/devices/bus/snes/sa1.cpp index be4f4c039fe..73a4bc82a79 100644 --- a/src/devices/bus/snes/sa1.cpp +++ b/src/devices/bus/snes/sa1.cpp @@ -349,23 +349,23 @@ UINT8 sns_sa1_device::read_regs(address_space &space, UINT32 offset) break; case 0x106: // Math Result bits0-7 - value = (UINT64)(m_math_res >> 0) & 0xff; + value = static_cast(m_math_res >> 0) & 0xff; break; case 0x107: // Math Result bits8-15 - value = (UINT64)(m_math_res >> 8) & 0xff; + value = static_cast(m_math_res >> 8) & 0xff; break; case 0x108: // Math Result bits16-23 - value = (UINT64)(m_math_res >> 16) & 0xff; + value = static_cast(m_math_res >> 16) & 0xff; break; case 0x109: // Math Result bits24-31 - value = (UINT64)(m_math_res >> 24) & 0xff; + value = static_cast(m_math_res >> 24) & 0xff; break; case 0x10a: // Math Result bits32-39 - value = (UINT64)(m_math_res >> 32) & 0xff; + value = static_cast(m_math_res >> 32) & 0xff; break; case 0x10b: // Math Overflow (above 40bit result) @@ -749,7 +749,7 @@ void sns_sa1_device::write_regs(address_space &space, UINT32 offset, UINT8 data) switch (m_math_ctlr) { case 0: //signed multiplication - m_math_res = (INT16)m_math_a * (INT16)m_math_b; + m_math_res = static_cast(m_math_a) * static_cast(m_math_b); m_math_b = 0; break; case 1: //unsigned division @@ -757,14 +757,14 @@ void sns_sa1_device::write_regs(address_space &space, UINT32 offset, UINT8 data) m_math_res = 0; else { - INT16 quotient = (INT16)m_math_a / (UINT16)m_math_b; - UINT16 remainder = (INT16)m_math_a % (UINT16)m_math_b; - m_math_res = (UINT64)((remainder << 16) | quotient); + INT16 quotient = static_cast(m_math_a) / static_cast(m_math_b); + UINT16 remainder = static_cast(m_math_a) % static_cast(m_math_b); + m_math_res = static_cast((remainder << 16) | quotient); } break; case 2: //sigma (accumulative multiplication) case 3: - UINT64 acum = (INT16)m_math_a * (INT16)m_math_b; + UINT64 acum = static_cast(m_math_a) * static_cast(m_math_b); UINT64 mask = U64(0xffffffffff); m_math_res += acum; m_math_overflow = (m_math_res > mask) ? 0x80 : 0; diff --git a/src/devices/bus/snes/sdd1.cpp b/src/devices/bus/snes/sdd1.cpp index 56376641705..5562cd14713 100644 --- a/src/devices/bus/snes/sdd1.cpp +++ b/src/devices/bus/snes/sdd1.cpp @@ -428,7 +428,7 @@ void sns_rom_sdd1_device::device_start() { m_sdd1emu = auto_alloc(machine(), SDD1_emu(machine())); - m_buffer.data = (UINT8*)auto_alloc_array(machine(), UINT8, 0x10000); + m_buffer.data = static_cast(auto_alloc_array(machine(), UINT8, 0x10000)); m_buffer.ready = 0; save_item(NAME(m_sdd1_enable)); @@ -573,7 +573,7 @@ UINT8 sns_rom_sdd1_device::read_helper(UINT32 addr) } // fetch a decompressed byte; once buffer is depleted, disable channel and invalidate buffer - data = m_buffer.data[(UINT16)m_buffer.offset++]; + data = m_buffer.data[static_cast(m_buffer.offset++)]; if (m_buffer.offset >= m_buffer.size) { m_buffer.ready = 0; diff --git a/src/devices/bus/snes/snes_slot.cpp b/src/devices/bus/snes/snes_slot.cpp index 10add2da1cc..7e74dd5fcb2 100644 --- a/src/devices/bus/snes/snes_slot.cpp +++ b/src/devices/bus/snes/snes_slot.cpp @@ -843,7 +843,7 @@ void base_sns_cart_slot_device::setup_addon_from_fullpath() void base_sns_cart_slot_device::setup_nvram() { - UINT8 *ROM = (UINT8 *)m_cart->get_rom_base(); + UINT8 *ROM = static_cast(m_cart->get_rom_base()); UINT32 size = 0; if (software_entry() == nullptr) { diff --git a/src/devices/bus/snes/spc7110.cpp b/src/devices/bus/snes/spc7110.cpp index a6ebbdab2df..ef827078a1f 100644 --- a/src/devices/bus/snes/spc7110.cpp +++ b/src/devices/bus/snes/spc7110.cpp @@ -300,7 +300,7 @@ static const UINT8 spc7110_mode2_context_table[32][2] = SPC7110_Decomp::SPC7110_Decomp(running_machine &machine) : m_machine(machine) { - m_decomp_buffer = (UINT8*)auto_alloc_array(machine, UINT8, SPC7110_DECOMP_BUFFER_SIZE); + m_decomp_buffer = static_cast(auto_alloc_array(machine, UINT8, SPC7110_DECOMP_BUFFER_SIZE)); reset(); for (int i = 0; i < 256; i++) @@ -995,7 +995,7 @@ void sns_rom_spc7110_device::spc7110_update_time(UINT8 offset) month--; year += (year >= 90) ? 1900 : 2000; - second += (UINT32)diff; + second += static_cast(diff); while (second >= 60) { second -= 60; @@ -1120,7 +1120,7 @@ READ8_MEMBER(sns_rom_spc7110_device::chip_read) adjust = spc7110_data_adjust(); if (m_r4818 & 8) { - adjust = (INT16)adjust; //16-bit sign extend + adjust = static_cast(adjust); //16-bit sign extend } adjustaddr = address; @@ -1136,7 +1136,7 @@ READ8_MEMBER(sns_rom_spc7110_device::chip_read) UINT32 increment = (m_r4818 & 1) ? spc7110_data_increment() : 1; if (m_r4818 & 4) { - increment = (INT16)increment; //16-bit sign extend + increment = static_cast(increment); //16-bit sign extend } if ((m_r4818 & 16) == 0) @@ -1172,7 +1172,7 @@ READ8_MEMBER(sns_rom_spc7110_device::chip_read) adjust = spc7110_data_adjust(); if (m_r4818 & 8) { - adjust = (INT16)adjust; //16-bit sign extend + adjust = static_cast(adjust); //16-bit sign extend } data = ROM[spc7110_datarom_addr(address + adjust, len)]; @@ -1324,7 +1324,7 @@ WRITE8_MEMBER(sns_rom_spc7110_device::chip_write) UINT32 increment = spc7110_data_adjust() & 0xff; if (m_r4818 & 8) { - increment = (INT8)increment; //8-bit sign extend + increment = static_cast(increment); //8-bit sign extend } spc7110_set_data_pointer(spc7110_data_pointer() + increment); } @@ -1333,7 +1333,7 @@ WRITE8_MEMBER(sns_rom_spc7110_device::chip_write) UINT32 increment = spc7110_data_adjust(); if (m_r4818 & 8) { - increment = (INT16)increment; //16-bit sign extend + increment = static_cast(increment); //16-bit sign extend } spc7110_set_data_pointer(spc7110_data_pointer() + increment); } @@ -1362,7 +1362,7 @@ WRITE8_MEMBER(sns_rom_spc7110_device::chip_write) UINT32 increment = spc7110_data_adjust() & 0xff; if (m_r4818 & 8) { - increment = (INT8)increment; //8-bit sign extend + increment = static_cast(increment); //8-bit sign extend } spc7110_set_data_pointer(spc7110_data_pointer() + increment); } @@ -1371,7 +1371,7 @@ WRITE8_MEMBER(sns_rom_spc7110_device::chip_write) UINT32 increment = spc7110_data_adjust(); if (m_r4818 & 8) { - increment = (INT16)increment; //16-bit sign extend + increment = static_cast(increment); //16-bit sign extend } spc7110_set_data_pointer(spc7110_data_pointer() + increment); } @@ -1406,8 +1406,8 @@ WRITE8_MEMBER(sns_rom_spc7110_device::chip_write) if (m_r482e & 1) { //signed 16-bit x 16-bit multiplication - INT16 r0 = (INT16)(m_r4824 + (m_r4825 << 8)); - INT16 r1 = (INT16)(m_r4820 + (m_r4821 << 8)); + INT16 r0 = static_cast(m_r4824 + (m_r4825 << 8)); + INT16 r1 = static_cast(m_r4820 + (m_r4821 << 8)); INT32 result = r0 * r1; m_r4828 = result; @@ -1418,8 +1418,8 @@ WRITE8_MEMBER(sns_rom_spc7110_device::chip_write) else { //unsigned 16-bit x 16-bit multiplication - UINT16 r0 = (UINT16)(m_r4824 + (m_r4825 << 8)); - UINT16 r1 = (UINT16)(m_r4820 + (m_r4821 << 8)); + UINT16 r0 = static_cast(m_r4824 + (m_r4825 << 8)); + UINT16 r1 = static_cast(m_r4820 + (m_r4821 << 8)); UINT32 result = r0 * r1; m_r4828 = result; @@ -1440,16 +1440,16 @@ WRITE8_MEMBER(sns_rom_spc7110_device::chip_write) if (m_r482e & 1) { //signed 32-bit x 16-bit division - INT32 dividend = (INT32)(m_r4820 + (m_r4821 << 8) + (m_r4822 << 16) + (m_r4823 << 24)); - INT16 divisor = (INT16)(m_r4826 + (m_r4827 << 8)); + INT32 dividend = static_cast(m_r4820 + (m_r4821 << 8) + (m_r4822 << 16) + (m_r4823 << 24)); + INT16 divisor = static_cast(m_r4826 + (m_r4827 << 8)); INT32 quotient; INT16 remainder; if (divisor) { - quotient = (INT32)(dividend / divisor); - remainder = (INT32)(dividend % divisor); + quotient = static_cast(dividend / divisor); + remainder = static_cast(dividend % divisor); } else { @@ -1469,16 +1469,16 @@ WRITE8_MEMBER(sns_rom_spc7110_device::chip_write) else { //unsigned 32-bit x 16-bit division - UINT32 dividend = (UINT32)(m_r4820 + (m_r4821 << 8) + (m_r4822 << 16) + (m_r4823 << 24)); - UINT16 divisor = (UINT16)(m_r4826 + (m_r4827 << 8)); + UINT32 dividend = static_cast(m_r4820 + (m_r4821 << 8) + (m_r4822 << 16) + (m_r4823 << 24)); + UINT16 divisor = static_cast(m_r4826 + (m_r4827 << 8)); UINT32 quotient; UINT16 remainder; if (divisor) { - quotient = (UINT32)(dividend / divisor); - remainder = (UINT16)(dividend % divisor); + quotient = static_cast(dividend / divisor); + remainder = static_cast(dividend % divisor); } else { @@ -1575,7 +1575,7 @@ WRITE8_MEMBER(sns_rom_spc7110_device::chip_write) { m_r4842 = 0x80; m_rtc_state = RTCS_IndexSelect; - m_rtc_mode = (RTC_Mode)data; + m_rtc_mode = static_cast(data); m_rtc_index = 0; } break; diff --git a/src/devices/bus/ti99_peb/bwg.cpp b/src/devices/bus/ti99_peb/bwg.cpp index cc1cedaf45b..158854b733b 100644 --- a/src/devices/bus/ti99_peb/bwg.cpp +++ b/src/devices/bus/ti99_peb/bwg.cpp @@ -114,7 +114,7 @@ void snug_bwg_device::operate_ready_line() WRITE_LINE_MEMBER( snug_bwg_device::fdc_irq_w ) { if (TRACE_SIGNALS) logerror("bwg: set intrq = %d\n", state); - m_IRQ = (line_state)state; + m_IRQ = static_cast(state); // Unlike the TI FDC, the BwG does not set the INTB line. Anyway, no one cares. // We need to explicitly set the READY line to release the datamux operate_ready_line(); @@ -123,7 +123,7 @@ WRITE_LINE_MEMBER( snug_bwg_device::fdc_irq_w ) WRITE_LINE_MEMBER( snug_bwg_device::fdc_drq_w ) { if (TRACE_SIGNALS) logerror("bwg: set drq = %d\n", state); - m_DRQ = (line_state)state; + m_DRQ = static_cast(state); // We need to explicitly set the READY line to release the datamux operate_ready_line(); diff --git a/src/devices/bus/ti99_peb/hfdc.cpp b/src/devices/bus/ti99_peb/hfdc.cpp index dddc49a4aeb..49758186a9d 100644 --- a/src/devices/bus/ti99_peb/hfdc.cpp +++ b/src/devices/bus/ti99_peb/hfdc.cpp @@ -811,7 +811,7 @@ void myarc_hfdc_device::set_floppy_motors_running(bool run) */ WRITE_LINE_MEMBER( myarc_hfdc_device::intrq_w ) { - m_irq = (line_state)state; + m_irq = static_cast(state); if (TRACE_INT) logerror("%s: INT pin from controller = %d, propagating to INTA*\n", tag(), state); // Set INTA* @@ -838,7 +838,7 @@ WRITE_LINE_MEMBER( myarc_hfdc_device::dmarq_w ) */ WRITE_LINE_MEMBER( myarc_hfdc_device::dip_w ) { - m_dip = (line_state)state; + m_dip = static_cast(state); } /* diff --git a/src/devices/bus/ti99_peb/ti_32kmem.cpp b/src/devices/bus/ti99_peb/ti_32kmem.cpp index 487847b82d8..a9fd83680a1 100644 --- a/src/devices/bus/ti99_peb/ti_32kmem.cpp +++ b/src/devices/bus/ti99_peb/ti_32kmem.cpp @@ -101,7 +101,7 @@ void ti_32k_expcard_device::device_start(void) // ROM_FILL does not seem to allow filling with an alternating pattern for (int i=0; i < 0x8000; i+=2) { - m_ram_ptr[i] = (UINT8)0xff; + m_ram_ptr[i] = static_cast(0xff); } } diff --git a/src/devices/bus/ti99x/990_hd.cpp b/src/devices/bus/ti99x/990_hd.cpp index 99ad509d39f..8b171900b12 100644 --- a/src/devices/bus/ti99x/990_hd.cpp +++ b/src/devices/bus/ti99x/990_hd.cpp @@ -445,7 +445,7 @@ void ti990_hdc_device::store_registers() m_d[dsk_sel].unsafe = 0; /* I think */ - dma_address = ((((int) m_w[6]) << 16) | m_w[5]) & 0x1ffffe; + dma_address = ((static_cast(m_w[6]) << 16) | m_w[5]) & 0x1ffffe; byte_count = m_w[4] & 0xfffe; /* formatted words per track */ @@ -584,7 +584,7 @@ void ti990_hdc_device::read_data() return; } - dma_address = ((((int) m_w[6]) << 16) | m_w[5]) & 0x1ffffe; + dma_address = ((static_cast(m_w[6]) << 16) | m_w[5]) & 0x1ffffe; byte_count = m_w[4] & 0xfffe; cylinder = m_w[3]; @@ -618,7 +618,7 @@ void ti990_hdc_device::read_data() if (! (m_w[1] & w1_transfer_inhibit)) for (i=0; imemory().space(AS_PROGRAM).write_word(dma_address, (((int) buffer[i]) << 8) | buffer[i+1]); + machine().device("maincpu")->memory().space(AS_PROGRAM).write_word(dma_address, (static_cast(buffer[i]) << 8) | buffer[i+1]); dma_address = (dma_address + 2) & 0x1ffffe; } @@ -691,7 +691,7 @@ void ti990_hdc_device::write_data() return; } - dma_address = ((((int) m_w[6]) << 16) | m_w[5]) & 0x1ffffe; + dma_address = ((static_cast(m_w[6]) << 16) | m_w[5]) & 0x1ffffe; byte_count = m_w[4] & 0xfffe; cylinder = m_w[3]; @@ -793,9 +793,6 @@ void ti990_hdc_device::unformatted_read() return; } - dma_address = ((((int) m_w[6]) << 16) | m_w[5]) & 0x1ffffe; - byte_count = m_w[4] & 0xfffe; - cylinder = m_w[3]; head = m_w[1] & w1_head_address; sector = m_w[2] & 0xff; @@ -803,7 +800,7 @@ void ti990_hdc_device::unformatted_read() if (check_sector_address(dsk_sel, cylinder, head, sector)) return; - dma_address = ((((int) m_w[6]) << 16) | m_w[5]) & 0x1ffffe; + dma_address = ((static_cast(m_w[6]) << 16) | m_w[5]) & 0x1ffffe; byte_count = m_w[4] & 0xfffe; /* bits 0-4: head address; bits 5-15: cylinder address */ diff --git a/src/devices/bus/ti99x/990_tap.cpp b/src/devices/bus/ti99x/990_tap.cpp index 978931d35de..a306d823688 100644 --- a/src/devices/bus/ti99x/990_tap.cpp +++ b/src/devices/bus/ti99x/990_tap.cpp @@ -164,7 +164,7 @@ void tap_990_device::cmd_read_binary_forward() m_tape[tap_sel].bot = 0; - dma_address = ((((int)m_w[6]) << 16) | m_w[5]) & 0x1ffffe; + dma_address = ((static_cast(m_w[6]) << 16) | m_w[5]) & 0x1ffffe; char_count = m_w[4]; read_offset = m_w[3]; @@ -191,7 +191,7 @@ void tap_990_device::cmd_read_binary_forward() goto update_registers; } } - reclen = (((int) buffer[1]) << 8) | buffer[0]; + reclen = (static_cast(buffer[1]) << 8) | buffer[0]; if (buffer[2] || buffer[3]) { /* no idea what these bytes mean */ logerror("Tape error\n"); @@ -257,7 +257,7 @@ void tap_990_device::cmd_read_binary_forward() /* DMA */ for (i=0; imemory().space(AS_PROGRAM).write_word(dma_address, (((int) buffer[i]) << 8) | buffer[i+1]); + machine().device("maincpu")->memory().space(AS_PROGRAM).write_word(dma_address, (static_cast(buffer[i]) << 8) | buffer[i+1]); dma_address = (dma_address + 2) & 0x1ffffe; } @@ -308,7 +308,7 @@ skip_trailer: goto update_registers; } - if (reclen != ((((int) buffer[1]) << 8) | buffer[0])) + if (reclen != ((static_cast(buffer[1]) << 8) | buffer[0])) { /* eject tape */ logerror("Tape error\n"); m_tape[tap_sel].img->unload(); @@ -410,7 +410,7 @@ void tap_990_device::cmd_record_skip_forward() goto update_registers; } } - reclen = (((int) buffer[1]) << 8) | buffer[0]; + reclen = (static_cast(buffer[1]) << 8) | buffer[0]; if (buffer[2] || buffer[3]) { /* no idea what these bytes mean */ logerror("Tape format looks gooofy\n"); @@ -451,7 +451,7 @@ void tap_990_device::cmd_record_skip_forward() goto update_registers; } - if (reclen != ((((int) buffer[1]) << 8) | buffer[0])) + if (reclen != ((static_cast(buffer[1]) << 8) | buffer[0])) { /* eject tape */ m_tape[tap_sel].img->unload(); m_w[0] |= w0_offline; @@ -553,7 +553,7 @@ void tap_990_device::cmd_record_skip_reverse() update_interrupt(); goto update_registers; } - reclen = (((int) buffer[1]) << 8) | buffer[0]; + reclen = (static_cast(buffer[1]) << 8) | buffer[0]; if (buffer[2] || buffer[3]) { /* no idea what these bytes mean */ logerror("Tape format looks gooofy\n"); @@ -600,7 +600,7 @@ void tap_990_device::cmd_record_skip_reverse() update_interrupt(); goto update_registers; } - if (reclen != ((((int) buffer[1]) << 8) | buffer[0])) + if (reclen != ((static_cast(buffer[1]) << 8) | buffer[0])) { /* eject tape */ m_tape[tap_sel].img->unload(); m_w[0] |= w0_offline; diff --git a/src/devices/bus/ti99x/998board.cpp b/src/devices/bus/ti99x/998board.cpp index d59313bc57c..89b5fa2400f 100644 --- a/src/devices/bus/ti99x/998board.cpp +++ b/src/devices/bus/ti99x/998board.cpp @@ -723,7 +723,7 @@ void mainboard8_device::device_start() for (int j=1; (j < 8) && (kind == MAP8_UNDEF); j++) { // Pseudo devices are enumerated as 1 ... 6 (see MAP8_SRAM etc.) - if (strcmp(entry[i].name, pseudodev[j-1])==0) kind = (mapper8_device_kind)j; + if (strcmp(entry[i].name, pseudodev[j-1])==0) kind = static_cast(j); } if (kind==MAP8_UNDEF) { @@ -735,13 +735,13 @@ void mainboard8_device::device_start() { if (entry[i].mode != PHYSIC) { - auto ad = new logically_addressed_device(kind, (device_t*)dev, entry[i]); + auto ad = new logically_addressed_device(kind, static_cast(dev), entry[i]); m_logcomp.append(*ad); if (TRACE_CONFIG) logerror("%s: Device %s mounted into logical address space.\n", tag(), entry[i].name); } else { - auto ad = new physically_addressed_device(kind, (device_t*)dev, entry[i]); + auto ad = new physically_addressed_device(kind, static_cast(dev), entry[i]); m_physcomp.append(*ad); if (TRACE_CONFIG) logerror("%s: Device %s mounted into physical address space.\n", tag(), entry[i].name); } @@ -1002,7 +1002,7 @@ WRITE8_MEMBER( ti998_spsyn_device::write ) { attotime time_to_ready = attotime::from_double(m_vsp->time_to_ready()); int cycles_to_ready = machine().device("maincpu")->attotime_to_cycles(time_to_ready); - if (TRACE_SPEECH && TRACE_DETAIL) logerror("%s: time to ready: %f -> %d\n", tag(), time_to_ready.as_double(), (int) cycles_to_ready); + if (TRACE_SPEECH && TRACE_DETAIL) logerror("%s: time to ready: %f -> %d\n", tag(), time_to_ready.as_double(), static_cast(cycles_to_ready)); machine().device("maincpu")->execute().adjust_icount(-cycles_to_ready); machine().scheduler().timer_set(attotime::zero, FUNC_NULL); diff --git a/src/devices/bus/ti99x/datamux.cpp b/src/devices/bus/ti99x/datamux.cpp index a9b60f30c47..883bfd5a0e6 100644 --- a/src/devices/bus/ti99x/datamux.cpp +++ b/src/devices/bus/ti99x/datamux.cpp @@ -375,7 +375,7 @@ WRITE_LINE_MEMBER( ti99_datamux_device::ready_line ) { if (state != m_sysready) logerror("datamux: READY line from PBox = %d\n", state); } - m_sysready = (line_state)state; + m_sysready = static_cast(state); // Also propagate to CPU via driver ready_join(); } diff --git a/src/devices/bus/ti99x/genboard.cpp b/src/devices/bus/ti99x/genboard.cpp index 1817aad95a2..5f1af03c022 100644 --- a/src/devices/bus/ti99x/genboard.cpp +++ b/src/devices/bus/ti99x/genboard.cpp @@ -214,7 +214,7 @@ geneve_mapper_device::geneve_mapper_device(const machine_config &mconfig, const INPUT_CHANGED_MEMBER( geneve_mapper_device::settings_changed ) { - int number = (int)((UINT64)param&0x03); + int number = static_cast(reinterpret_cast(param)&0x03); int value = newval; switch (number) @@ -298,7 +298,7 @@ WRITE8_MEMBER( geneve_mapper_device::write_grom ) } else { - m_grom_address = (m_grom_address & 0x00ff) | ((UINT16)data<<8); + m_grom_address = (m_grom_address & 0x00ff) | (static_cast(data)<<8); m_gromwaddr_LSB = true; } } diff --git a/src/devices/bus/ti99x/gromport.cpp b/src/devices/bus/ti99x/gromport.cpp index 2368c375e9b..75cec0ea6b8 100644 --- a/src/devices/bus/ti99x/gromport.cpp +++ b/src/devices/bus/ti99x/gromport.cpp @@ -916,8 +916,8 @@ WRITE8_MEMBER( gkracker_device::cruwrite ) INPUT_CHANGED_MEMBER( gkracker_device::gk_changed ) { - if (TRACE_GKRACKER) logerror("%s: Input changed %d - %d\n", tag(), (int)((UINT64)param & 0x07), newval); - m_gk_switch[(UINT64)param & 0x07] = newval; + if (TRACE_GKRACKER) logerror("%s: Input changed %d - %d\n", tag(), static_cast(reinterpret_cast(param) & 0x07), newval); + m_gk_switch[reinterpret_cast(param) & 0x07] = newval; } void gkracker_device::insert(int index, ti99_cartridge_device* cart) @@ -938,12 +938,12 @@ void gkracker_device::remove(int index) void gkracker_device::gk_install_menu(const char* menutext, int len, int ptr, int next, int start) { const int base = 0x0000; - m_ram_ptr[base + ptr] = (UINT8)((next >> 8) & 0xff); - m_ram_ptr[base + ptr+1] = (UINT8)(next & 0xff); - m_ram_ptr[base + ptr+2] = (UINT8)((start >> 8) & 0xff); - m_ram_ptr[base + ptr+3] = (UINT8)(start & 0xff); + m_ram_ptr[base + ptr] = static_cast((next >> 8) & 0xff); + m_ram_ptr[base + ptr+1] = static_cast(next & 0xff); + m_ram_ptr[base + ptr+2] = static_cast((start >> 8) & 0xff); + m_ram_ptr[base + ptr+3] = static_cast(start & 0xff); - m_ram_ptr[base + ptr+4] = (UINT8)(len & 0xff); + m_ram_ptr[base + ptr+4] = static_cast(len & 0xff); memcpy(m_ram_ptr + base + ptr+5, menutext, len); } @@ -2276,7 +2276,7 @@ rpk_socket* rpk_reader::load_rom_resource(zip_file* zip, xml_data_node* rom_reso if (sha1 != nullptr) { hash_collection actual_hashes; - actual_hashes.compute((const UINT8 *)contents, length, hash_collection::HASH_TYPES_CRC_SHA1); + actual_hashes.compute(static_cast(contents), length, hash_collection::HASH_TYPES_CRC_SHA1); hash_collection expected_hashes; expected_hashes.add_from_string(hash_collection::HASH_SHA1, sha1, strlen(sha1)); @@ -2495,7 +2495,7 @@ rpk* rpk_reader::open(emu_options &options, const char *filename, const char *sy if (!found) throw rpk_exception(RPK_INVALID_RESOURCE_REF, uses_name); } } - catch (rpk_exception &exp) + catch (rpk_exception) { newrpk->close(); if (layout_xml != nullptr) xml_file_free(layout_xml); diff --git a/src/devices/bus/ti99x/gromport.h b/src/devices/bus/ti99x/gromport.h index 880f5d95d64..69d5e6957fb 100644 --- a/src/devices/bus/ti99x/gromport.h +++ b/src/devices/bus/ti99x/gromport.h @@ -534,8 +534,8 @@ public: const char* to_string() { - if (m_detail==nullptr) return error_text[(int)m_err]; - std::string errormsg = std::string(error_text[(int)m_err]).append(": ").append(m_detail); + if (m_detail==nullptr) return error_text[static_cast(m_err)]; + std::string errormsg = std::string(error_text[static_cast(m_err)]).append(": ").append(m_detail); return core_strdup(errormsg.c_str()); } diff --git a/src/devices/bus/ti99x/handset.cpp b/src/devices/bus/ti99x/handset.cpp index 2a073636910..bd24ef18e02 100644 --- a/src/devices/bus/ti99x/handset.cpp +++ b/src/devices/bus/ti99x/handset.cpp @@ -181,7 +181,7 @@ bool ti99_handset_device::poll_keyboard(int num) previous_key[num] = current_key = previous_key[num] & ~0x20; } /* post message */ - post_message((((unsigned)current_key) << 4) | (num << 1)); + post_message((static_cast(current_key) << 4) | (num << 1)); return true; } } @@ -208,7 +208,7 @@ bool ti99_handset_device::poll_keyboard(int num) previous_key[num] = current_key; /* post message */ - post_message((((unsigned) current_key) << 4) | (num << 1)); + post_message((static_cast(current_key) << 4) | (num << 1)); return true; } return false; diff --git a/src/devices/bus/ti99x/videowrp.cpp b/src/devices/bus/ti99x/videowrp.cpp index 6f09da722e7..61baa0235b0 100644 --- a/src/devices/bus/ti99x/videowrp.cpp +++ b/src/devices/bus/ti99x/videowrp.cpp @@ -96,11 +96,11 @@ READ16_MEMBER( ti_exp_video_device::read16 ) if (offset & 1) { /* read VDP status */ - return ((int) m_v9938->status_r()) << 8; + return static_cast(m_v9938->status_r()) << 8; } else { /* read VDP RAM */ - return ((int) m_v9938->vram_r()) << 8; + return static_cast(m_v9938->vram_r()) << 8; } } diff --git a/src/devices/bus/vboy/slot.cpp b/src/devices/bus/vboy/slot.cpp index 88ef2ce7a2f..5b9684c372f 100644 --- a/src/devices/bus/vboy/slot.cpp +++ b/src/devices/bus/vboy/slot.cpp @@ -50,7 +50,7 @@ void device_vboy_cart_interface::rom_alloc(UINT32 size, const char *tag) { if (m_rom == nullptr) { - m_rom = (UINT32 *)device().machine().memory().region_alloc(std::string(tag).append(VBOYSLOT_ROM_REGION_TAG).c_str(), size, 4, ENDIANNESS_LITTLE)->base(); + m_rom = reinterpret_cast(device().machine().memory().region_alloc(std::string(tag).append(VBOYSLOT_ROM_REGION_TAG).c_str(), size, 4, ENDIANNESS_LITTLE)->base()); m_rom_size = size/4; m_rom_mask = m_rom_size - 1; } @@ -178,7 +178,7 @@ bool vboy_cart_slot_device::call_load() if (has_eeprom) m_cart->eeprom_alloc(get_software_region_length("eeprom")); - ROM = (UINT8 *)m_cart->get_rom_base(); + ROM = reinterpret_cast(m_cart->get_rom_base()); if (software_entry() == nullptr) fread(ROM, len); diff --git a/src/devices/bus/vcs/vcs_slot.cpp b/src/devices/bus/vcs/vcs_slot.cpp index caa46ef358b..be33405e774 100755 --- a/src/devices/bus/vcs/vcs_slot.cpp +++ b/src/devices/bus/vcs/vcs_slot.cpp @@ -308,7 +308,7 @@ bool vcs_cart_slot_device::call_load() // pass a pointer to the now allocated ROM for the DPC chip if (m_type == A26_DPC) - m_cart->setup_addon_ptr((UINT8 *)m_cart->get_rom_base() + 0x2000); + m_cart->setup_addon_ptr(static_cast(m_cart->get_rom_base()) + 0x2000); return IMAGE_INIT_PASS; } diff --git a/src/devices/bus/z88/flash.cpp b/src/devices/bus/z88/flash.cpp index 0793f126c18..9ff0c184cf8 100644 --- a/src/devices/bus/z88/flash.cpp +++ b/src/devices/bus/z88/flash.cpp @@ -72,7 +72,7 @@ machine_config_constructor z88_1024k_flash_device::device_mconfig_additions() co UINT8* z88_1024k_flash_device::get_cart_base() { - return (UINT8*)m_flash->space().get_read_ptr(0); + return static_cast(m_flash->space().get_read_ptr(0)); } /*-------------------------------------------------